(
+# has_next=response.list_metadata.after is not None,
+# items=response.data,
+# # This should be the outer function that returns the SyncPager again
+# get_next=lambda: list(..., cursor: response.cursor) (or list(..., offset: offset + 1))
+# )
+
+
+@dataclass(frozen=True)
+class SyncPager(Generic[T, R]):
+ get_next: Optional[Callable[[], Optional[SyncPager[T, R]]]]
+ has_next: bool
+ items: Optional[List[T]]
+ response: R
+
+ # Here we type ignore the iterator to avoid a mypy error
+ # caused by the type conflict with Pydanitc's __iter__ method
+ # brought in by extending the base model
+ def __iter__(self) -> Iterator[T]: # type: ignore[override]
+ for page in self.iter_pages():
+ if page.items is not None:
+ yield from page.items
+
+ def iter_pages(self) -> Iterator[SyncPager[T, R]]:
+ page: Optional[SyncPager[T, R]] = self
+ while page is not None:
+ yield page
+
+ if not page.has_next or page.get_next is None:
+ return
+
+ page = page.get_next()
+ if page is None or page.items is None or len(page.items) == 0:
+ return
+
+ def next_page(self) -> Optional[SyncPager[T, R]]:
+ return self.get_next() if self.get_next is not None else None
+
+
+@dataclass(frozen=True)
+class AsyncPager(Generic[T, R]):
+ get_next: Optional[Callable[[], Awaitable[Optional[AsyncPager[T, R]]]]]
+ has_next: bool
+ items: Optional[List[T]]
+ response: R
+
+ async def __aiter__(self) -> AsyncIterator[T]:
+ async for page in self.iter_pages():
+ if page.items is not None:
+ for item in page.items:
+ yield item
+
+ async def iter_pages(self) -> AsyncIterator[AsyncPager[T, R]]:
+ page: Optional[AsyncPager[T, R]] = self
+ while page is not None:
+ yield page
+
+ if not page.has_next or page.get_next is None:
+ return
+
+ page = await page.get_next()
+ if page is None or page.items is None or len(page.items) == 0:
+ return
+
+ async def next_page(self) -> Optional[AsyncPager[T, R]]:
+ return await self.get_next() if self.get_next is not None else None
diff --git a/src/square/core/pydantic_utilities.py b/src/square/core/pydantic_utilities.py
new file mode 100644
index 00000000..831aadc3
--- /dev/null
+++ b/src/square/core/pydantic_utilities.py
@@ -0,0 +1,577 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# nopycln: file
+import datetime as dt
+import inspect
+import json
+import logging
+from collections import defaultdict
+from dataclasses import asdict
+from typing import (
+ TYPE_CHECKING,
+ Any,
+ Callable,
+ ClassVar,
+ Dict,
+ List,
+ Mapping,
+ Optional,
+ Set,
+ Tuple,
+ Type,
+ TypeVar,
+ Union,
+ cast,
+)
+
+import pydantic
+import typing_extensions
+
+_logger = logging.getLogger(__name__)
+
+if TYPE_CHECKING:
+ from .http_sse._models import ServerSentEvent
+
+IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
+
+if IS_PYDANTIC_V2:
+ import warnings
+
+ _datetime_adapter = pydantic.TypeAdapter(dt.datetime) # type: ignore[attr-defined]
+ _date_adapter = pydantic.TypeAdapter(dt.date) # type: ignore[attr-defined]
+
+ def parse_datetime(value: Any) -> dt.datetime: # type: ignore[misc]
+ if isinstance(value, dt.datetime):
+ return value
+ return _datetime_adapter.validate_python(value)
+
+ def parse_date(value: Any) -> dt.date: # type: ignore[misc]
+ if isinstance(value, dt.datetime):
+ return value.date()
+ if isinstance(value, dt.date):
+ return value
+ return _date_adapter.validate_python(value)
+
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", UserWarning)
+ from pydantic.v1.fields import ModelField as ModelField
+ from pydantic.v1.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore[attr-defined]
+ from pydantic.v1.typing import get_args as get_args
+ from pydantic.v1.typing import get_origin as get_origin
+ from pydantic.v1.typing import is_literal_type as is_literal_type
+ from pydantic.v1.typing import is_union as is_union
+else:
+ from pydantic.datetime_parse import parse_date as parse_date # type: ignore[no-redef]
+ from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore[no-redef]
+ from pydantic.fields import ModelField as ModelField # type: ignore[attr-defined, no-redef]
+ from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore[no-redef]
+ from pydantic.typing import get_args as get_args # type: ignore[no-redef]
+ from pydantic.typing import get_origin as get_origin # type: ignore[no-redef]
+ from pydantic.typing import is_literal_type as is_literal_type # type: ignore[no-redef]
+ from pydantic.typing import is_union as is_union # type: ignore[no-redef]
+
+from .datetime_utils import serialize_datetime
+from .serialization import convert_and_respect_annotation_metadata
+from typing_extensions import TypeAlias
+
+T = TypeVar("T")
+Model = TypeVar("Model", bound=pydantic.BaseModel)
+
+
+def _get_discriminator_and_variants(type_: Type[Any]) -> Tuple[Optional[str], Optional[List[Type[Any]]]]:
+ """
+ Extract the discriminator field name and union variants from a discriminated union type.
+ Supports Annotated[Union[...], Field(discriminator=...)] patterns.
+ Returns (discriminator, variants) or (None, None) if not a discriminated union.
+ """
+ origin = typing_extensions.get_origin(type_)
+
+ if origin is typing_extensions.Annotated:
+ args = typing_extensions.get_args(type_)
+ if len(args) >= 2:
+ inner_type = args[0]
+ # Check annotations for discriminator
+ discriminator = None
+ for annotation in args[1:]:
+ if hasattr(annotation, "discriminator"):
+ discriminator = getattr(annotation, "discriminator", None)
+ break
+
+ if discriminator:
+ inner_origin = typing_extensions.get_origin(inner_type)
+ if inner_origin is Union:
+ variants = list(typing_extensions.get_args(inner_type))
+ return discriminator, variants
+ return None, None
+
+
+def _get_field_annotation(model: Type[Any], field_name: str) -> Optional[Type[Any]]:
+ """Get the type annotation of a field from a Pydantic model."""
+ if IS_PYDANTIC_V2:
+ fields = getattr(model, "model_fields", {})
+ field_info = fields.get(field_name)
+ if field_info:
+ return cast(Optional[Type[Any]], field_info.annotation)
+ else:
+ fields = getattr(model, "__fields__", {})
+ field_info = fields.get(field_name)
+ if field_info:
+ return cast(Optional[Type[Any]], field_info.outer_type_)
+ return None
+
+
+def _find_variant_by_discriminator(
+ variants: List[Type[Any]],
+ discriminator: str,
+ discriminator_value: Any,
+) -> Optional[Type[Any]]:
+ """Find the union variant that matches the discriminator value."""
+ for variant in variants:
+ if not (inspect.isclass(variant) and issubclass(variant, pydantic.BaseModel)):
+ continue
+
+ disc_annotation = _get_field_annotation(variant, discriminator)
+ if disc_annotation and is_literal_type(disc_annotation):
+ literal_args = get_args(disc_annotation)
+ if literal_args and literal_args[0] == discriminator_value:
+ return variant
+ return None
+
+
+def _is_string_type(type_: Type[Any]) -> bool:
+ """Check if a type is str or Optional[str]."""
+ if type_ is str:
+ return True
+
+ origin = typing_extensions.get_origin(type_)
+ if origin is Union:
+ args = typing_extensions.get_args(type_)
+ # Optional[str] = Union[str, None]
+ non_none_args = [a for a in args if a is not type(None)]
+ if len(non_none_args) == 1 and non_none_args[0] is str:
+ return True
+
+ return False
+
+
+def parse_sse_obj(sse: "ServerSentEvent", type_: Type[T]) -> T:
+ """
+ Parse a ServerSentEvent into the appropriate type.
+
+ Handles two scenarios based on where the discriminator field is located:
+
+ 1. Data-level discrimination: The discriminator (e.g., 'type') is inside the 'data' payload.
+ The union describes the data content, not the SSE envelope.
+ -> Returns: json.loads(data) parsed into the type
+
+ Example: ChatStreamResponse with discriminator='type'
+ Input: ServerSentEvent(event="message", data='{"type": "content-delta", ...}', id="")
+ Output: ContentDeltaEvent (parsed from data, SSE envelope stripped)
+
+ 2. Event-level discrimination: The discriminator (e.g., 'event') is at the SSE event level.
+ The union describes the full SSE event structure.
+ -> Returns: SSE envelope with 'data' field JSON-parsed only if the variant expects non-string
+
+ Example: JobStreamResponse with discriminator='event'
+ Input: ServerSentEvent(event="ERROR", data='{"code": "FAILED", ...}', id="123")
+ Output: JobStreamResponse_Error with data as ErrorData object
+
+ But for variants where data is str (like STATUS_UPDATE):
+ Input: ServerSentEvent(event="STATUS_UPDATE", data='{"status": "processing"}', id="1")
+ Output: JobStreamResponse_StatusUpdate with data as string (not parsed)
+
+ Args:
+ sse: The ServerSentEvent object to parse
+ type_: The target discriminated union type
+
+ Returns:
+ The parsed object of type T
+
+ Note:
+ This function is only available in SDK contexts where http_sse module exists.
+ """
+ sse_event = asdict(sse)
+ discriminator, variants = _get_discriminator_and_variants(type_)
+
+ if discriminator is None or variants is None:
+ # Not a discriminated union - parse the data field as JSON
+ data_value = sse_event.get("data")
+ if isinstance(data_value, str) and data_value:
+ try:
+ parsed_data = json.loads(data_value)
+ return parse_obj_as(type_, parsed_data)
+ except json.JSONDecodeError as e:
+ _logger.warning(
+ "Failed to parse SSE data field as JSON: %s, data: %s",
+ e,
+ data_value[:100] if len(data_value) > 100 else data_value,
+ )
+ return parse_obj_as(type_, sse_event)
+
+ data_value = sse_event.get("data")
+
+ # Check if discriminator is at the top level (event-level discrimination)
+ if discriminator in sse_event:
+ # Case 2: Event-level discrimination
+ # Find the matching variant to check if 'data' field needs JSON parsing
+ disc_value = sse_event.get(discriminator)
+ matching_variant = _find_variant_by_discriminator(variants, discriminator, disc_value)
+
+ if matching_variant is not None:
+ # Check what type the variant expects for 'data'
+ data_type = _get_field_annotation(matching_variant, "data")
+ if data_type is not None and not _is_string_type(data_type):
+ # Variant expects non-string data - parse JSON
+ if isinstance(data_value, str) and data_value:
+ try:
+ parsed_data = json.loads(data_value)
+ new_object = dict(sse_event)
+ new_object["data"] = parsed_data
+ return parse_obj_as(type_, new_object)
+ except json.JSONDecodeError as e:
+ _logger.warning(
+ "Failed to parse SSE data field as JSON for event-level discrimination: %s, data: %s",
+ e,
+ data_value[:100] if len(data_value) > 100 else data_value,
+ )
+ # Either no matching variant, data is string type, or JSON parse failed
+ return parse_obj_as(type_, sse_event)
+
+ else:
+ # Case 1: Data-level discrimination
+ # The discriminator is inside the data payload - extract and parse data only
+ if isinstance(data_value, str) and data_value:
+ try:
+ parsed_data = json.loads(data_value)
+ return parse_obj_as(type_, parsed_data)
+ except json.JSONDecodeError as e:
+ _logger.warning(
+ "Failed to parse SSE data field as JSON for data-level discrimination: %s, data: %s",
+ e,
+ data_value[:100] if len(data_value) > 100 else data_value,
+ )
+ return parse_obj_as(type_, sse_event)
+
+
+def parse_obj_as(type_: Type[T], object_: Any) -> T:
+ # convert_and_respect_annotation_metadata is required for TypedDict aliasing.
+ #
+ # For Pydantic models, whether we should pre-dealias depends on how the model encodes aliasing:
+ # - If the model uses real Pydantic aliases (pydantic.Field(alias=...)), then we must pass wire keys through
+ # unchanged so Pydantic can validate them.
+ # - If the model encodes aliasing only via FieldMetadata annotations, then we MUST pre-dealias because Pydantic
+ # will not recognize those aliases during validation.
+ if inspect.isclass(type_) and issubclass(type_, pydantic.BaseModel):
+ has_pydantic_aliases = False
+ if IS_PYDANTIC_V2:
+ for field_name, field_info in getattr(type_, "model_fields", {}).items(): # type: ignore[attr-defined]
+ alias = getattr(field_info, "alias", None)
+ if alias is not None and alias != field_name:
+ has_pydantic_aliases = True
+ break
+ else:
+ for field in getattr(type_, "__fields__", {}).values():
+ alias = getattr(field, "alias", None)
+ name = getattr(field, "name", None)
+ if alias is not None and name is not None and alias != name:
+ has_pydantic_aliases = True
+ break
+
+ dealiased_object = (
+ object_
+ if has_pydantic_aliases
+ else convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read")
+ )
+ else:
+ dealiased_object = convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read")
+ if IS_PYDANTIC_V2:
+ adapter = pydantic.TypeAdapter(type_) # type: ignore[attr-defined]
+ return adapter.validate_python(dealiased_object)
+ return pydantic.parse_obj_as(type_, dealiased_object)
+
+
+def to_jsonable_with_fallback(obj: Any, fallback_serializer: Callable[[Any], Any]) -> Any:
+ if IS_PYDANTIC_V2:
+ from pydantic_core import to_jsonable_python
+
+ return to_jsonable_python(obj, fallback=fallback_serializer)
+ return fallback_serializer(obj)
+
+
+class UniversalBaseModel(pydantic.BaseModel):
+ if IS_PYDANTIC_V2:
+ model_config: ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( # type: ignore[typeddict-unknown-key]
+ # Allow fields beginning with `model_` to be used in the model
+ protected_namespaces=(),
+ )
+
+ @pydantic.model_validator(mode="before") # type: ignore[attr-defined]
+ @classmethod
+ def _coerce_field_names_to_aliases(cls, data: Any) -> Any:
+ """
+ Accept Python field names in input by rewriting them to their Pydantic aliases,
+ while avoiding silent collisions when a key could refer to multiple fields.
+ """
+ if not isinstance(data, Mapping):
+ return data
+
+ fields = getattr(cls, "model_fields", {}) # type: ignore[attr-defined]
+ name_to_alias: Dict[str, str] = {}
+ alias_to_name: Dict[str, str] = {}
+
+ for name, field_info in fields.items():
+ alias = getattr(field_info, "alias", None) or name
+ name_to_alias[name] = alias
+ if alias != name:
+ alias_to_name[alias] = name
+
+ # Detect ambiguous keys: a key that is an alias for one field and a name for another.
+ ambiguous_keys = set(alias_to_name.keys()).intersection(set(name_to_alias.keys()))
+ for key in ambiguous_keys:
+ if key in data and name_to_alias[key] not in data:
+ raise ValueError(
+ f"Ambiguous input key '{key}': it is both a field name and an alias. "
+ "Provide the explicit alias key to disambiguate."
+ )
+
+ original_keys = set(data.keys())
+ rewritten: Dict[str, Any] = dict(data)
+ for name, alias in name_to_alias.items():
+ if alias != name and name in original_keys and alias not in rewritten:
+ rewritten[alias] = rewritten.pop(name)
+
+ return rewritten
+
+ @pydantic.model_serializer(mode="plain", when_used="json") # type: ignore[attr-defined]
+ def serialize_model(self) -> Any: # type: ignore[name-defined]
+ serialized = self.dict() # type: ignore[attr-defined]
+ data = {k: serialize_datetime(v) if isinstance(v, dt.datetime) else v for k, v in serialized.items()}
+ return data
+
+ else:
+
+ class Config:
+ smart_union = True
+ json_encoders = {dt.datetime: serialize_datetime}
+
+ @pydantic.root_validator(pre=True)
+ def _coerce_field_names_to_aliases(cls, values: Any) -> Any:
+ """
+ Pydantic v1 equivalent of _coerce_field_names_to_aliases.
+ """
+ if not isinstance(values, Mapping):
+ return values
+
+ fields = getattr(cls, "__fields__", {})
+ name_to_alias: Dict[str, str] = {}
+ alias_to_name: Dict[str, str] = {}
+
+ for name, field in fields.items():
+ alias = getattr(field, "alias", None) or name
+ name_to_alias[name] = alias
+ if alias != name:
+ alias_to_name[alias] = name
+
+ ambiguous_keys = set(alias_to_name.keys()).intersection(set(name_to_alias.keys()))
+ for key in ambiguous_keys:
+ if key in values and name_to_alias[key] not in values:
+ raise ValueError(
+ f"Ambiguous input key '{key}': it is both a field name and an alias. "
+ "Provide the explicit alias key to disambiguate."
+ )
+
+ original_keys = set(values.keys())
+ rewritten: Dict[str, Any] = dict(values)
+ for name, alias in name_to_alias.items():
+ if alias != name and name in original_keys and alias not in rewritten:
+ rewritten[alias] = rewritten.pop(name)
+
+ return rewritten
+
+ @classmethod
+ def model_construct(cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any) -> "Model":
+ dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read")
+ return cls.construct(_fields_set, **dealiased_object)
+
+ @classmethod
+ def construct(cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any) -> "Model":
+ dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read")
+ if IS_PYDANTIC_V2:
+ return super().model_construct(_fields_set, **dealiased_object) # type: ignore[misc]
+ return super().construct(_fields_set, **dealiased_object)
+
+ def json(self, **kwargs: Any) -> str:
+ kwargs_with_defaults = {
+ "by_alias": True,
+ "exclude_unset": True,
+ **kwargs,
+ }
+ if IS_PYDANTIC_V2:
+ return super().model_dump_json(**kwargs_with_defaults) # type: ignore[misc]
+ return super().json(**kwargs_with_defaults)
+
+ def dict(self, **kwargs: Any) -> Dict[str, Any]:
+ """
+ Override the default dict method to `exclude_unset` by default. This function patches
+ `exclude_unset` to work include fields within non-None default values.
+ """
+ # Note: the logic here is multiplexed given the levers exposed in Pydantic V1 vs V2
+ # Pydantic V1's .dict can be extremely slow, so we do not want to call it twice.
+ #
+ # We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models
+ # that we have less control over, and this is less intrusive than custom serializers for now.
+ if IS_PYDANTIC_V2:
+ kwargs_with_defaults_exclude_unset = {
+ **kwargs,
+ "by_alias": True,
+ "exclude_unset": True,
+ "exclude_none": False,
+ }
+ kwargs_with_defaults_exclude_none = {
+ **kwargs,
+ "by_alias": True,
+ "exclude_none": True,
+ "exclude_unset": False,
+ }
+ dict_dump = deep_union_pydantic_dicts(
+ super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore[misc]
+ super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore[misc]
+ )
+
+ else:
+ _fields_set = self.__fields_set__.copy()
+
+ fields = _get_model_fields(self.__class__)
+ for name, field in fields.items():
+ if name not in _fields_set:
+ default = _get_field_default(field)
+
+ # If the default values are non-null act like they've been set
+ # This effectively allows exclude_unset to work like exclude_none where
+ # the latter passes through intentionally set none values.
+ if default is not None or ("exclude_unset" in kwargs and not kwargs["exclude_unset"]):
+ _fields_set.add(name)
+
+ if default is not None:
+ self.__fields_set__.add(name)
+
+ kwargs_with_defaults_exclude_unset_include_fields = {
+ "by_alias": True,
+ "exclude_unset": True,
+ "include": _fields_set,
+ **kwargs,
+ }
+
+ dict_dump = super().dict(**kwargs_with_defaults_exclude_unset_include_fields)
+
+ return cast(
+ Dict[str, Any],
+ convert_and_respect_annotation_metadata(object_=dict_dump, annotation=self.__class__, direction="write"),
+ )
+
+
+def _union_list_of_pydantic_dicts(source: List[Any], destination: List[Any]) -> List[Any]:
+ converted_list: List[Any] = []
+ for i, item in enumerate(source):
+ destination_value = destination[i]
+ if isinstance(item, dict):
+ converted_list.append(deep_union_pydantic_dicts(item, destination_value))
+ elif isinstance(item, list):
+ converted_list.append(_union_list_of_pydantic_dicts(item, destination_value))
+ else:
+ converted_list.append(item)
+ return converted_list
+
+
+def deep_union_pydantic_dicts(source: Dict[str, Any], destination: Dict[str, Any]) -> Dict[str, Any]:
+ for key, value in source.items():
+ node = destination.setdefault(key, {})
+ if isinstance(value, dict):
+ deep_union_pydantic_dicts(value, node)
+ # Note: we do not do this same processing for sets given we do not have sets of models
+ # and given the sets are unordered, the processing of the set and matching objects would
+ # be non-trivial.
+ elif isinstance(value, list):
+ destination[key] = _union_list_of_pydantic_dicts(value, node)
+ else:
+ destination[key] = value
+
+ return destination
+
+
+if IS_PYDANTIC_V2:
+
+ class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore[misc, name-defined, type-arg]
+ pass
+
+ UniversalRootModel: TypeAlias = V2RootModel # type: ignore[misc]
+else:
+ UniversalRootModel: TypeAlias = UniversalBaseModel # type: ignore[misc, no-redef]
+
+
+def encode_by_type(o: Any) -> Any:
+ encoders_by_class_tuples: Dict[Callable[[Any], Any], Tuple[Any, ...]] = defaultdict(tuple)
+ for type_, encoder in encoders_by_type.items():
+ encoders_by_class_tuples[encoder] += (type_,)
+
+ if type(o) in encoders_by_type:
+ return encoders_by_type[type(o)](o)
+ for encoder, classes_tuple in encoders_by_class_tuples.items():
+ if isinstance(o, classes_tuple):
+ return encoder(o)
+
+
+def update_forward_refs(model: Type["Model"], **localns: Any) -> None:
+ if IS_PYDANTIC_V2:
+ model.model_rebuild(raise_errors=False) # type: ignore[attr-defined]
+ else:
+ model.update_forward_refs(**localns)
+
+
+# Mirrors Pydantic's internal typing
+AnyCallable = Callable[..., Any]
+
+
+def universal_root_validator(
+ pre: bool = False,
+) -> Callable[[AnyCallable], AnyCallable]:
+ def decorator(func: AnyCallable) -> AnyCallable:
+ if IS_PYDANTIC_V2:
+ # In Pydantic v2, for RootModel we always use "before" mode
+ # The custom validators transform the input value before the model is created
+ return cast(AnyCallable, pydantic.model_validator(mode="before")(func)) # type: ignore[attr-defined]
+ return cast(AnyCallable, pydantic.root_validator(pre=pre)(func)) # type: ignore[call-overload]
+
+ return decorator
+
+
+def universal_field_validator(field_name: str, pre: bool = False) -> Callable[[AnyCallable], AnyCallable]:
+ def decorator(func: AnyCallable) -> AnyCallable:
+ if IS_PYDANTIC_V2:
+ return cast(AnyCallable, pydantic.field_validator(field_name, mode="before" if pre else "after")(func)) # type: ignore[attr-defined]
+ return cast(AnyCallable, pydantic.validator(field_name, pre=pre)(func))
+
+ return decorator
+
+
+PydanticField = Union[ModelField, pydantic.fields.FieldInfo]
+
+
+def _get_model_fields(model: Type["Model"]) -> Mapping[str, PydanticField]:
+ if IS_PYDANTIC_V2:
+ return cast(Mapping[str, PydanticField], model.model_fields) # type: ignore[attr-defined]
+ return cast(Mapping[str, PydanticField], model.__fields__)
+
+
+def _get_field_default(field: PydanticField) -> Any:
+ try:
+ value = field.get_default() # type: ignore[union-attr]
+ except:
+ value = field.default
+ if IS_PYDANTIC_V2:
+ from pydantic_core import PydanticUndefined
+
+ if value == PydanticUndefined:
+ return None
+ return value
+ return value
diff --git a/src/square/core/query_encoder.py b/src/square/core/query_encoder.py
new file mode 100644
index 00000000..3183001d
--- /dev/null
+++ b/src/square/core/query_encoder.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from typing import Any, Dict, List, Optional, Tuple
+
+import pydantic
+
+
+# Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict
+def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> List[Tuple[str, Any]]:
+ result = []
+ for k, v in dict_flat.items():
+ key = f"{key_prefix}[{k}]" if key_prefix is not None else k
+ if isinstance(v, dict):
+ result.extend(traverse_query_dict(v, key))
+ elif isinstance(v, list):
+ for arr_v in v:
+ if isinstance(arr_v, dict):
+ result.extend(traverse_query_dict(arr_v, key))
+ else:
+ result.append((key, arr_v))
+ else:
+ result.append((key, v))
+ return result
+
+
+def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, Any]]:
+ if isinstance(query_value, pydantic.BaseModel) or isinstance(query_value, dict):
+ if isinstance(query_value, pydantic.BaseModel):
+ obj_dict = query_value.dict(by_alias=True)
+ else:
+ obj_dict = query_value
+ return traverse_query_dict(obj_dict, query_key)
+ elif isinstance(query_value, list):
+ encoded_values: List[Tuple[str, Any]] = []
+ for value in query_value:
+ if isinstance(value, pydantic.BaseModel) or isinstance(value, dict):
+ if isinstance(value, pydantic.BaseModel):
+ obj_dict = value.dict(by_alias=True)
+ elif isinstance(value, dict):
+ obj_dict = value
+
+ encoded_values.extend(single_query_encoder(query_key, obj_dict))
+ else:
+ encoded_values.append((query_key, value))
+
+ return encoded_values
+
+ return [(query_key, query_value)]
+
+
+def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]:
+ if query is None:
+ return None
+
+ encoded_query = []
+ for k, v in query.items():
+ encoded_query.extend(single_query_encoder(k, v))
+ return encoded_query
diff --git a/src/square/core/remove_none_from_dict.py b/src/square/core/remove_none_from_dict.py
new file mode 100644
index 00000000..c2298143
--- /dev/null
+++ b/src/square/core/remove_none_from_dict.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from typing import Any, Dict, Mapping, Optional
+
+
+def remove_none_from_dict(original: Mapping[str, Optional[Any]]) -> Dict[str, Any]:
+ new: Dict[str, Any] = {}
+ for key, value in original.items():
+ if value is not None:
+ new[key] = value
+ return new
diff --git a/src/square/core/request_options.py b/src/square/core/request_options.py
new file mode 100644
index 00000000..1b388044
--- /dev/null
+++ b/src/square/core/request_options.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+try:
+ from typing import NotRequired # type: ignore
+except ImportError:
+ from typing_extensions import NotRequired
+
+
+class RequestOptions(typing.TypedDict, total=False):
+ """
+ Additional options for request-specific configuration when calling APIs via the SDK.
+ This is used primarily as an optional final parameter for service functions.
+
+ Attributes:
+ - timeout_in_seconds: int. The number of seconds to await an API call before timing out.
+
+ - max_retries: int. The max number of retries to attempt if the API call fails.
+
+ - additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict
+
+ - additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict
+
+ - additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict
+
+ - chunk_size: int. The size, in bytes, to process each chunk of data being streamed back within the response. This equates to leveraging `chunk_size` within `requests` or `httpx`, and is only leveraged for file downloads.
+ """
+
+ timeout_in_seconds: NotRequired[int]
+ max_retries: NotRequired[int]
+ additional_headers: NotRequired[typing.Dict[str, typing.Any]]
+ additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]]
+ additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]]
+ chunk_size: NotRequired[int]
diff --git a/src/square/core/serialization.py b/src/square/core/serialization.py
new file mode 100644
index 00000000..c36e865c
--- /dev/null
+++ b/src/square/core/serialization.py
@@ -0,0 +1,276 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import collections
+import inspect
+import typing
+
+import pydantic
+import typing_extensions
+
+
+class FieldMetadata:
+ """
+ Metadata class used to annotate fields to provide additional information.
+
+ Example:
+ class MyDict(TypedDict):
+ field: typing.Annotated[str, FieldMetadata(alias="field_name")]
+
+ Will serialize: `{"field": "value"}`
+ To: `{"field_name": "value"}`
+ """
+
+ alias: str
+
+ def __init__(self, *, alias: str) -> None:
+ self.alias = alias
+
+
+def convert_and_respect_annotation_metadata(
+ *,
+ object_: typing.Any,
+ annotation: typing.Any,
+ inner_type: typing.Optional[typing.Any] = None,
+ direction: typing.Literal["read", "write"],
+) -> typing.Any:
+ """
+ Respect the metadata annotations on a field, such as aliasing. This function effectively
+ manipulates the dict-form of an object to respect the metadata annotations. This is primarily used for
+ TypedDicts, which cannot support aliasing out of the box, and can be extended for additional
+ utilities, such as defaults.
+
+ Parameters
+ ----------
+ object_ : typing.Any
+
+ annotation : type
+ The type we're looking to apply typing annotations from
+
+ inner_type : typing.Optional[type]
+
+ Returns
+ -------
+ typing.Any
+ """
+
+ if object_ is None:
+ return None
+ if inner_type is None:
+ inner_type = annotation
+
+ clean_type = _remove_annotations(inner_type)
+ # Pydantic models
+ if (
+ inspect.isclass(clean_type)
+ and issubclass(clean_type, pydantic.BaseModel)
+ and isinstance(object_, typing.Mapping)
+ ):
+ return _convert_mapping(object_, clean_type, direction)
+ # TypedDicts
+ if typing_extensions.is_typeddict(clean_type) and isinstance(object_, typing.Mapping):
+ return _convert_mapping(object_, clean_type, direction)
+
+ if (
+ typing_extensions.get_origin(clean_type) == typing.Dict
+ or typing_extensions.get_origin(clean_type) == dict
+ or clean_type == typing.Dict
+ ) and isinstance(object_, typing.Dict):
+ key_type = typing_extensions.get_args(clean_type)[0]
+ value_type = typing_extensions.get_args(clean_type)[1]
+
+ return {
+ key: convert_and_respect_annotation_metadata(
+ object_=value,
+ annotation=annotation,
+ inner_type=value_type,
+ direction=direction,
+ )
+ for key, value in object_.items()
+ }
+
+ # If you're iterating on a string, do not bother to coerce it to a sequence.
+ if not isinstance(object_, str):
+ if (
+ typing_extensions.get_origin(clean_type) == typing.Set
+ or typing_extensions.get_origin(clean_type) == set
+ or clean_type == typing.Set
+ ) and isinstance(object_, typing.Set):
+ inner_type = typing_extensions.get_args(clean_type)[0]
+ return {
+ convert_and_respect_annotation_metadata(
+ object_=item,
+ annotation=annotation,
+ inner_type=inner_type,
+ direction=direction,
+ )
+ for item in object_
+ }
+ elif (
+ (
+ typing_extensions.get_origin(clean_type) == typing.List
+ or typing_extensions.get_origin(clean_type) == list
+ or clean_type == typing.List
+ )
+ and isinstance(object_, typing.List)
+ ) or (
+ (
+ typing_extensions.get_origin(clean_type) == typing.Sequence
+ or typing_extensions.get_origin(clean_type) == collections.abc.Sequence
+ or clean_type == typing.Sequence
+ )
+ and isinstance(object_, typing.Sequence)
+ ):
+ inner_type = typing_extensions.get_args(clean_type)[0]
+ return [
+ convert_and_respect_annotation_metadata(
+ object_=item,
+ annotation=annotation,
+ inner_type=inner_type,
+ direction=direction,
+ )
+ for item in object_
+ ]
+
+ if typing_extensions.get_origin(clean_type) == typing.Union:
+ # We should be able to ~relatively~ safely try to convert keys against all
+ # member types in the union, the edge case here is if one member aliases a field
+ # of the same name to a different name from another member
+ # Or if another member aliases a field of the same name that another member does not.
+ for member in typing_extensions.get_args(clean_type):
+ object_ = convert_and_respect_annotation_metadata(
+ object_=object_,
+ annotation=annotation,
+ inner_type=member,
+ direction=direction,
+ )
+ return object_
+
+ annotated_type = _get_annotation(annotation)
+ if annotated_type is None:
+ return object_
+
+ # If the object is not a TypedDict, a Union, or other container (list, set, sequence, etc.)
+ # Then we can safely call it on the recursive conversion.
+ return object_
+
+
+def _convert_mapping(
+ object_: typing.Mapping[str, object],
+ expected_type: typing.Any,
+ direction: typing.Literal["read", "write"],
+) -> typing.Mapping[str, object]:
+ converted_object: typing.Dict[str, object] = {}
+ try:
+ annotations = typing_extensions.get_type_hints(expected_type, include_extras=True)
+ except NameError:
+ # The TypedDict contains a circular reference, so
+ # we use the __annotations__ attribute directly.
+ annotations = getattr(expected_type, "__annotations__", {})
+ aliases_to_field_names = _get_alias_to_field_name(annotations)
+ for key, value in object_.items():
+ if direction == "read" and key in aliases_to_field_names:
+ dealiased_key = aliases_to_field_names.get(key)
+ if dealiased_key is not None:
+ type_ = annotations.get(dealiased_key)
+ else:
+ type_ = annotations.get(key)
+ # Note you can't get the annotation by the field name if you're in read mode, so you must check the aliases map
+ #
+ # So this is effectively saying if we're in write mode, and we don't have a type, or if we're in read mode and we don't have an alias
+ # then we can just pass the value through as is
+ if type_ is None:
+ converted_object[key] = value
+ elif direction == "read" and key not in aliases_to_field_names:
+ converted_object[key] = convert_and_respect_annotation_metadata(
+ object_=value, annotation=type_, direction=direction
+ )
+ else:
+ converted_object[_alias_key(key, type_, direction, aliases_to_field_names)] = (
+ convert_and_respect_annotation_metadata(object_=value, annotation=type_, direction=direction)
+ )
+ return converted_object
+
+
+def _get_annotation(type_: typing.Any) -> typing.Optional[typing.Any]:
+ maybe_annotated_type = typing_extensions.get_origin(type_)
+ if maybe_annotated_type is None:
+ return None
+
+ if maybe_annotated_type == typing_extensions.NotRequired:
+ type_ = typing_extensions.get_args(type_)[0]
+ maybe_annotated_type = typing_extensions.get_origin(type_)
+
+ if maybe_annotated_type == typing_extensions.Annotated:
+ return type_
+
+ return None
+
+
+def _remove_annotations(type_: typing.Any) -> typing.Any:
+ maybe_annotated_type = typing_extensions.get_origin(type_)
+ if maybe_annotated_type is None:
+ return type_
+
+ if maybe_annotated_type == typing_extensions.NotRequired:
+ return _remove_annotations(typing_extensions.get_args(type_)[0])
+
+ if maybe_annotated_type == typing_extensions.Annotated:
+ return _remove_annotations(typing_extensions.get_args(type_)[0])
+
+ return type_
+
+
+def get_alias_to_field_mapping(type_: typing.Any) -> typing.Dict[str, str]:
+ annotations = typing_extensions.get_type_hints(type_, include_extras=True)
+ return _get_alias_to_field_name(annotations)
+
+
+def get_field_to_alias_mapping(type_: typing.Any) -> typing.Dict[str, str]:
+ annotations = typing_extensions.get_type_hints(type_, include_extras=True)
+ return _get_field_to_alias_name(annotations)
+
+
+def _get_alias_to_field_name(
+ field_to_hint: typing.Dict[str, typing.Any],
+) -> typing.Dict[str, str]:
+ aliases = {}
+ for field, hint in field_to_hint.items():
+ maybe_alias = _get_alias_from_type(hint)
+ if maybe_alias is not None:
+ aliases[maybe_alias] = field
+ return aliases
+
+
+def _get_field_to_alias_name(
+ field_to_hint: typing.Dict[str, typing.Any],
+) -> typing.Dict[str, str]:
+ aliases = {}
+ for field, hint in field_to_hint.items():
+ maybe_alias = _get_alias_from_type(hint)
+ if maybe_alias is not None:
+ aliases[field] = maybe_alias
+ return aliases
+
+
+def _get_alias_from_type(type_: typing.Any) -> typing.Optional[str]:
+ maybe_annotated_type = _get_annotation(type_)
+
+ if maybe_annotated_type is not None:
+ # The actual annotations are 1 onward, the first is the annotated type
+ annotations = typing_extensions.get_args(maybe_annotated_type)[1:]
+
+ for annotation in annotations:
+ if isinstance(annotation, FieldMetadata) and annotation.alias is not None:
+ return annotation.alias
+ return None
+
+
+def _alias_key(
+ key: str,
+ type_: typing.Any,
+ direction: typing.Literal["read", "write"],
+ aliases_to_field_names: typing.Dict[str, str],
+) -> str:
+ if direction == "read":
+ return aliases_to_field_names.get(key, key)
+ return _get_alias_from_type(type_=type_) or key
diff --git a/src/square/core/unchecked_base_model.py b/src/square/core/unchecked_base_model.py
new file mode 100644
index 00000000..9ea71ca6
--- /dev/null
+++ b/src/square/core/unchecked_base_model.py
@@ -0,0 +1,376 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import datetime as dt
+import inspect
+import typing
+import uuid
+
+import pydantic
+import typing_extensions
+from .pydantic_utilities import (
+ IS_PYDANTIC_V2,
+ ModelField,
+ UniversalBaseModel,
+ get_args,
+ get_origin,
+ is_literal_type,
+ is_union,
+ parse_date,
+ parse_datetime,
+ parse_obj_as,
+)
+from .serialization import get_field_to_alias_mapping
+from pydantic_core import PydanticUndefined
+
+
+class UnionMetadata:
+ discriminant: str
+
+ def __init__(self, *, discriminant: str) -> None:
+ self.discriminant = discriminant
+
+
+Model = typing.TypeVar("Model", bound=pydantic.BaseModel)
+
+
+class UncheckedBaseModel(UniversalBaseModel):
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ extra = pydantic.Extra.allow
+
+ @classmethod
+ def model_construct(
+ cls: typing.Type["Model"],
+ _fields_set: typing.Optional[typing.Set[str]] = None,
+ **values: typing.Any,
+ ) -> "Model":
+ # Fallback construct function to the specified override below.
+ return cls.construct(_fields_set=_fields_set, **values)
+
+ # Allow construct to not validate model
+ # Implementation taken from: https://github.com/pydantic/pydantic/issues/1168#issuecomment-817742836
+ @classmethod
+ def construct(
+ cls: typing.Type["Model"],
+ _fields_set: typing.Optional[typing.Set[str]] = None,
+ **values: typing.Any,
+ ) -> "Model":
+ m = cls.__new__(cls)
+ fields_values = {}
+
+ if _fields_set is None:
+ _fields_set = set(values.keys())
+
+ fields = _get_model_fields(cls)
+ populate_by_name = _get_is_populate_by_name(cls)
+ field_aliases = get_field_to_alias_mapping(cls)
+
+ for name, field in fields.items():
+ # Key here is only used to pull data from the values dict
+ # you should always use the NAME of the field to for field_values, etc.
+ # because that's how the object is constructed from a pydantic perspective
+ key = field.alias
+ if (key is None or field.alias == name) and name in field_aliases:
+ key = field_aliases[name]
+
+ if key is None or (key not in values and populate_by_name): # Added this to allow population by field name
+ key = name
+
+ if key in values:
+ if IS_PYDANTIC_V2:
+ type_ = field.annotation # type: ignore # Pydantic v2
+ else:
+ type_ = typing.cast(typing.Type, field.outer_type_) # type: ignore # Pydantic < v1.10.15
+
+ fields_values[name] = (
+ construct_type(object_=values[key], type_=type_) if type_ is not None else values[key]
+ )
+ _fields_set.add(name)
+ else:
+ default = _get_field_default(field)
+ fields_values[name] = default
+
+ # If the default values are non-null act like they've been set
+ # This effectively allows exclude_unset to work like exclude_none where
+ # the latter passes through intentionally set none values.
+ if default != None and default != PydanticUndefined:
+ _fields_set.add(name)
+
+ # Add extras back in
+ extras = {}
+ pydantic_alias_fields = [field.alias for field in fields.values()]
+ internal_alias_fields = list(field_aliases.values())
+ for key, value in values.items():
+ # If the key is not a field by name, nor an alias to a field, then it's extra
+ if (key not in pydantic_alias_fields and key not in internal_alias_fields) and key not in fields:
+ if IS_PYDANTIC_V2:
+ extras[key] = value
+ else:
+ _fields_set.add(key)
+ fields_values[key] = value
+
+ object.__setattr__(m, "__dict__", fields_values)
+
+ if IS_PYDANTIC_V2:
+ object.__setattr__(m, "__pydantic_private__", None)
+ object.__setattr__(m, "__pydantic_extra__", extras)
+ object.__setattr__(m, "__pydantic_fields_set__", _fields_set)
+ else:
+ object.__setattr__(m, "__fields_set__", _fields_set)
+ m._init_private_attributes() # type: ignore # Pydantic v1
+ return m
+
+
+def _validate_collection_items_compatible(collection: typing.Any, target_type: typing.Type[typing.Any]) -> bool:
+ """
+ Validate that all items in a collection are compatible with the target type.
+
+ Args:
+ collection: The collection to validate (list, set, or dict values)
+ target_type: The target type to validate against
+
+ Returns:
+ True if all items are compatible, False otherwise
+ """
+ if inspect.isclass(target_type) and issubclass(target_type, pydantic.BaseModel):
+ for item in collection:
+ try:
+ # Try to validate the item against the target type
+ if isinstance(item, dict):
+ parse_obj_as(target_type, item)
+ else:
+ # If it's not a dict, it might already be the right type
+ if not isinstance(item, target_type):
+ return False
+ except Exception:
+ return False
+ return True
+
+
+def _convert_undiscriminated_union_type(union_type: typing.Type[typing.Any], object_: typing.Any) -> typing.Any:
+ inner_types = get_args(union_type)
+ if typing.Any in inner_types:
+ return object_
+
+ for inner_type in inner_types:
+ # Handle lists of objects that need parsing
+ if get_origin(inner_type) is list and isinstance(object_, list):
+ list_inner_type = get_args(inner_type)[0]
+ try:
+ if inspect.isclass(list_inner_type) and issubclass(list_inner_type, pydantic.BaseModel):
+ # Validate that all items in the list are compatible with the target type
+ if _validate_collection_items_compatible(object_, list_inner_type):
+ parsed_list = [parse_obj_as(object_=item, type_=list_inner_type) for item in object_]
+ return parsed_list
+ except Exception:
+ pass
+
+ try:
+ if inspect.isclass(inner_type) and issubclass(inner_type, pydantic.BaseModel):
+ # Attempt a validated parse until one works
+ return parse_obj_as(inner_type, object_)
+ except Exception:
+ continue
+
+ # If none of the types work, try matching literal fields first, then fall back
+ # First pass: try types where all literal fields match the object's values
+ for inner_type in inner_types:
+ if inspect.isclass(inner_type) and issubclass(inner_type, pydantic.BaseModel):
+ fields = _get_model_fields(inner_type)
+ literal_fields_match = True
+
+ for field_name, field in fields.items():
+ # Check if this field has a Literal type
+ if IS_PYDANTIC_V2:
+ field_type = field.annotation # type: ignore # Pydantic v2
+ else:
+ field_type = field.outer_type_ # type: ignore # Pydantic v1
+
+ if is_literal_type(field_type): # type: ignore[arg-type]
+ field_default = _get_field_default(field)
+ name_or_alias = get_field_to_alias_mapping(inner_type).get(field_name, field_name)
+ # Get the value from the object
+ if isinstance(object_, dict):
+ object_value = object_.get(name_or_alias)
+ else:
+ object_value = getattr(object_, name_or_alias, None)
+
+ # If the literal field value doesn't match, this type is not a match
+ if object_value is not None and field_default != object_value:
+ literal_fields_match = False
+ break
+
+ # If all literal fields match, try to construct this type
+ if literal_fields_match:
+ try:
+ return construct_type(object_=object_, type_=inner_type)
+ except Exception:
+ continue
+
+ # Second pass: if no literal matches, just return the first successful cast
+ for inner_type in inner_types:
+ try:
+ return construct_type(object_=object_, type_=inner_type)
+ except Exception:
+ continue
+
+
+def _convert_union_type(type_: typing.Type[typing.Any], object_: typing.Any) -> typing.Any:
+ base_type = get_origin(type_) or type_
+ union_type = type_
+ if base_type == typing_extensions.Annotated: # type: ignore[comparison-overlap]
+ union_type = get_args(type_)[0]
+ annotated_metadata = get_args(type_)[1:]
+ for metadata in annotated_metadata:
+ if isinstance(metadata, UnionMetadata):
+ try:
+ # Cast to the correct type, based on the discriminant
+ for inner_type in get_args(union_type):
+ try:
+ objects_discriminant = getattr(object_, metadata.discriminant)
+ except:
+ objects_discriminant = object_[metadata.discriminant]
+ if inner_type.__fields__[metadata.discriminant].default == objects_discriminant:
+ return construct_type(object_=object_, type_=inner_type)
+ except Exception:
+ # Allow to fall through to our regular union handling
+ pass
+ return _convert_undiscriminated_union_type(union_type, object_)
+
+
+def construct_type(*, type_: typing.Type[typing.Any], object_: typing.Any) -> typing.Any:
+ """
+ Here we are essentially creating the same `construct` method in spirit as the above, but for all types, not just
+ Pydantic models.
+ The idea is to essentially attempt to coerce object_ to type_ (recursively)
+ """
+ # Short circuit when dealing with optionals, don't try to coerces None to a type
+ if object_ is None:
+ return None
+
+ base_type = get_origin(type_) or type_
+ is_annotated = base_type == typing_extensions.Annotated # type: ignore[comparison-overlap]
+ maybe_annotation_members = get_args(type_)
+ is_annotated_union = is_annotated and is_union(get_origin(maybe_annotation_members[0]))
+
+ if base_type == typing.Any: # type: ignore[comparison-overlap]
+ return object_
+
+ if base_type == dict:
+ if not isinstance(object_, typing.Mapping):
+ return object_
+
+ key_type, items_type = get_args(type_)
+ d = {
+ construct_type(object_=key, type_=key_type): construct_type(object_=item, type_=items_type)
+ for key, item in object_.items()
+ }
+ return d
+
+ if base_type == list:
+ if not isinstance(object_, list):
+ return object_
+
+ inner_type = get_args(type_)[0]
+ return [construct_type(object_=entry, type_=inner_type) for entry in object_]
+
+ if base_type == set:
+ if not isinstance(object_, set) and not isinstance(object_, list):
+ return object_
+
+ inner_type = get_args(type_)[0]
+ return {construct_type(object_=entry, type_=inner_type) for entry in object_}
+
+ if is_union(base_type) or is_annotated_union:
+ return _convert_union_type(type_, object_)
+
+ # Cannot do an `issubclass` with a literal type, let's also just confirm we have a class before this call
+ if (
+ object_ is not None
+ and not is_literal_type(type_)
+ and (
+ (inspect.isclass(base_type) and issubclass(base_type, pydantic.BaseModel))
+ or (
+ is_annotated
+ and inspect.isclass(maybe_annotation_members[0])
+ and issubclass(maybe_annotation_members[0], pydantic.BaseModel)
+ )
+ )
+ ):
+ if IS_PYDANTIC_V2:
+ return type_.model_construct(**object_)
+ else:
+ return type_.construct(**object_)
+
+ if base_type == dt.datetime:
+ try:
+ return parse_datetime(object_)
+ except Exception:
+ return object_
+
+ if base_type == dt.date:
+ try:
+ return parse_date(object_)
+ except Exception:
+ return object_
+
+ if base_type == uuid.UUID:
+ try:
+ return uuid.UUID(object_)
+ except Exception:
+ return object_
+
+ if base_type == int:
+ try:
+ return int(object_)
+ except Exception:
+ return object_
+
+ if base_type == bool:
+ try:
+ if isinstance(object_, str):
+ stringified_object = object_.lower()
+ return stringified_object == "true" or stringified_object == "1"
+
+ return bool(object_)
+ except Exception:
+ return object_
+
+ return object_
+
+
+def _get_is_populate_by_name(model: typing.Type["Model"]) -> bool:
+ if IS_PYDANTIC_V2:
+ return model.model_config.get("populate_by_name", False) # type: ignore # Pydantic v2
+ return model.__config__.allow_population_by_field_name # type: ignore # Pydantic v1
+
+
+PydanticField = typing.Union[ModelField, pydantic.fields.FieldInfo]
+
+
+# Pydantic V1 swapped the typing of __fields__'s values from ModelField to FieldInfo
+# And so we try to handle both V1 cases, as well as V2 (FieldInfo from model.model_fields)
+def _get_model_fields(
+ model: typing.Type["Model"],
+) -> typing.Mapping[str, PydanticField]:
+ if IS_PYDANTIC_V2:
+ return model.model_fields # type: ignore # Pydantic v2
+ else:
+ return model.__fields__ # type: ignore # Pydantic v1
+
+
+def _get_field_default(field: PydanticField) -> typing.Any:
+ try:
+ value = field.get_default() # type: ignore # Pydantic < v1.10.15
+ except:
+ value = field.default
+ if IS_PYDANTIC_V2:
+ from pydantic_core import PydanticUndefined
+
+ if value == PydanticUndefined:
+ return None
+ return value
+ return value
diff --git a/src/square/customers/__init__.py b/src/square/customers/__init__.py
new file mode 100644
index 00000000..90daab04
--- /dev/null
+++ b/src/square/customers/__init__.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import cards, custom_attribute_definitions, custom_attributes, groups, segments
+_dynamic_imports: typing.Dict[str, str] = {
+ "cards": ".cards",
+ "custom_attribute_definitions": ".custom_attribute_definitions",
+ "custom_attributes": ".custom_attributes",
+ "groups": ".groups",
+ "segments": ".segments",
+}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["cards", "custom_attribute_definitions", "custom_attributes", "groups", "segments"]
diff --git a/src/square/customers/cards/__init__.py b/src/square/customers/cards/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/customers/cards/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/customers/cards/client.py b/src/square/customers/cards/client.py
new file mode 100644
index 00000000..7e121427
--- /dev/null
+++ b/src/square/customers/cards/client.py
@@ -0,0 +1,307 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...requests.address import AddressParams
+from ...types.create_customer_card_response import CreateCustomerCardResponse
+from ...types.delete_customer_card_response import DeleteCustomerCardResponse
+from .raw_client import AsyncRawCardsClient, RawCardsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CardsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCardsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCardsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCardsClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ customer_id: str,
+ *,
+ card_nonce: str,
+ billing_address: typing.Optional[AddressParams] = OMIT,
+ cardholder_name: typing.Optional[str] = OMIT,
+ verification_token: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateCustomerCardResponse:
+ """
+ Adds a card on file to an existing customer.
+
+ As with charges, calls to `CreateCustomerCard` are idempotent. Multiple
+ calls with the same card nonce return the same card record that was created
+ with the provided nonce during the _first_ call.
+
+ Parameters
+ ----------
+ customer_id : str
+ The Square ID of the customer profile the card is linked to.
+
+ card_nonce : str
+ A card nonce representing the credit card to link to the customer.
+
+ Card nonces are generated by the Square payment form when customers enter
+ their card information. For more information, see
+ [Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/web-payments/take-card-payment).
+
+ __NOTE:__ Card nonces generated by digital wallets (such as Apple Pay)
+ cannot be used to create a customer card.
+
+ billing_address : typing.Optional[AddressParams]
+ Address information for the card on file.
+
+ __NOTE:__ If a billing address is provided in the request, the
+ `CreateCustomerCardRequest.billing_address.postal_code` must match
+ the postal code encoded in the card nonce.
+
+ cardholder_name : typing.Optional[str]
+ The full name printed on the credit card.
+
+ verification_token : typing.Optional[str]
+ An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
+ Verification tokens encapsulate customer device information and 3-D Secure
+ challenge results to indicate that Square has verified the buyer identity.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateCustomerCardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.cards.create(
+ customer_id="customer_id",
+ card_nonce="YOUR_CARD_NONCE",
+ billing_address={
+ "address_line1": "500 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ cardholder_name="Amelia Earhart",
+ )
+ """
+ _response = self._raw_client.create(
+ customer_id,
+ card_nonce=card_nonce,
+ billing_address=billing_address,
+ cardholder_name=cardholder_name,
+ verification_token=verification_token,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self, customer_id: str, card_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteCustomerCardResponse:
+ """
+ Removes a card on file from a customer.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer that the card on file belongs to.
+
+ card_id : str
+ The ID of the card on file to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteCustomerCardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.cards.delete(
+ customer_id="customer_id",
+ card_id="card_id",
+ )
+ """
+ _response = self._raw_client.delete(customer_id, card_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncCardsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCardsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCardsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCardsClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ customer_id: str,
+ *,
+ card_nonce: str,
+ billing_address: typing.Optional[AddressParams] = OMIT,
+ cardholder_name: typing.Optional[str] = OMIT,
+ verification_token: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateCustomerCardResponse:
+ """
+ Adds a card on file to an existing customer.
+
+ As with charges, calls to `CreateCustomerCard` are idempotent. Multiple
+ calls with the same card nonce return the same card record that was created
+ with the provided nonce during the _first_ call.
+
+ Parameters
+ ----------
+ customer_id : str
+ The Square ID of the customer profile the card is linked to.
+
+ card_nonce : str
+ A card nonce representing the credit card to link to the customer.
+
+ Card nonces are generated by the Square payment form when customers enter
+ their card information. For more information, see
+ [Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/web-payments/take-card-payment).
+
+ __NOTE:__ Card nonces generated by digital wallets (such as Apple Pay)
+ cannot be used to create a customer card.
+
+ billing_address : typing.Optional[AddressParams]
+ Address information for the card on file.
+
+ __NOTE:__ If a billing address is provided in the request, the
+ `CreateCustomerCardRequest.billing_address.postal_code` must match
+ the postal code encoded in the card nonce.
+
+ cardholder_name : typing.Optional[str]
+ The full name printed on the credit card.
+
+ verification_token : typing.Optional[str]
+ An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
+ Verification tokens encapsulate customer device information and 3-D Secure
+ challenge results to indicate that Square has verified the buyer identity.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateCustomerCardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.cards.create(
+ customer_id="customer_id",
+ card_nonce="YOUR_CARD_NONCE",
+ billing_address={
+ "address_line1": "500 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ cardholder_name="Amelia Earhart",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ customer_id,
+ card_nonce=card_nonce,
+ billing_address=billing_address,
+ cardholder_name=cardholder_name,
+ verification_token=verification_token,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self, customer_id: str, card_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteCustomerCardResponse:
+ """
+ Removes a card on file from a customer.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer that the card on file belongs to.
+
+ card_id : str
+ The ID of the card on file to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteCustomerCardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.cards.delete(
+ customer_id="customer_id",
+ card_id="card_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(customer_id, card_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/customers/cards/raw_client.py b/src/square/customers/cards/raw_client.py
new file mode 100644
index 00000000..7de85233
--- /dev/null
+++ b/src/square/customers/cards/raw_client.py
@@ -0,0 +1,286 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.address import AddressParams
+from ...types.create_customer_card_response import CreateCustomerCardResponse
+from ...types.delete_customer_card_response import DeleteCustomerCardResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCardsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ customer_id: str,
+ *,
+ card_nonce: str,
+ billing_address: typing.Optional[AddressParams] = OMIT,
+ cardholder_name: typing.Optional[str] = OMIT,
+ verification_token: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateCustomerCardResponse]:
+ """
+ Adds a card on file to an existing customer.
+
+ As with charges, calls to `CreateCustomerCard` are idempotent. Multiple
+ calls with the same card nonce return the same card record that was created
+ with the provided nonce during the _first_ call.
+
+ Parameters
+ ----------
+ customer_id : str
+ The Square ID of the customer profile the card is linked to.
+
+ card_nonce : str
+ A card nonce representing the credit card to link to the customer.
+
+ Card nonces are generated by the Square payment form when customers enter
+ their card information. For more information, see
+ [Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/web-payments/take-card-payment).
+
+ __NOTE:__ Card nonces generated by digital wallets (such as Apple Pay)
+ cannot be used to create a customer card.
+
+ billing_address : typing.Optional[AddressParams]
+ Address information for the card on file.
+
+ __NOTE:__ If a billing address is provided in the request, the
+ `CreateCustomerCardRequest.billing_address.postal_code` must match
+ the postal code encoded in the card nonce.
+
+ cardholder_name : typing.Optional[str]
+ The full name printed on the credit card.
+
+ verification_token : typing.Optional[str]
+ An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
+ Verification tokens encapsulate customer device information and 3-D Secure
+ challenge results to indicate that Square has verified the buyer identity.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateCustomerCardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/cards",
+ method="POST",
+ json={
+ "card_nonce": card_nonce,
+ "billing_address": convert_and_respect_annotation_metadata(
+ object_=billing_address, annotation=AddressParams, direction="write"
+ ),
+ "cardholder_name": cardholder_name,
+ "verification_token": verification_token,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateCustomerCardResponse,
+ construct_type(
+ type_=CreateCustomerCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, customer_id: str, card_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteCustomerCardResponse]:
+ """
+ Removes a card on file from a customer.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer that the card on file belongs to.
+
+ card_id : str
+ The ID of the card on file to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteCustomerCardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/cards/{jsonable_encoder(card_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteCustomerCardResponse,
+ construct_type(
+ type_=DeleteCustomerCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCardsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ customer_id: str,
+ *,
+ card_nonce: str,
+ billing_address: typing.Optional[AddressParams] = OMIT,
+ cardholder_name: typing.Optional[str] = OMIT,
+ verification_token: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateCustomerCardResponse]:
+ """
+ Adds a card on file to an existing customer.
+
+ As with charges, calls to `CreateCustomerCard` are idempotent. Multiple
+ calls with the same card nonce return the same card record that was created
+ with the provided nonce during the _first_ call.
+
+ Parameters
+ ----------
+ customer_id : str
+ The Square ID of the customer profile the card is linked to.
+
+ card_nonce : str
+ A card nonce representing the credit card to link to the customer.
+
+ Card nonces are generated by the Square payment form when customers enter
+ their card information. For more information, see
+ [Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/web-payments/take-card-payment).
+
+ __NOTE:__ Card nonces generated by digital wallets (such as Apple Pay)
+ cannot be used to create a customer card.
+
+ billing_address : typing.Optional[AddressParams]
+ Address information for the card on file.
+
+ __NOTE:__ If a billing address is provided in the request, the
+ `CreateCustomerCardRequest.billing_address.postal_code` must match
+ the postal code encoded in the card nonce.
+
+ cardholder_name : typing.Optional[str]
+ The full name printed on the credit card.
+
+ verification_token : typing.Optional[str]
+ An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
+ Verification tokens encapsulate customer device information and 3-D Secure
+ challenge results to indicate that Square has verified the buyer identity.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateCustomerCardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/cards",
+ method="POST",
+ json={
+ "card_nonce": card_nonce,
+ "billing_address": convert_and_respect_annotation_metadata(
+ object_=billing_address, annotation=AddressParams, direction="write"
+ ),
+ "cardholder_name": cardholder_name,
+ "verification_token": verification_token,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateCustomerCardResponse,
+ construct_type(
+ type_=CreateCustomerCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, customer_id: str, card_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteCustomerCardResponse]:
+ """
+ Removes a card on file from a customer.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer that the card on file belongs to.
+
+ card_id : str
+ The ID of the card on file to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteCustomerCardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/cards/{jsonable_encoder(card_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteCustomerCardResponse,
+ construct_type(
+ type_=DeleteCustomerCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/customers/client.py b/src/square/customers/client.py
new file mode 100644
index 00000000..3ae9e1be
--- /dev/null
+++ b/src/square/customers/client.py
@@ -0,0 +1,1704 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..requests.address import AddressParams
+from ..requests.bulk_create_customer_data import BulkCreateCustomerDataParams
+from ..requests.bulk_update_customer_data import BulkUpdateCustomerDataParams
+from ..requests.customer_query import CustomerQueryParams
+from ..requests.customer_tax_ids import CustomerTaxIdsParams
+from ..types.bulk_create_customers_response import BulkCreateCustomersResponse
+from ..types.bulk_delete_customers_response import BulkDeleteCustomersResponse
+from ..types.bulk_retrieve_customers_response import BulkRetrieveCustomersResponse
+from ..types.bulk_update_customers_response import BulkUpdateCustomersResponse
+from ..types.create_customer_response import CreateCustomerResponse
+from ..types.customer import Customer
+from ..types.customer_sort_field import CustomerSortField
+from ..types.delete_customer_response import DeleteCustomerResponse
+from ..types.get_customer_response import GetCustomerResponse
+from ..types.list_customers_response import ListCustomersResponse
+from ..types.search_customers_response import SearchCustomersResponse
+from ..types.sort_order import SortOrder
+from ..types.update_customer_response import UpdateCustomerResponse
+from .raw_client import AsyncRawCustomersClient, RawCustomersClient
+
+if typing.TYPE_CHECKING:
+ from .cards.client import AsyncCardsClient, CardsClient
+ from .custom_attribute_definitions.client import (
+ AsyncCustomAttributeDefinitionsClient,
+ CustomAttributeDefinitionsClient,
+ )
+ from .custom_attributes.client import AsyncCustomAttributesClient, CustomAttributesClient
+ from .groups.client import AsyncGroupsClient, GroupsClient
+ from .segments.client import AsyncSegmentsClient, SegmentsClient
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CustomersClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCustomersClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._custom_attribute_definitions: typing.Optional[CustomAttributeDefinitionsClient] = None
+ self._groups: typing.Optional[GroupsClient] = None
+ self._segments: typing.Optional[SegmentsClient] = None
+ self._cards: typing.Optional[CardsClient] = None
+ self._custom_attributes: typing.Optional[CustomAttributesClient] = None
+
+ @property
+ def with_raw_response(self) -> RawCustomersClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCustomersClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ sort_field: typing.Optional[CustomerSortField] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ count: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Customer, ListCustomersResponse]:
+ """
+ Lists customer profiles associated with a Square account.
+
+ Under normal operating conditions, newly created or updated customer profiles become available
+ for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated
+ profiles can take closer to one minute or longer, especially during network incidents and outages.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ sort_field : typing.Optional[CustomerSortField]
+ Indicates how customers should be sorted.
+
+ The default value is `DEFAULT`.
+
+ sort_order : typing.Optional[SortOrder]
+ Indicates whether customers should be sorted in ascending (`ASC`) or
+ descending (`DESC`) order.
+
+ The default value is `ASC`.
+
+ count : typing.Optional[bool]
+ Indicates whether to return the total count of customers in the `count` field of the response.
+
+ The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Customer, ListCustomersResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.customers.list(
+ cursor="cursor",
+ limit=1,
+ sort_field="DEFAULT",
+ sort_order="DESC",
+ count=True,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ cursor=cursor,
+ limit=limit,
+ sort_field=sort_field,
+ sort_order=sort_order,
+ count=count,
+ request_options=request_options,
+ )
+
+ def create(
+ self,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ given_name: typing.Optional[str] = OMIT,
+ family_name: typing.Optional[str] = OMIT,
+ company_name: typing.Optional[str] = OMIT,
+ nickname: typing.Optional[str] = OMIT,
+ email_address: typing.Optional[str] = OMIT,
+ address: typing.Optional[AddressParams] = OMIT,
+ phone_number: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ birthday: typing.Optional[str] = OMIT,
+ tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateCustomerResponse:
+ """
+ Creates a new customer for a business.
+
+ You must provide at least one of the following values in your request to this
+ endpoint:
+
+ - `given_name`
+ - `family_name`
+ - `company_name`
+ - `email_address`
+ - `phone_number`
+
+ Parameters
+ ----------
+ idempotency_key : typing.Optional[str]
+ The idempotency key for the request. For more information, see
+ [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ given_name : typing.Optional[str]
+ The given name (that is, the first name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ family_name : typing.Optional[str]
+ The family name (that is, the last name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ company_name : typing.Optional[str]
+ A business name associated with the customer profile.
+
+ The maximum length for this value is 500 characters.
+
+ nickname : typing.Optional[str]
+ A nickname for the customer profile.
+
+ The maximum length for this value is 100 characters.
+
+ email_address : typing.Optional[str]
+ The email address associated with the customer profile.
+
+ The maximum length for this value is 254 characters.
+
+ address : typing.Optional[AddressParams]
+ The physical address associated with the customer profile. For maximum length constraints, see
+ [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+
+ phone_number : typing.Optional[str]
+ The phone number associated with the customer profile. The phone number must be valid and can contain
+ 9–16 digits, with an optional `+` prefix and country code. For more information, see
+ [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+
+ reference_id : typing.Optional[str]
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+
+ The maximum length for this value is 100 characters.
+
+ note : typing.Optional[str]
+ A custom note associated with the customer profile.
+
+ birthday : typing.Optional[str]
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
+ specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
+ format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.
+
+ tax_ids : typing.Optional[CustomerTaxIdsParams]
+ The tax ID associated with the customer profile. This field is available only for customers of sellers
+ in EU countries or the United Kingdom. For more information,
+ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateCustomerResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.create(
+ given_name="Amelia",
+ family_name="Earhart",
+ email_address="Amelia.Earhart@example.com",
+ address={
+ "address_line1": "500 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ phone_number="+1-212-555-4240",
+ reference_id="YOUR_REFERENCE_ID",
+ note="a customer",
+ )
+ """
+ _response = self._raw_client.create(
+ idempotency_key=idempotency_key,
+ given_name=given_name,
+ family_name=family_name,
+ company_name=company_name,
+ nickname=nickname,
+ email_address=email_address,
+ address=address,
+ phone_number=phone_number,
+ reference_id=reference_id,
+ note=note,
+ birthday=birthday,
+ tax_ids=tax_ids,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def batch_create(
+ self,
+ *,
+ customers: typing.Dict[str, BulkCreateCustomerDataParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkCreateCustomersResponse:
+ """
+ Creates multiple [customer profiles](entity:Customer) for a business.
+
+ This endpoint takes a map of individual create requests and returns a map of responses.
+
+ You must provide at least one of the following values in each create request:
+
+ - `given_name`
+ - `family_name`
+ - `company_name`
+ - `email_address`
+ - `phone_number`
+
+ Parameters
+ ----------
+ customers : typing.Dict[str, BulkCreateCustomerDataParams]
+ A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }`
+ key-value pairs.
+
+ Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ that uniquely identifies the create request. Each value contains the customer data used to create the
+ customer profile.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkCreateCustomersResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.batch_create(
+ customers={
+ "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": {
+ "given_name": "Amelia",
+ "family_name": "Earhart",
+ "email_address": "Amelia.Earhart@example.com",
+ "address": {
+ "address_line1": "500 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ "phone_number": "+1-212-555-4240",
+ "reference_id": "YOUR_REFERENCE_ID",
+ "note": "a customer",
+ },
+ "d1689f23-b25d-4932-b2f0-aed00f5e2029": {
+ "given_name": "Marie",
+ "family_name": "Curie",
+ "email_address": "Marie.Curie@example.com",
+ "address": {
+ "address_line1": "500 Electric Ave",
+ "address_line2": "Suite 601",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ "phone_number": "+1-212-444-4240",
+ "reference_id": "YOUR_REFERENCE_ID",
+ "note": "another customer",
+ },
+ },
+ )
+ """
+ _response = self._raw_client.batch_create(customers=customers, request_options=request_options)
+ return _response.data
+
+ def bulk_delete_customers(
+ self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
+ ) -> BulkDeleteCustomersResponse:
+ """
+ Deletes multiple customer profiles.
+
+ The endpoint takes a list of customer IDs and returns a map of responses.
+
+ Parameters
+ ----------
+ customer_ids : typing.Sequence[str]
+ The IDs of the [customer profiles](entity:Customer) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkDeleteCustomersResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.bulk_delete_customers(
+ customer_ids=[
+ "8DDA5NZVBZFGAX0V3HPF81HHE0",
+ "N18CPRVXR5214XPBBA6BZQWF3C",
+ "2GYD7WNXF7BJZW1PMGNXZ3Y8M8",
+ ],
+ )
+ """
+ _response = self._raw_client.bulk_delete_customers(customer_ids=customer_ids, request_options=request_options)
+ return _response.data
+
+ def bulk_retrieve_customers(
+ self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
+ ) -> BulkRetrieveCustomersResponse:
+ """
+ Retrieves multiple customer profiles.
+
+ This endpoint takes a list of customer IDs and returns a map of responses.
+
+ Parameters
+ ----------
+ customer_ids : typing.Sequence[str]
+ The IDs of the [customer profiles](entity:Customer) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkRetrieveCustomersResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.bulk_retrieve_customers(
+ customer_ids=[
+ "8DDA5NZVBZFGAX0V3HPF81HHE0",
+ "N18CPRVXR5214XPBBA6BZQWF3C",
+ "2GYD7WNXF7BJZW1PMGNXZ3Y8M8",
+ ],
+ )
+ """
+ _response = self._raw_client.bulk_retrieve_customers(customer_ids=customer_ids, request_options=request_options)
+ return _response.data
+
+ def bulk_update_customers(
+ self,
+ *,
+ customers: typing.Dict[str, BulkUpdateCustomerDataParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkUpdateCustomersResponse:
+ """
+ Updates multiple customer profiles.
+
+ This endpoint takes a map of individual update requests and returns a map of responses.
+
+ Parameters
+ ----------
+ customers : typing.Dict[str, BulkUpdateCustomerDataParams]
+ A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }`
+ key-value pairs.
+
+ Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer profile
+ that was created by merging existing profiles, provide the ID of the newly created profile.
+
+ Each value contains the updated customer data. Only new or changed fields are required. To add or
+ update a field, specify the new value. To remove a field, specify `null`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkUpdateCustomersResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.bulk_update_customers(
+ customers={
+ "8DDA5NZVBZFGAX0V3HPF81HHE0": {
+ "email_address": "New.Amelia.Earhart@example.com",
+ "note": "updated customer note",
+ "version": 2,
+ },
+ "N18CPRVXR5214XPBBA6BZQWF3C": {
+ "given_name": "Marie",
+ "family_name": "Curie",
+ "version": 0,
+ },
+ },
+ )
+ """
+ _response = self._raw_client.bulk_update_customers(customers=customers, request_options=request_options)
+ return _response.data
+
+ def search(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[CustomerQueryParams] = OMIT,
+ count: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchCustomersResponse:
+ """
+ Searches the customer profiles associated with a Square account using one or more supported query filters.
+
+ Calling `SearchCustomers` without any explicit query filter returns all
+ customer profiles ordered alphabetically based on `given_name` and
+ `family_name`.
+
+ Under normal operating conditions, newly created or updated customer profiles become available
+ for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated
+ profiles can take closer to one minute or longer, especially during network incidents and outages.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ Include the pagination cursor in subsequent calls to this endpoint to retrieve
+ the next set of results associated with the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ query : typing.Optional[CustomerQueryParams]
+ The filtering and sorting criteria for the search request. If a query is not specified,
+ Square returns all customer profiles ordered alphabetically by `given_name` and `family_name`.
+
+ count : typing.Optional[bool]
+ Indicates whether to return the total count of matching customers in the `count` field of the response.
+
+ The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchCustomersResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.search(
+ limit=2,
+ query={
+ "filter": {
+ "creation_source": {"values": ["THIRD_PARTY"], "rule": "INCLUDE"},
+ "created_at": {
+ "start_at": "2018-01-01T00:00:00-00:00",
+ "end_at": "2018-02-01T00:00:00-00:00",
+ },
+ "email_address": {"fuzzy": "example.com"},
+ "group_ids": {"all_": ["545AXB44B4XXWMVQ4W8SBT3HHF"]},
+ },
+ "sort": {"field": "CREATED_AT", "order": "ASC"},
+ },
+ )
+ """
+ _response = self._raw_client.search(
+ cursor=cursor, limit=limit, query=query, count=count, request_options=request_options
+ )
+ return _response.data
+
+ def get(self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetCustomerResponse:
+ """
+ Returns details for a single customer.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetCustomerResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.get(
+ customer_id="customer_id",
+ )
+ """
+ _response = self._raw_client.get(customer_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ customer_id: str,
+ *,
+ given_name: typing.Optional[str] = OMIT,
+ family_name: typing.Optional[str] = OMIT,
+ company_name: typing.Optional[str] = OMIT,
+ nickname: typing.Optional[str] = OMIT,
+ email_address: typing.Optional[str] = OMIT,
+ address: typing.Optional[AddressParams] = OMIT,
+ phone_number: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ birthday: typing.Optional[str] = OMIT,
+ version: typing.Optional[int] = OMIT,
+ tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateCustomerResponse:
+ """
+ Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request.
+ To add or update a field, specify the new value. To remove a field, specify `null`.
+
+ To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to update.
+
+ given_name : typing.Optional[str]
+ The given name (that is, the first name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ family_name : typing.Optional[str]
+ The family name (that is, the last name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ company_name : typing.Optional[str]
+ A business name associated with the customer profile.
+
+ The maximum length for this value is 500 characters.
+
+ nickname : typing.Optional[str]
+ A nickname for the customer profile.
+
+ The maximum length for this value is 100 characters.
+
+ email_address : typing.Optional[str]
+ The email address associated with the customer profile.
+
+ The maximum length for this value is 254 characters.
+
+ address : typing.Optional[AddressParams]
+ The physical address associated with the customer profile. Only new or changed fields are required in the request.
+
+ For maximum length constraints, see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+
+ phone_number : typing.Optional[str]
+ The phone number associated with the customer profile. The phone number must be valid and can contain
+ 9–16 digits, with an optional `+` prefix and country code. For more information, see
+ [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+
+ reference_id : typing.Optional[str]
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+
+ The maximum length for this value is 100 characters.
+
+ note : typing.Optional[str]
+ A custom note associated with the customer profile.
+
+ birthday : typing.Optional[str]
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
+ specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
+ format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.
+
+ version : typing.Optional[int]
+ The current version of the customer profile.
+
+ As a best practice, you should include this field to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Update a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#update-a-customer-profile).
+
+ tax_ids : typing.Optional[CustomerTaxIdsParams]
+ The tax ID associated with the customer profile. This field is available only for customers of sellers
+ in EU countries or the United Kingdom. For more information,
+ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateCustomerResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.update(
+ customer_id="customer_id",
+ email_address="New.Amelia.Earhart@example.com",
+ note="updated customer note",
+ version=2,
+ )
+ """
+ _response = self._raw_client.update(
+ customer_id,
+ given_name=given_name,
+ family_name=family_name,
+ company_name=company_name,
+ nickname=nickname,
+ email_address=email_address,
+ address=address,
+ phone_number=phone_number,
+ reference_id=reference_id,
+ note=note,
+ birthday=birthday,
+ version=version,
+ tax_ids=tax_ids,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self,
+ customer_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> DeleteCustomerResponse:
+ """
+ Deletes a customer profile from a business.
+
+ To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to delete.
+
+ version : typing.Optional[int]
+ The current version of the customer profile.
+
+ As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteCustomerResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.delete(
+ customer_id="customer_id",
+ version=1000000,
+ )
+ """
+ _response = self._raw_client.delete(customer_id, version=version, request_options=request_options)
+ return _response.data
+
+ @property
+ def custom_attribute_definitions(self):
+ if self._custom_attribute_definitions is None:
+ from .custom_attribute_definitions.client import CustomAttributeDefinitionsClient # noqa: E402
+
+ self._custom_attribute_definitions = CustomAttributeDefinitionsClient(client_wrapper=self._client_wrapper)
+ return self._custom_attribute_definitions
+
+ @property
+ def groups(self):
+ if self._groups is None:
+ from .groups.client import GroupsClient # noqa: E402
+
+ self._groups = GroupsClient(client_wrapper=self._client_wrapper)
+ return self._groups
+
+ @property
+ def segments(self):
+ if self._segments is None:
+ from .segments.client import SegmentsClient # noqa: E402
+
+ self._segments = SegmentsClient(client_wrapper=self._client_wrapper)
+ return self._segments
+
+ @property
+ def cards(self):
+ if self._cards is None:
+ from .cards.client import CardsClient # noqa: E402
+
+ self._cards = CardsClient(client_wrapper=self._client_wrapper)
+ return self._cards
+
+ @property
+ def custom_attributes(self):
+ if self._custom_attributes is None:
+ from .custom_attributes.client import CustomAttributesClient # noqa: E402
+
+ self._custom_attributes = CustomAttributesClient(client_wrapper=self._client_wrapper)
+ return self._custom_attributes
+
+
+class AsyncCustomersClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCustomersClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._custom_attribute_definitions: typing.Optional[AsyncCustomAttributeDefinitionsClient] = None
+ self._groups: typing.Optional[AsyncGroupsClient] = None
+ self._segments: typing.Optional[AsyncSegmentsClient] = None
+ self._cards: typing.Optional[AsyncCardsClient] = None
+ self._custom_attributes: typing.Optional[AsyncCustomAttributesClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawCustomersClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCustomersClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ sort_field: typing.Optional[CustomerSortField] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ count: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Customer, ListCustomersResponse]:
+ """
+ Lists customer profiles associated with a Square account.
+
+ Under normal operating conditions, newly created or updated customer profiles become available
+ for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated
+ profiles can take closer to one minute or longer, especially during network incidents and outages.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ sort_field : typing.Optional[CustomerSortField]
+ Indicates how customers should be sorted.
+
+ The default value is `DEFAULT`.
+
+ sort_order : typing.Optional[SortOrder]
+ Indicates whether customers should be sorted in ascending (`ASC`) or
+ descending (`DESC`) order.
+
+ The default value is `ASC`.
+
+ count : typing.Optional[bool]
+ Indicates whether to return the total count of customers in the `count` field of the response.
+
+ The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Customer, ListCustomersResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.customers.list(
+ cursor="cursor",
+ limit=1,
+ sort_field="DEFAULT",
+ sort_order="DESC",
+ count=True,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ cursor=cursor,
+ limit=limit,
+ sort_field=sort_field,
+ sort_order=sort_order,
+ count=count,
+ request_options=request_options,
+ )
+
+ async def create(
+ self,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ given_name: typing.Optional[str] = OMIT,
+ family_name: typing.Optional[str] = OMIT,
+ company_name: typing.Optional[str] = OMIT,
+ nickname: typing.Optional[str] = OMIT,
+ email_address: typing.Optional[str] = OMIT,
+ address: typing.Optional[AddressParams] = OMIT,
+ phone_number: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ birthday: typing.Optional[str] = OMIT,
+ tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateCustomerResponse:
+ """
+ Creates a new customer for a business.
+
+ You must provide at least one of the following values in your request to this
+ endpoint:
+
+ - `given_name`
+ - `family_name`
+ - `company_name`
+ - `email_address`
+ - `phone_number`
+
+ Parameters
+ ----------
+ idempotency_key : typing.Optional[str]
+ The idempotency key for the request. For more information, see
+ [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ given_name : typing.Optional[str]
+ The given name (that is, the first name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ family_name : typing.Optional[str]
+ The family name (that is, the last name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ company_name : typing.Optional[str]
+ A business name associated with the customer profile.
+
+ The maximum length for this value is 500 characters.
+
+ nickname : typing.Optional[str]
+ A nickname for the customer profile.
+
+ The maximum length for this value is 100 characters.
+
+ email_address : typing.Optional[str]
+ The email address associated with the customer profile.
+
+ The maximum length for this value is 254 characters.
+
+ address : typing.Optional[AddressParams]
+ The physical address associated with the customer profile. For maximum length constraints, see
+ [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+
+ phone_number : typing.Optional[str]
+ The phone number associated with the customer profile. The phone number must be valid and can contain
+ 9–16 digits, with an optional `+` prefix and country code. For more information, see
+ [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+
+ reference_id : typing.Optional[str]
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+
+ The maximum length for this value is 100 characters.
+
+ note : typing.Optional[str]
+ A custom note associated with the customer profile.
+
+ birthday : typing.Optional[str]
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
+ specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
+ format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.
+
+ tax_ids : typing.Optional[CustomerTaxIdsParams]
+ The tax ID associated with the customer profile. This field is available only for customers of sellers
+ in EU countries or the United Kingdom. For more information,
+ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateCustomerResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.create(
+ given_name="Amelia",
+ family_name="Earhart",
+ email_address="Amelia.Earhart@example.com",
+ address={
+ "address_line1": "500 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ phone_number="+1-212-555-4240",
+ reference_id="YOUR_REFERENCE_ID",
+ note="a customer",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ idempotency_key=idempotency_key,
+ given_name=given_name,
+ family_name=family_name,
+ company_name=company_name,
+ nickname=nickname,
+ email_address=email_address,
+ address=address,
+ phone_number=phone_number,
+ reference_id=reference_id,
+ note=note,
+ birthday=birthday,
+ tax_ids=tax_ids,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def batch_create(
+ self,
+ *,
+ customers: typing.Dict[str, BulkCreateCustomerDataParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkCreateCustomersResponse:
+ """
+ Creates multiple [customer profiles](entity:Customer) for a business.
+
+ This endpoint takes a map of individual create requests and returns a map of responses.
+
+ You must provide at least one of the following values in each create request:
+
+ - `given_name`
+ - `family_name`
+ - `company_name`
+ - `email_address`
+ - `phone_number`
+
+ Parameters
+ ----------
+ customers : typing.Dict[str, BulkCreateCustomerDataParams]
+ A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }`
+ key-value pairs.
+
+ Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ that uniquely identifies the create request. Each value contains the customer data used to create the
+ customer profile.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkCreateCustomersResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.batch_create(
+ customers={
+ "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": {
+ "given_name": "Amelia",
+ "family_name": "Earhart",
+ "email_address": "Amelia.Earhart@example.com",
+ "address": {
+ "address_line1": "500 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ "phone_number": "+1-212-555-4240",
+ "reference_id": "YOUR_REFERENCE_ID",
+ "note": "a customer",
+ },
+ "d1689f23-b25d-4932-b2f0-aed00f5e2029": {
+ "given_name": "Marie",
+ "family_name": "Curie",
+ "email_address": "Marie.Curie@example.com",
+ "address": {
+ "address_line1": "500 Electric Ave",
+ "address_line2": "Suite 601",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ "phone_number": "+1-212-444-4240",
+ "reference_id": "YOUR_REFERENCE_ID",
+ "note": "another customer",
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_create(customers=customers, request_options=request_options)
+ return _response.data
+
+ async def bulk_delete_customers(
+ self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
+ ) -> BulkDeleteCustomersResponse:
+ """
+ Deletes multiple customer profiles.
+
+ The endpoint takes a list of customer IDs and returns a map of responses.
+
+ Parameters
+ ----------
+ customer_ids : typing.Sequence[str]
+ The IDs of the [customer profiles](entity:Customer) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkDeleteCustomersResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.bulk_delete_customers(
+ customer_ids=[
+ "8DDA5NZVBZFGAX0V3HPF81HHE0",
+ "N18CPRVXR5214XPBBA6BZQWF3C",
+ "2GYD7WNXF7BJZW1PMGNXZ3Y8M8",
+ ],
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.bulk_delete_customers(
+ customer_ids=customer_ids, request_options=request_options
+ )
+ return _response.data
+
+ async def bulk_retrieve_customers(
+ self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
+ ) -> BulkRetrieveCustomersResponse:
+ """
+ Retrieves multiple customer profiles.
+
+ This endpoint takes a list of customer IDs and returns a map of responses.
+
+ Parameters
+ ----------
+ customer_ids : typing.Sequence[str]
+ The IDs of the [customer profiles](entity:Customer) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkRetrieveCustomersResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.bulk_retrieve_customers(
+ customer_ids=[
+ "8DDA5NZVBZFGAX0V3HPF81HHE0",
+ "N18CPRVXR5214XPBBA6BZQWF3C",
+ "2GYD7WNXF7BJZW1PMGNXZ3Y8M8",
+ ],
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.bulk_retrieve_customers(
+ customer_ids=customer_ids, request_options=request_options
+ )
+ return _response.data
+
+ async def bulk_update_customers(
+ self,
+ *,
+ customers: typing.Dict[str, BulkUpdateCustomerDataParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkUpdateCustomersResponse:
+ """
+ Updates multiple customer profiles.
+
+ This endpoint takes a map of individual update requests and returns a map of responses.
+
+ Parameters
+ ----------
+ customers : typing.Dict[str, BulkUpdateCustomerDataParams]
+ A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }`
+ key-value pairs.
+
+ Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer profile
+ that was created by merging existing profiles, provide the ID of the newly created profile.
+
+ Each value contains the updated customer data. Only new or changed fields are required. To add or
+ update a field, specify the new value. To remove a field, specify `null`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkUpdateCustomersResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.bulk_update_customers(
+ customers={
+ "8DDA5NZVBZFGAX0V3HPF81HHE0": {
+ "email_address": "New.Amelia.Earhart@example.com",
+ "note": "updated customer note",
+ "version": 2,
+ },
+ "N18CPRVXR5214XPBBA6BZQWF3C": {
+ "given_name": "Marie",
+ "family_name": "Curie",
+ "version": 0,
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.bulk_update_customers(customers=customers, request_options=request_options)
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[CustomerQueryParams] = OMIT,
+ count: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchCustomersResponse:
+ """
+ Searches the customer profiles associated with a Square account using one or more supported query filters.
+
+ Calling `SearchCustomers` without any explicit query filter returns all
+ customer profiles ordered alphabetically based on `given_name` and
+ `family_name`.
+
+ Under normal operating conditions, newly created or updated customer profiles become available
+ for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated
+ profiles can take closer to one minute or longer, especially during network incidents and outages.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ Include the pagination cursor in subsequent calls to this endpoint to retrieve
+ the next set of results associated with the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ query : typing.Optional[CustomerQueryParams]
+ The filtering and sorting criteria for the search request. If a query is not specified,
+ Square returns all customer profiles ordered alphabetically by `given_name` and `family_name`.
+
+ count : typing.Optional[bool]
+ Indicates whether to return the total count of matching customers in the `count` field of the response.
+
+ The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchCustomersResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.search(
+ limit=2,
+ query={
+ "filter": {
+ "creation_source": {
+ "values": ["THIRD_PARTY"],
+ "rule": "INCLUDE",
+ },
+ "created_at": {
+ "start_at": "2018-01-01T00:00:00-00:00",
+ "end_at": "2018-02-01T00:00:00-00:00",
+ },
+ "email_address": {"fuzzy": "example.com"},
+ "group_ids": {"all_": ["545AXB44B4XXWMVQ4W8SBT3HHF"]},
+ },
+ "sort": {"field": "CREATED_AT", "order": "ASC"},
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ cursor=cursor, limit=limit, query=query, count=count, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetCustomerResponse:
+ """
+ Returns details for a single customer.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetCustomerResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.get(
+ customer_id="customer_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(customer_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ customer_id: str,
+ *,
+ given_name: typing.Optional[str] = OMIT,
+ family_name: typing.Optional[str] = OMIT,
+ company_name: typing.Optional[str] = OMIT,
+ nickname: typing.Optional[str] = OMIT,
+ email_address: typing.Optional[str] = OMIT,
+ address: typing.Optional[AddressParams] = OMIT,
+ phone_number: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ birthday: typing.Optional[str] = OMIT,
+ version: typing.Optional[int] = OMIT,
+ tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateCustomerResponse:
+ """
+ Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request.
+ To add or update a field, specify the new value. To remove a field, specify `null`.
+
+ To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to update.
+
+ given_name : typing.Optional[str]
+ The given name (that is, the first name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ family_name : typing.Optional[str]
+ The family name (that is, the last name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ company_name : typing.Optional[str]
+ A business name associated with the customer profile.
+
+ The maximum length for this value is 500 characters.
+
+ nickname : typing.Optional[str]
+ A nickname for the customer profile.
+
+ The maximum length for this value is 100 characters.
+
+ email_address : typing.Optional[str]
+ The email address associated with the customer profile.
+
+ The maximum length for this value is 254 characters.
+
+ address : typing.Optional[AddressParams]
+ The physical address associated with the customer profile. Only new or changed fields are required in the request.
+
+ For maximum length constraints, see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+
+ phone_number : typing.Optional[str]
+ The phone number associated with the customer profile. The phone number must be valid and can contain
+ 9–16 digits, with an optional `+` prefix and country code. For more information, see
+ [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+
+ reference_id : typing.Optional[str]
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+
+ The maximum length for this value is 100 characters.
+
+ note : typing.Optional[str]
+ A custom note associated with the customer profile.
+
+ birthday : typing.Optional[str]
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
+ specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
+ format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.
+
+ version : typing.Optional[int]
+ The current version of the customer profile.
+
+ As a best practice, you should include this field to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Update a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#update-a-customer-profile).
+
+ tax_ids : typing.Optional[CustomerTaxIdsParams]
+ The tax ID associated with the customer profile. This field is available only for customers of sellers
+ in EU countries or the United Kingdom. For more information,
+ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateCustomerResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.update(
+ customer_id="customer_id",
+ email_address="New.Amelia.Earhart@example.com",
+ note="updated customer note",
+ version=2,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ customer_id,
+ given_name=given_name,
+ family_name=family_name,
+ company_name=company_name,
+ nickname=nickname,
+ email_address=email_address,
+ address=address,
+ phone_number=phone_number,
+ reference_id=reference_id,
+ note=note,
+ birthday=birthday,
+ version=version,
+ tax_ids=tax_ids,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self,
+ customer_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> DeleteCustomerResponse:
+ """
+ Deletes a customer profile from a business.
+
+ To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to delete.
+
+ version : typing.Optional[int]
+ The current version of the customer profile.
+
+ As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteCustomerResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.delete(
+ customer_id="customer_id",
+ version=1000000,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(customer_id, version=version, request_options=request_options)
+ return _response.data
+
+ @property
+ def custom_attribute_definitions(self):
+ if self._custom_attribute_definitions is None:
+ from .custom_attribute_definitions.client import AsyncCustomAttributeDefinitionsClient # noqa: E402
+
+ self._custom_attribute_definitions = AsyncCustomAttributeDefinitionsClient(
+ client_wrapper=self._client_wrapper
+ )
+ return self._custom_attribute_definitions
+
+ @property
+ def groups(self):
+ if self._groups is None:
+ from .groups.client import AsyncGroupsClient # noqa: E402
+
+ self._groups = AsyncGroupsClient(client_wrapper=self._client_wrapper)
+ return self._groups
+
+ @property
+ def segments(self):
+ if self._segments is None:
+ from .segments.client import AsyncSegmentsClient # noqa: E402
+
+ self._segments = AsyncSegmentsClient(client_wrapper=self._client_wrapper)
+ return self._segments
+
+ @property
+ def cards(self):
+ if self._cards is None:
+ from .cards.client import AsyncCardsClient # noqa: E402
+
+ self._cards = AsyncCardsClient(client_wrapper=self._client_wrapper)
+ return self._cards
+
+ @property
+ def custom_attributes(self):
+ if self._custom_attributes is None:
+ from .custom_attributes.client import AsyncCustomAttributesClient # noqa: E402
+
+ self._custom_attributes = AsyncCustomAttributesClient(client_wrapper=self._client_wrapper)
+ return self._custom_attributes
diff --git a/src/square/customers/custom_attribute_definitions/__init__.py b/src/square/customers/custom_attribute_definitions/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/customers/custom_attribute_definitions/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/customers/custom_attribute_definitions/client.py b/src/square/customers/custom_attribute_definitions/client.py
new file mode 100644
index 00000000..126fb37f
--- /dev/null
+++ b/src/square/customers/custom_attribute_definitions/client.py
@@ -0,0 +1,826 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request import (
+ BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams,
+)
+from ...requests.custom_attribute_definition import CustomAttributeDefinitionParams
+from ...types.batch_upsert_customer_custom_attributes_response import BatchUpsertCustomerCustomAttributesResponse
+from ...types.create_customer_custom_attribute_definition_response import (
+ CreateCustomerCustomAttributeDefinitionResponse,
+)
+from ...types.custom_attribute_definition import CustomAttributeDefinition
+from ...types.delete_customer_custom_attribute_definition_response import (
+ DeleteCustomerCustomAttributeDefinitionResponse,
+)
+from ...types.get_customer_custom_attribute_definition_response import GetCustomerCustomAttributeDefinitionResponse
+from ...types.list_customer_custom_attribute_definitions_response import ListCustomerCustomAttributeDefinitionsResponse
+from ...types.update_customer_custom_attribute_definition_response import (
+ UpdateCustomerCustomAttributeDefinitionResponse,
+)
+from .raw_client import AsyncRawCustomAttributeDefinitionsClient, RawCustomAttributeDefinitionsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCustomAttributeDefinitionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCustomAttributeDefinitionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCustomAttributeDefinitionsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttributeDefinition, ListCustomerCustomAttributeDefinitionsResponse]:
+ """
+ Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that
+ seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttributeDefinition, ListCustomerCustomAttributeDefinitionsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.customers.custom_attribute_definitions.list(
+ limit=1,
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(limit=limit, cursor=cursor, request_options=request_options)
+
+ def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateCustomerCustomAttributeDefinitionResponse:
+ """
+ Creates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with customer profiles.
+
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) or
+ [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes)
+ to set the custom attribute for customer profiles in the seller's Customer Directory.
+
+ Sellers can view all custom attributes in exported customer data, including those set to
+ `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema).
+ - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller.
+ - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateCustomerCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.custom_attribute_definitions.create(
+ custom_attribute_definition={
+ "key": "favoritemovie",
+ "schema": {
+ "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"
+ },
+ "name": "Favorite Movie",
+ "description": "The favorite movie of the customer.",
+ "visibility": "VISIBILITY_HIDDEN",
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetCustomerCustomAttributeDefinitionResponse:
+ """
+ Retrieves a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetCustomerCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.custom_attribute_definitions.get(
+ key="key",
+ version=1,
+ )
+ """
+ _response = self._raw_client.get(key, version=version, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateCustomerCustomAttributeDefinitionResponse:
+ """
+ Updates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+
+ Only the definition owner can update a custom attribute definition. Note that sellers can view
+ all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+
+ For more information, see
+ [Updatable definition fields](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields).
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include the optional `version` field and specify the current version of the custom attribute definition.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateCustomerCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.custom_attribute_definitions.update(
+ key="key",
+ custom_attribute_definition={
+ "description": "Update the description as desired.",
+ "visibility": "VISIBILITY_READ_ONLY",
+ },
+ )
+ """
+ _response = self._raw_client.update(
+ key,
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteCustomerCustomAttributeDefinitionResponse:
+ """
+ Deletes a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ all customer profiles in the seller's Customer Directory.
+
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteCustomerCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.custom_attribute_definitions.delete(
+ key="key",
+ )
+ """
+ _response = self._raw_client.delete(key, request_options=request_options)
+ return _response.data
+
+ def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchUpsertCustomerCustomAttributesResponse:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for customer profiles as a bulk operation.
+
+ Use this endpoint to set the value of one or more custom attributes for one or more customer profiles.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint.
+
+ This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a customer ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertCustomerCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchUpsertCustomerCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.custom_attribute_definitions.batch_upsert(
+ values={
+ "id1": {
+ "customer_id": "N3NCVYY3WS27HF0HKANA3R9FP8",
+ "custom_attribute": {"key": "favoritemovie", "value": "Dune"},
+ },
+ "id2": {
+ "customer_id": "SY8EMWRNDN3TQDP2H4KS1QWMMM",
+ "custom_attribute": {"key": "ownsmovie", "value": False},
+ },
+ "id3": {
+ "customer_id": "SY8EMWRNDN3TQDP2H4KS1QWMMM",
+ "custom_attribute": {"key": "favoritemovie", "value": "Star Wars"},
+ },
+ "id4": {
+ "customer_id": "N3NCVYY3WS27HF0HKANA3R9FP8",
+ "custom_attribute": {
+ "key": "square:a0f1505a-2aa1-490d-91a8-8d31ff181808",
+ "value": "10.5",
+ },
+ },
+ "id5": {
+ "customer_id": "70548QG1HN43B05G0KCZ4MMC1G",
+ "custom_attribute": {
+ "key": "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail",
+ "value": "fake-email@squareup.com",
+ },
+ },
+ },
+ )
+ """
+ _response = self._raw_client.batch_upsert(values=values, request_options=request_options)
+ return _response.data
+
+
+class AsyncCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCustomAttributeDefinitionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCustomAttributeDefinitionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCustomAttributeDefinitionsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttributeDefinition, ListCustomerCustomAttributeDefinitionsResponse]:
+ """
+ Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that
+ seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttributeDefinition, ListCustomerCustomAttributeDefinitionsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.customers.custom_attribute_definitions.list(
+ limit=1,
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(limit=limit, cursor=cursor, request_options=request_options)
+
+ async def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateCustomerCustomAttributeDefinitionResponse:
+ """
+ Creates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with customer profiles.
+
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) or
+ [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes)
+ to set the custom attribute for customer profiles in the seller's Customer Directory.
+
+ Sellers can view all custom attributes in exported customer data, including those set to
+ `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema).
+ - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller.
+ - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateCustomerCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.custom_attribute_definitions.create(
+ custom_attribute_definition={
+ "key": "favoritemovie",
+ "schema": {
+ "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"
+ },
+ "name": "Favorite Movie",
+ "description": "The favorite movie of the customer.",
+ "visibility": "VISIBILITY_HIDDEN",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetCustomerCustomAttributeDefinitionResponse:
+ """
+ Retrieves a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetCustomerCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.custom_attribute_definitions.get(
+ key="key",
+ version=1,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(key, version=version, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateCustomerCustomAttributeDefinitionResponse:
+ """
+ Updates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+
+ Only the definition owner can update a custom attribute definition. Note that sellers can view
+ all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+
+ For more information, see
+ [Updatable definition fields](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields).
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include the optional `version` field and specify the current version of the custom attribute definition.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateCustomerCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.custom_attribute_definitions.update(
+ key="key",
+ custom_attribute_definition={
+ "description": "Update the description as desired.",
+ "visibility": "VISIBILITY_READ_ONLY",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ key,
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteCustomerCustomAttributeDefinitionResponse:
+ """
+ Deletes a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ all customer profiles in the seller's Customer Directory.
+
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteCustomerCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.custom_attribute_definitions.delete(
+ key="key",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(key, request_options=request_options)
+ return _response.data
+
+ async def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchUpsertCustomerCustomAttributesResponse:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for customer profiles as a bulk operation.
+
+ Use this endpoint to set the value of one or more custom attributes for one or more customer profiles.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint.
+
+ This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a customer ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertCustomerCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchUpsertCustomerCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.custom_attribute_definitions.batch_upsert(
+ values={
+ "id1": {
+ "customer_id": "N3NCVYY3WS27HF0HKANA3R9FP8",
+ "custom_attribute": {"key": "favoritemovie", "value": "Dune"},
+ },
+ "id2": {
+ "customer_id": "SY8EMWRNDN3TQDP2H4KS1QWMMM",
+ "custom_attribute": {"key": "ownsmovie", "value": False},
+ },
+ "id3": {
+ "customer_id": "SY8EMWRNDN3TQDP2H4KS1QWMMM",
+ "custom_attribute": {
+ "key": "favoritemovie",
+ "value": "Star Wars",
+ },
+ },
+ "id4": {
+ "customer_id": "N3NCVYY3WS27HF0HKANA3R9FP8",
+ "custom_attribute": {
+ "key": "square:a0f1505a-2aa1-490d-91a8-8d31ff181808",
+ "value": "10.5",
+ },
+ },
+ "id5": {
+ "customer_id": "70548QG1HN43B05G0KCZ4MMC1G",
+ "custom_attribute": {
+ "key": "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail",
+ "value": "fake-email@squareup.com",
+ },
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_upsert(values=values, request_options=request_options)
+ return _response.data
diff --git a/src/square/customers/custom_attribute_definitions/raw_client.py b/src/square/customers/custom_attribute_definitions/raw_client.py
new file mode 100644
index 00000000..69c4ff0e
--- /dev/null
+++ b/src/square/customers/custom_attribute_definitions/raw_client.py
@@ -0,0 +1,820 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request import (
+ BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams,
+)
+from ...requests.custom_attribute_definition import CustomAttributeDefinitionParams
+from ...types.batch_upsert_customer_custom_attributes_response import BatchUpsertCustomerCustomAttributesResponse
+from ...types.create_customer_custom_attribute_definition_response import (
+ CreateCustomerCustomAttributeDefinitionResponse,
+)
+from ...types.custom_attribute_definition import CustomAttributeDefinition
+from ...types.delete_customer_custom_attribute_definition_response import (
+ DeleteCustomerCustomAttributeDefinitionResponse,
+)
+from ...types.get_customer_custom_attribute_definition_response import GetCustomerCustomAttributeDefinitionResponse
+from ...types.list_customer_custom_attribute_definitions_response import ListCustomerCustomAttributeDefinitionsResponse
+from ...types.update_customer_custom_attribute_definition_response import (
+ UpdateCustomerCustomAttributeDefinitionResponse,
+)
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttributeDefinition, ListCustomerCustomAttributeDefinitionsResponse]:
+ """
+ Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that
+ seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttributeDefinition, ListCustomerCustomAttributeDefinitionsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/custom-attribute-definitions",
+ method="GET",
+ params={
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListCustomerCustomAttributeDefinitionsResponse,
+ construct_type(
+ type_=ListCustomerCustomAttributeDefinitionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attribute_definitions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateCustomerCustomAttributeDefinitionResponse]:
+ """
+ Creates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with customer profiles.
+
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) or
+ [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes)
+ to set the custom attribute for customer profiles in the seller's Customer Directory.
+
+ Sellers can view all custom attributes in exported customer data, including those set to
+ `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema).
+ - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller.
+ - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateCustomerCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/custom-attribute-definitions",
+ method="POST",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateCustomerCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=CreateCustomerCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetCustomerCustomAttributeDefinitionResponse]:
+ """
+ Retrieves a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetCustomerCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetCustomerCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=GetCustomerCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateCustomerCustomAttributeDefinitionResponse]:
+ """
+ Updates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+
+ Only the definition owner can update a custom attribute definition. Note that sellers can view
+ all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+
+ For more information, see
+ [Updatable definition fields](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields).
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include the optional `version` field and specify the current version of the custom attribute definition.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateCustomerCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="PUT",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateCustomerCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=UpdateCustomerCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteCustomerCustomAttributeDefinitionResponse]:
+ """
+ Deletes a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ all customer profiles in the seller's Customer Directory.
+
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteCustomerCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteCustomerCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=DeleteCustomerCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BatchUpsertCustomerCustomAttributesResponse]:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for customer profiles as a bulk operation.
+
+ Use this endpoint to set the value of one or more custom attributes for one or more customer profiles.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint.
+
+ This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a customer ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertCustomerCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchUpsertCustomerCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/custom-attributes/bulk-upsert",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[
+ str, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams
+ ],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchUpsertCustomerCustomAttributesResponse,
+ construct_type(
+ type_=BatchUpsertCustomerCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttributeDefinition, ListCustomerCustomAttributeDefinitionsResponse]:
+ """
+ Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that
+ seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttributeDefinition, ListCustomerCustomAttributeDefinitionsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/custom-attribute-definitions",
+ method="GET",
+ params={
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListCustomerCustomAttributeDefinitionsResponse,
+ construct_type(
+ type_=ListCustomerCustomAttributeDefinitionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attribute_definitions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateCustomerCustomAttributeDefinitionResponse]:
+ """
+ Creates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with customer profiles.
+
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) or
+ [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes)
+ to set the custom attribute for customer profiles in the seller's Customer Directory.
+
+ Sellers can view all custom attributes in exported customer data, including those set to
+ `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema).
+ - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller.
+ - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateCustomerCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/custom-attribute-definitions",
+ method="POST",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateCustomerCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=CreateCustomerCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetCustomerCustomAttributeDefinitionResponse]:
+ """
+ Retrieves a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetCustomerCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetCustomerCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=GetCustomerCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateCustomerCustomAttributeDefinitionResponse]:
+ """
+ Updates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+
+ Only the definition owner can update a custom attribute definition. Note that sellers can view
+ all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+
+ For more information, see
+ [Updatable definition fields](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields).
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include the optional `version` field and specify the current version of the custom attribute definition.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateCustomerCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="PUT",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateCustomerCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=UpdateCustomerCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteCustomerCustomAttributeDefinitionResponse]:
+ """
+ Deletes a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ all customer profiles in the seller's Customer Directory.
+
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteCustomerCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteCustomerCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=DeleteCustomerCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BatchUpsertCustomerCustomAttributesResponse]:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for customer profiles as a bulk operation.
+
+ Use this endpoint to set the value of one or more custom attributes for one or more customer profiles.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint.
+
+ This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a customer ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertCustomerCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchUpsertCustomerCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/custom-attributes/bulk-upsert",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[
+ str, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams
+ ],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchUpsertCustomerCustomAttributesResponse,
+ construct_type(
+ type_=BatchUpsertCustomerCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/customers/custom_attributes/__init__.py b/src/square/customers/custom_attributes/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/customers/custom_attributes/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/customers/custom_attributes/client.py b/src/square/customers/custom_attributes/client.py
new file mode 100644
index 00000000..e7b193b4
--- /dev/null
+++ b/src/square/customers/custom_attributes/client.py
@@ -0,0 +1,590 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.custom_attribute import CustomAttributeParams
+from ...types.custom_attribute import CustomAttribute
+from ...types.delete_customer_custom_attribute_response import DeleteCustomerCustomAttributeResponse
+from ...types.get_customer_custom_attribute_response import GetCustomerCustomAttributeResponse
+from ...types.list_customer_custom_attributes_response import ListCustomerCustomAttributesResponse
+from ...types.upsert_customer_custom_attribute_response import UpsertCustomerCustomAttributeResponse
+from .raw_client import AsyncRawCustomAttributesClient, RawCustomAttributesClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CustomAttributesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCustomAttributesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCustomAttributesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCustomAttributesClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ customer_id: str,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a customer profile.
+
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.customers.custom_attributes.list(
+ customer_id="customer_id",
+ limit=1,
+ cursor="cursor",
+ with_definitions=True,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ customer_id, limit=limit, cursor=cursor, with_definitions=with_definitions, request_options=request_options
+ )
+
+ def get(
+ self,
+ customer_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> GetCustomerCustomAttributeResponse:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetCustomerCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.custom_attributes.get(
+ customer_id="customer_id",
+ key="key",
+ with_definition=True,
+ version=1,
+ )
+ """
+ _response = self._raw_client.get(
+ customer_id, key, with_definition=with_definition, version=version, request_options=request_options
+ )
+ return _response.data
+
+ def upsert(
+ self,
+ customer_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpsertCustomerCustomAttributeResponse:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a customer profile.
+
+ Use this endpoint to set the value of a custom attribute for a specified customer profile.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for an update operation, include this optional field and specify the current version
+ of the custom attribute.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpsertCustomerCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.custom_attributes.upsert(
+ customer_id="customer_id",
+ key="key",
+ custom_attribute={"value": "Dune"},
+ )
+ """
+ _response = self._raw_client.upsert(
+ customer_id,
+ key,
+ custom_attribute=custom_attribute,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self, customer_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteCustomerCustomAttributeResponse:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteCustomerCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.custom_attributes.delete(
+ customer_id="customer_id",
+ key="key",
+ )
+ """
+ _response = self._raw_client.delete(customer_id, key, request_options=request_options)
+ return _response.data
+
+
+class AsyncCustomAttributesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCustomAttributesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCustomAttributesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCustomAttributesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ customer_id: str,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a customer profile.
+
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.customers.custom_attributes.list(
+ customer_id="customer_id",
+ limit=1,
+ cursor="cursor",
+ with_definitions=True,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ customer_id, limit=limit, cursor=cursor, with_definitions=with_definitions, request_options=request_options
+ )
+
+ async def get(
+ self,
+ customer_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> GetCustomerCustomAttributeResponse:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetCustomerCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.custom_attributes.get(
+ customer_id="customer_id",
+ key="key",
+ with_definition=True,
+ version=1,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(
+ customer_id, key, with_definition=with_definition, version=version, request_options=request_options
+ )
+ return _response.data
+
+ async def upsert(
+ self,
+ customer_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpsertCustomerCustomAttributeResponse:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a customer profile.
+
+ Use this endpoint to set the value of a custom attribute for a specified customer profile.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for an update operation, include this optional field and specify the current version
+ of the custom attribute.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpsertCustomerCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.custom_attributes.upsert(
+ customer_id="customer_id",
+ key="key",
+ custom_attribute={"value": "Dune"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.upsert(
+ customer_id,
+ key,
+ custom_attribute=custom_attribute,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self, customer_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteCustomerCustomAttributeResponse:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteCustomerCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.custom_attributes.delete(
+ customer_id="customer_id",
+ key="key",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(customer_id, key, request_options=request_options)
+ return _response.data
diff --git a/src/square/customers/custom_attributes/raw_client.py b/src/square/customers/custom_attributes/raw_client.py
new file mode 100644
index 00000000..bd97fb7e
--- /dev/null
+++ b/src/square/customers/custom_attributes/raw_client.py
@@ -0,0 +1,603 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.custom_attribute import CustomAttributeParams
+from ...types.custom_attribute import CustomAttribute
+from ...types.delete_customer_custom_attribute_response import DeleteCustomerCustomAttributeResponse
+from ...types.get_customer_custom_attribute_response import GetCustomerCustomAttributeResponse
+from ...types.list_customer_custom_attributes_response import ListCustomerCustomAttributesResponse
+from ...types.upsert_customer_custom_attribute_response import UpsertCustomerCustomAttributeResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCustomAttributesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ customer_id: str,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a customer profile.
+
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/custom-attributes",
+ method="GET",
+ params={
+ "limit": limit,
+ "cursor": cursor,
+ "with_definitions": with_definitions,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListCustomerCustomAttributesResponse,
+ construct_type(
+ type_=ListCustomerCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attributes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ customer_id,
+ limit=limit,
+ cursor=_parsed_next,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self,
+ customer_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[GetCustomerCustomAttributeResponse]:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetCustomerCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "with_definition": with_definition,
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetCustomerCustomAttributeResponse,
+ construct_type(
+ type_=GetCustomerCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def upsert(
+ self,
+ customer_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpsertCustomerCustomAttributeResponse]:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a customer profile.
+
+ Use this endpoint to set the value of a custom attribute for a specified customer profile.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for an update operation, include this optional field and specify the current version
+ of the custom attribute.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpsertCustomerCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="POST",
+ json={
+ "custom_attribute": convert_and_respect_annotation_metadata(
+ object_=custom_attribute, annotation=CustomAttributeParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertCustomerCustomAttributeResponse,
+ construct_type(
+ type_=UpsertCustomerCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, customer_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteCustomerCustomAttributeResponse]:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteCustomerCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteCustomerCustomAttributeResponse,
+ construct_type(
+ type_=DeleteCustomerCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCustomAttributesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ customer_id: str,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a customer profile.
+
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/custom-attributes",
+ method="GET",
+ params={
+ "limit": limit,
+ "cursor": cursor,
+ "with_definitions": with_definitions,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListCustomerCustomAttributesResponse,
+ construct_type(
+ type_=ListCustomerCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attributes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ customer_id,
+ limit=limit,
+ cursor=_parsed_next,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self,
+ customer_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[GetCustomerCustomAttributeResponse]:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetCustomerCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "with_definition": with_definition,
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetCustomerCustomAttributeResponse,
+ construct_type(
+ type_=GetCustomerCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def upsert(
+ self,
+ customer_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpsertCustomerCustomAttributeResponse]:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a customer profile.
+
+ Use this endpoint to set the value of a custom attribute for a specified customer profile.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for an update operation, include this optional field and specify the current version
+ of the custom attribute.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpsertCustomerCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="POST",
+ json={
+ "custom_attribute": convert_and_respect_annotation_metadata(
+ object_=custom_attribute, annotation=CustomAttributeParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertCustomerCustomAttributeResponse,
+ construct_type(
+ type_=UpsertCustomerCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, customer_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteCustomerCustomAttributeResponse]:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the target [customer profile](entity:Customer).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteCustomerCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteCustomerCustomAttributeResponse,
+ construct_type(
+ type_=DeleteCustomerCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/customers/groups/__init__.py b/src/square/customers/groups/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/customers/groups/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/customers/groups/client.py b/src/square/customers/groups/client.py
new file mode 100644
index 00000000..fb9efafd
--- /dev/null
+++ b/src/square/customers/groups/client.py
@@ -0,0 +1,665 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.customer_group import CustomerGroupParams
+from ...types.add_group_to_customer_response import AddGroupToCustomerResponse
+from ...types.create_customer_group_response import CreateCustomerGroupResponse
+from ...types.customer_group import CustomerGroup
+from ...types.delete_customer_group_response import DeleteCustomerGroupResponse
+from ...types.get_customer_group_response import GetCustomerGroupResponse
+from ...types.list_customer_groups_response import ListCustomerGroupsResponse
+from ...types.remove_group_from_customer_response import RemoveGroupFromCustomerResponse
+from ...types.update_customer_group_response import UpdateCustomerGroupResponse
+from .raw_client import AsyncRawGroupsClient, RawGroupsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class GroupsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawGroupsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawGroupsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawGroupsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomerGroup, ListCustomerGroupsResponse]:
+ """
+ Retrieves the list of customer groups of a business.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomerGroup, ListCustomerGroupsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.customers.groups.list(
+ cursor="cursor",
+ limit=1,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(cursor=cursor, limit=limit, request_options=request_options)
+
+ def create(
+ self,
+ *,
+ group: CustomerGroupParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateCustomerGroupResponse:
+ """
+ Creates a new customer group for a business.
+
+ The request must include the `name` value of the group.
+
+ Parameters
+ ----------
+ group : CustomerGroupParams
+ The customer group to create.
+
+ idempotency_key : typing.Optional[str]
+ The idempotency key for the request. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateCustomerGroupResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.groups.create(
+ group={"name": "Loyal Customers"},
+ )
+ """
+ _response = self._raw_client.create(
+ group=group, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def get(
+ self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetCustomerGroupResponse:
+ """
+ Retrieves a specific customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetCustomerGroupResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.groups.get(
+ group_id="group_id",
+ )
+ """
+ _response = self._raw_client.get(group_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self, group_id: str, *, group: CustomerGroupParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateCustomerGroupResponse:
+ """
+ Updates a customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to update.
+
+ group : CustomerGroupParams
+ The `CustomerGroup` object including all the updates you want to make.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateCustomerGroupResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.groups.update(
+ group_id="group_id",
+ group={"name": "Loyal Customers"},
+ )
+ """
+ _response = self._raw_client.update(group_id, group=group, request_options=request_options)
+ return _response.data
+
+ def delete(
+ self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteCustomerGroupResponse:
+ """
+ Deletes a customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteCustomerGroupResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.groups.delete(
+ group_id="group_id",
+ )
+ """
+ _response = self._raw_client.delete(group_id, request_options=request_options)
+ return _response.data
+
+ def add(
+ self, customer_id: str, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AddGroupToCustomerResponse:
+ """
+ Adds a group membership to a customer.
+
+ The customer is identified by the `customer_id` value
+ and the customer group is identified by the `group_id` value.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to add to a group.
+
+ group_id : str
+ The ID of the customer group to add the customer to.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AddGroupToCustomerResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.groups.add(
+ customer_id="customer_id",
+ group_id="group_id",
+ )
+ """
+ _response = self._raw_client.add(customer_id, group_id, request_options=request_options)
+ return _response.data
+
+ def remove(
+ self, customer_id: str, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RemoveGroupFromCustomerResponse:
+ """
+ Removes a group membership from a customer.
+
+ The customer is identified by the `customer_id` value
+ and the customer group is identified by the `group_id` value.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to remove from the group.
+
+ group_id : str
+ The ID of the customer group to remove the customer from.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RemoveGroupFromCustomerResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.groups.remove(
+ customer_id="customer_id",
+ group_id="group_id",
+ )
+ """
+ _response = self._raw_client.remove(customer_id, group_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncGroupsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawGroupsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawGroupsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawGroupsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomerGroup, ListCustomerGroupsResponse]:
+ """
+ Retrieves the list of customer groups of a business.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomerGroup, ListCustomerGroupsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.customers.groups.list(
+ cursor="cursor",
+ limit=1,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(cursor=cursor, limit=limit, request_options=request_options)
+
+ async def create(
+ self,
+ *,
+ group: CustomerGroupParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateCustomerGroupResponse:
+ """
+ Creates a new customer group for a business.
+
+ The request must include the `name` value of the group.
+
+ Parameters
+ ----------
+ group : CustomerGroupParams
+ The customer group to create.
+
+ idempotency_key : typing.Optional[str]
+ The idempotency key for the request. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateCustomerGroupResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.groups.create(
+ group={"name": "Loyal Customers"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ group=group, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetCustomerGroupResponse:
+ """
+ Retrieves a specific customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetCustomerGroupResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.groups.get(
+ group_id="group_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(group_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self, group_id: str, *, group: CustomerGroupParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateCustomerGroupResponse:
+ """
+ Updates a customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to update.
+
+ group : CustomerGroupParams
+ The `CustomerGroup` object including all the updates you want to make.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateCustomerGroupResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.groups.update(
+ group_id="group_id",
+ group={"name": "Loyal Customers"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(group_id, group=group, request_options=request_options)
+ return _response.data
+
+ async def delete(
+ self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteCustomerGroupResponse:
+ """
+ Deletes a customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteCustomerGroupResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.groups.delete(
+ group_id="group_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(group_id, request_options=request_options)
+ return _response.data
+
+ async def add(
+ self, customer_id: str, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AddGroupToCustomerResponse:
+ """
+ Adds a group membership to a customer.
+
+ The customer is identified by the `customer_id` value
+ and the customer group is identified by the `group_id` value.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to add to a group.
+
+ group_id : str
+ The ID of the customer group to add the customer to.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AddGroupToCustomerResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.groups.add(
+ customer_id="customer_id",
+ group_id="group_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.add(customer_id, group_id, request_options=request_options)
+ return _response.data
+
+ async def remove(
+ self, customer_id: str, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RemoveGroupFromCustomerResponse:
+ """
+ Removes a group membership from a customer.
+
+ The customer is identified by the `customer_id` value
+ and the customer group is identified by the `group_id` value.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to remove from the group.
+
+ group_id : str
+ The ID of the customer group to remove the customer from.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RemoveGroupFromCustomerResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.groups.remove(
+ customer_id="customer_id",
+ group_id="group_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.remove(customer_id, group_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/customers/groups/raw_client.py b/src/square/customers/groups/raw_client.py
new file mode 100644
index 00000000..2637aaa3
--- /dev/null
+++ b/src/square/customers/groups/raw_client.py
@@ -0,0 +1,720 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.customer_group import CustomerGroupParams
+from ...types.add_group_to_customer_response import AddGroupToCustomerResponse
+from ...types.create_customer_group_response import CreateCustomerGroupResponse
+from ...types.customer_group import CustomerGroup
+from ...types.delete_customer_group_response import DeleteCustomerGroupResponse
+from ...types.get_customer_group_response import GetCustomerGroupResponse
+from ...types.list_customer_groups_response import ListCustomerGroupsResponse
+from ...types.remove_group_from_customer_response import RemoveGroupFromCustomerResponse
+from ...types.update_customer_group_response import UpdateCustomerGroupResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawGroupsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomerGroup, ListCustomerGroupsResponse]:
+ """
+ Retrieves the list of customer groups of a business.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomerGroup, ListCustomerGroupsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/groups",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListCustomerGroupsResponse,
+ construct_type(
+ type_=ListCustomerGroupsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.groups
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ group: CustomerGroupParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateCustomerGroupResponse]:
+ """
+ Creates a new customer group for a business.
+
+ The request must include the `name` value of the group.
+
+ Parameters
+ ----------
+ group : CustomerGroupParams
+ The customer group to create.
+
+ idempotency_key : typing.Optional[str]
+ The idempotency key for the request. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateCustomerGroupResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/groups",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "group": convert_and_respect_annotation_metadata(
+ object_=group, annotation=CustomerGroupParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateCustomerGroupResponse,
+ construct_type(
+ type_=CreateCustomerGroupResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetCustomerGroupResponse]:
+ """
+ Retrieves a specific customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetCustomerGroupResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/groups/{jsonable_encoder(group_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetCustomerGroupResponse,
+ construct_type(
+ type_=GetCustomerGroupResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self, group_id: str, *, group: CustomerGroupParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[UpdateCustomerGroupResponse]:
+ """
+ Updates a customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to update.
+
+ group : CustomerGroupParams
+ The `CustomerGroup` object including all the updates you want to make.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateCustomerGroupResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/groups/{jsonable_encoder(group_id)}",
+ method="PUT",
+ json={
+ "group": convert_and_respect_annotation_metadata(
+ object_=group, annotation=CustomerGroupParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateCustomerGroupResponse,
+ construct_type(
+ type_=UpdateCustomerGroupResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteCustomerGroupResponse]:
+ """
+ Deletes a customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteCustomerGroupResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/groups/{jsonable_encoder(group_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteCustomerGroupResponse,
+ construct_type(
+ type_=DeleteCustomerGroupResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def add(
+ self, customer_id: str, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[AddGroupToCustomerResponse]:
+ """
+ Adds a group membership to a customer.
+
+ The customer is identified by the `customer_id` value
+ and the customer group is identified by the `group_id` value.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to add to a group.
+
+ group_id : str
+ The ID of the customer group to add the customer to.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[AddGroupToCustomerResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/groups/{jsonable_encoder(group_id)}",
+ method="PUT",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ AddGroupToCustomerResponse,
+ construct_type(
+ type_=AddGroupToCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def remove(
+ self, customer_id: str, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RemoveGroupFromCustomerResponse]:
+ """
+ Removes a group membership from a customer.
+
+ The customer is identified by the `customer_id` value
+ and the customer group is identified by the `group_id` value.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to remove from the group.
+
+ group_id : str
+ The ID of the customer group to remove the customer from.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RemoveGroupFromCustomerResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/groups/{jsonable_encoder(group_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RemoveGroupFromCustomerResponse,
+ construct_type(
+ type_=RemoveGroupFromCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawGroupsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomerGroup, ListCustomerGroupsResponse]:
+ """
+ Retrieves the list of customer groups of a business.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomerGroup, ListCustomerGroupsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/groups",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListCustomerGroupsResponse,
+ construct_type(
+ type_=ListCustomerGroupsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.groups
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ group: CustomerGroupParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateCustomerGroupResponse]:
+ """
+ Creates a new customer group for a business.
+
+ The request must include the `name` value of the group.
+
+ Parameters
+ ----------
+ group : CustomerGroupParams
+ The customer group to create.
+
+ idempotency_key : typing.Optional[str]
+ The idempotency key for the request. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateCustomerGroupResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/groups",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "group": convert_and_respect_annotation_metadata(
+ object_=group, annotation=CustomerGroupParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateCustomerGroupResponse,
+ construct_type(
+ type_=CreateCustomerGroupResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetCustomerGroupResponse]:
+ """
+ Retrieves a specific customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetCustomerGroupResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/groups/{jsonable_encoder(group_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetCustomerGroupResponse,
+ construct_type(
+ type_=GetCustomerGroupResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self, group_id: str, *, group: CustomerGroupParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[UpdateCustomerGroupResponse]:
+ """
+ Updates a customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to update.
+
+ group : CustomerGroupParams
+ The `CustomerGroup` object including all the updates you want to make.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateCustomerGroupResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/groups/{jsonable_encoder(group_id)}",
+ method="PUT",
+ json={
+ "group": convert_and_respect_annotation_metadata(
+ object_=group, annotation=CustomerGroupParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateCustomerGroupResponse,
+ construct_type(
+ type_=UpdateCustomerGroupResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteCustomerGroupResponse]:
+ """
+ Deletes a customer group as identified by the `group_id` value.
+
+ Parameters
+ ----------
+ group_id : str
+ The ID of the customer group to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteCustomerGroupResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/groups/{jsonable_encoder(group_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteCustomerGroupResponse,
+ construct_type(
+ type_=DeleteCustomerGroupResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def add(
+ self, customer_id: str, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[AddGroupToCustomerResponse]:
+ """
+ Adds a group membership to a customer.
+
+ The customer is identified by the `customer_id` value
+ and the customer group is identified by the `group_id` value.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to add to a group.
+
+ group_id : str
+ The ID of the customer group to add the customer to.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[AddGroupToCustomerResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/groups/{jsonable_encoder(group_id)}",
+ method="PUT",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ AddGroupToCustomerResponse,
+ construct_type(
+ type_=AddGroupToCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def remove(
+ self, customer_id: str, group_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RemoveGroupFromCustomerResponse]:
+ """
+ Removes a group membership from a customer.
+
+ The customer is identified by the `customer_id` value
+ and the customer group is identified by the `group_id` value.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to remove from the group.
+
+ group_id : str
+ The ID of the customer group to remove the customer from.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RemoveGroupFromCustomerResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}/groups/{jsonable_encoder(group_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RemoveGroupFromCustomerResponse,
+ construct_type(
+ type_=RemoveGroupFromCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/customers/raw_client.py b/src/square/customers/raw_client.py
new file mode 100644
index 00000000..ad3972c7
--- /dev/null
+++ b/src/square/customers/raw_client.py
@@ -0,0 +1,1583 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.address import AddressParams
+from ..requests.bulk_create_customer_data import BulkCreateCustomerDataParams
+from ..requests.bulk_update_customer_data import BulkUpdateCustomerDataParams
+from ..requests.customer_query import CustomerQueryParams
+from ..requests.customer_tax_ids import CustomerTaxIdsParams
+from ..types.bulk_create_customers_response import BulkCreateCustomersResponse
+from ..types.bulk_delete_customers_response import BulkDeleteCustomersResponse
+from ..types.bulk_retrieve_customers_response import BulkRetrieveCustomersResponse
+from ..types.bulk_update_customers_response import BulkUpdateCustomersResponse
+from ..types.create_customer_response import CreateCustomerResponse
+from ..types.customer import Customer
+from ..types.customer_sort_field import CustomerSortField
+from ..types.delete_customer_response import DeleteCustomerResponse
+from ..types.get_customer_response import GetCustomerResponse
+from ..types.list_customers_response import ListCustomersResponse
+from ..types.search_customers_response import SearchCustomersResponse
+from ..types.sort_order import SortOrder
+from ..types.update_customer_response import UpdateCustomerResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCustomersClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ sort_field: typing.Optional[CustomerSortField] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ count: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Customer, ListCustomersResponse]:
+ """
+ Lists customer profiles associated with a Square account.
+
+ Under normal operating conditions, newly created or updated customer profiles become available
+ for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated
+ profiles can take closer to one minute or longer, especially during network incidents and outages.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ sort_field : typing.Optional[CustomerSortField]
+ Indicates how customers should be sorted.
+
+ The default value is `DEFAULT`.
+
+ sort_order : typing.Optional[SortOrder]
+ Indicates whether customers should be sorted in ascending (`ASC`) or
+ descending (`DESC`) order.
+
+ The default value is `ASC`.
+
+ count : typing.Optional[bool]
+ Indicates whether to return the total count of customers in the `count` field of the response.
+
+ The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Customer, ListCustomersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "limit": limit,
+ "sort_field": sort_field,
+ "sort_order": sort_order,
+ "count": count,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListCustomersResponse,
+ construct_type(
+ type_=ListCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.customers
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ cursor=_parsed_next,
+ limit=limit,
+ sort_field=sort_field,
+ sort_order=sort_order,
+ count=count,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ given_name: typing.Optional[str] = OMIT,
+ family_name: typing.Optional[str] = OMIT,
+ company_name: typing.Optional[str] = OMIT,
+ nickname: typing.Optional[str] = OMIT,
+ email_address: typing.Optional[str] = OMIT,
+ address: typing.Optional[AddressParams] = OMIT,
+ phone_number: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ birthday: typing.Optional[str] = OMIT,
+ tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateCustomerResponse]:
+ """
+ Creates a new customer for a business.
+
+ You must provide at least one of the following values in your request to this
+ endpoint:
+
+ - `given_name`
+ - `family_name`
+ - `company_name`
+ - `email_address`
+ - `phone_number`
+
+ Parameters
+ ----------
+ idempotency_key : typing.Optional[str]
+ The idempotency key for the request. For more information, see
+ [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ given_name : typing.Optional[str]
+ The given name (that is, the first name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ family_name : typing.Optional[str]
+ The family name (that is, the last name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ company_name : typing.Optional[str]
+ A business name associated with the customer profile.
+
+ The maximum length for this value is 500 characters.
+
+ nickname : typing.Optional[str]
+ A nickname for the customer profile.
+
+ The maximum length for this value is 100 characters.
+
+ email_address : typing.Optional[str]
+ The email address associated with the customer profile.
+
+ The maximum length for this value is 254 characters.
+
+ address : typing.Optional[AddressParams]
+ The physical address associated with the customer profile. For maximum length constraints, see
+ [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+
+ phone_number : typing.Optional[str]
+ The phone number associated with the customer profile. The phone number must be valid and can contain
+ 9–16 digits, with an optional `+` prefix and country code. For more information, see
+ [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+
+ reference_id : typing.Optional[str]
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+
+ The maximum length for this value is 100 characters.
+
+ note : typing.Optional[str]
+ A custom note associated with the customer profile.
+
+ birthday : typing.Optional[str]
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
+ specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
+ format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.
+
+ tax_ids : typing.Optional[CustomerTaxIdsParams]
+ The tax ID associated with the customer profile. This field is available only for customers of sellers
+ in EU countries or the United Kingdom. For more information,
+ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateCustomerResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "given_name": given_name,
+ "family_name": family_name,
+ "company_name": company_name,
+ "nickname": nickname,
+ "email_address": email_address,
+ "address": convert_and_respect_annotation_metadata(
+ object_=address, annotation=AddressParams, direction="write"
+ ),
+ "phone_number": phone_number,
+ "reference_id": reference_id,
+ "note": note,
+ "birthday": birthday,
+ "tax_ids": convert_and_respect_annotation_metadata(
+ object_=tax_ids, annotation=CustomerTaxIdsParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateCustomerResponse,
+ construct_type(
+ type_=CreateCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_create(
+ self,
+ *,
+ customers: typing.Dict[str, BulkCreateCustomerDataParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BulkCreateCustomersResponse]:
+ """
+ Creates multiple [customer profiles](entity:Customer) for a business.
+
+ This endpoint takes a map of individual create requests and returns a map of responses.
+
+ You must provide at least one of the following values in each create request:
+
+ - `given_name`
+ - `family_name`
+ - `company_name`
+ - `email_address`
+ - `phone_number`
+
+ Parameters
+ ----------
+ customers : typing.Dict[str, BulkCreateCustomerDataParams]
+ A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }`
+ key-value pairs.
+
+ Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ that uniquely identifies the create request. Each value contains the customer data used to create the
+ customer profile.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkCreateCustomersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/bulk-create",
+ method="POST",
+ json={
+ "customers": convert_and_respect_annotation_metadata(
+ object_=customers, annotation=typing.Dict[str, BulkCreateCustomerDataParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkCreateCustomersResponse,
+ construct_type(
+ type_=BulkCreateCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def bulk_delete_customers(
+ self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[BulkDeleteCustomersResponse]:
+ """
+ Deletes multiple customer profiles.
+
+ The endpoint takes a list of customer IDs and returns a map of responses.
+
+ Parameters
+ ----------
+ customer_ids : typing.Sequence[str]
+ The IDs of the [customer profiles](entity:Customer) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkDeleteCustomersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/bulk-delete",
+ method="POST",
+ json={
+ "customer_ids": customer_ids,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkDeleteCustomersResponse,
+ construct_type(
+ type_=BulkDeleteCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def bulk_retrieve_customers(
+ self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[BulkRetrieveCustomersResponse]:
+ """
+ Retrieves multiple customer profiles.
+
+ This endpoint takes a list of customer IDs and returns a map of responses.
+
+ Parameters
+ ----------
+ customer_ids : typing.Sequence[str]
+ The IDs of the [customer profiles](entity:Customer) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkRetrieveCustomersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/bulk-retrieve",
+ method="POST",
+ json={
+ "customer_ids": customer_ids,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkRetrieveCustomersResponse,
+ construct_type(
+ type_=BulkRetrieveCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def bulk_update_customers(
+ self,
+ *,
+ customers: typing.Dict[str, BulkUpdateCustomerDataParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BulkUpdateCustomersResponse]:
+ """
+ Updates multiple customer profiles.
+
+ This endpoint takes a map of individual update requests and returns a map of responses.
+
+ Parameters
+ ----------
+ customers : typing.Dict[str, BulkUpdateCustomerDataParams]
+ A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }`
+ key-value pairs.
+
+ Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer profile
+ that was created by merging existing profiles, provide the ID of the newly created profile.
+
+ Each value contains the updated customer data. Only new or changed fields are required. To add or
+ update a field, specify the new value. To remove a field, specify `null`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkUpdateCustomersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/bulk-update",
+ method="POST",
+ json={
+ "customers": convert_and_respect_annotation_metadata(
+ object_=customers, annotation=typing.Dict[str, BulkUpdateCustomerDataParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkUpdateCustomersResponse,
+ construct_type(
+ type_=BulkUpdateCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[CustomerQueryParams] = OMIT,
+ count: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchCustomersResponse]:
+ """
+ Searches the customer profiles associated with a Square account using one or more supported query filters.
+
+ Calling `SearchCustomers` without any explicit query filter returns all
+ customer profiles ordered alphabetically based on `given_name` and
+ `family_name`.
+
+ Under normal operating conditions, newly created or updated customer profiles become available
+ for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated
+ profiles can take closer to one minute or longer, especially during network incidents and outages.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ Include the pagination cursor in subsequent calls to this endpoint to retrieve
+ the next set of results associated with the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ query : typing.Optional[CustomerQueryParams]
+ The filtering and sorting criteria for the search request. If a query is not specified,
+ Square returns all customer profiles ordered alphabetically by `given_name` and `family_name`.
+
+ count : typing.Optional[bool]
+ Indicates whether to return the total count of matching customers in the `count` field of the response.
+
+ The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchCustomersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/search",
+ method="POST",
+ json={
+ "cursor": cursor,
+ "limit": limit,
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=CustomerQueryParams, direction="write"
+ ),
+ "count": count,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchCustomersResponse,
+ construct_type(
+ type_=SearchCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetCustomerResponse]:
+ """
+ Returns details for a single customer.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetCustomerResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetCustomerResponse,
+ construct_type(
+ type_=GetCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ customer_id: str,
+ *,
+ given_name: typing.Optional[str] = OMIT,
+ family_name: typing.Optional[str] = OMIT,
+ company_name: typing.Optional[str] = OMIT,
+ nickname: typing.Optional[str] = OMIT,
+ email_address: typing.Optional[str] = OMIT,
+ address: typing.Optional[AddressParams] = OMIT,
+ phone_number: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ birthday: typing.Optional[str] = OMIT,
+ version: typing.Optional[int] = OMIT,
+ tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateCustomerResponse]:
+ """
+ Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request.
+ To add or update a field, specify the new value. To remove a field, specify `null`.
+
+ To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to update.
+
+ given_name : typing.Optional[str]
+ The given name (that is, the first name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ family_name : typing.Optional[str]
+ The family name (that is, the last name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ company_name : typing.Optional[str]
+ A business name associated with the customer profile.
+
+ The maximum length for this value is 500 characters.
+
+ nickname : typing.Optional[str]
+ A nickname for the customer profile.
+
+ The maximum length for this value is 100 characters.
+
+ email_address : typing.Optional[str]
+ The email address associated with the customer profile.
+
+ The maximum length for this value is 254 characters.
+
+ address : typing.Optional[AddressParams]
+ The physical address associated with the customer profile. Only new or changed fields are required in the request.
+
+ For maximum length constraints, see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+
+ phone_number : typing.Optional[str]
+ The phone number associated with the customer profile. The phone number must be valid and can contain
+ 9–16 digits, with an optional `+` prefix and country code. For more information, see
+ [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+
+ reference_id : typing.Optional[str]
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+
+ The maximum length for this value is 100 characters.
+
+ note : typing.Optional[str]
+ A custom note associated with the customer profile.
+
+ birthday : typing.Optional[str]
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
+ specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
+ format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.
+
+ version : typing.Optional[int]
+ The current version of the customer profile.
+
+ As a best practice, you should include this field to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Update a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#update-a-customer-profile).
+
+ tax_ids : typing.Optional[CustomerTaxIdsParams]
+ The tax ID associated with the customer profile. This field is available only for customers of sellers
+ in EU countries or the United Kingdom. For more information,
+ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateCustomerResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}",
+ method="PUT",
+ json={
+ "given_name": given_name,
+ "family_name": family_name,
+ "company_name": company_name,
+ "nickname": nickname,
+ "email_address": email_address,
+ "address": convert_and_respect_annotation_metadata(
+ object_=address, annotation=AddressParams, direction="write"
+ ),
+ "phone_number": phone_number,
+ "reference_id": reference_id,
+ "note": note,
+ "birthday": birthday,
+ "version": version,
+ "tax_ids": convert_and_respect_annotation_metadata(
+ object_=tax_ids, annotation=CustomerTaxIdsParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateCustomerResponse,
+ construct_type(
+ type_=UpdateCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self,
+ customer_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[DeleteCustomerResponse]:
+ """
+ Deletes a customer profile from a business.
+
+ To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to delete.
+
+ version : typing.Optional[int]
+ The current version of the customer profile.
+
+ As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteCustomerResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}",
+ method="DELETE",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteCustomerResponse,
+ construct_type(
+ type_=DeleteCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCustomersClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ sort_field: typing.Optional[CustomerSortField] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ count: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Customer, ListCustomersResponse]:
+ """
+ Lists customer profiles associated with a Square account.
+
+ Under normal operating conditions, newly created or updated customer profiles become available
+ for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated
+ profiles can take closer to one minute or longer, especially during network incidents and outages.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ sort_field : typing.Optional[CustomerSortField]
+ Indicates how customers should be sorted.
+
+ The default value is `DEFAULT`.
+
+ sort_order : typing.Optional[SortOrder]
+ Indicates whether customers should be sorted in ascending (`ASC`) or
+ descending (`DESC`) order.
+
+ The default value is `ASC`.
+
+ count : typing.Optional[bool]
+ Indicates whether to return the total count of customers in the `count` field of the response.
+
+ The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Customer, ListCustomersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "limit": limit,
+ "sort_field": sort_field,
+ "sort_order": sort_order,
+ "count": count,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListCustomersResponse,
+ construct_type(
+ type_=ListCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.customers
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ cursor=_parsed_next,
+ limit=limit,
+ sort_field=sort_field,
+ sort_order=sort_order,
+ count=count,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ given_name: typing.Optional[str] = OMIT,
+ family_name: typing.Optional[str] = OMIT,
+ company_name: typing.Optional[str] = OMIT,
+ nickname: typing.Optional[str] = OMIT,
+ email_address: typing.Optional[str] = OMIT,
+ address: typing.Optional[AddressParams] = OMIT,
+ phone_number: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ birthday: typing.Optional[str] = OMIT,
+ tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateCustomerResponse]:
+ """
+ Creates a new customer for a business.
+
+ You must provide at least one of the following values in your request to this
+ endpoint:
+
+ - `given_name`
+ - `family_name`
+ - `company_name`
+ - `email_address`
+ - `phone_number`
+
+ Parameters
+ ----------
+ idempotency_key : typing.Optional[str]
+ The idempotency key for the request. For more information, see
+ [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ given_name : typing.Optional[str]
+ The given name (that is, the first name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ family_name : typing.Optional[str]
+ The family name (that is, the last name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ company_name : typing.Optional[str]
+ A business name associated with the customer profile.
+
+ The maximum length for this value is 500 characters.
+
+ nickname : typing.Optional[str]
+ A nickname for the customer profile.
+
+ The maximum length for this value is 100 characters.
+
+ email_address : typing.Optional[str]
+ The email address associated with the customer profile.
+
+ The maximum length for this value is 254 characters.
+
+ address : typing.Optional[AddressParams]
+ The physical address associated with the customer profile. For maximum length constraints, see
+ [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+
+ phone_number : typing.Optional[str]
+ The phone number associated with the customer profile. The phone number must be valid and can contain
+ 9–16 digits, with an optional `+` prefix and country code. For more information, see
+ [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+
+ reference_id : typing.Optional[str]
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+
+ The maximum length for this value is 100 characters.
+
+ note : typing.Optional[str]
+ A custom note associated with the customer profile.
+
+ birthday : typing.Optional[str]
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
+ specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
+ format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.
+
+ tax_ids : typing.Optional[CustomerTaxIdsParams]
+ The tax ID associated with the customer profile. This field is available only for customers of sellers
+ in EU countries or the United Kingdom. For more information,
+ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateCustomerResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "given_name": given_name,
+ "family_name": family_name,
+ "company_name": company_name,
+ "nickname": nickname,
+ "email_address": email_address,
+ "address": convert_and_respect_annotation_metadata(
+ object_=address, annotation=AddressParams, direction="write"
+ ),
+ "phone_number": phone_number,
+ "reference_id": reference_id,
+ "note": note,
+ "birthday": birthday,
+ "tax_ids": convert_and_respect_annotation_metadata(
+ object_=tax_ids, annotation=CustomerTaxIdsParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateCustomerResponse,
+ construct_type(
+ type_=CreateCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_create(
+ self,
+ *,
+ customers: typing.Dict[str, BulkCreateCustomerDataParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BulkCreateCustomersResponse]:
+ """
+ Creates multiple [customer profiles](entity:Customer) for a business.
+
+ This endpoint takes a map of individual create requests and returns a map of responses.
+
+ You must provide at least one of the following values in each create request:
+
+ - `given_name`
+ - `family_name`
+ - `company_name`
+ - `email_address`
+ - `phone_number`
+
+ Parameters
+ ----------
+ customers : typing.Dict[str, BulkCreateCustomerDataParams]
+ A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }`
+ key-value pairs.
+
+ Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ that uniquely identifies the create request. Each value contains the customer data used to create the
+ customer profile.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkCreateCustomersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/bulk-create",
+ method="POST",
+ json={
+ "customers": convert_and_respect_annotation_metadata(
+ object_=customers, annotation=typing.Dict[str, BulkCreateCustomerDataParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkCreateCustomersResponse,
+ construct_type(
+ type_=BulkCreateCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def bulk_delete_customers(
+ self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[BulkDeleteCustomersResponse]:
+ """
+ Deletes multiple customer profiles.
+
+ The endpoint takes a list of customer IDs and returns a map of responses.
+
+ Parameters
+ ----------
+ customer_ids : typing.Sequence[str]
+ The IDs of the [customer profiles](entity:Customer) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkDeleteCustomersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/bulk-delete",
+ method="POST",
+ json={
+ "customer_ids": customer_ids,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkDeleteCustomersResponse,
+ construct_type(
+ type_=BulkDeleteCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def bulk_retrieve_customers(
+ self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[BulkRetrieveCustomersResponse]:
+ """
+ Retrieves multiple customer profiles.
+
+ This endpoint takes a list of customer IDs and returns a map of responses.
+
+ Parameters
+ ----------
+ customer_ids : typing.Sequence[str]
+ The IDs of the [customer profiles](entity:Customer) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkRetrieveCustomersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/bulk-retrieve",
+ method="POST",
+ json={
+ "customer_ids": customer_ids,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkRetrieveCustomersResponse,
+ construct_type(
+ type_=BulkRetrieveCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def bulk_update_customers(
+ self,
+ *,
+ customers: typing.Dict[str, BulkUpdateCustomerDataParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BulkUpdateCustomersResponse]:
+ """
+ Updates multiple customer profiles.
+
+ This endpoint takes a map of individual update requests and returns a map of responses.
+
+ Parameters
+ ----------
+ customers : typing.Dict[str, BulkUpdateCustomerDataParams]
+ A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }`
+ key-value pairs.
+
+ Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer profile
+ that was created by merging existing profiles, provide the ID of the newly created profile.
+
+ Each value contains the updated customer data. Only new or changed fields are required. To add or
+ update a field, specify the new value. To remove a field, specify `null`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkUpdateCustomersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/bulk-update",
+ method="POST",
+ json={
+ "customers": convert_and_respect_annotation_metadata(
+ object_=customers, annotation=typing.Dict[str, BulkUpdateCustomerDataParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkUpdateCustomersResponse,
+ construct_type(
+ type_=BulkUpdateCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[CustomerQueryParams] = OMIT,
+ count: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchCustomersResponse]:
+ """
+ Searches the customer profiles associated with a Square account using one or more supported query filters.
+
+ Calling `SearchCustomers` without any explicit query filter returns all
+ customer profiles ordered alphabetically based on `given_name` and
+ `family_name`.
+
+ Under normal operating conditions, newly created or updated customer profiles become available
+ for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated
+ profiles can take closer to one minute or longer, especially during network incidents and outages.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ Include the pagination cursor in subsequent calls to this endpoint to retrieve
+ the next set of results associated with the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ query : typing.Optional[CustomerQueryParams]
+ The filtering and sorting criteria for the search request. If a query is not specified,
+ Square returns all customer profiles ordered alphabetically by `given_name` and `family_name`.
+
+ count : typing.Optional[bool]
+ Indicates whether to return the total count of matching customers in the `count` field of the response.
+
+ The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchCustomersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/search",
+ method="POST",
+ json={
+ "cursor": cursor,
+ "limit": limit,
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=CustomerQueryParams, direction="write"
+ ),
+ "count": count,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchCustomersResponse,
+ construct_type(
+ type_=SearchCustomersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetCustomerResponse]:
+ """
+ Returns details for a single customer.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetCustomerResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetCustomerResponse,
+ construct_type(
+ type_=GetCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ customer_id: str,
+ *,
+ given_name: typing.Optional[str] = OMIT,
+ family_name: typing.Optional[str] = OMIT,
+ company_name: typing.Optional[str] = OMIT,
+ nickname: typing.Optional[str] = OMIT,
+ email_address: typing.Optional[str] = OMIT,
+ address: typing.Optional[AddressParams] = OMIT,
+ phone_number: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ birthday: typing.Optional[str] = OMIT,
+ version: typing.Optional[int] = OMIT,
+ tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateCustomerResponse]:
+ """
+ Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request.
+ To add or update a field, specify the new value. To remove a field, specify `null`.
+
+ To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to update.
+
+ given_name : typing.Optional[str]
+ The given name (that is, the first name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ family_name : typing.Optional[str]
+ The family name (that is, the last name) associated with the customer profile.
+
+ The maximum length for this value is 300 characters.
+
+ company_name : typing.Optional[str]
+ A business name associated with the customer profile.
+
+ The maximum length for this value is 500 characters.
+
+ nickname : typing.Optional[str]
+ A nickname for the customer profile.
+
+ The maximum length for this value is 100 characters.
+
+ email_address : typing.Optional[str]
+ The email address associated with the customer profile.
+
+ The maximum length for this value is 254 characters.
+
+ address : typing.Optional[AddressParams]
+ The physical address associated with the customer profile. Only new or changed fields are required in the request.
+
+ For maximum length constraints, see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+
+ phone_number : typing.Optional[str]
+ The phone number associated with the customer profile. The phone number must be valid and can contain
+ 9–16 digits, with an optional `+` prefix and country code. For more information, see
+ [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+
+ reference_id : typing.Optional[str]
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+
+ The maximum length for this value is 100 characters.
+
+ note : typing.Optional[str]
+ A custom note associated with the customer profile.
+
+ birthday : typing.Optional[str]
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
+ specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
+ format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.
+
+ version : typing.Optional[int]
+ The current version of the customer profile.
+
+ As a best practice, you should include this field to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Update a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#update-a-customer-profile).
+
+ tax_ids : typing.Optional[CustomerTaxIdsParams]
+ The tax ID associated with the customer profile. This field is available only for customers of sellers
+ in EU countries or the United Kingdom. For more information,
+ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateCustomerResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}",
+ method="PUT",
+ json={
+ "given_name": given_name,
+ "family_name": family_name,
+ "company_name": company_name,
+ "nickname": nickname,
+ "email_address": email_address,
+ "address": convert_and_respect_annotation_metadata(
+ object_=address, annotation=AddressParams, direction="write"
+ ),
+ "phone_number": phone_number,
+ "reference_id": reference_id,
+ "note": note,
+ "birthday": birthday,
+ "version": version,
+ "tax_ids": convert_and_respect_annotation_metadata(
+ object_=tax_ids, annotation=CustomerTaxIdsParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateCustomerResponse,
+ construct_type(
+ type_=UpdateCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self,
+ customer_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[DeleteCustomerResponse]:
+ """
+ Deletes a customer profile from a business.
+
+ To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
+
+ Parameters
+ ----------
+ customer_id : str
+ The ID of the customer to delete.
+
+ version : typing.Optional[int]
+ The current version of the customer profile.
+
+ As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteCustomerResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/{jsonable_encoder(customer_id)}",
+ method="DELETE",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteCustomerResponse,
+ construct_type(
+ type_=DeleteCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/customers/segments/__init__.py b/src/square/customers/segments/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/customers/segments/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/customers/segments/client.py b/src/square/customers/segments/client.py
new file mode 100644
index 00000000..d95eab9e
--- /dev/null
+++ b/src/square/customers/segments/client.py
@@ -0,0 +1,228 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...types.customer_segment import CustomerSegment
+from ...types.get_customer_segment_response import GetCustomerSegmentResponse
+from ...types.list_customer_segments_response import ListCustomerSegmentsResponse
+from .raw_client import AsyncRawSegmentsClient, RawSegmentsClient
+
+
+class SegmentsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawSegmentsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawSegmentsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawSegmentsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomerSegment, ListCustomerSegmentsResponse]:
+ """
+ Retrieves the list of customer segments of a business.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by previous calls to `ListCustomerSegments`.
+ This cursor is used to retrieve the next set of query results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomerSegment, ListCustomerSegmentsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.customers.segments.list(
+ cursor="cursor",
+ limit=1,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(cursor=cursor, limit=limit, request_options=request_options)
+
+ def get(
+ self, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetCustomerSegmentResponse:
+ """
+ Retrieves a specific customer segment as identified by the `segment_id` value.
+
+ Parameters
+ ----------
+ segment_id : str
+ The Square-issued ID of the customer segment.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetCustomerSegmentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.customers.segments.get(
+ segment_id="segment_id",
+ )
+ """
+ _response = self._raw_client.get(segment_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncSegmentsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawSegmentsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawSegmentsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawSegmentsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomerSegment, ListCustomerSegmentsResponse]:
+ """
+ Retrieves the list of customer segments of a business.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by previous calls to `ListCustomerSegments`.
+ This cursor is used to retrieve the next set of query results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomerSegment, ListCustomerSegmentsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.customers.segments.list(
+ cursor="cursor",
+ limit=1,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(cursor=cursor, limit=limit, request_options=request_options)
+
+ async def get(
+ self, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetCustomerSegmentResponse:
+ """
+ Retrieves a specific customer segment as identified by the `segment_id` value.
+
+ Parameters
+ ----------
+ segment_id : str
+ The Square-issued ID of the customer segment.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetCustomerSegmentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.customers.segments.get(
+ segment_id="segment_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(segment_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/customers/segments/raw_client.py b/src/square/customers/segments/raw_client.py
new file mode 100644
index 00000000..aead0dfe
--- /dev/null
+++ b/src/square/customers/segments/raw_client.py
@@ -0,0 +1,234 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.unchecked_base_model import construct_type
+from ...types.customer_segment import CustomerSegment
+from ...types.get_customer_segment_response import GetCustomerSegmentResponse
+from ...types.list_customer_segments_response import ListCustomerSegmentsResponse
+
+
+class RawSegmentsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomerSegment, ListCustomerSegmentsResponse]:
+ """
+ Retrieves the list of customer segments of a business.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by previous calls to `ListCustomerSegments`.
+ This cursor is used to retrieve the next set of query results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomerSegment, ListCustomerSegmentsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/customers/segments",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListCustomerSegmentsResponse,
+ construct_type(
+ type_=ListCustomerSegmentsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.segments
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetCustomerSegmentResponse]:
+ """
+ Retrieves a specific customer segment as identified by the `segment_id` value.
+
+ Parameters
+ ----------
+ segment_id : str
+ The Square-issued ID of the customer segment.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetCustomerSegmentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/customers/segments/{jsonable_encoder(segment_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetCustomerSegmentResponse,
+ construct_type(
+ type_=GetCustomerSegmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawSegmentsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomerSegment, ListCustomerSegmentsResponse]:
+ """
+ Retrieves the list of customer segments of a business.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by previous calls to `ListCustomerSegments`.
+ This cursor is used to retrieve the next set of query results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
+ If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomerSegment, ListCustomerSegmentsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/customers/segments",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListCustomerSegmentsResponse,
+ construct_type(
+ type_=ListCustomerSegmentsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.segments
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetCustomerSegmentResponse]:
+ """
+ Retrieves a specific customer segment as identified by the `segment_id` value.
+
+ Parameters
+ ----------
+ segment_id : str
+ The Square-issued ID of the customer segment.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetCustomerSegmentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/customers/segments/{jsonable_encoder(segment_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetCustomerSegmentResponse,
+ construct_type(
+ type_=GetCustomerSegmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/devices/__init__.py b/src/square/devices/__init__.py
new file mode 100644
index 00000000..bc1c2328
--- /dev/null
+++ b/src/square/devices/__init__.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import codes
+_dynamic_imports: typing.Dict[str, str] = {"codes": ".codes"}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["codes"]
diff --git a/src/square/devices/client.py b/src/square/devices/client.py
new file mode 100644
index 00000000..f4e42b47
--- /dev/null
+++ b/src/square/devices/client.py
@@ -0,0 +1,274 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..types.device import Device
+from ..types.get_device_response import GetDeviceResponse
+from ..types.list_devices_response import ListDevicesResponse
+from ..types.sort_order import SortOrder
+from .raw_client import AsyncRawDevicesClient, RawDevicesClient
+
+if typing.TYPE_CHECKING:
+ from .codes.client import AsyncCodesClient, CodesClient
+
+
+class DevicesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawDevicesClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._codes: typing.Optional[CodesClient] = None
+
+ @property
+ def with_raw_response(self) -> RawDevicesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawDevicesClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ location_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Device, ListDevicesResponse]:
+ """
+ List devices associated with the merchant. Currently, only Terminal API
+ devices are supported.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which results are listed.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ limit : typing.Optional[int]
+ The number of results to return in a single page.
+
+ location_id : typing.Optional[str]
+ If present, only returns devices at the target location.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Device, ListDevicesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.devices.list(
+ cursor="cursor",
+ sort_order="DESC",
+ limit=1,
+ location_id="location_id",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ cursor=cursor, sort_order=sort_order, limit=limit, location_id=location_id, request_options=request_options
+ )
+
+ def get(self, device_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetDeviceResponse:
+ """
+ Retrieves Device with the associated `device_id`.
+
+ Parameters
+ ----------
+ device_id : str
+ The unique ID for the desired `Device`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetDeviceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.devices.get(
+ device_id="device_id",
+ )
+ """
+ _response = self._raw_client.get(device_id, request_options=request_options)
+ return _response.data
+
+ @property
+ def codes(self):
+ if self._codes is None:
+ from .codes.client import CodesClient # noqa: E402
+
+ self._codes = CodesClient(client_wrapper=self._client_wrapper)
+ return self._codes
+
+
+class AsyncDevicesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawDevicesClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._codes: typing.Optional[AsyncCodesClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawDevicesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawDevicesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ location_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Device, ListDevicesResponse]:
+ """
+ List devices associated with the merchant. Currently, only Terminal API
+ devices are supported.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which results are listed.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ limit : typing.Optional[int]
+ The number of results to return in a single page.
+
+ location_id : typing.Optional[str]
+ If present, only returns devices at the target location.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Device, ListDevicesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.devices.list(
+ cursor="cursor",
+ sort_order="DESC",
+ limit=1,
+ location_id="location_id",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ cursor=cursor, sort_order=sort_order, limit=limit, location_id=location_id, request_options=request_options
+ )
+
+ async def get(
+ self, device_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetDeviceResponse:
+ """
+ Retrieves Device with the associated `device_id`.
+
+ Parameters
+ ----------
+ device_id : str
+ The unique ID for the desired `Device`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetDeviceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.devices.get(
+ device_id="device_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(device_id, request_options=request_options)
+ return _response.data
+
+ @property
+ def codes(self):
+ if self._codes is None:
+ from .codes.client import AsyncCodesClient # noqa: E402
+
+ self._codes = AsyncCodesClient(client_wrapper=self._client_wrapper)
+ return self._codes
diff --git a/src/square/devices/codes/__init__.py b/src/square/devices/codes/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/devices/codes/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/devices/codes/client.py b/src/square/devices/codes/client.py
new file mode 100644
index 00000000..5d4c2819
--- /dev/null
+++ b/src/square/devices/codes/client.py
@@ -0,0 +1,371 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.device_code import DeviceCodeParams
+from ...types.create_device_code_response import CreateDeviceCodeResponse
+from ...types.device_code import DeviceCode
+from ...types.device_code_status import DeviceCodeStatus
+from ...types.get_device_code_response import GetDeviceCodeResponse
+from ...types.list_device_codes_response import ListDeviceCodesResponse
+from ...types.product_type import ProductType
+from .raw_client import AsyncRawCodesClient, RawCodesClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CodesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCodesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCodesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCodesClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ product_type: typing.Optional[ProductType] = None,
+ status: typing.Optional[DeviceCodeStatus] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[DeviceCode, ListDeviceCodesResponse]:
+ """
+ Lists all DeviceCodes associated with the merchant.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+
+ location_id : typing.Optional[str]
+ If specified, only returns DeviceCodes of the specified location.
+ Returns DeviceCodes of all locations if empty.
+
+ product_type : typing.Optional[ProductType]
+ If specified, only returns DeviceCodes targeting the specified product type.
+ Returns DeviceCodes of all product types if empty.
+
+ status : typing.Optional[DeviceCodeStatus]
+ If specified, returns DeviceCodes with the specified statuses.
+ Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[DeviceCode, ListDeviceCodesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.devices.codes.list(
+ cursor="cursor",
+ location_id="location_id",
+ status="UNKNOWN",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ cursor=cursor,
+ location_id=location_id,
+ product_type=product_type,
+ status=status,
+ request_options=request_options,
+ )
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ device_code: DeviceCodeParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateDeviceCodeResponse:
+ """
+ Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected
+ terminal mode.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this CreateDeviceCode request. Keys can
+ be any valid string but must be unique for every CreateDeviceCode request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ device_code : DeviceCodeParams
+ The device code to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateDeviceCodeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.devices.codes.create(
+ idempotency_key="01bb00a6-0c86-4770-94ed-f5fca973cd56",
+ device_code={
+ "name": "Counter 1",
+ "product_type": "TERMINAL_API",
+ "location_id": "B5E4484SHHNYH",
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ idempotency_key=idempotency_key, device_code=device_code, request_options=request_options
+ )
+ return _response.data
+
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetDeviceCodeResponse:
+ """
+ Retrieves DeviceCode with the associated ID.
+
+ Parameters
+ ----------
+ id : str
+ The unique identifier for the device code.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetDeviceCodeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.devices.codes.get(
+ id="id",
+ )
+ """
+ _response = self._raw_client.get(id, request_options=request_options)
+ return _response.data
+
+
+class AsyncCodesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCodesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCodesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCodesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ product_type: typing.Optional[ProductType] = None,
+ status: typing.Optional[DeviceCodeStatus] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[DeviceCode, ListDeviceCodesResponse]:
+ """
+ Lists all DeviceCodes associated with the merchant.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+
+ location_id : typing.Optional[str]
+ If specified, only returns DeviceCodes of the specified location.
+ Returns DeviceCodes of all locations if empty.
+
+ product_type : typing.Optional[ProductType]
+ If specified, only returns DeviceCodes targeting the specified product type.
+ Returns DeviceCodes of all product types if empty.
+
+ status : typing.Optional[DeviceCodeStatus]
+ If specified, returns DeviceCodes with the specified statuses.
+ Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[DeviceCode, ListDeviceCodesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.devices.codes.list(
+ cursor="cursor",
+ location_id="location_id",
+ status="UNKNOWN",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ cursor=cursor,
+ location_id=location_id,
+ product_type=product_type,
+ status=status,
+ request_options=request_options,
+ )
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ device_code: DeviceCodeParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateDeviceCodeResponse:
+ """
+ Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected
+ terminal mode.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this CreateDeviceCode request. Keys can
+ be any valid string but must be unique for every CreateDeviceCode request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ device_code : DeviceCodeParams
+ The device code to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateDeviceCodeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.devices.codes.create(
+ idempotency_key="01bb00a6-0c86-4770-94ed-f5fca973cd56",
+ device_code={
+ "name": "Counter 1",
+ "product_type": "TERMINAL_API",
+ "location_id": "B5E4484SHHNYH",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ idempotency_key=idempotency_key, device_code=device_code, request_options=request_options
+ )
+ return _response.data
+
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetDeviceCodeResponse:
+ """
+ Retrieves DeviceCode with the associated ID.
+
+ Parameters
+ ----------
+ id : str
+ The unique identifier for the device code.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetDeviceCodeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.devices.codes.get(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(id, request_options=request_options)
+ return _response.data
diff --git a/src/square/devices/codes/raw_client.py b/src/square/devices/codes/raw_client.py
new file mode 100644
index 00000000..b6aaabfb
--- /dev/null
+++ b/src/square/devices/codes/raw_client.py
@@ -0,0 +1,386 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.device_code import DeviceCodeParams
+from ...types.create_device_code_response import CreateDeviceCodeResponse
+from ...types.device_code import DeviceCode
+from ...types.device_code_status import DeviceCodeStatus
+from ...types.get_device_code_response import GetDeviceCodeResponse
+from ...types.list_device_codes_response import ListDeviceCodesResponse
+from ...types.product_type import ProductType
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCodesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ product_type: typing.Optional[ProductType] = None,
+ status: typing.Optional[DeviceCodeStatus] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[DeviceCode, ListDeviceCodesResponse]:
+ """
+ Lists all DeviceCodes associated with the merchant.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+
+ location_id : typing.Optional[str]
+ If specified, only returns DeviceCodes of the specified location.
+ Returns DeviceCodes of all locations if empty.
+
+ product_type : typing.Optional[ProductType]
+ If specified, only returns DeviceCodes targeting the specified product type.
+ Returns DeviceCodes of all product types if empty.
+
+ status : typing.Optional[DeviceCodeStatus]
+ If specified, returns DeviceCodes with the specified statuses.
+ Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[DeviceCode, ListDeviceCodesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/devices/codes",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "location_id": location_id,
+ "product_type": product_type,
+ "status": status,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListDeviceCodesResponse,
+ construct_type(
+ type_=ListDeviceCodesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.device_codes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ cursor=_parsed_next,
+ location_id=location_id,
+ product_type=product_type,
+ status=status,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ device_code: DeviceCodeParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateDeviceCodeResponse]:
+ """
+ Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected
+ terminal mode.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this CreateDeviceCode request. Keys can
+ be any valid string but must be unique for every CreateDeviceCode request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ device_code : DeviceCodeParams
+ The device code to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateDeviceCodeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/devices/codes",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "device_code": convert_and_respect_annotation_metadata(
+ object_=device_code, annotation=DeviceCodeParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateDeviceCodeResponse,
+ construct_type(
+ type_=CreateDeviceCodeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetDeviceCodeResponse]:
+ """
+ Retrieves DeviceCode with the associated ID.
+
+ Parameters
+ ----------
+ id : str
+ The unique identifier for the device code.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetDeviceCodeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/devices/codes/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetDeviceCodeResponse,
+ construct_type(
+ type_=GetDeviceCodeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCodesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ product_type: typing.Optional[ProductType] = None,
+ status: typing.Optional[DeviceCodeStatus] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[DeviceCode, ListDeviceCodesResponse]:
+ """
+ Lists all DeviceCodes associated with the merchant.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+
+ location_id : typing.Optional[str]
+ If specified, only returns DeviceCodes of the specified location.
+ Returns DeviceCodes of all locations if empty.
+
+ product_type : typing.Optional[ProductType]
+ If specified, only returns DeviceCodes targeting the specified product type.
+ Returns DeviceCodes of all product types if empty.
+
+ status : typing.Optional[DeviceCodeStatus]
+ If specified, returns DeviceCodes with the specified statuses.
+ Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[DeviceCode, ListDeviceCodesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/devices/codes",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "location_id": location_id,
+ "product_type": product_type,
+ "status": status,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListDeviceCodesResponse,
+ construct_type(
+ type_=ListDeviceCodesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.device_codes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ cursor=_parsed_next,
+ location_id=location_id,
+ product_type=product_type,
+ status=status,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ device_code: DeviceCodeParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateDeviceCodeResponse]:
+ """
+ Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected
+ terminal mode.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this CreateDeviceCode request. Keys can
+ be any valid string but must be unique for every CreateDeviceCode request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ device_code : DeviceCodeParams
+ The device code to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateDeviceCodeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/devices/codes",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "device_code": convert_and_respect_annotation_metadata(
+ object_=device_code, annotation=DeviceCodeParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateDeviceCodeResponse,
+ construct_type(
+ type_=CreateDeviceCodeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetDeviceCodeResponse]:
+ """
+ Retrieves DeviceCode with the associated ID.
+
+ Parameters
+ ----------
+ id : str
+ The unique identifier for the device code.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetDeviceCodeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/devices/codes/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetDeviceCodeResponse,
+ construct_type(
+ type_=GetDeviceCodeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/devices/raw_client.py b/src/square/devices/raw_client.py
new file mode 100644
index 00000000..3a5b0f9b
--- /dev/null
+++ b/src/square/devices/raw_client.py
@@ -0,0 +1,257 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.unchecked_base_model import construct_type
+from ..types.device import Device
+from ..types.get_device_response import GetDeviceResponse
+from ..types.list_devices_response import ListDevicesResponse
+from ..types.sort_order import SortOrder
+
+
+class RawDevicesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ location_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Device, ListDevicesResponse]:
+ """
+ List devices associated with the merchant. Currently, only Terminal API
+ devices are supported.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which results are listed.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ limit : typing.Optional[int]
+ The number of results to return in a single page.
+
+ location_id : typing.Optional[str]
+ If present, only returns devices at the target location.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Device, ListDevicesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/devices",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "sort_order": sort_order,
+ "limit": limit,
+ "location_id": location_id,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListDevicesResponse,
+ construct_type(
+ type_=ListDevicesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.devices
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ cursor=_parsed_next,
+ sort_order=sort_order,
+ limit=limit,
+ location_id=location_id,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, device_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetDeviceResponse]:
+ """
+ Retrieves Device with the associated `device_id`.
+
+ Parameters
+ ----------
+ device_id : str
+ The unique ID for the desired `Device`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetDeviceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/devices/{jsonable_encoder(device_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetDeviceResponse,
+ construct_type(
+ type_=GetDeviceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawDevicesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ location_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Device, ListDevicesResponse]:
+ """
+ List devices associated with the merchant. Currently, only Terminal API
+ devices are supported.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which results are listed.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ limit : typing.Optional[int]
+ The number of results to return in a single page.
+
+ location_id : typing.Optional[str]
+ If present, only returns devices at the target location.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Device, ListDevicesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/devices",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "sort_order": sort_order,
+ "limit": limit,
+ "location_id": location_id,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListDevicesResponse,
+ construct_type(
+ type_=ListDevicesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.devices
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ cursor=_parsed_next,
+ sort_order=sort_order,
+ limit=limit,
+ location_id=location_id,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, device_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetDeviceResponse]:
+ """
+ Retrieves Device with the associated `device_id`.
+
+ Parameters
+ ----------
+ device_id : str
+ The unique ID for the desired `Device`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetDeviceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/devices/{jsonable_encoder(device_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetDeviceResponse,
+ construct_type(
+ type_=GetDeviceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/disputes/__init__.py b/src/square/disputes/__init__.py
new file mode 100644
index 00000000..94331272
--- /dev/null
+++ b/src/square/disputes/__init__.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import evidence
+_dynamic_imports: typing.Dict[str, str] = {"evidence": ".evidence"}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["evidence"]
diff --git a/src/square/disputes/client.py b/src/square/disputes/client.py
new file mode 100644
index 00000000..88bb04dc
--- /dev/null
+++ b/src/square/disputes/client.py
@@ -0,0 +1,661 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from .. import core
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..requests.create_dispute_evidence_file_request import CreateDisputeEvidenceFileRequestParams
+from ..types.accept_dispute_response import AcceptDisputeResponse
+from ..types.create_dispute_evidence_file_response import CreateDisputeEvidenceFileResponse
+from ..types.create_dispute_evidence_text_response import CreateDisputeEvidenceTextResponse
+from ..types.dispute import Dispute
+from ..types.dispute_evidence_type import DisputeEvidenceType
+from ..types.dispute_state import DisputeState
+from ..types.get_dispute_response import GetDisputeResponse
+from ..types.list_disputes_response import ListDisputesResponse
+from ..types.submit_evidence_response import SubmitEvidenceResponse
+from .raw_client import AsyncRawDisputesClient, RawDisputesClient
+
+if typing.TYPE_CHECKING:
+ from .evidence.client import AsyncEvidenceClient, EvidenceClient
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class DisputesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawDisputesClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._evidence: typing.Optional[EvidenceClient] = None
+
+ @property
+ def with_raw_response(self) -> RawDisputesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawDisputesClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ states: typing.Optional[DisputeState] = None,
+ location_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Dispute, ListDisputesResponse]:
+ """
+ Returns a list of disputes associated with a particular account.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ states : typing.Optional[DisputeState]
+ The dispute states used to filter the result. If not specified, the endpoint returns all disputes.
+
+ location_id : typing.Optional[str]
+ The ID of the location for which to return a list of disputes.
+ If not specified, the endpoint returns disputes associated with all locations.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Dispute, ListDisputesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.disputes.list(
+ cursor="cursor",
+ states="INQUIRY_EVIDENCE_REQUIRED",
+ location_id="location_id",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ cursor=cursor, states=states, location_id=location_id, request_options=request_options
+ )
+
+ def get(self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetDisputeResponse:
+ """
+ Returns details about a specific dispute.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute you want more details about.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetDisputeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.disputes.get(
+ dispute_id="dispute_id",
+ )
+ """
+ _response = self._raw_client.get(dispute_id, request_options=request_options)
+ return _response.data
+
+ def accept(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AcceptDisputeResponse:
+ """
+ Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and
+ updates the dispute state to ACCEPTED.
+
+ Square debits the disputed amount from the seller’s Square account. If the Square account
+ does not have sufficient funds, Square debits the associated bank account.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute you want to accept.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AcceptDisputeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.disputes.accept(
+ dispute_id="dispute_id",
+ )
+ """
+ _response = self._raw_client.accept(dispute_id, request_options=request_options)
+ return _response.data
+
+ def create_evidence_file(
+ self,
+ dispute_id: str,
+ *,
+ request: typing.Optional[CreateDisputeEvidenceFileRequestParams] = OMIT,
+ image_file: typing.Optional[core.File] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateDisputeEvidenceFileResponse:
+ """
+ Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP
+ multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to upload evidence.
+
+ request : typing.Optional[CreateDisputeEvidenceFileRequestParams]
+
+ image_file : typing.Optional[core.File]
+ See core.File for more documentation
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateDisputeEvidenceFileResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.disputes.create_evidence_file(
+ dispute_id="dispute_id",
+ )
+ """
+ _response = self._raw_client.create_evidence_file(
+ dispute_id, request=request, image_file=image_file, request_options=request_options
+ )
+ return _response.data
+
+ def create_evidence_text(
+ self,
+ dispute_id: str,
+ *,
+ idempotency_key: str,
+ evidence_text: str,
+ evidence_type: typing.Optional[DisputeEvidenceType] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateDisputeEvidenceTextResponse:
+ """
+ Uploads text to use as evidence for a dispute challenge.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to upload evidence.
+
+ idempotency_key : str
+ A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ evidence_text : str
+ The evidence string.
+
+ evidence_type : typing.Optional[DisputeEvidenceType]
+ The type of evidence you are uploading.
+ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateDisputeEvidenceTextResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.disputes.create_evidence_text(
+ dispute_id="dispute_id",
+ idempotency_key="ed3ee3933d946f1514d505d173c82648",
+ evidence_type="TRACKING_NUMBER",
+ evidence_text="1Z8888888888888888",
+ )
+ """
+ _response = self._raw_client.create_evidence_text(
+ dispute_id,
+ idempotency_key=idempotency_key,
+ evidence_text=evidence_text,
+ evidence_type=evidence_type,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def submit_evidence(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> SubmitEvidenceResponse:
+ """
+ Submits evidence to the cardholder's bank.
+
+ The evidence submitted by this endpoint includes evidence uploaded
+ using the [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) and
+ [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText) endpoints and
+ evidence automatically provided by Square, when available. Evidence cannot be removed from
+ a dispute after submission.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to submit evidence.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SubmitEvidenceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.disputes.submit_evidence(
+ dispute_id="dispute_id",
+ )
+ """
+ _response = self._raw_client.submit_evidence(dispute_id, request_options=request_options)
+ return _response.data
+
+ @property
+ def evidence(self):
+ if self._evidence is None:
+ from .evidence.client import EvidenceClient # noqa: E402
+
+ self._evidence = EvidenceClient(client_wrapper=self._client_wrapper)
+ return self._evidence
+
+
+class AsyncDisputesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawDisputesClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._evidence: typing.Optional[AsyncEvidenceClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawDisputesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawDisputesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ states: typing.Optional[DisputeState] = None,
+ location_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Dispute, ListDisputesResponse]:
+ """
+ Returns a list of disputes associated with a particular account.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ states : typing.Optional[DisputeState]
+ The dispute states used to filter the result. If not specified, the endpoint returns all disputes.
+
+ location_id : typing.Optional[str]
+ The ID of the location for which to return a list of disputes.
+ If not specified, the endpoint returns disputes associated with all locations.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Dispute, ListDisputesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.disputes.list(
+ cursor="cursor",
+ states="INQUIRY_EVIDENCE_REQUIRED",
+ location_id="location_id",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ cursor=cursor, states=states, location_id=location_id, request_options=request_options
+ )
+
+ async def get(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetDisputeResponse:
+ """
+ Returns details about a specific dispute.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute you want more details about.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetDisputeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.disputes.get(
+ dispute_id="dispute_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(dispute_id, request_options=request_options)
+ return _response.data
+
+ async def accept(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AcceptDisputeResponse:
+ """
+ Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and
+ updates the dispute state to ACCEPTED.
+
+ Square debits the disputed amount from the seller’s Square account. If the Square account
+ does not have sufficient funds, Square debits the associated bank account.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute you want to accept.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AcceptDisputeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.disputes.accept(
+ dispute_id="dispute_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.accept(dispute_id, request_options=request_options)
+ return _response.data
+
+ async def create_evidence_file(
+ self,
+ dispute_id: str,
+ *,
+ request: typing.Optional[CreateDisputeEvidenceFileRequestParams] = OMIT,
+ image_file: typing.Optional[core.File] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateDisputeEvidenceFileResponse:
+ """
+ Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP
+ multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to upload evidence.
+
+ request : typing.Optional[CreateDisputeEvidenceFileRequestParams]
+
+ image_file : typing.Optional[core.File]
+ See core.File for more documentation
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateDisputeEvidenceFileResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.disputes.create_evidence_file(
+ dispute_id="dispute_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create_evidence_file(
+ dispute_id, request=request, image_file=image_file, request_options=request_options
+ )
+ return _response.data
+
+ async def create_evidence_text(
+ self,
+ dispute_id: str,
+ *,
+ idempotency_key: str,
+ evidence_text: str,
+ evidence_type: typing.Optional[DisputeEvidenceType] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateDisputeEvidenceTextResponse:
+ """
+ Uploads text to use as evidence for a dispute challenge.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to upload evidence.
+
+ idempotency_key : str
+ A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ evidence_text : str
+ The evidence string.
+
+ evidence_type : typing.Optional[DisputeEvidenceType]
+ The type of evidence you are uploading.
+ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateDisputeEvidenceTextResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.disputes.create_evidence_text(
+ dispute_id="dispute_id",
+ idempotency_key="ed3ee3933d946f1514d505d173c82648",
+ evidence_type="TRACKING_NUMBER",
+ evidence_text="1Z8888888888888888",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create_evidence_text(
+ dispute_id,
+ idempotency_key=idempotency_key,
+ evidence_text=evidence_text,
+ evidence_type=evidence_type,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def submit_evidence(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> SubmitEvidenceResponse:
+ """
+ Submits evidence to the cardholder's bank.
+
+ The evidence submitted by this endpoint includes evidence uploaded
+ using the [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) and
+ [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText) endpoints and
+ evidence automatically provided by Square, when available. Evidence cannot be removed from
+ a dispute after submission.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to submit evidence.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SubmitEvidenceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.disputes.submit_evidence(
+ dispute_id="dispute_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.submit_evidence(dispute_id, request_options=request_options)
+ return _response.data
+
+ @property
+ def evidence(self):
+ if self._evidence is None:
+ from .evidence.client import AsyncEvidenceClient # noqa: E402
+
+ self._evidence = AsyncEvidenceClient(client_wrapper=self._client_wrapper)
+ return self._evidence
diff --git a/src/square/disputes/evidence/__init__.py b/src/square/disputes/evidence/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/disputes/evidence/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/disputes/evidence/client.py b/src/square/disputes/evidence/client.py
new file mode 100644
index 00000000..1f549aac
--- /dev/null
+++ b/src/square/disputes/evidence/client.py
@@ -0,0 +1,317 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...types.delete_dispute_evidence_response import DeleteDisputeEvidenceResponse
+from ...types.dispute_evidence import DisputeEvidence
+from ...types.get_dispute_evidence_response import GetDisputeEvidenceResponse
+from ...types.list_dispute_evidence_response import ListDisputeEvidenceResponse
+from .raw_client import AsyncRawEvidenceClient, RawEvidenceClient
+
+
+class EvidenceClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawEvidenceClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawEvidenceClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawEvidenceClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ dispute_id: str,
+ *,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[DisputeEvidence, ListDisputeEvidenceResponse]:
+ """
+ Returns a list of evidence associated with a dispute.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[DisputeEvidence, ListDisputeEvidenceResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.disputes.evidence.list(
+ dispute_id="dispute_id",
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(dispute_id, cursor=cursor, request_options=request_options)
+
+ def get(
+ self, dispute_id: str, evidence_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetDisputeEvidenceResponse:
+ """
+ Returns the metadata for the evidence specified in the request URL path.
+
+ You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot be downloaded after you upload it.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute from which you want to retrieve evidence metadata.
+
+ evidence_id : str
+ The ID of the evidence to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetDisputeEvidenceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.disputes.evidence.get(
+ dispute_id="dispute_id",
+ evidence_id="evidence_id",
+ )
+ """
+ _response = self._raw_client.get(dispute_id, evidence_id, request_options=request_options)
+ return _response.data
+
+ def delete(
+ self, dispute_id: str, evidence_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteDisputeEvidenceResponse:
+ """
+ Removes specified evidence from a dispute.
+ Square does not send the bank any evidence that is removed.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute from which you want to remove evidence.
+
+ evidence_id : str
+ The ID of the evidence you want to remove.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteDisputeEvidenceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.disputes.evidence.delete(
+ dispute_id="dispute_id",
+ evidence_id="evidence_id",
+ )
+ """
+ _response = self._raw_client.delete(dispute_id, evidence_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncEvidenceClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawEvidenceClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawEvidenceClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawEvidenceClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ dispute_id: str,
+ *,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[DisputeEvidence, ListDisputeEvidenceResponse]:
+ """
+ Returns a list of evidence associated with a dispute.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[DisputeEvidence, ListDisputeEvidenceResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.disputes.evidence.list(
+ dispute_id="dispute_id",
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(dispute_id, cursor=cursor, request_options=request_options)
+
+ async def get(
+ self, dispute_id: str, evidence_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetDisputeEvidenceResponse:
+ """
+ Returns the metadata for the evidence specified in the request URL path.
+
+ You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot be downloaded after you upload it.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute from which you want to retrieve evidence metadata.
+
+ evidence_id : str
+ The ID of the evidence to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetDisputeEvidenceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.disputes.evidence.get(
+ dispute_id="dispute_id",
+ evidence_id="evidence_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(dispute_id, evidence_id, request_options=request_options)
+ return _response.data
+
+ async def delete(
+ self, dispute_id: str, evidence_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteDisputeEvidenceResponse:
+ """
+ Removes specified evidence from a dispute.
+ Square does not send the bank any evidence that is removed.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute from which you want to remove evidence.
+
+ evidence_id : str
+ The ID of the evidence you want to remove.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteDisputeEvidenceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.disputes.evidence.delete(
+ dispute_id="dispute_id",
+ evidence_id="evidence_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(dispute_id, evidence_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/disputes/evidence/raw_client.py b/src/square/disputes/evidence/raw_client.py
new file mode 100644
index 00000000..3f71bdeb
--- /dev/null
+++ b/src/square/disputes/evidence/raw_client.py
@@ -0,0 +1,321 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.unchecked_base_model import construct_type
+from ...types.delete_dispute_evidence_response import DeleteDisputeEvidenceResponse
+from ...types.dispute_evidence import DisputeEvidence
+from ...types.get_dispute_evidence_response import GetDisputeEvidenceResponse
+from ...types.list_dispute_evidence_response import ListDisputeEvidenceResponse
+
+
+class RawEvidenceClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ dispute_id: str,
+ *,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[DisputeEvidence, ListDisputeEvidenceResponse]:
+ """
+ Returns a list of evidence associated with a dispute.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[DisputeEvidence, ListDisputeEvidenceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/evidence",
+ method="GET",
+ params={
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListDisputeEvidenceResponse,
+ construct_type(
+ type_=ListDisputeEvidenceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.evidence
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ dispute_id,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, dispute_id: str, evidence_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetDisputeEvidenceResponse]:
+ """
+ Returns the metadata for the evidence specified in the request URL path.
+
+ You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot be downloaded after you upload it.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute from which you want to retrieve evidence metadata.
+
+ evidence_id : str
+ The ID of the evidence to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetDisputeEvidenceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/evidence/{jsonable_encoder(evidence_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetDisputeEvidenceResponse,
+ construct_type(
+ type_=GetDisputeEvidenceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, dispute_id: str, evidence_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteDisputeEvidenceResponse]:
+ """
+ Removes specified evidence from a dispute.
+ Square does not send the bank any evidence that is removed.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute from which you want to remove evidence.
+
+ evidence_id : str
+ The ID of the evidence you want to remove.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteDisputeEvidenceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/evidence/{jsonable_encoder(evidence_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteDisputeEvidenceResponse,
+ construct_type(
+ type_=DeleteDisputeEvidenceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawEvidenceClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ dispute_id: str,
+ *,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[DisputeEvidence, ListDisputeEvidenceResponse]:
+ """
+ Returns a list of evidence associated with a dispute.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[DisputeEvidence, ListDisputeEvidenceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/evidence",
+ method="GET",
+ params={
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListDisputeEvidenceResponse,
+ construct_type(
+ type_=ListDisputeEvidenceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.evidence
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ dispute_id,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, dispute_id: str, evidence_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetDisputeEvidenceResponse]:
+ """
+ Returns the metadata for the evidence specified in the request URL path.
+
+ You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot be downloaded after you upload it.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute from which you want to retrieve evidence metadata.
+
+ evidence_id : str
+ The ID of the evidence to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetDisputeEvidenceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/evidence/{jsonable_encoder(evidence_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetDisputeEvidenceResponse,
+ construct_type(
+ type_=GetDisputeEvidenceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, dispute_id: str, evidence_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteDisputeEvidenceResponse]:
+ """
+ Removes specified evidence from a dispute.
+ Square does not send the bank any evidence that is removed.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute from which you want to remove evidence.
+
+ evidence_id : str
+ The ID of the evidence you want to remove.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteDisputeEvidenceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/evidence/{jsonable_encoder(evidence_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteDisputeEvidenceResponse,
+ construct_type(
+ type_=DeleteDisputeEvidenceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/disputes/raw_client.py b/src/square/disputes/raw_client.py
new file mode 100644
index 00000000..a0dc9983
--- /dev/null
+++ b/src/square/disputes/raw_client.py
@@ -0,0 +1,686 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import json
+import typing
+from json.decoder import JSONDecodeError
+
+from .. import core
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.unchecked_base_model import construct_type
+from ..requests.create_dispute_evidence_file_request import CreateDisputeEvidenceFileRequestParams
+from ..types.accept_dispute_response import AcceptDisputeResponse
+from ..types.create_dispute_evidence_file_response import CreateDisputeEvidenceFileResponse
+from ..types.create_dispute_evidence_text_response import CreateDisputeEvidenceTextResponse
+from ..types.dispute import Dispute
+from ..types.dispute_evidence_type import DisputeEvidenceType
+from ..types.dispute_state import DisputeState
+from ..types.get_dispute_response import GetDisputeResponse
+from ..types.list_disputes_response import ListDisputesResponse
+from ..types.submit_evidence_response import SubmitEvidenceResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawDisputesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ states: typing.Optional[DisputeState] = None,
+ location_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Dispute, ListDisputesResponse]:
+ """
+ Returns a list of disputes associated with a particular account.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ states : typing.Optional[DisputeState]
+ The dispute states used to filter the result. If not specified, the endpoint returns all disputes.
+
+ location_id : typing.Optional[str]
+ The ID of the location for which to return a list of disputes.
+ If not specified, the endpoint returns disputes associated with all locations.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Dispute, ListDisputesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/disputes",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "states": states,
+ "location_id": location_id,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListDisputesResponse,
+ construct_type(
+ type_=ListDisputesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.disputes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ cursor=_parsed_next,
+ states=states,
+ location_id=location_id,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetDisputeResponse]:
+ """
+ Returns details about a specific dispute.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute you want more details about.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetDisputeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetDisputeResponse,
+ construct_type(
+ type_=GetDisputeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def accept(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[AcceptDisputeResponse]:
+ """
+ Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and
+ updates the dispute state to ACCEPTED.
+
+ Square debits the disputed amount from the seller’s Square account. If the Square account
+ does not have sufficient funds, Square debits the associated bank account.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute you want to accept.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[AcceptDisputeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/accept",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ AcceptDisputeResponse,
+ construct_type(
+ type_=AcceptDisputeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create_evidence_file(
+ self,
+ dispute_id: str,
+ *,
+ request: typing.Optional[CreateDisputeEvidenceFileRequestParams] = OMIT,
+ image_file: typing.Optional[core.File] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateDisputeEvidenceFileResponse]:
+ """
+ Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP
+ multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to upload evidence.
+
+ request : typing.Optional[CreateDisputeEvidenceFileRequestParams]
+
+ image_file : typing.Optional[core.File]
+ See core.File for more documentation
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateDisputeEvidenceFileResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/evidence-files",
+ method="POST",
+ data={},
+ files={
+ **(
+ {"request": (None, json.dumps(jsonable_encoder(request)), "application/json; charset=utf-8")}
+ if request is not OMIT
+ else {}
+ ),
+ **(
+ {"image_file": core.with_content_type(file=image_file, default_content_type="image/jpeg")}
+ if image_file is not None
+ else {}
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ force_multipart=True,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateDisputeEvidenceFileResponse,
+ construct_type(
+ type_=CreateDisputeEvidenceFileResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create_evidence_text(
+ self,
+ dispute_id: str,
+ *,
+ idempotency_key: str,
+ evidence_text: str,
+ evidence_type: typing.Optional[DisputeEvidenceType] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateDisputeEvidenceTextResponse]:
+ """
+ Uploads text to use as evidence for a dispute challenge.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to upload evidence.
+
+ idempotency_key : str
+ A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ evidence_text : str
+ The evidence string.
+
+ evidence_type : typing.Optional[DisputeEvidenceType]
+ The type of evidence you are uploading.
+ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateDisputeEvidenceTextResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/evidence-text",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "evidence_type": evidence_type,
+ "evidence_text": evidence_text,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateDisputeEvidenceTextResponse,
+ construct_type(
+ type_=CreateDisputeEvidenceTextResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def submit_evidence(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[SubmitEvidenceResponse]:
+ """
+ Submits evidence to the cardholder's bank.
+
+ The evidence submitted by this endpoint includes evidence uploaded
+ using the [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) and
+ [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText) endpoints and
+ evidence automatically provided by Square, when available. Evidence cannot be removed from
+ a dispute after submission.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to submit evidence.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SubmitEvidenceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/submit-evidence",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SubmitEvidenceResponse,
+ construct_type(
+ type_=SubmitEvidenceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawDisputesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ states: typing.Optional[DisputeState] = None,
+ location_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Dispute, ListDisputesResponse]:
+ """
+ Returns a list of disputes associated with a particular account.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ states : typing.Optional[DisputeState]
+ The dispute states used to filter the result. If not specified, the endpoint returns all disputes.
+
+ location_id : typing.Optional[str]
+ The ID of the location for which to return a list of disputes.
+ If not specified, the endpoint returns disputes associated with all locations.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Dispute, ListDisputesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/disputes",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "states": states,
+ "location_id": location_id,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListDisputesResponse,
+ construct_type(
+ type_=ListDisputesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.disputes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ cursor=_parsed_next,
+ states=states,
+ location_id=location_id,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetDisputeResponse]:
+ """
+ Returns details about a specific dispute.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute you want more details about.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetDisputeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetDisputeResponse,
+ construct_type(
+ type_=GetDisputeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def accept(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[AcceptDisputeResponse]:
+ """
+ Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and
+ updates the dispute state to ACCEPTED.
+
+ Square debits the disputed amount from the seller’s Square account. If the Square account
+ does not have sufficient funds, Square debits the associated bank account.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute you want to accept.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[AcceptDisputeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/accept",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ AcceptDisputeResponse,
+ construct_type(
+ type_=AcceptDisputeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create_evidence_file(
+ self,
+ dispute_id: str,
+ *,
+ request: typing.Optional[CreateDisputeEvidenceFileRequestParams] = OMIT,
+ image_file: typing.Optional[core.File] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateDisputeEvidenceFileResponse]:
+ """
+ Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP
+ multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to upload evidence.
+
+ request : typing.Optional[CreateDisputeEvidenceFileRequestParams]
+
+ image_file : typing.Optional[core.File]
+ See core.File for more documentation
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateDisputeEvidenceFileResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/evidence-files",
+ method="POST",
+ data={},
+ files={
+ **(
+ {"request": (None, json.dumps(jsonable_encoder(request)), "application/json; charset=utf-8")}
+ if request is not OMIT
+ else {}
+ ),
+ **(
+ {"image_file": core.with_content_type(file=image_file, default_content_type="image/jpeg")}
+ if image_file is not None
+ else {}
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ force_multipart=True,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateDisputeEvidenceFileResponse,
+ construct_type(
+ type_=CreateDisputeEvidenceFileResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create_evidence_text(
+ self,
+ dispute_id: str,
+ *,
+ idempotency_key: str,
+ evidence_text: str,
+ evidence_type: typing.Optional[DisputeEvidenceType] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateDisputeEvidenceTextResponse]:
+ """
+ Uploads text to use as evidence for a dispute challenge.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to upload evidence.
+
+ idempotency_key : str
+ A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ evidence_text : str
+ The evidence string.
+
+ evidence_type : typing.Optional[DisputeEvidenceType]
+ The type of evidence you are uploading.
+ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateDisputeEvidenceTextResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/evidence-text",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "evidence_type": evidence_type,
+ "evidence_text": evidence_text,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateDisputeEvidenceTextResponse,
+ construct_type(
+ type_=CreateDisputeEvidenceTextResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def submit_evidence(
+ self, dispute_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[SubmitEvidenceResponse]:
+ """
+ Submits evidence to the cardholder's bank.
+
+ The evidence submitted by this endpoint includes evidence uploaded
+ using the [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) and
+ [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText) endpoints and
+ evidence automatically provided by Square, when available. Evidence cannot be removed from
+ a dispute after submission.
+
+ Parameters
+ ----------
+ dispute_id : str
+ The ID of the dispute for which you want to submit evidence.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SubmitEvidenceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/disputes/{jsonable_encoder(dispute_id)}/submit-evidence",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SubmitEvidenceResponse,
+ construct_type(
+ type_=SubmitEvidenceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/employees/__init__.py b/src/square/employees/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/employees/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/employees/client.py b/src/square/employees/client.py
new file mode 100644
index 00000000..93376d9d
--- /dev/null
+++ b/src/square/employees/client.py
@@ -0,0 +1,237 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..types.employee import Employee
+from ..types.employee_status import EmployeeStatus
+from ..types.get_employee_response import GetEmployeeResponse
+from ..types.list_employees_response import ListEmployeesResponse
+from .raw_client import AsyncRawEmployeesClient, RawEmployeesClient
+
+
+class EmployeesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawEmployeesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawEmployeesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawEmployeesClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[EmployeeStatus] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Employee, ListEmployeesResponse]:
+ """
+
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+
+
+ status : typing.Optional[EmployeeStatus]
+ Specifies the EmployeeStatus to filter the employee by.
+
+ limit : typing.Optional[int]
+ The number of employees to be returned on each page.
+
+ cursor : typing.Optional[str]
+ The token required to retrieve the specified page of results.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Employee, ListEmployeesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.employees.list(
+ location_id="location_id",
+ status="ACTIVE",
+ limit=1,
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ location_id=location_id, status=status, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetEmployeeResponse:
+ """
+
+
+ Parameters
+ ----------
+ id : str
+ UUID for the employee that was requested.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetEmployeeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.employees.get(
+ id="id",
+ )
+ """
+ _response = self._raw_client.get(id, request_options=request_options)
+ return _response.data
+
+
+class AsyncEmployeesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawEmployeesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawEmployeesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawEmployeesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[EmployeeStatus] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Employee, ListEmployeesResponse]:
+ """
+
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+
+
+ status : typing.Optional[EmployeeStatus]
+ Specifies the EmployeeStatus to filter the employee by.
+
+ limit : typing.Optional[int]
+ The number of employees to be returned on each page.
+
+ cursor : typing.Optional[str]
+ The token required to retrieve the specified page of results.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Employee, ListEmployeesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.employees.list(
+ location_id="location_id",
+ status="ACTIVE",
+ limit=1,
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ location_id=location_id, status=status, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetEmployeeResponse:
+ """
+
+
+ Parameters
+ ----------
+ id : str
+ UUID for the employee that was requested.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetEmployeeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.employees.get(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(id, request_options=request_options)
+ return _response.data
diff --git a/src/square/employees/raw_client.py b/src/square/employees/raw_client.py
new file mode 100644
index 00000000..fadff481
--- /dev/null
+++ b/src/square/employees/raw_client.py
@@ -0,0 +1,247 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.unchecked_base_model import construct_type
+from ..types.employee import Employee
+from ..types.employee_status import EmployeeStatus
+from ..types.get_employee_response import GetEmployeeResponse
+from ..types.list_employees_response import ListEmployeesResponse
+
+
+class RawEmployeesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[EmployeeStatus] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Employee, ListEmployeesResponse]:
+ """
+
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+
+
+ status : typing.Optional[EmployeeStatus]
+ Specifies the EmployeeStatus to filter the employee by.
+
+ limit : typing.Optional[int]
+ The number of employees to be returned on each page.
+
+ cursor : typing.Optional[str]
+ The token required to retrieve the specified page of results.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Employee, ListEmployeesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/employees",
+ method="GET",
+ params={
+ "location_id": location_id,
+ "status": status,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListEmployeesResponse,
+ construct_type(
+ type_=ListEmployeesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.employees
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ location_id=location_id,
+ status=status,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetEmployeeResponse]:
+ """
+
+
+ Parameters
+ ----------
+ id : str
+ UUID for the employee that was requested.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetEmployeeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/employees/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetEmployeeResponse,
+ construct_type(
+ type_=GetEmployeeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawEmployeesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[EmployeeStatus] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Employee, ListEmployeesResponse]:
+ """
+
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+
+
+ status : typing.Optional[EmployeeStatus]
+ Specifies the EmployeeStatus to filter the employee by.
+
+ limit : typing.Optional[int]
+ The number of employees to be returned on each page.
+
+ cursor : typing.Optional[str]
+ The token required to retrieve the specified page of results.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Employee, ListEmployeesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/employees",
+ method="GET",
+ params={
+ "location_id": location_id,
+ "status": status,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListEmployeesResponse,
+ construct_type(
+ type_=ListEmployeesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.employees
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ location_id=location_id,
+ status=status,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetEmployeeResponse]:
+ """
+
+
+ Parameters
+ ----------
+ id : str
+ UUID for the employee that was requested.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetEmployeeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/employees/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetEmployeeResponse,
+ construct_type(
+ type_=GetEmployeeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/environment.py b/src/square/environment.py
new file mode 100644
index 00000000..7e3a13ea
--- /dev/null
+++ b/src/square/environment.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import enum
+
+
+class SquareEnvironment(enum.Enum):
+ PRODUCTION = "https://connect.squareup.com"
+ SANDBOX = "https://connect.squareupsandbox.com"
diff --git a/src/square/events/__init__.py b/src/square/events/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/events/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/events/client.py b/src/square/events/client.py
new file mode 100644
index 00000000..0b33e0fa
--- /dev/null
+++ b/src/square/events/client.py
@@ -0,0 +1,353 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..requests.search_events_query import SearchEventsQueryParams
+from ..types.disable_events_response import DisableEventsResponse
+from ..types.enable_events_response import EnableEventsResponse
+from ..types.list_event_types_response import ListEventTypesResponse
+from ..types.search_events_response import SearchEventsResponse
+from .raw_client import AsyncRawEventsClient, RawEventsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class EventsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawEventsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawEventsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawEventsClient
+ """
+ return self._raw_client
+
+ def search_events(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[SearchEventsQueryParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchEventsResponse:
+ """
+ Search for Square API events that occur within a 28-day timeframe.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of events for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of events to return in a single page. The response might contain fewer events. The default value is 100, which is also the maximum allowed value.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ Default: 100
+
+ query : typing.Optional[SearchEventsQueryParams]
+ The filtering and sorting criteria for the search request. To retrieve additional pages using a cursor, you must use the original query.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchEventsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.events.search_events()
+ """
+ _response = self._raw_client.search_events(
+ cursor=cursor, limit=limit, query=query, request_options=request_options
+ )
+ return _response.data
+
+ def disable_events(self, *, request_options: typing.Optional[RequestOptions] = None) -> DisableEventsResponse:
+ """
+ Disables events to prevent them from being searchable.
+ All events are disabled by default. You must enable events to make them searchable.
+ Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DisableEventsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.events.disable_events()
+ """
+ _response = self._raw_client.disable_events(request_options=request_options)
+ return _response.data
+
+ def enable_events(self, *, request_options: typing.Optional[RequestOptions] = None) -> EnableEventsResponse:
+ """
+ Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ EnableEventsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.events.enable_events()
+ """
+ _response = self._raw_client.enable_events(request_options=request_options)
+ return _response.data
+
+ def list_event_types(
+ self, *, api_version: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> ListEventTypesResponse:
+ """
+ Lists all event types that you can subscribe to as webhooks or query using the Events API.
+
+ Parameters
+ ----------
+ api_version : typing.Optional[str]
+ The API version for which to list event types. Setting this field overrides the default version used by the application.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListEventTypesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.events.list_event_types(
+ api_version="api_version",
+ )
+ """
+ _response = self._raw_client.list_event_types(api_version=api_version, request_options=request_options)
+ return _response.data
+
+
+class AsyncEventsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawEventsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawEventsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawEventsClient
+ """
+ return self._raw_client
+
+ async def search_events(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[SearchEventsQueryParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchEventsResponse:
+ """
+ Search for Square API events that occur within a 28-day timeframe.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of events for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of events to return in a single page. The response might contain fewer events. The default value is 100, which is also the maximum allowed value.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ Default: 100
+
+ query : typing.Optional[SearchEventsQueryParams]
+ The filtering and sorting criteria for the search request. To retrieve additional pages using a cursor, you must use the original query.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchEventsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.events.search_events()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search_events(
+ cursor=cursor, limit=limit, query=query, request_options=request_options
+ )
+ return _response.data
+
+ async def disable_events(self, *, request_options: typing.Optional[RequestOptions] = None) -> DisableEventsResponse:
+ """
+ Disables events to prevent them from being searchable.
+ All events are disabled by default. You must enable events to make them searchable.
+ Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DisableEventsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.events.disable_events()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.disable_events(request_options=request_options)
+ return _response.data
+
+ async def enable_events(self, *, request_options: typing.Optional[RequestOptions] = None) -> EnableEventsResponse:
+ """
+ Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ EnableEventsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.events.enable_events()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.enable_events(request_options=request_options)
+ return _response.data
+
+ async def list_event_types(
+ self, *, api_version: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> ListEventTypesResponse:
+ """
+ Lists all event types that you can subscribe to as webhooks or query using the Events API.
+
+ Parameters
+ ----------
+ api_version : typing.Optional[str]
+ The API version for which to list event types. Setting this field overrides the default version used by the application.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListEventTypesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.events.list_event_types(
+ api_version="api_version",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.list_event_types(api_version=api_version, request_options=request_options)
+ return _response.data
diff --git a/src/square/events/raw_client.py b/src/square/events/raw_client.py
new file mode 100644
index 00000000..831b57a5
--- /dev/null
+++ b/src/square/events/raw_client.py
@@ -0,0 +1,395 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.search_events_query import SearchEventsQueryParams
+from ..types.disable_events_response import DisableEventsResponse
+from ..types.enable_events_response import EnableEventsResponse
+from ..types.list_event_types_response import ListEventTypesResponse
+from ..types.search_events_response import SearchEventsResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawEventsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def search_events(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[SearchEventsQueryParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchEventsResponse]:
+ """
+ Search for Square API events that occur within a 28-day timeframe.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of events for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of events to return in a single page. The response might contain fewer events. The default value is 100, which is also the maximum allowed value.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ Default: 100
+
+ query : typing.Optional[SearchEventsQueryParams]
+ The filtering and sorting criteria for the search request. To retrieve additional pages using a cursor, you must use the original query.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchEventsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/events",
+ method="POST",
+ json={
+ "cursor": cursor,
+ "limit": limit,
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchEventsQueryParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchEventsResponse,
+ construct_type(
+ type_=SearchEventsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def disable_events(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DisableEventsResponse]:
+ """
+ Disables events to prevent them from being searchable.
+ All events are disabled by default. You must enable events to make them searchable.
+ Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DisableEventsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/events/disable",
+ method="PUT",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DisableEventsResponse,
+ construct_type(
+ type_=DisableEventsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def enable_events(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[EnableEventsResponse]:
+ """
+ Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[EnableEventsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/events/enable",
+ method="PUT",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ EnableEventsResponse,
+ construct_type(
+ type_=EnableEventsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def list_event_types(
+ self, *, api_version: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[ListEventTypesResponse]:
+ """
+ Lists all event types that you can subscribe to as webhooks or query using the Events API.
+
+ Parameters
+ ----------
+ api_version : typing.Optional[str]
+ The API version for which to list event types. Setting this field overrides the default version used by the application.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ListEventTypesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/events/types",
+ method="GET",
+ params={
+ "api_version": api_version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListEventTypesResponse,
+ construct_type(
+ type_=ListEventTypesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawEventsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def search_events(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[SearchEventsQueryParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchEventsResponse]:
+ """
+ Search for Square API events that occur within a 28-day timeframe.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of events for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of events to return in a single page. The response might contain fewer events. The default value is 100, which is also the maximum allowed value.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ Default: 100
+
+ query : typing.Optional[SearchEventsQueryParams]
+ The filtering and sorting criteria for the search request. To retrieve additional pages using a cursor, you must use the original query.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchEventsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/events",
+ method="POST",
+ json={
+ "cursor": cursor,
+ "limit": limit,
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchEventsQueryParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchEventsResponse,
+ construct_type(
+ type_=SearchEventsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def disable_events(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DisableEventsResponse]:
+ """
+ Disables events to prevent them from being searchable.
+ All events are disabled by default. You must enable events to make them searchable.
+ Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DisableEventsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/events/disable",
+ method="PUT",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DisableEventsResponse,
+ construct_type(
+ type_=DisableEventsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def enable_events(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[EnableEventsResponse]:
+ """
+ Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[EnableEventsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/events/enable",
+ method="PUT",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ EnableEventsResponse,
+ construct_type(
+ type_=EnableEventsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def list_event_types(
+ self, *, api_version: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[ListEventTypesResponse]:
+ """
+ Lists all event types that you can subscribe to as webhooks or query using the Events API.
+
+ Parameters
+ ----------
+ api_version : typing.Optional[str]
+ The API version for which to list event types. Setting this field overrides the default version used by the application.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ListEventTypesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/events/types",
+ method="GET",
+ params={
+ "api_version": api_version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListEventTypesResponse,
+ construct_type(
+ type_=ListEventTypesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/gift_cards/__init__.py b/src/square/gift_cards/__init__.py
new file mode 100644
index 00000000..6d7e0218
--- /dev/null
+++ b/src/square/gift_cards/__init__.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import activities
+_dynamic_imports: typing.Dict[str, str] = {"activities": ".activities"}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["activities"]
diff --git a/src/square/gift_cards/activities/__init__.py b/src/square/gift_cards/activities/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/gift_cards/activities/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/gift_cards/activities/client.py b/src/square/gift_cards/activities/client.py
new file mode 100644
index 00000000..561fdab0
--- /dev/null
+++ b/src/square/gift_cards/activities/client.py
@@ -0,0 +1,372 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.gift_card_activity import GiftCardActivityParams
+from ...types.create_gift_card_activity_response import CreateGiftCardActivityResponse
+from ...types.gift_card_activity import GiftCardActivity
+from ...types.list_gift_card_activities_response import ListGiftCardActivitiesResponse
+from .raw_client import AsyncRawActivitiesClient, RawActivitiesClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class ActivitiesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawActivitiesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawActivitiesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawActivitiesClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ gift_card_id: typing.Optional[str] = None,
+ type: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]:
+ """
+ Lists gift card activities. By default, you get gift card activities for all
+ gift cards in the seller's account. You can optionally specify query parameters to
+ filter the list. For example, you can get a list of gift card activities for a gift card,
+ for all gift cards in a specific region, or for activities within a time window.
+
+ Parameters
+ ----------
+ gift_card_id : typing.Optional[str]
+ If a gift card ID is provided, the endpoint returns activities related
+ to the specified gift card. Otherwise, the endpoint returns all gift card activities for
+ the seller.
+
+ type : typing.Optional[str]
+ If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of the specified type.
+ Otherwise, the endpoint returns all types of gift card activities.
+
+ location_id : typing.Optional[str]
+ If a location ID is provided, the endpoint returns gift card activities for the specified location.
+ Otherwise, the endpoint returns gift card activities for all locations.
+
+ begin_time : typing.Optional[str]
+ The timestamp for the beginning of the reporting period, in RFC 3339 format.
+ This start time is inclusive. The default value is the current time minus one year.
+
+ end_time : typing.Optional[str]
+ The timestamp for the end of the reporting period, in RFC 3339 format.
+ This end time is inclusive. The default value is the current time.
+
+ limit : typing.Optional[int]
+ If a limit is provided, the endpoint returns the specified number
+ of results (or fewer) per page. The maximum value is 100. The default value is 50.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ If a cursor is not provided, the endpoint returns the first page of the results.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ sort_order : typing.Optional[str]
+ The order in which the endpoint returns the activities, based on `created_at`.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.gift_cards.activities.list(
+ gift_card_id="gift_card_id",
+ type="type",
+ location_id="location_id",
+ begin_time="begin_time",
+ end_time="end_time",
+ limit=1,
+ cursor="cursor",
+ sort_order="sort_order",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ gift_card_id=gift_card_id,
+ type=type,
+ location_id=location_id,
+ begin_time=begin_time,
+ end_time=end_time,
+ limit=limit,
+ cursor=cursor,
+ sort_order=sort_order,
+ request_options=request_options,
+ )
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ gift_card_activity: GiftCardActivityParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateGiftCardActivityResponse:
+ """
+ Creates a gift card activity to manage the balance or state of a [gift card](entity:GiftCard).
+ For example, create an `ACTIVATE` activity to activate a gift card with an initial balance before first use.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies the `CreateGiftCardActivity` request.
+
+ gift_card_activity : GiftCardActivityParams
+ The activity to create for the gift card. This activity must specify `gift_card_id` or `gift_card_gan` for the target
+ gift card, the `location_id` where the activity occurred, and the activity `type` along with the corresponding activity details.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateGiftCardActivityResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.gift_cards.activities.create(
+ idempotency_key="U16kfr-kA70er-q4Rsym-7U7NnY",
+ gift_card_activity={
+ "type": "ACTIVATE",
+ "location_id": "81FN9BNFZTKS4",
+ "gift_card_id": "gftc:6d55a72470d940c6ba09c0ab8ad08d20",
+ "activate_activity_details": {
+ "order_id": "jJNGHm4gLI6XkFbwtiSLqK72KkAZY",
+ "line_item_uid": "eIWl7X0nMuO9Ewbh0ChIx",
+ },
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ idempotency_key=idempotency_key, gift_card_activity=gift_card_activity, request_options=request_options
+ )
+ return _response.data
+
+
+class AsyncActivitiesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawActivitiesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawActivitiesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawActivitiesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ gift_card_id: typing.Optional[str] = None,
+ type: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]:
+ """
+ Lists gift card activities. By default, you get gift card activities for all
+ gift cards in the seller's account. You can optionally specify query parameters to
+ filter the list. For example, you can get a list of gift card activities for a gift card,
+ for all gift cards in a specific region, or for activities within a time window.
+
+ Parameters
+ ----------
+ gift_card_id : typing.Optional[str]
+ If a gift card ID is provided, the endpoint returns activities related
+ to the specified gift card. Otherwise, the endpoint returns all gift card activities for
+ the seller.
+
+ type : typing.Optional[str]
+ If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of the specified type.
+ Otherwise, the endpoint returns all types of gift card activities.
+
+ location_id : typing.Optional[str]
+ If a location ID is provided, the endpoint returns gift card activities for the specified location.
+ Otherwise, the endpoint returns gift card activities for all locations.
+
+ begin_time : typing.Optional[str]
+ The timestamp for the beginning of the reporting period, in RFC 3339 format.
+ This start time is inclusive. The default value is the current time minus one year.
+
+ end_time : typing.Optional[str]
+ The timestamp for the end of the reporting period, in RFC 3339 format.
+ This end time is inclusive. The default value is the current time.
+
+ limit : typing.Optional[int]
+ If a limit is provided, the endpoint returns the specified number
+ of results (or fewer) per page. The maximum value is 100. The default value is 50.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ If a cursor is not provided, the endpoint returns the first page of the results.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ sort_order : typing.Optional[str]
+ The order in which the endpoint returns the activities, based on `created_at`.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.gift_cards.activities.list(
+ gift_card_id="gift_card_id",
+ type="type",
+ location_id="location_id",
+ begin_time="begin_time",
+ end_time="end_time",
+ limit=1,
+ cursor="cursor",
+ sort_order="sort_order",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ gift_card_id=gift_card_id,
+ type=type,
+ location_id=location_id,
+ begin_time=begin_time,
+ end_time=end_time,
+ limit=limit,
+ cursor=cursor,
+ sort_order=sort_order,
+ request_options=request_options,
+ )
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ gift_card_activity: GiftCardActivityParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateGiftCardActivityResponse:
+ """
+ Creates a gift card activity to manage the balance or state of a [gift card](entity:GiftCard).
+ For example, create an `ACTIVATE` activity to activate a gift card with an initial balance before first use.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies the `CreateGiftCardActivity` request.
+
+ gift_card_activity : GiftCardActivityParams
+ The activity to create for the gift card. This activity must specify `gift_card_id` or `gift_card_gan` for the target
+ gift card, the `location_id` where the activity occurred, and the activity `type` along with the corresponding activity details.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateGiftCardActivityResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.gift_cards.activities.create(
+ idempotency_key="U16kfr-kA70er-q4Rsym-7U7NnY",
+ gift_card_activity={
+ "type": "ACTIVATE",
+ "location_id": "81FN9BNFZTKS4",
+ "gift_card_id": "gftc:6d55a72470d940c6ba09c0ab8ad08d20",
+ "activate_activity_details": {
+ "order_id": "jJNGHm4gLI6XkFbwtiSLqK72KkAZY",
+ "line_item_uid": "eIWl7X0nMuO9Ewbh0ChIx",
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ idempotency_key=idempotency_key, gift_card_activity=gift_card_activity, request_options=request_options
+ )
+ return _response.data
diff --git a/src/square/gift_cards/activities/raw_client.py b/src/square/gift_cards/activities/raw_client.py
new file mode 100644
index 00000000..8f6e798d
--- /dev/null
+++ b/src/square/gift_cards/activities/raw_client.py
@@ -0,0 +1,368 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.gift_card_activity import GiftCardActivityParams
+from ...types.create_gift_card_activity_response import CreateGiftCardActivityResponse
+from ...types.gift_card_activity import GiftCardActivity
+from ...types.list_gift_card_activities_response import ListGiftCardActivitiesResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawActivitiesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ gift_card_id: typing.Optional[str] = None,
+ type: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]:
+ """
+ Lists gift card activities. By default, you get gift card activities for all
+ gift cards in the seller's account. You can optionally specify query parameters to
+ filter the list. For example, you can get a list of gift card activities for a gift card,
+ for all gift cards in a specific region, or for activities within a time window.
+
+ Parameters
+ ----------
+ gift_card_id : typing.Optional[str]
+ If a gift card ID is provided, the endpoint returns activities related
+ to the specified gift card. Otherwise, the endpoint returns all gift card activities for
+ the seller.
+
+ type : typing.Optional[str]
+ If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of the specified type.
+ Otherwise, the endpoint returns all types of gift card activities.
+
+ location_id : typing.Optional[str]
+ If a location ID is provided, the endpoint returns gift card activities for the specified location.
+ Otherwise, the endpoint returns gift card activities for all locations.
+
+ begin_time : typing.Optional[str]
+ The timestamp for the beginning of the reporting period, in RFC 3339 format.
+ This start time is inclusive. The default value is the current time minus one year.
+
+ end_time : typing.Optional[str]
+ The timestamp for the end of the reporting period, in RFC 3339 format.
+ This end time is inclusive. The default value is the current time.
+
+ limit : typing.Optional[int]
+ If a limit is provided, the endpoint returns the specified number
+ of results (or fewer) per page. The maximum value is 100. The default value is 50.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ If a cursor is not provided, the endpoint returns the first page of the results.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ sort_order : typing.Optional[str]
+ The order in which the endpoint returns the activities, based on `created_at`.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/gift-cards/activities",
+ method="GET",
+ params={
+ "gift_card_id": gift_card_id,
+ "type": type,
+ "location_id": location_id,
+ "begin_time": begin_time,
+ "end_time": end_time,
+ "limit": limit,
+ "cursor": cursor,
+ "sort_order": sort_order,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListGiftCardActivitiesResponse,
+ construct_type(
+ type_=ListGiftCardActivitiesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.gift_card_activities
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ gift_card_id=gift_card_id,
+ type=type,
+ location_id=location_id,
+ begin_time=begin_time,
+ end_time=end_time,
+ limit=limit,
+ cursor=_parsed_next,
+ sort_order=sort_order,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ gift_card_activity: GiftCardActivityParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateGiftCardActivityResponse]:
+ """
+ Creates a gift card activity to manage the balance or state of a [gift card](entity:GiftCard).
+ For example, create an `ACTIVATE` activity to activate a gift card with an initial balance before first use.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies the `CreateGiftCardActivity` request.
+
+ gift_card_activity : GiftCardActivityParams
+ The activity to create for the gift card. This activity must specify `gift_card_id` or `gift_card_gan` for the target
+ gift card, the `location_id` where the activity occurred, and the activity `type` along with the corresponding activity details.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateGiftCardActivityResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/gift-cards/activities",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "gift_card_activity": convert_and_respect_annotation_metadata(
+ object_=gift_card_activity, annotation=GiftCardActivityParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateGiftCardActivityResponse,
+ construct_type(
+ type_=CreateGiftCardActivityResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawActivitiesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ gift_card_id: typing.Optional[str] = None,
+ type: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]:
+ """
+ Lists gift card activities. By default, you get gift card activities for all
+ gift cards in the seller's account. You can optionally specify query parameters to
+ filter the list. For example, you can get a list of gift card activities for a gift card,
+ for all gift cards in a specific region, or for activities within a time window.
+
+ Parameters
+ ----------
+ gift_card_id : typing.Optional[str]
+ If a gift card ID is provided, the endpoint returns activities related
+ to the specified gift card. Otherwise, the endpoint returns all gift card activities for
+ the seller.
+
+ type : typing.Optional[str]
+ If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of the specified type.
+ Otherwise, the endpoint returns all types of gift card activities.
+
+ location_id : typing.Optional[str]
+ If a location ID is provided, the endpoint returns gift card activities for the specified location.
+ Otherwise, the endpoint returns gift card activities for all locations.
+
+ begin_time : typing.Optional[str]
+ The timestamp for the beginning of the reporting period, in RFC 3339 format.
+ This start time is inclusive. The default value is the current time minus one year.
+
+ end_time : typing.Optional[str]
+ The timestamp for the end of the reporting period, in RFC 3339 format.
+ This end time is inclusive. The default value is the current time.
+
+ limit : typing.Optional[int]
+ If a limit is provided, the endpoint returns the specified number
+ of results (or fewer) per page. The maximum value is 100. The default value is 50.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ If a cursor is not provided, the endpoint returns the first page of the results.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ sort_order : typing.Optional[str]
+ The order in which the endpoint returns the activities, based on `created_at`.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/gift-cards/activities",
+ method="GET",
+ params={
+ "gift_card_id": gift_card_id,
+ "type": type,
+ "location_id": location_id,
+ "begin_time": begin_time,
+ "end_time": end_time,
+ "limit": limit,
+ "cursor": cursor,
+ "sort_order": sort_order,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListGiftCardActivitiesResponse,
+ construct_type(
+ type_=ListGiftCardActivitiesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.gift_card_activities
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ gift_card_id=gift_card_id,
+ type=type,
+ location_id=location_id,
+ begin_time=begin_time,
+ end_time=end_time,
+ limit=limit,
+ cursor=_parsed_next,
+ sort_order=sort_order,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ gift_card_activity: GiftCardActivityParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateGiftCardActivityResponse]:
+ """
+ Creates a gift card activity to manage the balance or state of a [gift card](entity:GiftCard).
+ For example, create an `ACTIVATE` activity to activate a gift card with an initial balance before first use.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies the `CreateGiftCardActivity` request.
+
+ gift_card_activity : GiftCardActivityParams
+ The activity to create for the gift card. This activity must specify `gift_card_id` or `gift_card_gan` for the target
+ gift card, the `location_id` where the activity occurred, and the activity `type` along with the corresponding activity details.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateGiftCardActivityResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/gift-cards/activities",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "gift_card_activity": convert_and_respect_annotation_metadata(
+ object_=gift_card_activity, annotation=GiftCardActivityParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateGiftCardActivityResponse,
+ construct_type(
+ type_=CreateGiftCardActivityResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/gift_cards/client.py b/src/square/gift_cards/client.py
new file mode 100644
index 00000000..37d6e91c
--- /dev/null
+++ b/src/square/gift_cards/client.py
@@ -0,0 +1,773 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..requests.gift_card import GiftCardParams
+from ..types.create_gift_card_response import CreateGiftCardResponse
+from ..types.get_gift_card_from_gan_response import GetGiftCardFromGanResponse
+from ..types.get_gift_card_from_nonce_response import GetGiftCardFromNonceResponse
+from ..types.get_gift_card_response import GetGiftCardResponse
+from ..types.gift_card import GiftCard
+from ..types.link_customer_to_gift_card_response import LinkCustomerToGiftCardResponse
+from ..types.list_gift_cards_response import ListGiftCardsResponse
+from ..types.unlink_customer_from_gift_card_response import UnlinkCustomerFromGiftCardResponse
+from .raw_client import AsyncRawGiftCardsClient, RawGiftCardsClient
+
+if typing.TYPE_CHECKING:
+ from .activities.client import ActivitiesClient, AsyncActivitiesClient
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class GiftCardsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawGiftCardsClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._activities: typing.Optional[ActivitiesClient] = None
+
+ @property
+ def with_raw_response(self) -> RawGiftCardsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawGiftCardsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ type: typing.Optional[str] = None,
+ state: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ customer_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[GiftCard, ListGiftCardsResponse]:
+ """
+ Lists all gift cards. You can specify optional filters to retrieve
+ a subset of the gift cards. Results are sorted by `created_at` in ascending order.
+
+ Parameters
+ ----------
+ type : typing.Optional[str]
+ If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the specified type.
+ Otherwise, the endpoint returns gift cards of all types.
+
+ state : typing.Optional[str]
+ If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards in the specified state.
+ Otherwise, the endpoint returns the gift cards of all states.
+
+ limit : typing.Optional[int]
+ If a limit is provided, the endpoint returns only the specified number of results per page.
+ The maximum value is 200. The default value is 30.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ If a cursor is not provided, the endpoint returns the first page of the results.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ customer_id : typing.Optional[str]
+ If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[GiftCard, ListGiftCardsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.gift_cards.list(
+ type="type",
+ state="state",
+ limit=1,
+ cursor="cursor",
+ customer_id="customer_id",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ type=type, state=state, limit=limit, cursor=cursor, customer_id=customer_id, request_options=request_options
+ )
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ location_id: str,
+ gift_card: GiftCardParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateGiftCardResponse:
+ """
+ Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card
+ has a `PENDING` state. To activate a gift card so that it can be redeemed for purchases, call
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) and create an `ACTIVATE`
+ activity with the initial balance. Alternatively, you can use [RefundPayment](api-endpoint:Refunds-RefundPayment)
+ to refund a payment to the new gift card.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ location_id : str
+ The ID of the [location](entity:Location) where the gift card should be registered for
+ reporting purposes. Gift cards can be redeemed at any of the seller's locations.
+
+ gift_card : GiftCardParams
+ The gift card to create. The `type` field is required for this request. The `gan_source`
+ and `gan` fields are included as follows:
+
+ To direct Square to generate a 16-digit GAN, omit `gan_source` and `gan`.
+
+ To provide a custom GAN, include `gan_source` and `gan`.
+ - For `gan_source`, specify `OTHER`.
+ - For `gan`, provide a custom GAN containing 8 to 20 alphanumeric characters. The GAN must be
+ unique for the seller and cannot start with the same bank identification number (BIN) as major
+ credit cards. Do not use GANs that are easy to guess (such as 12345678) because they greatly
+ increase the risk of fraud. It is the responsibility of the developer to ensure the security
+ of their custom GANs. For more information, see
+ [Custom GANs](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#custom-gans).
+
+ To register an unused, physical gift card that the seller previously ordered from Square,
+ include `gan` and provide the GAN that is printed on the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateGiftCardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.gift_cards.create(
+ idempotency_key="NC9Tm69EjbjtConu",
+ location_id="81FN9BNFZTKS4",
+ gift_card={"type": "DIGITAL"},
+ )
+ """
+ _response = self._raw_client.create(
+ idempotency_key=idempotency_key,
+ location_id=location_id,
+ gift_card=gift_card,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def get_from_gan(
+ self, *, gan: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetGiftCardFromGanResponse:
+ """
+ Retrieves a gift card using the gift card account number (GAN).
+
+ Parameters
+ ----------
+ gan : str
+ The gift card account number (GAN) of the gift card to retrieve.
+ The maximum length of a GAN is 255 digits to account for third-party GANs that have been imported.
+ Square-issued gift cards have 16-digit GANs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetGiftCardFromGanResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.gift_cards.get_from_gan(
+ gan="7783320001001635",
+ )
+ """
+ _response = self._raw_client.get_from_gan(gan=gan, request_options=request_options)
+ return _response.data
+
+ def get_from_nonce(
+ self, *, nonce: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetGiftCardFromNonceResponse:
+ """
+ Retrieves a gift card using a secure payment token that represents the gift card.
+
+ Parameters
+ ----------
+ nonce : str
+ The payment token of the gift card to retrieve. Payment tokens are generated by the
+ Web Payments SDK or In-App Payments SDK.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetGiftCardFromNonceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.gift_cards.get_from_nonce(
+ nonce="cnon:7783322135245171",
+ )
+ """
+ _response = self._raw_client.get_from_nonce(nonce=nonce, request_options=request_options)
+ return _response.data
+
+ def link_customer(
+ self, gift_card_id: str, *, customer_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> LinkCustomerToGiftCardResponse:
+ """
+ Links a customer to a gift card, which is also referred to as adding a card on file.
+
+ Parameters
+ ----------
+ gift_card_id : str
+ The ID of the gift card to be linked.
+
+ customer_id : str
+ The ID of the customer to link to the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ LinkCustomerToGiftCardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.gift_cards.link_customer(
+ gift_card_id="gift_card_id",
+ customer_id="GKY0FZ3V717AH8Q2D821PNT2ZW",
+ )
+ """
+ _response = self._raw_client.link_customer(
+ gift_card_id, customer_id=customer_id, request_options=request_options
+ )
+ return _response.data
+
+ def unlink_customer(
+ self, gift_card_id: str, *, customer_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> UnlinkCustomerFromGiftCardResponse:
+ """
+ Unlinks a customer from a gift card, which is also referred to as removing a card on file.
+
+ Parameters
+ ----------
+ gift_card_id : str
+ The ID of the gift card to be unlinked.
+
+ customer_id : str
+ The ID of the customer to unlink from the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UnlinkCustomerFromGiftCardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.gift_cards.unlink_customer(
+ gift_card_id="gift_card_id",
+ customer_id="GKY0FZ3V717AH8Q2D821PNT2ZW",
+ )
+ """
+ _response = self._raw_client.unlink_customer(
+ gift_card_id, customer_id=customer_id, request_options=request_options
+ )
+ return _response.data
+
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetGiftCardResponse:
+ """
+ Retrieves a gift card using the gift card ID.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the gift card to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetGiftCardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.gift_cards.get(
+ id="id",
+ )
+ """
+ _response = self._raw_client.get(id, request_options=request_options)
+ return _response.data
+
+ @property
+ def activities(self):
+ if self._activities is None:
+ from .activities.client import ActivitiesClient # noqa: E402
+
+ self._activities = ActivitiesClient(client_wrapper=self._client_wrapper)
+ return self._activities
+
+
+class AsyncGiftCardsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawGiftCardsClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._activities: typing.Optional[AsyncActivitiesClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawGiftCardsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawGiftCardsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ type: typing.Optional[str] = None,
+ state: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ customer_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[GiftCard, ListGiftCardsResponse]:
+ """
+ Lists all gift cards. You can specify optional filters to retrieve
+ a subset of the gift cards. Results are sorted by `created_at` in ascending order.
+
+ Parameters
+ ----------
+ type : typing.Optional[str]
+ If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the specified type.
+ Otherwise, the endpoint returns gift cards of all types.
+
+ state : typing.Optional[str]
+ If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards in the specified state.
+ Otherwise, the endpoint returns the gift cards of all states.
+
+ limit : typing.Optional[int]
+ If a limit is provided, the endpoint returns only the specified number of results per page.
+ The maximum value is 200. The default value is 30.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ If a cursor is not provided, the endpoint returns the first page of the results.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ customer_id : typing.Optional[str]
+ If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[GiftCard, ListGiftCardsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.gift_cards.list(
+ type="type",
+ state="state",
+ limit=1,
+ cursor="cursor",
+ customer_id="customer_id",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ type=type, state=state, limit=limit, cursor=cursor, customer_id=customer_id, request_options=request_options
+ )
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ location_id: str,
+ gift_card: GiftCardParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateGiftCardResponse:
+ """
+ Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card
+ has a `PENDING` state. To activate a gift card so that it can be redeemed for purchases, call
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) and create an `ACTIVATE`
+ activity with the initial balance. Alternatively, you can use [RefundPayment](api-endpoint:Refunds-RefundPayment)
+ to refund a payment to the new gift card.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ location_id : str
+ The ID of the [location](entity:Location) where the gift card should be registered for
+ reporting purposes. Gift cards can be redeemed at any of the seller's locations.
+
+ gift_card : GiftCardParams
+ The gift card to create. The `type` field is required for this request. The `gan_source`
+ and `gan` fields are included as follows:
+
+ To direct Square to generate a 16-digit GAN, omit `gan_source` and `gan`.
+
+ To provide a custom GAN, include `gan_source` and `gan`.
+ - For `gan_source`, specify `OTHER`.
+ - For `gan`, provide a custom GAN containing 8 to 20 alphanumeric characters. The GAN must be
+ unique for the seller and cannot start with the same bank identification number (BIN) as major
+ credit cards. Do not use GANs that are easy to guess (such as 12345678) because they greatly
+ increase the risk of fraud. It is the responsibility of the developer to ensure the security
+ of their custom GANs. For more information, see
+ [Custom GANs](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#custom-gans).
+
+ To register an unused, physical gift card that the seller previously ordered from Square,
+ include `gan` and provide the GAN that is printed on the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateGiftCardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.gift_cards.create(
+ idempotency_key="NC9Tm69EjbjtConu",
+ location_id="81FN9BNFZTKS4",
+ gift_card={"type": "DIGITAL"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ idempotency_key=idempotency_key,
+ location_id=location_id,
+ gift_card=gift_card,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def get_from_gan(
+ self, *, gan: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetGiftCardFromGanResponse:
+ """
+ Retrieves a gift card using the gift card account number (GAN).
+
+ Parameters
+ ----------
+ gan : str
+ The gift card account number (GAN) of the gift card to retrieve.
+ The maximum length of a GAN is 255 digits to account for third-party GANs that have been imported.
+ Square-issued gift cards have 16-digit GANs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetGiftCardFromGanResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.gift_cards.get_from_gan(
+ gan="7783320001001635",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get_from_gan(gan=gan, request_options=request_options)
+ return _response.data
+
+ async def get_from_nonce(
+ self, *, nonce: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetGiftCardFromNonceResponse:
+ """
+ Retrieves a gift card using a secure payment token that represents the gift card.
+
+ Parameters
+ ----------
+ nonce : str
+ The payment token of the gift card to retrieve. Payment tokens are generated by the
+ Web Payments SDK or In-App Payments SDK.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetGiftCardFromNonceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.gift_cards.get_from_nonce(
+ nonce="cnon:7783322135245171",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get_from_nonce(nonce=nonce, request_options=request_options)
+ return _response.data
+
+ async def link_customer(
+ self, gift_card_id: str, *, customer_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> LinkCustomerToGiftCardResponse:
+ """
+ Links a customer to a gift card, which is also referred to as adding a card on file.
+
+ Parameters
+ ----------
+ gift_card_id : str
+ The ID of the gift card to be linked.
+
+ customer_id : str
+ The ID of the customer to link to the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ LinkCustomerToGiftCardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.gift_cards.link_customer(
+ gift_card_id="gift_card_id",
+ customer_id="GKY0FZ3V717AH8Q2D821PNT2ZW",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.link_customer(
+ gift_card_id, customer_id=customer_id, request_options=request_options
+ )
+ return _response.data
+
+ async def unlink_customer(
+ self, gift_card_id: str, *, customer_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> UnlinkCustomerFromGiftCardResponse:
+ """
+ Unlinks a customer from a gift card, which is also referred to as removing a card on file.
+
+ Parameters
+ ----------
+ gift_card_id : str
+ The ID of the gift card to be unlinked.
+
+ customer_id : str
+ The ID of the customer to unlink from the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UnlinkCustomerFromGiftCardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.gift_cards.unlink_customer(
+ gift_card_id="gift_card_id",
+ customer_id="GKY0FZ3V717AH8Q2D821PNT2ZW",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.unlink_customer(
+ gift_card_id, customer_id=customer_id, request_options=request_options
+ )
+ return _response.data
+
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetGiftCardResponse:
+ """
+ Retrieves a gift card using the gift card ID.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the gift card to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetGiftCardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.gift_cards.get(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(id, request_options=request_options)
+ return _response.data
+
+ @property
+ def activities(self):
+ if self._activities is None:
+ from .activities.client import AsyncActivitiesClient # noqa: E402
+
+ self._activities = AsyncActivitiesClient(client_wrapper=self._client_wrapper)
+ return self._activities
diff --git a/src/square/gift_cards/raw_client.py b/src/square/gift_cards/raw_client.py
new file mode 100644
index 00000000..a34df1a7
--- /dev/null
+++ b/src/square/gift_cards/raw_client.py
@@ -0,0 +1,834 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.gift_card import GiftCardParams
+from ..types.create_gift_card_response import CreateGiftCardResponse
+from ..types.get_gift_card_from_gan_response import GetGiftCardFromGanResponse
+from ..types.get_gift_card_from_nonce_response import GetGiftCardFromNonceResponse
+from ..types.get_gift_card_response import GetGiftCardResponse
+from ..types.gift_card import GiftCard
+from ..types.link_customer_to_gift_card_response import LinkCustomerToGiftCardResponse
+from ..types.list_gift_cards_response import ListGiftCardsResponse
+from ..types.unlink_customer_from_gift_card_response import UnlinkCustomerFromGiftCardResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawGiftCardsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ type: typing.Optional[str] = None,
+ state: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ customer_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[GiftCard, ListGiftCardsResponse]:
+ """
+ Lists all gift cards. You can specify optional filters to retrieve
+ a subset of the gift cards. Results are sorted by `created_at` in ascending order.
+
+ Parameters
+ ----------
+ type : typing.Optional[str]
+ If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the specified type.
+ Otherwise, the endpoint returns gift cards of all types.
+
+ state : typing.Optional[str]
+ If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards in the specified state.
+ Otherwise, the endpoint returns the gift cards of all states.
+
+ limit : typing.Optional[int]
+ If a limit is provided, the endpoint returns only the specified number of results per page.
+ The maximum value is 200. The default value is 30.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ If a cursor is not provided, the endpoint returns the first page of the results.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ customer_id : typing.Optional[str]
+ If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[GiftCard, ListGiftCardsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/gift-cards",
+ method="GET",
+ params={
+ "type": type,
+ "state": state,
+ "limit": limit,
+ "cursor": cursor,
+ "customer_id": customer_id,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListGiftCardsResponse,
+ construct_type(
+ type_=ListGiftCardsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.gift_cards
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ type=type,
+ state=state,
+ limit=limit,
+ cursor=_parsed_next,
+ customer_id=customer_id,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ location_id: str,
+ gift_card: GiftCardParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateGiftCardResponse]:
+ """
+ Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card
+ has a `PENDING` state. To activate a gift card so that it can be redeemed for purchases, call
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) and create an `ACTIVATE`
+ activity with the initial balance. Alternatively, you can use [RefundPayment](api-endpoint:Refunds-RefundPayment)
+ to refund a payment to the new gift card.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ location_id : str
+ The ID of the [location](entity:Location) where the gift card should be registered for
+ reporting purposes. Gift cards can be redeemed at any of the seller's locations.
+
+ gift_card : GiftCardParams
+ The gift card to create. The `type` field is required for this request. The `gan_source`
+ and `gan` fields are included as follows:
+
+ To direct Square to generate a 16-digit GAN, omit `gan_source` and `gan`.
+
+ To provide a custom GAN, include `gan_source` and `gan`.
+ - For `gan_source`, specify `OTHER`.
+ - For `gan`, provide a custom GAN containing 8 to 20 alphanumeric characters. The GAN must be
+ unique for the seller and cannot start with the same bank identification number (BIN) as major
+ credit cards. Do not use GANs that are easy to guess (such as 12345678) because they greatly
+ increase the risk of fraud. It is the responsibility of the developer to ensure the security
+ of their custom GANs. For more information, see
+ [Custom GANs](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#custom-gans).
+
+ To register an unused, physical gift card that the seller previously ordered from Square,
+ include `gan` and provide the GAN that is printed on the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateGiftCardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/gift-cards",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "location_id": location_id,
+ "gift_card": convert_and_respect_annotation_metadata(
+ object_=gift_card, annotation=GiftCardParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateGiftCardResponse,
+ construct_type(
+ type_=CreateGiftCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get_from_gan(
+ self, *, gan: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetGiftCardFromGanResponse]:
+ """
+ Retrieves a gift card using the gift card account number (GAN).
+
+ Parameters
+ ----------
+ gan : str
+ The gift card account number (GAN) of the gift card to retrieve.
+ The maximum length of a GAN is 255 digits to account for third-party GANs that have been imported.
+ Square-issued gift cards have 16-digit GANs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetGiftCardFromGanResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/gift-cards/from-gan",
+ method="POST",
+ json={
+ "gan": gan,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetGiftCardFromGanResponse,
+ construct_type(
+ type_=GetGiftCardFromGanResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get_from_nonce(
+ self, *, nonce: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetGiftCardFromNonceResponse]:
+ """
+ Retrieves a gift card using a secure payment token that represents the gift card.
+
+ Parameters
+ ----------
+ nonce : str
+ The payment token of the gift card to retrieve. Payment tokens are generated by the
+ Web Payments SDK or In-App Payments SDK.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetGiftCardFromNonceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/gift-cards/from-nonce",
+ method="POST",
+ json={
+ "nonce": nonce,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetGiftCardFromNonceResponse,
+ construct_type(
+ type_=GetGiftCardFromNonceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def link_customer(
+ self, gift_card_id: str, *, customer_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[LinkCustomerToGiftCardResponse]:
+ """
+ Links a customer to a gift card, which is also referred to as adding a card on file.
+
+ Parameters
+ ----------
+ gift_card_id : str
+ The ID of the gift card to be linked.
+
+ customer_id : str
+ The ID of the customer to link to the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[LinkCustomerToGiftCardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/gift-cards/{jsonable_encoder(gift_card_id)}/link-customer",
+ method="POST",
+ json={
+ "customer_id": customer_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ LinkCustomerToGiftCardResponse,
+ construct_type(
+ type_=LinkCustomerToGiftCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def unlink_customer(
+ self, gift_card_id: str, *, customer_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[UnlinkCustomerFromGiftCardResponse]:
+ """
+ Unlinks a customer from a gift card, which is also referred to as removing a card on file.
+
+ Parameters
+ ----------
+ gift_card_id : str
+ The ID of the gift card to be unlinked.
+
+ customer_id : str
+ The ID of the customer to unlink from the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UnlinkCustomerFromGiftCardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/gift-cards/{jsonable_encoder(gift_card_id)}/unlink-customer",
+ method="POST",
+ json={
+ "customer_id": customer_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UnlinkCustomerFromGiftCardResponse,
+ construct_type(
+ type_=UnlinkCustomerFromGiftCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetGiftCardResponse]:
+ """
+ Retrieves a gift card using the gift card ID.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the gift card to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetGiftCardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/gift-cards/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetGiftCardResponse,
+ construct_type(
+ type_=GetGiftCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawGiftCardsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ type: typing.Optional[str] = None,
+ state: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ customer_id: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[GiftCard, ListGiftCardsResponse]:
+ """
+ Lists all gift cards. You can specify optional filters to retrieve
+ a subset of the gift cards. Results are sorted by `created_at` in ascending order.
+
+ Parameters
+ ----------
+ type : typing.Optional[str]
+ If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the specified type.
+ Otherwise, the endpoint returns gift cards of all types.
+
+ state : typing.Optional[str]
+ If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards in the specified state.
+ Otherwise, the endpoint returns the gift cards of all states.
+
+ limit : typing.Optional[int]
+ If a limit is provided, the endpoint returns only the specified number of results per page.
+ The maximum value is 200. The default value is 30.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ If a cursor is not provided, the endpoint returns the first page of the results.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ customer_id : typing.Optional[str]
+ If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[GiftCard, ListGiftCardsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/gift-cards",
+ method="GET",
+ params={
+ "type": type,
+ "state": state,
+ "limit": limit,
+ "cursor": cursor,
+ "customer_id": customer_id,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListGiftCardsResponse,
+ construct_type(
+ type_=ListGiftCardsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.gift_cards
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ type=type,
+ state=state,
+ limit=limit,
+ cursor=_parsed_next,
+ customer_id=customer_id,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ location_id: str,
+ gift_card: GiftCardParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateGiftCardResponse]:
+ """
+ Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card
+ has a `PENDING` state. To activate a gift card so that it can be redeemed for purchases, call
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) and create an `ACTIVATE`
+ activity with the initial balance. Alternatively, you can use [RefundPayment](api-endpoint:Refunds-RefundPayment)
+ to refund a payment to the new gift card.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ location_id : str
+ The ID of the [location](entity:Location) where the gift card should be registered for
+ reporting purposes. Gift cards can be redeemed at any of the seller's locations.
+
+ gift_card : GiftCardParams
+ The gift card to create. The `type` field is required for this request. The `gan_source`
+ and `gan` fields are included as follows:
+
+ To direct Square to generate a 16-digit GAN, omit `gan_source` and `gan`.
+
+ To provide a custom GAN, include `gan_source` and `gan`.
+ - For `gan_source`, specify `OTHER`.
+ - For `gan`, provide a custom GAN containing 8 to 20 alphanumeric characters. The GAN must be
+ unique for the seller and cannot start with the same bank identification number (BIN) as major
+ credit cards. Do not use GANs that are easy to guess (such as 12345678) because they greatly
+ increase the risk of fraud. It is the responsibility of the developer to ensure the security
+ of their custom GANs. For more information, see
+ [Custom GANs](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#custom-gans).
+
+ To register an unused, physical gift card that the seller previously ordered from Square,
+ include `gan` and provide the GAN that is printed on the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateGiftCardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/gift-cards",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "location_id": location_id,
+ "gift_card": convert_and_respect_annotation_metadata(
+ object_=gift_card, annotation=GiftCardParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateGiftCardResponse,
+ construct_type(
+ type_=CreateGiftCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get_from_gan(
+ self, *, gan: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetGiftCardFromGanResponse]:
+ """
+ Retrieves a gift card using the gift card account number (GAN).
+
+ Parameters
+ ----------
+ gan : str
+ The gift card account number (GAN) of the gift card to retrieve.
+ The maximum length of a GAN is 255 digits to account for third-party GANs that have been imported.
+ Square-issued gift cards have 16-digit GANs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetGiftCardFromGanResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/gift-cards/from-gan",
+ method="POST",
+ json={
+ "gan": gan,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetGiftCardFromGanResponse,
+ construct_type(
+ type_=GetGiftCardFromGanResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get_from_nonce(
+ self, *, nonce: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetGiftCardFromNonceResponse]:
+ """
+ Retrieves a gift card using a secure payment token that represents the gift card.
+
+ Parameters
+ ----------
+ nonce : str
+ The payment token of the gift card to retrieve. Payment tokens are generated by the
+ Web Payments SDK or In-App Payments SDK.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetGiftCardFromNonceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/gift-cards/from-nonce",
+ method="POST",
+ json={
+ "nonce": nonce,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetGiftCardFromNonceResponse,
+ construct_type(
+ type_=GetGiftCardFromNonceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def link_customer(
+ self, gift_card_id: str, *, customer_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[LinkCustomerToGiftCardResponse]:
+ """
+ Links a customer to a gift card, which is also referred to as adding a card on file.
+
+ Parameters
+ ----------
+ gift_card_id : str
+ The ID of the gift card to be linked.
+
+ customer_id : str
+ The ID of the customer to link to the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[LinkCustomerToGiftCardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/gift-cards/{jsonable_encoder(gift_card_id)}/link-customer",
+ method="POST",
+ json={
+ "customer_id": customer_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ LinkCustomerToGiftCardResponse,
+ construct_type(
+ type_=LinkCustomerToGiftCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def unlink_customer(
+ self, gift_card_id: str, *, customer_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[UnlinkCustomerFromGiftCardResponse]:
+ """
+ Unlinks a customer from a gift card, which is also referred to as removing a card on file.
+
+ Parameters
+ ----------
+ gift_card_id : str
+ The ID of the gift card to be unlinked.
+
+ customer_id : str
+ The ID of the customer to unlink from the gift card.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UnlinkCustomerFromGiftCardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/gift-cards/{jsonable_encoder(gift_card_id)}/unlink-customer",
+ method="POST",
+ json={
+ "customer_id": customer_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UnlinkCustomerFromGiftCardResponse,
+ construct_type(
+ type_=UnlinkCustomerFromGiftCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetGiftCardResponse]:
+ """
+ Retrieves a gift card using the gift card ID.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the gift card to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetGiftCardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/gift-cards/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetGiftCardResponse,
+ construct_type(
+ type_=GetGiftCardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/inventory/__init__.py b/src/square/inventory/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/inventory/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/inventory/client.py b/src/square/inventory/client.py
new file mode 100644
index 00000000..03e03441
--- /dev/null
+++ b/src/square/inventory/client.py
@@ -0,0 +1,2524 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..requests.batch_retrieve_inventory_changes_sort import BatchRetrieveInventoryChangesSortParams
+from ..requests.inventory_adjustment import InventoryAdjustmentParams
+from ..requests.inventory_adjustment_reason import InventoryAdjustmentReasonParams
+from ..requests.inventory_adjustment_reason_id import InventoryAdjustmentReasonIdParams
+from ..requests.inventory_change import InventoryChangeParams
+from ..types.batch_change_inventory_response import BatchChangeInventoryResponse
+from ..types.batch_get_inventory_changes_response import BatchGetInventoryChangesResponse
+from ..types.batch_get_inventory_counts_response import BatchGetInventoryCountsResponse
+from ..types.create_inventory_adjustment_reason_response import CreateInventoryAdjustmentReasonResponse
+from ..types.delete_inventory_adjustment_reason_response import DeleteInventoryAdjustmentReasonResponse
+from ..types.get_inventory_adjustment_response import GetInventoryAdjustmentResponse
+from ..types.get_inventory_changes_response import GetInventoryChangesResponse
+from ..types.get_inventory_count_response import GetInventoryCountResponse
+from ..types.get_inventory_physical_count_response import GetInventoryPhysicalCountResponse
+from ..types.inventory_change import InventoryChange
+from ..types.inventory_change_type import InventoryChangeType
+from ..types.inventory_count import InventoryCount
+from ..types.inventory_state import InventoryState
+from ..types.list_inventory_adjustment_reasons_response import ListInventoryAdjustmentReasonsResponse
+from ..types.restore_inventory_adjustment_reason_response import RestoreInventoryAdjustmentReasonResponse
+from ..types.retrieve_inventory_adjustment_reason_response import RetrieveInventoryAdjustmentReasonResponse
+from ..types.update_inventory_adjustment_reason_response import UpdateInventoryAdjustmentReasonResponse
+from ..types.update_inventory_adjustment_response import UpdateInventoryAdjustmentResponse
+from .raw_client import AsyncRawInventoryClient, RawInventoryClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class InventoryClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawInventoryClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawInventoryClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawInventoryClient
+ """
+ return self._raw_client
+
+ def list_inventory_adjustment_reasons(
+ self,
+ *,
+ include_deleted: typing.Optional[bool] = None,
+ include_system_codes: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ListInventoryAdjustmentReasonsResponse:
+ """
+ Returns the standard and custom inventory adjustment reasons available
+ to the seller.
+
+ Parameters
+ ----------
+ include_deleted : typing.Optional[bool]
+ Indicates whether the response should include deleted custom inventory
+ adjustment reasons. The default value is `false`.
+
+ include_system_codes : typing.Optional[bool]
+ Indicates whether the response should include Square-generated system
+ inventory adjustment reason codes that cannot be used to write adjustments
+ from the Connect API, such as `SALE`, `RECOUNT`, `TRANSFER`, `IN_TRANSIT`,
+ and `CANCELED_SALE`. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListInventoryAdjustmentReasonsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.list_inventory_adjustment_reasons(
+ include_deleted=True,
+ include_system_codes=True,
+ )
+ """
+ _response = self._raw_client.list_inventory_adjustment_reasons(
+ include_deleted=include_deleted, include_system_codes=include_system_codes, request_options=request_options
+ )
+ return _response.data
+
+ def create_inventory_adjustment_reason(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateInventoryAdjustmentReasonResponse:
+ """
+ Creates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier to make this
+ [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason)
+ request idempotent.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The custom inventory adjustment reason to create. Only custom
+ adjustment reasons can be created.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.create_inventory_adjustment_reason(
+ idempotency_key="27b2f2b1-1c2a-4b9e-8f3a-0d9c3a1e5b47",
+ adjustment_reason={
+ "id": {"type": "CUSTOM"},
+ "name": "Donated to charity",
+ "direction": "DECREASE",
+ },
+ )
+ """
+ _response = self._raw_client.create_inventory_adjustment_reason(
+ idempotency_key=idempotency_key, adjustment_reason=adjustment_reason, request_options=request_options
+ )
+ return _response.data
+
+ def delete_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteInventoryAdjustmentReasonResponse:
+ """
+ Soft deletes a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to soft delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.delete_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+ """
+ _response = self._raw_client.delete_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
+ return _response.data
+
+ def restore_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> RestoreInventoryAdjustmentReasonResponse:
+ """
+ Restores a soft-deleted custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the soft-deleted custom inventory adjustment reason
+ to restore.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RestoreInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.restore_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+ """
+ _response = self._raw_client.restore_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
+ return _response.data
+
+ def retrieve_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveInventoryAdjustmentReasonResponse:
+ """
+ Returns the inventory adjustment reason identified by the provided
+ `reason_id`. Deleted custom reasons can be retrieved by ID.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the inventory adjustment reason to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.retrieve_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+ """
+ _response = self._raw_client.retrieve_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
+ return _response.data
+
+ def update_inventory_adjustment_reason(
+ self,
+ *,
+ reason_id: InventoryAdjustmentReasonIdParams,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateInventoryAdjustmentReasonResponse:
+ """
+ Updates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to update.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The requested custom inventory adjustment reason update. Only the
+ `name` field can be updated. Deleted custom reasons cannot be updated. To
+ restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.update_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ adjustment_reason={
+ "id": {"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ "name": "Charitable donation",
+ },
+ )
+ """
+ _response = self._raw_client.update_inventory_adjustment_reason(
+ reason_id=reason_id, adjustment_reason=adjustment_reason, request_options=request_options
+ )
+ return _response.data
+
+ def deprecated_get_adjustment(
+ self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetInventoryAdjustmentResponse:
+ """
+ Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ adjustment_id : str
+ ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetInventoryAdjustmentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.deprecated_get_adjustment(
+ adjustment_id="adjustment_id",
+ )
+ """
+ _response = self._raw_client.deprecated_get_adjustment(adjustment_id, request_options=request_options)
+ return _response.data
+
+ def update_inventory_adjustment(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment: InventoryAdjustmentParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateInventoryAdjustmentResponse:
+ """
+ Applies an update to the provided adjustment.
+
+ On success: returns the newly updated adjustment.
+ On failure: returns a list of related errors.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [Build Basics](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ adjustment : InventoryAdjustmentParams
+ Represents the updates being written to a past/existing inventory adjustment.
+ This works using sparse updates, meaning that any fields omitted from the inputted InventoryAdjustment
+ will retain their values.
+
+ Only updates to the quantity, cost_money, vendor_id, and reason_id fields of an InventoryAdjustment can be made here.
+ Note that the quantity field must be provided, but it can be identical to the current quantity if there are no desired quantity changes.
+ cost_money and vendor_id can only be written to adjustments that add stock to the system (from_state of NONE or UNLINKED_RETURN) and to untracked sale adjustments.
+ reason_id can be changed to any reason that is valid for the adjustment's state transition. The reason of a system-generated adjustment (for example, SALE or RECOUNT) cannot be changed.
+ Adjustments generated by Square from other records cannot be updated. This includes inferred adjustments created by physical counts, transfer-like cross-location adjustments, and component adjustments.
+ Adjustments linked to purchase orders cannot be updated. Adjustments linked to sales can only have cost_money and vendor_id updated, and only for untracked sales.
+ Restock adjustments linked to an itemized return can have their quantity updated, up to the quantity remaining on the return.
+ Adjustments older than one year cannot be updated.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateInventoryAdjustmentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.update_inventory_adjustment(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ adjustment={},
+ )
+ """
+ _response = self._raw_client.update_inventory_adjustment(
+ idempotency_key=idempotency_key, adjustment=adjustment, request_options=request_options
+ )
+ return _response.data
+
+ def get_adjustment(
+ self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetInventoryAdjustmentResponse:
+ """
+ Returns the [InventoryAdjustment](entity:InventoryAdjustment) object
+ with the provided `adjustment_id`.
+
+ Parameters
+ ----------
+ adjustment_id : str
+ ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetInventoryAdjustmentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.get_adjustment(
+ adjustment_id="adjustment_id",
+ )
+ """
+ _response = self._raw_client.get_adjustment(adjustment_id, request_options=request_options)
+ return _response.data
+
+ def deprecated_batch_change(
+ self,
+ *,
+ idempotency_key: str,
+ changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
+ ignore_unchanged_counts: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchChangeInventoryResponse:
+ """
+ Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
+ The set of physical counts and inventory adjustments to be made.
+ Changes are applied based on the client-supplied timestamp and may be sent
+ out of order.
+
+ ignore_unchanged_counts : typing.Optional[bool]
+ Indicates whether the current physical count should be ignored if
+ the quantity is unchanged since the last physical count. Default: `true`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchChangeInventoryResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.deprecated_batch_change(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ changes=[
+ {
+ "type": "PHYSICAL_COUNT",
+ "physical_count": {
+ "reference_id": "1536bfbf-efed-48bf-b17d-a197141b2a92",
+ "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
+ "state": "IN_STOCK",
+ "location_id": "C6W5YS5QM06F5",
+ "quantity": "53",
+ "team_member_id": "LRK57NSQ5X7PUD05",
+ "occurred_at": "2016-11-16T22:25:24.878Z",
+ },
+ }
+ ],
+ ignore_unchanged_counts=True,
+ )
+ """
+ _response = self._raw_client.deprecated_batch_change(
+ idempotency_key=idempotency_key,
+ changes=changes,
+ ignore_unchanged_counts=ignore_unchanged_counts,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def deprecated_batch_get_changes(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ types: typing.Optional[typing.Sequence[InventoryChangeType]] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ updated_before: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchGetInventoryChangesResponse:
+ """
+ Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is only applicable when set. The default value is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ The filter is only applicable when set. The default value is null.
+
+ types : typing.Optional[typing.Sequence[InventoryChangeType]]
+ The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
+ The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return `ADJUSTMENT` query results by
+ `InventoryState`. This filter is only applied when set.
+ The default value is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ updated_before : typing.Optional[str]
+ The filter to return results with their `created_at` or `calculated_at` value
+ strictly before the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryChange) to return.
+
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchGetInventoryChangesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.deprecated_batch_get_changes(
+ catalog_object_ids=["W62UWFY35CWMYGVWK6TWJDNI"],
+ location_ids=["C6W5YS5QM06F5"],
+ types=["PHYSICAL_COUNT"],
+ states=["IN_STOCK"],
+ updated_after="2016-11-01T00:00:00.000Z",
+ updated_before="2016-12-01T00:00:00.000Z",
+ )
+ """
+ _response = self._raw_client.deprecated_batch_get_changes(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ types=types,
+ states=states,
+ updated_after=updated_after,
+ updated_before=updated_before,
+ cursor=cursor,
+ limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def deprecated_batch_get_counts(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchGetInventoryCountsResponse:
+ """
+ Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is applicable only when set. The default is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ This filter is applicable only when set. The default is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return results by `InventoryState`. The filter is only applicable when set.
+ Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
+ The default is null.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryCount) to return.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchGetInventoryCountsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.deprecated_batch_get_counts(
+ catalog_object_ids=["W62UWFY35CWMYGVWK6TWJDNI"],
+ location_ids=["59TNP9SA8VGDA"],
+ updated_after="2016-11-16T00:00:00.000Z",
+ )
+ """
+ _response = self._raw_client.deprecated_batch_get_counts(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ updated_after=updated_after,
+ cursor=cursor,
+ states=states,
+ limit=limit,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def batch_create_changes(
+ self,
+ *,
+ idempotency_key: str,
+ changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
+ ignore_unchanged_counts: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchChangeInventoryResponse:
+ """
+ Applies adjustments and counts to the provided item quantities.
+
+ On success: returns the current calculated counts for all objects
+ referenced in the request.
+ On failure: returns a list of related errors.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
+ The set of physical counts and inventory adjustments to be made.
+ Changes are applied based on the client-supplied timestamp and may be sent
+ out of order.
+
+ ignore_unchanged_counts : typing.Optional[bool]
+ Indicates whether the current physical count should be ignored if
+ the quantity is unchanged since the last physical count. Default: `true`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchChangeInventoryResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.batch_create_changes(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ changes=[
+ {
+ "type": "PHYSICAL_COUNT",
+ "physical_count": {
+ "reference_id": "1536bfbf-efed-48bf-b17d-a197141b2a92",
+ "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
+ "state": "IN_STOCK",
+ "location_id": "C6W5YS5QM06F5",
+ "quantity": "53",
+ "team_member_id": "LRK57NSQ5X7PUD05",
+ "occurred_at": "2016-11-16T22:25:24.878Z",
+ },
+ }
+ ],
+ ignore_unchanged_counts=True,
+ )
+ """
+ _response = self._raw_client.batch_create_changes(
+ idempotency_key=idempotency_key,
+ changes=changes,
+ ignore_unchanged_counts=ignore_unchanged_counts,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def batch_get_changes(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ types: typing.Optional[typing.Sequence[InventoryChangeType]] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ updated_before: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryChange, BatchGetInventoryChangesResponse]:
+ """
+ Returns historical physical counts and adjustments based on the
+ provided filter criteria.
+
+ Results are paginated and sorted in ascending order according their
+ `occurred_at` timestamp (oldest first).
+
+ BatchRetrieveInventoryChanges is a catch-all query endpoint for queries
+ that cannot be handled by other, simpler endpoints.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is only applicable when set. The default value is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ The filter is only applicable when set. The default value is null.
+
+ types : typing.Optional[typing.Sequence[InventoryChangeType]]
+ The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
+ The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return `ADJUSTMENT` query results by
+ `InventoryState`. This filter is only applied when set.
+ The default value is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ updated_before : typing.Optional[str]
+ The filter to return results with their `created_at` or `calculated_at` value
+ strictly before the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryChange) to return.
+
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryChange, BatchGetInventoryChangesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.inventory.batch_get_changes(
+ catalog_object_ids=["W62UWFY35CWMYGVWK6TWJDNI"],
+ location_ids=["C6W5YS5QM06F5"],
+ types=["PHYSICAL_COUNT"],
+ states=["IN_STOCK"],
+ updated_after="2016-11-01T00:00:00.000Z",
+ updated_before="2016-12-01T00:00:00.000Z",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.batch_get_changes(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ types=types,
+ states=states,
+ updated_after=updated_after,
+ updated_before=updated_before,
+ cursor=cursor,
+ limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
+ request_options=request_options,
+ )
+
+ def batch_get_counts(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryCount, BatchGetInventoryCountsResponse]:
+ """
+ Returns current counts for the provided
+ [CatalogObject](entity:CatalogObject)s at the requested
+ [Location](entity:Location)s.
+
+ Results are paginated and sorted in descending order according to their
+ `calculated_at` timestamp (newest first).
+
+ When `updated_after` is specified, only counts that have changed since that
+ time (based on the server timestamp for the most recent change) are
+ returned. This allows clients to perform a "sync" operation, for example
+ in response to receiving a Webhook notification.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is applicable only when set. The default is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ This filter is applicable only when set. The default is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return results by `InventoryState`. The filter is only applicable when set.
+ Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
+ The default is null.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryCount) to return.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryCount, BatchGetInventoryCountsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.inventory.batch_get_counts(
+ catalog_object_ids=["W62UWFY35CWMYGVWK6TWJDNI"],
+ location_ids=["59TNP9SA8VGDA"],
+ updated_after="2016-11-16T00:00:00.000Z",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.batch_get_counts(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ updated_after=updated_after,
+ cursor=cursor,
+ states=states,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ def deprecated_get_physical_count(
+ self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetInventoryPhysicalCountResponse:
+ """
+ Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ physical_count_id : str
+ ID of the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetInventoryPhysicalCountResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.deprecated_get_physical_count(
+ physical_count_id="physical_count_id",
+ )
+ """
+ _response = self._raw_client.deprecated_get_physical_count(physical_count_id, request_options=request_options)
+ return _response.data
+
+ def get_physical_count(
+ self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetInventoryPhysicalCountResponse:
+ """
+ Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount)
+ object with the provided `physical_count_id`.
+
+ Parameters
+ ----------
+ physical_count_id : str
+ ID of the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetInventoryPhysicalCountResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.get_physical_count(
+ physical_count_id="physical_count_id",
+ )
+ """
+ _response = self._raw_client.get_physical_count(physical_count_id, request_options=request_options)
+ return _response.data
+
+ def get(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryCount, GetInventoryCountResponse]:
+ """
+ Retrieves the current calculated stock count for a given
+ [CatalogObject](entity:CatalogObject) at a given set of
+ [Location](entity:Location)s. Responses are paginated and unsorted.
+ For more sophisticated queries, use a batch endpoint.
+
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryCount, GetInventoryCountResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.inventory.get(
+ catalog_object_id="catalog_object_id",
+ location_ids="location_ids",
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.get(
+ catalog_object_id, location_ids=location_ids, cursor=cursor, request_options=request_options
+ )
+
+ def changes(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryChange, GetInventoryChangesResponse]:
+ """
+ Returns a set of physical counts and inventory adjustments for the
+ provided [CatalogObject](entity:CatalogObject) at the requested
+ [Location](entity:Location)s.
+
+ You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges)
+ and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID.
+
+ Results are paginated and sorted in descending order according to their
+ `occurred_at` timestamp (newest first).
+
+ There are no limits on how far back the caller can page. This endpoint can be
+ used to display recent changes for a specific item. For more
+ sophisticated queries, use a batch endpoint.
+
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryChange, GetInventoryChangesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.inventory.changes(
+ catalog_object_id="catalog_object_id",
+ location_ids="location_ids",
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.changes(
+ catalog_object_id, location_ids=location_ids, cursor=cursor, request_options=request_options
+ )
+
+ def get_transfer(self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
+ """
+ Parameters
+ ----------
+ transfer_id : str
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ None
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.get_transfer(
+ transfer_id="transfer_id",
+ )
+ """
+ _response = self._raw_client.get_transfer(transfer_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncInventoryClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawInventoryClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawInventoryClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawInventoryClient
+ """
+ return self._raw_client
+
+ async def list_inventory_adjustment_reasons(
+ self,
+ *,
+ include_deleted: typing.Optional[bool] = None,
+ include_system_codes: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ListInventoryAdjustmentReasonsResponse:
+ """
+ Returns the standard and custom inventory adjustment reasons available
+ to the seller.
+
+ Parameters
+ ----------
+ include_deleted : typing.Optional[bool]
+ Indicates whether the response should include deleted custom inventory
+ adjustment reasons. The default value is `false`.
+
+ include_system_codes : typing.Optional[bool]
+ Indicates whether the response should include Square-generated system
+ inventory adjustment reason codes that cannot be used to write adjustments
+ from the Connect API, such as `SALE`, `RECOUNT`, `TRANSFER`, `IN_TRANSIT`,
+ and `CANCELED_SALE`. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListInventoryAdjustmentReasonsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.list_inventory_adjustment_reasons(
+ include_deleted=True,
+ include_system_codes=True,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.list_inventory_adjustment_reasons(
+ include_deleted=include_deleted, include_system_codes=include_system_codes, request_options=request_options
+ )
+ return _response.data
+
+ async def create_inventory_adjustment_reason(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateInventoryAdjustmentReasonResponse:
+ """
+ Creates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier to make this
+ [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason)
+ request idempotent.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The custom inventory adjustment reason to create. Only custom
+ adjustment reasons can be created.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.create_inventory_adjustment_reason(
+ idempotency_key="27b2f2b1-1c2a-4b9e-8f3a-0d9c3a1e5b47",
+ adjustment_reason={
+ "id": {"type": "CUSTOM"},
+ "name": "Donated to charity",
+ "direction": "DECREASE",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create_inventory_adjustment_reason(
+ idempotency_key=idempotency_key, adjustment_reason=adjustment_reason, request_options=request_options
+ )
+ return _response.data
+
+ async def delete_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteInventoryAdjustmentReasonResponse:
+ """
+ Soft deletes a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to soft delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.delete_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
+ return _response.data
+
+ async def restore_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> RestoreInventoryAdjustmentReasonResponse:
+ """
+ Restores a soft-deleted custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the soft-deleted custom inventory adjustment reason
+ to restore.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RestoreInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.restore_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.restore_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
+ return _response.data
+
+ async def retrieve_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveInventoryAdjustmentReasonResponse:
+ """
+ Returns the inventory adjustment reason identified by the provided
+ `reason_id`. Deleted custom reasons can be retrieved by ID.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the inventory adjustment reason to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.retrieve_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.retrieve_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
+ return _response.data
+
+ async def update_inventory_adjustment_reason(
+ self,
+ *,
+ reason_id: InventoryAdjustmentReasonIdParams,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateInventoryAdjustmentReasonResponse:
+ """
+ Updates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to update.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The requested custom inventory adjustment reason update. Only the
+ `name` field can be updated. Deleted custom reasons cannot be updated. To
+ restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.update_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ adjustment_reason={
+ "id": {"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ "name": "Charitable donation",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update_inventory_adjustment_reason(
+ reason_id=reason_id, adjustment_reason=adjustment_reason, request_options=request_options
+ )
+ return _response.data
+
+ async def deprecated_get_adjustment(
+ self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetInventoryAdjustmentResponse:
+ """
+ Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ adjustment_id : str
+ ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetInventoryAdjustmentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.deprecated_get_adjustment(
+ adjustment_id="adjustment_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.deprecated_get_adjustment(adjustment_id, request_options=request_options)
+ return _response.data
+
+ async def update_inventory_adjustment(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment: InventoryAdjustmentParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateInventoryAdjustmentResponse:
+ """
+ Applies an update to the provided adjustment.
+
+ On success: returns the newly updated adjustment.
+ On failure: returns a list of related errors.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [Build Basics](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ adjustment : InventoryAdjustmentParams
+ Represents the updates being written to a past/existing inventory adjustment.
+ This works using sparse updates, meaning that any fields omitted from the inputted InventoryAdjustment
+ will retain their values.
+
+ Only updates to the quantity, cost_money, vendor_id, and reason_id fields of an InventoryAdjustment can be made here.
+ Note that the quantity field must be provided, but it can be identical to the current quantity if there are no desired quantity changes.
+ cost_money and vendor_id can only be written to adjustments that add stock to the system (from_state of NONE or UNLINKED_RETURN) and to untracked sale adjustments.
+ reason_id can be changed to any reason that is valid for the adjustment's state transition. The reason of a system-generated adjustment (for example, SALE or RECOUNT) cannot be changed.
+ Adjustments generated by Square from other records cannot be updated. This includes inferred adjustments created by physical counts, transfer-like cross-location adjustments, and component adjustments.
+ Adjustments linked to purchase orders cannot be updated. Adjustments linked to sales can only have cost_money and vendor_id updated, and only for untracked sales.
+ Restock adjustments linked to an itemized return can have their quantity updated, up to the quantity remaining on the return.
+ Adjustments older than one year cannot be updated.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateInventoryAdjustmentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.update_inventory_adjustment(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ adjustment={},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update_inventory_adjustment(
+ idempotency_key=idempotency_key, adjustment=adjustment, request_options=request_options
+ )
+ return _response.data
+
+ async def get_adjustment(
+ self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetInventoryAdjustmentResponse:
+ """
+ Returns the [InventoryAdjustment](entity:InventoryAdjustment) object
+ with the provided `adjustment_id`.
+
+ Parameters
+ ----------
+ adjustment_id : str
+ ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetInventoryAdjustmentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.get_adjustment(
+ adjustment_id="adjustment_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get_adjustment(adjustment_id, request_options=request_options)
+ return _response.data
+
+ async def deprecated_batch_change(
+ self,
+ *,
+ idempotency_key: str,
+ changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
+ ignore_unchanged_counts: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchChangeInventoryResponse:
+ """
+ Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
+ The set of physical counts and inventory adjustments to be made.
+ Changes are applied based on the client-supplied timestamp and may be sent
+ out of order.
+
+ ignore_unchanged_counts : typing.Optional[bool]
+ Indicates whether the current physical count should be ignored if
+ the quantity is unchanged since the last physical count. Default: `true`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchChangeInventoryResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.deprecated_batch_change(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ changes=[
+ {
+ "type": "PHYSICAL_COUNT",
+ "physical_count": {
+ "reference_id": "1536bfbf-efed-48bf-b17d-a197141b2a92",
+ "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
+ "state": "IN_STOCK",
+ "location_id": "C6W5YS5QM06F5",
+ "quantity": "53",
+ "team_member_id": "LRK57NSQ5X7PUD05",
+ "occurred_at": "2016-11-16T22:25:24.878Z",
+ },
+ }
+ ],
+ ignore_unchanged_counts=True,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.deprecated_batch_change(
+ idempotency_key=idempotency_key,
+ changes=changes,
+ ignore_unchanged_counts=ignore_unchanged_counts,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def deprecated_batch_get_changes(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ types: typing.Optional[typing.Sequence[InventoryChangeType]] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ updated_before: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchGetInventoryChangesResponse:
+ """
+ Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is only applicable when set. The default value is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ The filter is only applicable when set. The default value is null.
+
+ types : typing.Optional[typing.Sequence[InventoryChangeType]]
+ The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
+ The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return `ADJUSTMENT` query results by
+ `InventoryState`. This filter is only applied when set.
+ The default value is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ updated_before : typing.Optional[str]
+ The filter to return results with their `created_at` or `calculated_at` value
+ strictly before the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryChange) to return.
+
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchGetInventoryChangesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.deprecated_batch_get_changes(
+ catalog_object_ids=["W62UWFY35CWMYGVWK6TWJDNI"],
+ location_ids=["C6W5YS5QM06F5"],
+ types=["PHYSICAL_COUNT"],
+ states=["IN_STOCK"],
+ updated_after="2016-11-01T00:00:00.000Z",
+ updated_before="2016-12-01T00:00:00.000Z",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.deprecated_batch_get_changes(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ types=types,
+ states=states,
+ updated_after=updated_after,
+ updated_before=updated_before,
+ cursor=cursor,
+ limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def deprecated_batch_get_counts(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchGetInventoryCountsResponse:
+ """
+ Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is applicable only when set. The default is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ This filter is applicable only when set. The default is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return results by `InventoryState`. The filter is only applicable when set.
+ Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
+ The default is null.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryCount) to return.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchGetInventoryCountsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.deprecated_batch_get_counts(
+ catalog_object_ids=["W62UWFY35CWMYGVWK6TWJDNI"],
+ location_ids=["59TNP9SA8VGDA"],
+ updated_after="2016-11-16T00:00:00.000Z",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.deprecated_batch_get_counts(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ updated_after=updated_after,
+ cursor=cursor,
+ states=states,
+ limit=limit,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def batch_create_changes(
+ self,
+ *,
+ idempotency_key: str,
+ changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
+ ignore_unchanged_counts: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchChangeInventoryResponse:
+ """
+ Applies adjustments and counts to the provided item quantities.
+
+ On success: returns the current calculated counts for all objects
+ referenced in the request.
+ On failure: returns a list of related errors.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
+ The set of physical counts and inventory adjustments to be made.
+ Changes are applied based on the client-supplied timestamp and may be sent
+ out of order.
+
+ ignore_unchanged_counts : typing.Optional[bool]
+ Indicates whether the current physical count should be ignored if
+ the quantity is unchanged since the last physical count. Default: `true`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchChangeInventoryResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.batch_create_changes(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ changes=[
+ {
+ "type": "PHYSICAL_COUNT",
+ "physical_count": {
+ "reference_id": "1536bfbf-efed-48bf-b17d-a197141b2a92",
+ "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
+ "state": "IN_STOCK",
+ "location_id": "C6W5YS5QM06F5",
+ "quantity": "53",
+ "team_member_id": "LRK57NSQ5X7PUD05",
+ "occurred_at": "2016-11-16T22:25:24.878Z",
+ },
+ }
+ ],
+ ignore_unchanged_counts=True,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_create_changes(
+ idempotency_key=idempotency_key,
+ changes=changes,
+ ignore_unchanged_counts=ignore_unchanged_counts,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def batch_get_changes(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ types: typing.Optional[typing.Sequence[InventoryChangeType]] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ updated_before: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[InventoryChange, BatchGetInventoryChangesResponse]:
+ """
+ Returns historical physical counts and adjustments based on the
+ provided filter criteria.
+
+ Results are paginated and sorted in ascending order according their
+ `occurred_at` timestamp (oldest first).
+
+ BatchRetrieveInventoryChanges is a catch-all query endpoint for queries
+ that cannot be handled by other, simpler endpoints.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is only applicable when set. The default value is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ The filter is only applicable when set. The default value is null.
+
+ types : typing.Optional[typing.Sequence[InventoryChangeType]]
+ The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
+ The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return `ADJUSTMENT` query results by
+ `InventoryState`. This filter is only applied when set.
+ The default value is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ updated_before : typing.Optional[str]
+ The filter to return results with their `created_at` or `calculated_at` value
+ strictly before the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryChange) to return.
+
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[InventoryChange, BatchGetInventoryChangesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.inventory.batch_get_changes(
+ catalog_object_ids=["W62UWFY35CWMYGVWK6TWJDNI"],
+ location_ids=["C6W5YS5QM06F5"],
+ types=["PHYSICAL_COUNT"],
+ states=["IN_STOCK"],
+ updated_after="2016-11-01T00:00:00.000Z",
+ updated_before="2016-12-01T00:00:00.000Z",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.batch_get_changes(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ types=types,
+ states=states,
+ updated_after=updated_after,
+ updated_before=updated_before,
+ cursor=cursor,
+ limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
+ request_options=request_options,
+ )
+
+ async def batch_get_counts(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[InventoryCount, BatchGetInventoryCountsResponse]:
+ """
+ Returns current counts for the provided
+ [CatalogObject](entity:CatalogObject)s at the requested
+ [Location](entity:Location)s.
+
+ Results are paginated and sorted in descending order according to their
+ `calculated_at` timestamp (newest first).
+
+ When `updated_after` is specified, only counts that have changed since that
+ time (based on the server timestamp for the most recent change) are
+ returned. This allows clients to perform a "sync" operation, for example
+ in response to receiving a Webhook notification.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is applicable only when set. The default is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ This filter is applicable only when set. The default is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return results by `InventoryState`. The filter is only applicable when set.
+ Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
+ The default is null.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryCount) to return.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[InventoryCount, BatchGetInventoryCountsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.inventory.batch_get_counts(
+ catalog_object_ids=["W62UWFY35CWMYGVWK6TWJDNI"],
+ location_ids=["59TNP9SA8VGDA"],
+ updated_after="2016-11-16T00:00:00.000Z",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.batch_get_counts(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ updated_after=updated_after,
+ cursor=cursor,
+ states=states,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ async def deprecated_get_physical_count(
+ self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetInventoryPhysicalCountResponse:
+ """
+ Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ physical_count_id : str
+ ID of the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetInventoryPhysicalCountResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.deprecated_get_physical_count(
+ physical_count_id="physical_count_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.deprecated_get_physical_count(
+ physical_count_id, request_options=request_options
+ )
+ return _response.data
+
+ async def get_physical_count(
+ self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetInventoryPhysicalCountResponse:
+ """
+ Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount)
+ object with the provided `physical_count_id`.
+
+ Parameters
+ ----------
+ physical_count_id : str
+ ID of the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetInventoryPhysicalCountResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.get_physical_count(
+ physical_count_id="physical_count_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get_physical_count(physical_count_id, request_options=request_options)
+ return _response.data
+
+ async def get(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[InventoryCount, GetInventoryCountResponse]:
+ """
+ Retrieves the current calculated stock count for a given
+ [CatalogObject](entity:CatalogObject) at a given set of
+ [Location](entity:Location)s. Responses are paginated and unsorted.
+ For more sophisticated queries, use a batch endpoint.
+
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[InventoryCount, GetInventoryCountResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.inventory.get(
+ catalog_object_id="catalog_object_id",
+ location_ids="location_ids",
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.get(
+ catalog_object_id, location_ids=location_ids, cursor=cursor, request_options=request_options
+ )
+
+ async def changes(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[InventoryChange, GetInventoryChangesResponse]:
+ """
+ Returns a set of physical counts and inventory adjustments for the
+ provided [CatalogObject](entity:CatalogObject) at the requested
+ [Location](entity:Location)s.
+
+ You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges)
+ and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID.
+
+ Results are paginated and sorted in descending order according to their
+ `occurred_at` timestamp (newest first).
+
+ There are no limits on how far back the caller can page. This endpoint can be
+ used to display recent changes for a specific item. For more
+ sophisticated queries, use a batch endpoint.
+
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[InventoryChange, GetInventoryChangesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.inventory.changes(
+ catalog_object_id="catalog_object_id",
+ location_ids="location_ids",
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.changes(
+ catalog_object_id, location_ids=location_ids, cursor=cursor, request_options=request_options
+ )
+
+ async def get_transfer(self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
+ """
+ Parameters
+ ----------
+ transfer_id : str
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ None
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.get_transfer(
+ transfer_id="transfer_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get_transfer(transfer_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/inventory/raw_client.py b/src/square/inventory/raw_client.py
new file mode 100644
index 00000000..9e965f32
--- /dev/null
+++ b/src/square/inventory/raw_client.py
@@ -0,0 +1,2683 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.batch_retrieve_inventory_changes_sort import BatchRetrieveInventoryChangesSortParams
+from ..requests.inventory_adjustment import InventoryAdjustmentParams
+from ..requests.inventory_adjustment_reason import InventoryAdjustmentReasonParams
+from ..requests.inventory_adjustment_reason_id import InventoryAdjustmentReasonIdParams
+from ..requests.inventory_change import InventoryChangeParams
+from ..types.batch_change_inventory_response import BatchChangeInventoryResponse
+from ..types.batch_get_inventory_changes_response import BatchGetInventoryChangesResponse
+from ..types.batch_get_inventory_counts_response import BatchGetInventoryCountsResponse
+from ..types.create_inventory_adjustment_reason_response import CreateInventoryAdjustmentReasonResponse
+from ..types.delete_inventory_adjustment_reason_response import DeleteInventoryAdjustmentReasonResponse
+from ..types.get_inventory_adjustment_response import GetInventoryAdjustmentResponse
+from ..types.get_inventory_changes_response import GetInventoryChangesResponse
+from ..types.get_inventory_count_response import GetInventoryCountResponse
+from ..types.get_inventory_physical_count_response import GetInventoryPhysicalCountResponse
+from ..types.inventory_change import InventoryChange
+from ..types.inventory_change_type import InventoryChangeType
+from ..types.inventory_count import InventoryCount
+from ..types.inventory_state import InventoryState
+from ..types.list_inventory_adjustment_reasons_response import ListInventoryAdjustmentReasonsResponse
+from ..types.restore_inventory_adjustment_reason_response import RestoreInventoryAdjustmentReasonResponse
+from ..types.retrieve_inventory_adjustment_reason_response import RetrieveInventoryAdjustmentReasonResponse
+from ..types.update_inventory_adjustment_reason_response import UpdateInventoryAdjustmentReasonResponse
+from ..types.update_inventory_adjustment_response import UpdateInventoryAdjustmentResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawInventoryClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list_inventory_adjustment_reasons(
+ self,
+ *,
+ include_deleted: typing.Optional[bool] = None,
+ include_system_codes: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[ListInventoryAdjustmentReasonsResponse]:
+ """
+ Returns the standard and custom inventory adjustment reasons available
+ to the seller.
+
+ Parameters
+ ----------
+ include_deleted : typing.Optional[bool]
+ Indicates whether the response should include deleted custom inventory
+ adjustment reasons. The default value is `false`.
+
+ include_system_codes : typing.Optional[bool]
+ Indicates whether the response should include Square-generated system
+ inventory adjustment reason codes that cannot be used to write adjustments
+ from the Connect API, such as `SALE`, `RECOUNT`, `TRANSFER`, `IN_TRANSIT`,
+ and `CANCELED_SALE`. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ListInventoryAdjustmentReasonsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons",
+ method="GET",
+ params={
+ "include_deleted": include_deleted,
+ "include_system_codes": include_system_codes,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListInventoryAdjustmentReasonsResponse,
+ construct_type(
+ type_=ListInventoryAdjustmentReasonsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create_inventory_adjustment_reason(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateInventoryAdjustmentReasonResponse]:
+ """
+ Creates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier to make this
+ [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason)
+ request idempotent.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The custom inventory adjustment reason to create. Only custom
+ adjustment reasons can be created.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/create",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "adjustment_reason": convert_and_respect_annotation_metadata(
+ object_=adjustment_reason, annotation=InventoryAdjustmentReasonParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=CreateInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteInventoryAdjustmentReasonResponse]:
+ """
+ Soft deletes a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to soft delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/delete",
+ method="POST",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=DeleteInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def restore_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RestoreInventoryAdjustmentReasonResponse]:
+ """
+ Restores a soft-deleted custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the soft-deleted custom inventory adjustment reason
+ to restore.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RestoreInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/restore",
+ method="POST",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RestoreInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=RestoreInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def retrieve_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RetrieveInventoryAdjustmentReasonResponse]:
+ """
+ Returns the inventory adjustment reason identified by the provided
+ `reason_id`. Deleted custom reasons can be retrieved by ID.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the inventory adjustment reason to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/retrieve",
+ method="POST",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=RetrieveInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update_inventory_adjustment_reason(
+ self,
+ *,
+ reason_id: InventoryAdjustmentReasonIdParams,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateInventoryAdjustmentReasonResponse]:
+ """
+ Updates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to update.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The requested custom inventory adjustment reason update. Only the
+ `name` field can be updated. Deleted custom reasons cannot be updated. To
+ restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/update",
+ method="PUT",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ "adjustment_reason": convert_and_respect_annotation_metadata(
+ object_=adjustment_reason, annotation=InventoryAdjustmentReasonParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=UpdateInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def deprecated_get_adjustment(
+ self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetInventoryAdjustmentResponse]:
+ """
+ Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ adjustment_id : str
+ ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetInventoryAdjustmentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/inventory/adjustment/{jsonable_encoder(adjustment_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetInventoryAdjustmentResponse,
+ construct_type(
+ type_=GetInventoryAdjustmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update_inventory_adjustment(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment: InventoryAdjustmentParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateInventoryAdjustmentResponse]:
+ """
+ Applies an update to the provided adjustment.
+
+ On success: returns the newly updated adjustment.
+ On failure: returns a list of related errors.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [Build Basics](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ adjustment : InventoryAdjustmentParams
+ Represents the updates being written to a past/existing inventory adjustment.
+ This works using sparse updates, meaning that any fields omitted from the inputted InventoryAdjustment
+ will retain their values.
+
+ Only updates to the quantity, cost_money, vendor_id, and reason_id fields of an InventoryAdjustment can be made here.
+ Note that the quantity field must be provided, but it can be identical to the current quantity if there are no desired quantity changes.
+ cost_money and vendor_id can only be written to adjustments that add stock to the system (from_state of NONE or UNLINKED_RETURN) and to untracked sale adjustments.
+ reason_id can be changed to any reason that is valid for the adjustment's state transition. The reason of a system-generated adjustment (for example, SALE or RECOUNT) cannot be changed.
+ Adjustments generated by Square from other records cannot be updated. This includes inferred adjustments created by physical counts, transfer-like cross-location adjustments, and component adjustments.
+ Adjustments linked to purchase orders cannot be updated. Adjustments linked to sales can only have cost_money and vendor_id updated, and only for untracked sales.
+ Restock adjustments linked to an itemized return can have their quantity updated, up to the quantity remaining on the return.
+ Adjustments older than one year cannot be updated.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateInventoryAdjustmentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustments/update",
+ method="PUT",
+ json={
+ "idempotency_key": idempotency_key,
+ "adjustment": convert_and_respect_annotation_metadata(
+ object_=adjustment, annotation=InventoryAdjustmentParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateInventoryAdjustmentResponse,
+ construct_type(
+ type_=UpdateInventoryAdjustmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get_adjustment(
+ self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetInventoryAdjustmentResponse]:
+ """
+ Returns the [InventoryAdjustment](entity:InventoryAdjustment) object
+ with the provided `adjustment_id`.
+
+ Parameters
+ ----------
+ adjustment_id : str
+ ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetInventoryAdjustmentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/inventory/adjustments/{jsonable_encoder(adjustment_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetInventoryAdjustmentResponse,
+ construct_type(
+ type_=GetInventoryAdjustmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def deprecated_batch_change(
+ self,
+ *,
+ idempotency_key: str,
+ changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
+ ignore_unchanged_counts: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BatchChangeInventoryResponse]:
+ """
+ Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
+ The set of physical counts and inventory adjustments to be made.
+ Changes are applied based on the client-supplied timestamp and may be sent
+ out of order.
+
+ ignore_unchanged_counts : typing.Optional[bool]
+ Indicates whether the current physical count should be ignored if
+ the quantity is unchanged since the last physical count. Default: `true`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchChangeInventoryResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/batch-change",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "changes": convert_and_respect_annotation_metadata(
+ object_=changes,
+ annotation=typing.Optional[typing.Sequence[InventoryChangeParams]],
+ direction="write",
+ ),
+ "ignore_unchanged_counts": ignore_unchanged_counts,
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchChangeInventoryResponse,
+ construct_type(
+ type_=BatchChangeInventoryResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def deprecated_batch_get_changes(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ types: typing.Optional[typing.Sequence[InventoryChangeType]] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ updated_before: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BatchGetInventoryChangesResponse]:
+ """
+ Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is only applicable when set. The default value is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ The filter is only applicable when set. The default value is null.
+
+ types : typing.Optional[typing.Sequence[InventoryChangeType]]
+ The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
+ The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return `ADJUSTMENT` query results by
+ `InventoryState`. This filter is only applied when set.
+ The default value is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ updated_before : typing.Optional[str]
+ The filter to return results with their `created_at` or `calculated_at` value
+ strictly before the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryChange) to return.
+
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchGetInventoryChangesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/batch-retrieve-changes",
+ method="POST",
+ json={
+ "catalog_object_ids": catalog_object_ids,
+ "location_ids": location_ids,
+ "types": types,
+ "states": states,
+ "updated_after": updated_after,
+ "updated_before": updated_before,
+ "cursor": cursor,
+ "limit": limit,
+ "sort": convert_and_respect_annotation_metadata(
+ object_=sort, annotation=BatchRetrieveInventoryChangesSortParams, direction="write"
+ ),
+ "reason_ids": convert_and_respect_annotation_metadata(
+ object_=reason_ids,
+ annotation=typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]],
+ direction="write",
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchGetInventoryChangesResponse,
+ construct_type(
+ type_=BatchGetInventoryChangesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def deprecated_batch_get_counts(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BatchGetInventoryCountsResponse]:
+ """
+ Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is applicable only when set. The default is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ This filter is applicable only when set. The default is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return results by `InventoryState`. The filter is only applicable when set.
+ Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
+ The default is null.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryCount) to return.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchGetInventoryCountsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/batch-retrieve-counts",
+ method="POST",
+ json={
+ "catalog_object_ids": catalog_object_ids,
+ "location_ids": location_ids,
+ "updated_after": updated_after,
+ "cursor": cursor,
+ "states": states,
+ "limit": limit,
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchGetInventoryCountsResponse,
+ construct_type(
+ type_=BatchGetInventoryCountsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_create_changes(
+ self,
+ *,
+ idempotency_key: str,
+ changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
+ ignore_unchanged_counts: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BatchChangeInventoryResponse]:
+ """
+ Applies adjustments and counts to the provided item quantities.
+
+ On success: returns the current calculated counts for all objects
+ referenced in the request.
+ On failure: returns a list of related errors.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
+ The set of physical counts and inventory adjustments to be made.
+ Changes are applied based on the client-supplied timestamp and may be sent
+ out of order.
+
+ ignore_unchanged_counts : typing.Optional[bool]
+ Indicates whether the current physical count should be ignored if
+ the quantity is unchanged since the last physical count. Default: `true`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchChangeInventoryResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/changes/batch-create",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "changes": convert_and_respect_annotation_metadata(
+ object_=changes,
+ annotation=typing.Optional[typing.Sequence[InventoryChangeParams]],
+ direction="write",
+ ),
+ "ignore_unchanged_counts": ignore_unchanged_counts,
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchChangeInventoryResponse,
+ construct_type(
+ type_=BatchChangeInventoryResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_get_changes(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ types: typing.Optional[typing.Sequence[InventoryChangeType]] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ updated_before: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryChange, BatchGetInventoryChangesResponse]:
+ """
+ Returns historical physical counts and adjustments based on the
+ provided filter criteria.
+
+ Results are paginated and sorted in ascending order according their
+ `occurred_at` timestamp (oldest first).
+
+ BatchRetrieveInventoryChanges is a catch-all query endpoint for queries
+ that cannot be handled by other, simpler endpoints.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is only applicable when set. The default value is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ The filter is only applicable when set. The default value is null.
+
+ types : typing.Optional[typing.Sequence[InventoryChangeType]]
+ The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
+ The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return `ADJUSTMENT` query results by
+ `InventoryState`. This filter is only applied when set.
+ The default value is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ updated_before : typing.Optional[str]
+ The filter to return results with their `created_at` or `calculated_at` value
+ strictly before the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryChange) to return.
+
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryChange, BatchGetInventoryChangesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/changes/batch-retrieve",
+ method="POST",
+ json={
+ "catalog_object_ids": catalog_object_ids,
+ "location_ids": location_ids,
+ "types": types,
+ "states": states,
+ "updated_after": updated_after,
+ "updated_before": updated_before,
+ "cursor": cursor,
+ "limit": limit,
+ "sort": convert_and_respect_annotation_metadata(
+ object_=sort, annotation=BatchRetrieveInventoryChangesSortParams, direction="write"
+ ),
+ "reason_ids": convert_and_respect_annotation_metadata(
+ object_=reason_ids,
+ annotation=typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]],
+ direction="write",
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ BatchGetInventoryChangesResponse,
+ construct_type(
+ type_=BatchGetInventoryChangesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.changes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.batch_get_changes(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ types=types,
+ states=states,
+ updated_after=updated_after,
+ updated_before=updated_before,
+ cursor=_parsed_next,
+ limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_get_counts(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryCount, BatchGetInventoryCountsResponse]:
+ """
+ Returns current counts for the provided
+ [CatalogObject](entity:CatalogObject)s at the requested
+ [Location](entity:Location)s.
+
+ Results are paginated and sorted in descending order according to their
+ `calculated_at` timestamp (newest first).
+
+ When `updated_after` is specified, only counts that have changed since that
+ time (based on the server timestamp for the most recent change) are
+ returned. This allows clients to perform a "sync" operation, for example
+ in response to receiving a Webhook notification.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is applicable only when set. The default is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ This filter is applicable only when set. The default is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return results by `InventoryState`. The filter is only applicable when set.
+ Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
+ The default is null.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryCount) to return.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryCount, BatchGetInventoryCountsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/counts/batch-retrieve",
+ method="POST",
+ json={
+ "catalog_object_ids": catalog_object_ids,
+ "location_ids": location_ids,
+ "updated_after": updated_after,
+ "cursor": cursor,
+ "states": states,
+ "limit": limit,
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ BatchGetInventoryCountsResponse,
+ construct_type(
+ type_=BatchGetInventoryCountsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.counts
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.batch_get_counts(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ updated_after=updated_after,
+ cursor=_parsed_next,
+ states=states,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def deprecated_get_physical_count(
+ self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetInventoryPhysicalCountResponse]:
+ """
+ Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ physical_count_id : str
+ ID of the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetInventoryPhysicalCountResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/inventory/physical-count/{jsonable_encoder(physical_count_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetInventoryPhysicalCountResponse,
+ construct_type(
+ type_=GetInventoryPhysicalCountResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get_physical_count(
+ self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetInventoryPhysicalCountResponse]:
+ """
+ Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount)
+ object with the provided `physical_count_id`.
+
+ Parameters
+ ----------
+ physical_count_id : str
+ ID of the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetInventoryPhysicalCountResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/inventory/physical-counts/{jsonable_encoder(physical_count_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetInventoryPhysicalCountResponse,
+ construct_type(
+ type_=GetInventoryPhysicalCountResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryCount, GetInventoryCountResponse]:
+ """
+ Retrieves the current calculated stock count for a given
+ [CatalogObject](entity:CatalogObject) at a given set of
+ [Location](entity:Location)s. Responses are paginated and unsorted.
+ For more sophisticated queries, use a batch endpoint.
+
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryCount, GetInventoryCountResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/inventory/{jsonable_encoder(catalog_object_id)}",
+ method="GET",
+ params={
+ "location_ids": location_ids,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ GetInventoryCountResponse,
+ construct_type(
+ type_=GetInventoryCountResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.counts
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.get(
+ catalog_object_id,
+ location_ids=location_ids,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def changes(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryChange, GetInventoryChangesResponse]:
+ """
+ Returns a set of physical counts and inventory adjustments for the
+ provided [CatalogObject](entity:CatalogObject) at the requested
+ [Location](entity:Location)s.
+
+ You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges)
+ and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID.
+
+ Results are paginated and sorted in descending order according to their
+ `occurred_at` timestamp (newest first).
+
+ There are no limits on how far back the caller can page. This endpoint can be
+ used to display recent changes for a specific item. For more
+ sophisticated queries, use a batch endpoint.
+
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryChange, GetInventoryChangesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/inventory/{jsonable_encoder(catalog_object_id)}/changes",
+ method="GET",
+ params={
+ "location_ids": location_ids,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ GetInventoryChangesResponse,
+ construct_type(
+ type_=GetInventoryChangesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.changes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.changes(
+ catalog_object_id,
+ location_ids=location_ids,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get_transfer(
+ self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[None]:
+ """
+ Parameters
+ ----------
+ transfer_id : str
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[None]
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/inventory/transfers/{jsonable_encoder(transfer_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ return HttpResponse(response=_response, data=None)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawInventoryClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list_inventory_adjustment_reasons(
+ self,
+ *,
+ include_deleted: typing.Optional[bool] = None,
+ include_system_codes: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[ListInventoryAdjustmentReasonsResponse]:
+ """
+ Returns the standard and custom inventory adjustment reasons available
+ to the seller.
+
+ Parameters
+ ----------
+ include_deleted : typing.Optional[bool]
+ Indicates whether the response should include deleted custom inventory
+ adjustment reasons. The default value is `false`.
+
+ include_system_codes : typing.Optional[bool]
+ Indicates whether the response should include Square-generated system
+ inventory adjustment reason codes that cannot be used to write adjustments
+ from the Connect API, such as `SALE`, `RECOUNT`, `TRANSFER`, `IN_TRANSIT`,
+ and `CANCELED_SALE`. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ListInventoryAdjustmentReasonsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons",
+ method="GET",
+ params={
+ "include_deleted": include_deleted,
+ "include_system_codes": include_system_codes,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListInventoryAdjustmentReasonsResponse,
+ construct_type(
+ type_=ListInventoryAdjustmentReasonsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create_inventory_adjustment_reason(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateInventoryAdjustmentReasonResponse]:
+ """
+ Creates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier to make this
+ [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason)
+ request idempotent.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The custom inventory adjustment reason to create. Only custom
+ adjustment reasons can be created.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/create",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "adjustment_reason": convert_and_respect_annotation_metadata(
+ object_=adjustment_reason, annotation=InventoryAdjustmentReasonParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=CreateInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteInventoryAdjustmentReasonResponse]:
+ """
+ Soft deletes a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to soft delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/delete",
+ method="POST",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=DeleteInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def restore_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RestoreInventoryAdjustmentReasonResponse]:
+ """
+ Restores a soft-deleted custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the soft-deleted custom inventory adjustment reason
+ to restore.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RestoreInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/restore",
+ method="POST",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RestoreInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=RestoreInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def retrieve_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RetrieveInventoryAdjustmentReasonResponse]:
+ """
+ Returns the inventory adjustment reason identified by the provided
+ `reason_id`. Deleted custom reasons can be retrieved by ID.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the inventory adjustment reason to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/retrieve",
+ method="POST",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=RetrieveInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update_inventory_adjustment_reason(
+ self,
+ *,
+ reason_id: InventoryAdjustmentReasonIdParams,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateInventoryAdjustmentReasonResponse]:
+ """
+ Updates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to update.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The requested custom inventory adjustment reason update. Only the
+ `name` field can be updated. Deleted custom reasons cannot be updated. To
+ restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/update",
+ method="PUT",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ "adjustment_reason": convert_and_respect_annotation_metadata(
+ object_=adjustment_reason, annotation=InventoryAdjustmentReasonParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=UpdateInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def deprecated_get_adjustment(
+ self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]:
+ """
+ Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ adjustment_id : str
+ ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetInventoryAdjustmentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/inventory/adjustment/{jsonable_encoder(adjustment_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetInventoryAdjustmentResponse,
+ construct_type(
+ type_=GetInventoryAdjustmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update_inventory_adjustment(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment: InventoryAdjustmentParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateInventoryAdjustmentResponse]:
+ """
+ Applies an update to the provided adjustment.
+
+ On success: returns the newly updated adjustment.
+ On failure: returns a list of related errors.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [Build Basics](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ adjustment : InventoryAdjustmentParams
+ Represents the updates being written to a past/existing inventory adjustment.
+ This works using sparse updates, meaning that any fields omitted from the inputted InventoryAdjustment
+ will retain their values.
+
+ Only updates to the quantity, cost_money, vendor_id, and reason_id fields of an InventoryAdjustment can be made here.
+ Note that the quantity field must be provided, but it can be identical to the current quantity if there are no desired quantity changes.
+ cost_money and vendor_id can only be written to adjustments that add stock to the system (from_state of NONE or UNLINKED_RETURN) and to untracked sale adjustments.
+ reason_id can be changed to any reason that is valid for the adjustment's state transition. The reason of a system-generated adjustment (for example, SALE or RECOUNT) cannot be changed.
+ Adjustments generated by Square from other records cannot be updated. This includes inferred adjustments created by physical counts, transfer-like cross-location adjustments, and component adjustments.
+ Adjustments linked to purchase orders cannot be updated. Adjustments linked to sales can only have cost_money and vendor_id updated, and only for untracked sales.
+ Restock adjustments linked to an itemized return can have their quantity updated, up to the quantity remaining on the return.
+ Adjustments older than one year cannot be updated.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateInventoryAdjustmentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustments/update",
+ method="PUT",
+ json={
+ "idempotency_key": idempotency_key,
+ "adjustment": convert_and_respect_annotation_metadata(
+ object_=adjustment, annotation=InventoryAdjustmentParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateInventoryAdjustmentResponse,
+ construct_type(
+ type_=UpdateInventoryAdjustmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get_adjustment(
+ self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]:
+ """
+ Returns the [InventoryAdjustment](entity:InventoryAdjustment) object
+ with the provided `adjustment_id`.
+
+ Parameters
+ ----------
+ adjustment_id : str
+ ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetInventoryAdjustmentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/inventory/adjustments/{jsonable_encoder(adjustment_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetInventoryAdjustmentResponse,
+ construct_type(
+ type_=GetInventoryAdjustmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def deprecated_batch_change(
+ self,
+ *,
+ idempotency_key: str,
+ changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
+ ignore_unchanged_counts: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BatchChangeInventoryResponse]:
+ """
+ Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
+ The set of physical counts and inventory adjustments to be made.
+ Changes are applied based on the client-supplied timestamp and may be sent
+ out of order.
+
+ ignore_unchanged_counts : typing.Optional[bool]
+ Indicates whether the current physical count should be ignored if
+ the quantity is unchanged since the last physical count. Default: `true`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchChangeInventoryResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/batch-change",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "changes": convert_and_respect_annotation_metadata(
+ object_=changes,
+ annotation=typing.Optional[typing.Sequence[InventoryChangeParams]],
+ direction="write",
+ ),
+ "ignore_unchanged_counts": ignore_unchanged_counts,
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchChangeInventoryResponse,
+ construct_type(
+ type_=BatchChangeInventoryResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def deprecated_batch_get_changes(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ types: typing.Optional[typing.Sequence[InventoryChangeType]] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ updated_before: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BatchGetInventoryChangesResponse]:
+ """
+ Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is only applicable when set. The default value is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ The filter is only applicable when set. The default value is null.
+
+ types : typing.Optional[typing.Sequence[InventoryChangeType]]
+ The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
+ The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return `ADJUSTMENT` query results by
+ `InventoryState`. This filter is only applied when set.
+ The default value is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ updated_before : typing.Optional[str]
+ The filter to return results with their `created_at` or `calculated_at` value
+ strictly before the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryChange) to return.
+
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchGetInventoryChangesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/batch-retrieve-changes",
+ method="POST",
+ json={
+ "catalog_object_ids": catalog_object_ids,
+ "location_ids": location_ids,
+ "types": types,
+ "states": states,
+ "updated_after": updated_after,
+ "updated_before": updated_before,
+ "cursor": cursor,
+ "limit": limit,
+ "sort": convert_and_respect_annotation_metadata(
+ object_=sort, annotation=BatchRetrieveInventoryChangesSortParams, direction="write"
+ ),
+ "reason_ids": convert_and_respect_annotation_metadata(
+ object_=reason_ids,
+ annotation=typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]],
+ direction="write",
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchGetInventoryChangesResponse,
+ construct_type(
+ type_=BatchGetInventoryChangesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def deprecated_batch_get_counts(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BatchGetInventoryCountsResponse]:
+ """
+ Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is applicable only when set. The default is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ This filter is applicable only when set. The default is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return results by `InventoryState`. The filter is only applicable when set.
+ Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
+ The default is null.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryCount) to return.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchGetInventoryCountsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/batch-retrieve-counts",
+ method="POST",
+ json={
+ "catalog_object_ids": catalog_object_ids,
+ "location_ids": location_ids,
+ "updated_after": updated_after,
+ "cursor": cursor,
+ "states": states,
+ "limit": limit,
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchGetInventoryCountsResponse,
+ construct_type(
+ type_=BatchGetInventoryCountsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_create_changes(
+ self,
+ *,
+ idempotency_key: str,
+ changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
+ ignore_unchanged_counts: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BatchChangeInventoryResponse]:
+ """
+ Applies adjustments and counts to the provided item quantities.
+
+ On success: returns the current calculated counts for all objects
+ referenced in the request.
+ On failure: returns a list of related errors.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
+ The set of physical counts and inventory adjustments to be made.
+ Changes are applied based on the client-supplied timestamp and may be sent
+ out of order.
+
+ ignore_unchanged_counts : typing.Optional[bool]
+ Indicates whether the current physical count should be ignored if
+ the quantity is unchanged since the last physical count. Default: `true`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchChangeInventoryResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/changes/batch-create",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "changes": convert_and_respect_annotation_metadata(
+ object_=changes,
+ annotation=typing.Optional[typing.Sequence[InventoryChangeParams]],
+ direction="write",
+ ),
+ "ignore_unchanged_counts": ignore_unchanged_counts,
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchChangeInventoryResponse,
+ construct_type(
+ type_=BatchChangeInventoryResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_get_changes(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ types: typing.Optional[typing.Sequence[InventoryChangeType]] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ updated_before: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[InventoryChange, BatchGetInventoryChangesResponse]:
+ """
+ Returns historical physical counts and adjustments based on the
+ provided filter criteria.
+
+ Results are paginated and sorted in ascending order according their
+ `occurred_at` timestamp (oldest first).
+
+ BatchRetrieveInventoryChanges is a catch-all query endpoint for queries
+ that cannot be handled by other, simpler endpoints.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is only applicable when set. The default value is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ The filter is only applicable when set. The default value is null.
+
+ types : typing.Optional[typing.Sequence[InventoryChangeType]]
+ The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
+ The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return `ADJUSTMENT` query results by
+ `InventoryState`. This filter is only applied when set.
+ The default value is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ updated_before : typing.Optional[str]
+ The filter to return results with their `created_at` or `calculated_at` value
+ strictly before the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryChange) to return.
+
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[InventoryChange, BatchGetInventoryChangesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/changes/batch-retrieve",
+ method="POST",
+ json={
+ "catalog_object_ids": catalog_object_ids,
+ "location_ids": location_ids,
+ "types": types,
+ "states": states,
+ "updated_after": updated_after,
+ "updated_before": updated_before,
+ "cursor": cursor,
+ "limit": limit,
+ "sort": convert_and_respect_annotation_metadata(
+ object_=sort, annotation=BatchRetrieveInventoryChangesSortParams, direction="write"
+ ),
+ "reason_ids": convert_and_respect_annotation_metadata(
+ object_=reason_ids,
+ annotation=typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]],
+ direction="write",
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ BatchGetInventoryChangesResponse,
+ construct_type(
+ type_=BatchGetInventoryChangesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.changes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.batch_get_changes(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ types=types,
+ states=states,
+ updated_after=updated_after,
+ updated_before=updated_before,
+ cursor=_parsed_next,
+ limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_get_counts(
+ self,
+ *,
+ catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ updated_after: typing.Optional[str] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[InventoryCount, BatchGetInventoryCountsResponse]:
+ """
+ Returns current counts for the provided
+ [CatalogObject](entity:CatalogObject)s at the requested
+ [Location](entity:Location)s.
+
+ Results are paginated and sorted in descending order according to their
+ `calculated_at` timestamp (newest first).
+
+ When `updated_after` is specified, only counts that have changed since that
+ time (based on the server timestamp for the most recent change) are
+ returned. This allows clients to perform a "sync" operation, for example
+ in response to receiving a Webhook notification.
+
+ Parameters
+ ----------
+ catalog_object_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `CatalogObject` ID.
+ The filter is applicable only when set. The default is null.
+
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The filter to return results by `Location` ID.
+ This filter is applicable only when set. The default is null.
+
+ updated_after : typing.Optional[str]
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ states : typing.Optional[typing.Sequence[InventoryState]]
+ The filter to return results by `InventoryState`. The filter is only applicable when set.
+ Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
+ The default is null.
+
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryCount) to return.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[InventoryCount, BatchGetInventoryCountsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/counts/batch-retrieve",
+ method="POST",
+ json={
+ "catalog_object_ids": catalog_object_ids,
+ "location_ids": location_ids,
+ "updated_after": updated_after,
+ "cursor": cursor,
+ "states": states,
+ "limit": limit,
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ BatchGetInventoryCountsResponse,
+ construct_type(
+ type_=BatchGetInventoryCountsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.counts
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.batch_get_counts(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ updated_after=updated_after,
+ cursor=_parsed_next,
+ states=states,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def deprecated_get_physical_count(
+ self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetInventoryPhysicalCountResponse]:
+ """
+ Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL
+ is updated to conform to the standard convention.
+
+ Parameters
+ ----------
+ physical_count_id : str
+ ID of the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetInventoryPhysicalCountResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/inventory/physical-count/{jsonable_encoder(physical_count_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetInventoryPhysicalCountResponse,
+ construct_type(
+ type_=GetInventoryPhysicalCountResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get_physical_count(
+ self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetInventoryPhysicalCountResponse]:
+ """
+ Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount)
+ object with the provided `physical_count_id`.
+
+ Parameters
+ ----------
+ physical_count_id : str
+ ID of the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetInventoryPhysicalCountResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/inventory/physical-counts/{jsonable_encoder(physical_count_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetInventoryPhysicalCountResponse,
+ construct_type(
+ type_=GetInventoryPhysicalCountResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[InventoryCount, GetInventoryCountResponse]:
+ """
+ Retrieves the current calculated stock count for a given
+ [CatalogObject](entity:CatalogObject) at a given set of
+ [Location](entity:Location)s. Responses are paginated and unsorted.
+ For more sophisticated queries, use a batch endpoint.
+
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[InventoryCount, GetInventoryCountResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/inventory/{jsonable_encoder(catalog_object_id)}",
+ method="GET",
+ params={
+ "location_ids": location_ids,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ GetInventoryCountResponse,
+ construct_type(
+ type_=GetInventoryCountResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.counts
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.get(
+ catalog_object_id,
+ location_ids=location_ids,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def changes(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[InventoryChange, GetInventoryChangesResponse]:
+ """
+ Returns a set of physical counts and inventory adjustments for the
+ provided [CatalogObject](entity:CatalogObject) at the requested
+ [Location](entity:Location)s.
+
+ You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges)
+ and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID.
+
+ Results are paginated and sorted in descending order according to their
+ `occurred_at` timestamp (newest first).
+
+ There are no limits on how far back the caller can page. This endpoint can be
+ used to display recent changes for a specific item. For more
+ sophisticated queries, use a batch endpoint.
+
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[InventoryChange, GetInventoryChangesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/inventory/{jsonable_encoder(catalog_object_id)}/changes",
+ method="GET",
+ params={
+ "location_ids": location_ids,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ GetInventoryChangesResponse,
+ construct_type(
+ type_=GetInventoryChangesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.changes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.changes(
+ catalog_object_id,
+ location_ids=location_ids,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get_transfer(
+ self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[None]:
+ """
+ Parameters
+ ----------
+ transfer_id : str
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[None]
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/inventory/transfers/{jsonable_encoder(transfer_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ return AsyncHttpResponse(response=_response, data=None)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/invoices/__init__.py b/src/square/invoices/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/invoices/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/invoices/client.py b/src/square/invoices/client.py
new file mode 100644
index 00000000..4e1fe1ae
--- /dev/null
+++ b/src/square/invoices/client.py
@@ -0,0 +1,1275 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .. import core
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..requests.create_invoice_attachment_request_data import CreateInvoiceAttachmentRequestDataParams
+from ..requests.invoice import InvoiceParams
+from ..requests.invoice_query import InvoiceQueryParams
+from ..types.cancel_invoice_response import CancelInvoiceResponse
+from ..types.create_invoice_attachment_response import CreateInvoiceAttachmentResponse
+from ..types.create_invoice_response import CreateInvoiceResponse
+from ..types.delete_invoice_attachment_response import DeleteInvoiceAttachmentResponse
+from ..types.delete_invoice_response import DeleteInvoiceResponse
+from ..types.get_invoice_response import GetInvoiceResponse
+from ..types.invoice import Invoice
+from ..types.list_invoices_response import ListInvoicesResponse
+from ..types.publish_invoice_response import PublishInvoiceResponse
+from ..types.search_invoices_response import SearchInvoicesResponse
+from ..types.update_invoice_response import UpdateInvoiceResponse
+from .raw_client import AsyncRawInvoicesClient, RawInvoicesClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class InvoicesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawInvoicesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawInvoicesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawInvoicesClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ location_id: str,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Invoice, ListInvoicesResponse]:
+ """
+ Returns a list of invoices for a given location. The response
+ is paginated. If truncated, the response includes a `cursor` that you
+ use in a subsequent request to retrieve the next set of invoices.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location for which to list invoices.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of invoices to return (200 is the maximum `limit`).
+ If not provided, the server uses a default limit of 100 invoices.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Invoice, ListInvoicesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.invoices.list(
+ location_id="location_id",
+ cursor="cursor",
+ limit=1,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ location_id=location_id, cursor=cursor, limit=limit, request_options=request_options
+ )
+
+ def create(
+ self,
+ *,
+ invoice: InvoiceParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateInvoiceResponse:
+ """
+ Creates a draft [invoice](entity:Invoice)
+ for an order created using the Orders API.
+
+ A draft invoice remains in your account and no action is taken.
+ You must publish the invoice before Square can process it (send it to the customer's email address or charge the customer’s card on file).
+
+ Parameters
+ ----------
+ invoice : InvoiceParams
+ The invoice to create.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `CreateInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateInvoiceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.invoices.create(
+ invoice={
+ "location_id": "ES0RJRZYEC39A",
+ "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY",
+ "primary_recipient": {"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4"},
+ "payment_requests": [
+ {
+ "request_type": "BALANCE",
+ "due_date": "2030-01-24",
+ "tipping_enabled": True,
+ "automatic_payment_source": "NONE",
+ "reminders": [
+ {
+ "relative_scheduled_days": -1,
+ "message": "Your invoice is due tomorrow",
+ }
+ ],
+ }
+ ],
+ "delivery_method": "EMAIL",
+ "invoice_number": "inv-100",
+ "title": "Event Planning Services",
+ "description": "We appreciate your business!",
+ "scheduled_at": "2030-01-13T10:00:00Z",
+ "accepted_payment_methods": {
+ "card": True,
+ "square_gift_card": False,
+ "bank_account": False,
+ "buy_now_pay_later": False,
+ "cash_app_pay": False,
+ },
+ "custom_fields": [
+ {
+ "label": "Event Reference Number",
+ "value": "Ref. #1234",
+ "placement": "ABOVE_LINE_ITEMS",
+ },
+ {
+ "label": "Terms of Service",
+ "value": "The terms of service are...",
+ "placement": "BELOW_LINE_ITEMS",
+ },
+ ],
+ "sale_or_service_date": "2030-01-24",
+ "store_payment_method_enabled": False,
+ },
+ idempotency_key="ce3748f9-5fc1-4762-aa12-aae5e843f1f4",
+ )
+ """
+ _response = self._raw_client.create(
+ invoice=invoice, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ query: InvoiceQueryParams,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchInvoicesResponse:
+ """
+ Searches for invoices from a location specified in
+ the filter. You can optionally specify customers in the filter for whom to
+ retrieve invoices. In the current implementation, you can only specify one location and
+ optionally one customer.
+
+ The response is paginated. If truncated, the response includes a `cursor`
+ that you use in a subsequent request to retrieve the next set of invoices.
+
+ Parameters
+ ----------
+ query : InvoiceQueryParams
+ Describes the query criteria for searching invoices.
+
+ limit : typing.Optional[int]
+ The maximum number of invoices to return (200 is the maximum `limit`).
+ If not provided, the server uses a default limit of 100 invoices.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchInvoicesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.invoices.search(
+ query={
+ "filter": {
+ "location_ids": ["ES0RJRZYEC39A"],
+ "customer_ids": ["JDKYHBWT1D4F8MFH63DBMEN8Y4"],
+ },
+ "sort": {"field": "INVOICE_SORT_DATE", "order": "DESC"},
+ },
+ limit=100,
+ )
+ """
+ _response = self._raw_client.search(query=query, limit=limit, cursor=cursor, request_options=request_options)
+ return _response.data
+
+ def get(self, invoice_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetInvoiceResponse:
+ """
+ Retrieves an invoice by invoice ID.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetInvoiceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.invoices.get(
+ invoice_id="invoice_id",
+ )
+ """
+ _response = self._raw_client.get(invoice_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ invoice_id: str,
+ *,
+ invoice: InvoiceParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ fields_to_clear: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateInvoiceResponse:
+ """
+ Updates an invoice. This endpoint supports sparse updates, so you only need
+ to specify the fields you want to change along with the required `version` field.
+ Some restrictions apply to updating invoices. For example, you cannot change the
+ `order_id` or `location_id` field.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to update.
+
+ invoice : InvoiceParams
+ The invoice fields to add, change, or clear. Fields can be cleared using
+ null values or the `remove` field (for individual payment requests or reminders).
+ The current invoice `version` is also required. For more information, including requirements,
+ limitations, and more examples, see [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices).
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `UpdateInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ fields_to_clear : typing.Optional[typing.Sequence[str]]
+ The list of fields to clear. Although this field is currently supported, we
+ recommend using null values or the `remove` field when possible. For examples, see
+ [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateInvoiceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.invoices.update(
+ invoice_id="invoice_id",
+ invoice={
+ "version": 1,
+ "payment_requests": [
+ {
+ "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355",
+ "tipping_enabled": False,
+ }
+ ],
+ },
+ idempotency_key="4ee82288-0910-499e-ab4c-5d0071dad1be",
+ )
+ """
+ _response = self._raw_client.update(
+ invoice_id,
+ invoice=invoice,
+ idempotency_key=idempotency_key,
+ fields_to_clear=fields_to_clear,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self,
+ invoice_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> DeleteInvoiceResponse:
+ """
+ Deletes the specified invoice. When an invoice is deleted, the
+ associated order status changes to CANCELED. You can only delete a draft
+ invoice (you cannot delete a published invoice, including one that is scheduled for processing).
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to delete.
+
+ version : typing.Optional[int]
+ The version of the [invoice](entity:Invoice) to delete.
+ If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or
+ [ListInvoices](api-endpoint:Invoices-ListInvoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteInvoiceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.invoices.delete(
+ invoice_id="invoice_id",
+ version=1,
+ )
+ """
+ _response = self._raw_client.delete(invoice_id, version=version, request_options=request_options)
+ return _response.data
+
+ def create_invoice_attachment(
+ self,
+ invoice_id: str,
+ *,
+ request: typing.Optional[CreateInvoiceAttachmentRequestDataParams] = OMIT,
+ image_file: typing.Optional[core.File] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateInvoiceAttachmentResponse:
+ """
+ Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file uploads
+ with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that contains a file
+ in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF.
+
+ Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added only to invoices
+ in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state.
+
+ __NOTE:__ When testing in the Sandbox environment, the total file size is limited to 1 KB.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to attach the file to.
+
+ request : typing.Optional[CreateInvoiceAttachmentRequestDataParams]
+
+ image_file : typing.Optional[core.File]
+ See core.File for more documentation
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateInvoiceAttachmentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.invoices.create_invoice_attachment(
+ invoice_id="invoice_id",
+ )
+ """
+ _response = self._raw_client.create_invoice_attachment(
+ invoice_id, request=request, image_file=image_file, request_options=request_options
+ )
+ return _response.data
+
+ def delete_invoice_attachment(
+ self, invoice_id: str, attachment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteInvoiceAttachmentResponse:
+ """
+ Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed only
+ from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to delete the attachment from.
+
+ attachment_id : str
+ The ID of the [attachment](entity:InvoiceAttachment) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteInvoiceAttachmentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.invoices.delete_invoice_attachment(
+ invoice_id="invoice_id",
+ attachment_id="attachment_id",
+ )
+ """
+ _response = self._raw_client.delete_invoice_attachment(
+ invoice_id, attachment_id, request_options=request_options
+ )
+ return _response.data
+
+ def cancel(
+ self, invoice_id: str, *, version: int, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelInvoiceResponse:
+ """
+ Cancels an invoice. The seller cannot collect payments for
+ the canceled invoice.
+
+ You cannot cancel an invoice in the `DRAFT` state or in a terminal state: `PAID`, `REFUNDED`, `CANCELED`, or `FAILED`.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to cancel.
+
+ version : int
+ The version of the [invoice](entity:Invoice) to cancel.
+ If you do not know the version, you can call
+ [GetInvoice](api-endpoint:Invoices-GetInvoice) or [ListInvoices](api-endpoint:Invoices-ListInvoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelInvoiceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.invoices.cancel(
+ invoice_id="invoice_id",
+ version=0,
+ )
+ """
+ _response = self._raw_client.cancel(invoice_id, version=version, request_options=request_options)
+ return _response.data
+
+ def publish(
+ self,
+ invoice_id: str,
+ *,
+ version: int,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> PublishInvoiceResponse:
+ """
+ Publishes the specified draft invoice.
+
+ After an invoice is published, Square
+ follows up based on the invoice configuration. For example, Square
+ sends the invoice to the customer's email address, charges the customer's card on file, or does
+ nothing. Square also makes the invoice available on a Square-hosted invoice page.
+
+ The invoice `status` also changes from `DRAFT` to a status
+ based on the invoice configuration. For example, the status changes to `UNPAID` if
+ Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the
+ invoice amount.
+
+ In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ`
+ and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to publish.
+
+ version : int
+ The version of the [invoice](entity:Invoice) to publish.
+ This must match the current version of the invoice; otherwise, the request is rejected.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `PublishInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ PublishInvoiceResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.invoices.publish(
+ invoice_id="invoice_id",
+ version=1,
+ idempotency_key="32da42d0-1997-41b0-826b-f09464fc2c2e",
+ )
+ """
+ _response = self._raw_client.publish(
+ invoice_id, version=version, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+
+class AsyncInvoicesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawInvoicesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawInvoicesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawInvoicesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ location_id: str,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Invoice, ListInvoicesResponse]:
+ """
+ Returns a list of invoices for a given location. The response
+ is paginated. If truncated, the response includes a `cursor` that you
+ use in a subsequent request to retrieve the next set of invoices.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location for which to list invoices.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of invoices to return (200 is the maximum `limit`).
+ If not provided, the server uses a default limit of 100 invoices.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Invoice, ListInvoicesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.invoices.list(
+ location_id="location_id",
+ cursor="cursor",
+ limit=1,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ location_id=location_id, cursor=cursor, limit=limit, request_options=request_options
+ )
+
+ async def create(
+ self,
+ *,
+ invoice: InvoiceParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateInvoiceResponse:
+ """
+ Creates a draft [invoice](entity:Invoice)
+ for an order created using the Orders API.
+
+ A draft invoice remains in your account and no action is taken.
+ You must publish the invoice before Square can process it (send it to the customer's email address or charge the customer’s card on file).
+
+ Parameters
+ ----------
+ invoice : InvoiceParams
+ The invoice to create.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `CreateInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateInvoiceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.invoices.create(
+ invoice={
+ "location_id": "ES0RJRZYEC39A",
+ "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY",
+ "primary_recipient": {"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4"},
+ "payment_requests": [
+ {
+ "request_type": "BALANCE",
+ "due_date": "2030-01-24",
+ "tipping_enabled": True,
+ "automatic_payment_source": "NONE",
+ "reminders": [
+ {
+ "relative_scheduled_days": -1,
+ "message": "Your invoice is due tomorrow",
+ }
+ ],
+ }
+ ],
+ "delivery_method": "EMAIL",
+ "invoice_number": "inv-100",
+ "title": "Event Planning Services",
+ "description": "We appreciate your business!",
+ "scheduled_at": "2030-01-13T10:00:00Z",
+ "accepted_payment_methods": {
+ "card": True,
+ "square_gift_card": False,
+ "bank_account": False,
+ "buy_now_pay_later": False,
+ "cash_app_pay": False,
+ },
+ "custom_fields": [
+ {
+ "label": "Event Reference Number",
+ "value": "Ref. #1234",
+ "placement": "ABOVE_LINE_ITEMS",
+ },
+ {
+ "label": "Terms of Service",
+ "value": "The terms of service are...",
+ "placement": "BELOW_LINE_ITEMS",
+ },
+ ],
+ "sale_or_service_date": "2030-01-24",
+ "store_payment_method_enabled": False,
+ },
+ idempotency_key="ce3748f9-5fc1-4762-aa12-aae5e843f1f4",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ invoice=invoice, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ query: InvoiceQueryParams,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchInvoicesResponse:
+ """
+ Searches for invoices from a location specified in
+ the filter. You can optionally specify customers in the filter for whom to
+ retrieve invoices. In the current implementation, you can only specify one location and
+ optionally one customer.
+
+ The response is paginated. If truncated, the response includes a `cursor`
+ that you use in a subsequent request to retrieve the next set of invoices.
+
+ Parameters
+ ----------
+ query : InvoiceQueryParams
+ Describes the query criteria for searching invoices.
+
+ limit : typing.Optional[int]
+ The maximum number of invoices to return (200 is the maximum `limit`).
+ If not provided, the server uses a default limit of 100 invoices.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchInvoicesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.invoices.search(
+ query={
+ "filter": {
+ "location_ids": ["ES0RJRZYEC39A"],
+ "customer_ids": ["JDKYHBWT1D4F8MFH63DBMEN8Y4"],
+ },
+ "sort": {"field": "INVOICE_SORT_DATE", "order": "DESC"},
+ },
+ limit=100,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, invoice_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetInvoiceResponse:
+ """
+ Retrieves an invoice by invoice ID.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetInvoiceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.invoices.get(
+ invoice_id="invoice_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(invoice_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ invoice_id: str,
+ *,
+ invoice: InvoiceParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ fields_to_clear: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateInvoiceResponse:
+ """
+ Updates an invoice. This endpoint supports sparse updates, so you only need
+ to specify the fields you want to change along with the required `version` field.
+ Some restrictions apply to updating invoices. For example, you cannot change the
+ `order_id` or `location_id` field.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to update.
+
+ invoice : InvoiceParams
+ The invoice fields to add, change, or clear. Fields can be cleared using
+ null values or the `remove` field (for individual payment requests or reminders).
+ The current invoice `version` is also required. For more information, including requirements,
+ limitations, and more examples, see [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices).
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `UpdateInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ fields_to_clear : typing.Optional[typing.Sequence[str]]
+ The list of fields to clear. Although this field is currently supported, we
+ recommend using null values or the `remove` field when possible. For examples, see
+ [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateInvoiceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.invoices.update(
+ invoice_id="invoice_id",
+ invoice={
+ "version": 1,
+ "payment_requests": [
+ {
+ "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355",
+ "tipping_enabled": False,
+ }
+ ],
+ },
+ idempotency_key="4ee82288-0910-499e-ab4c-5d0071dad1be",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ invoice_id,
+ invoice=invoice,
+ idempotency_key=idempotency_key,
+ fields_to_clear=fields_to_clear,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self,
+ invoice_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> DeleteInvoiceResponse:
+ """
+ Deletes the specified invoice. When an invoice is deleted, the
+ associated order status changes to CANCELED. You can only delete a draft
+ invoice (you cannot delete a published invoice, including one that is scheduled for processing).
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to delete.
+
+ version : typing.Optional[int]
+ The version of the [invoice](entity:Invoice) to delete.
+ If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or
+ [ListInvoices](api-endpoint:Invoices-ListInvoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteInvoiceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.invoices.delete(
+ invoice_id="invoice_id",
+ version=1,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(invoice_id, version=version, request_options=request_options)
+ return _response.data
+
+ async def create_invoice_attachment(
+ self,
+ invoice_id: str,
+ *,
+ request: typing.Optional[CreateInvoiceAttachmentRequestDataParams] = OMIT,
+ image_file: typing.Optional[core.File] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateInvoiceAttachmentResponse:
+ """
+ Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file uploads
+ with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that contains a file
+ in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF.
+
+ Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added only to invoices
+ in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state.
+
+ __NOTE:__ When testing in the Sandbox environment, the total file size is limited to 1 KB.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to attach the file to.
+
+ request : typing.Optional[CreateInvoiceAttachmentRequestDataParams]
+
+ image_file : typing.Optional[core.File]
+ See core.File for more documentation
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateInvoiceAttachmentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.invoices.create_invoice_attachment(
+ invoice_id="invoice_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create_invoice_attachment(
+ invoice_id, request=request, image_file=image_file, request_options=request_options
+ )
+ return _response.data
+
+ async def delete_invoice_attachment(
+ self, invoice_id: str, attachment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteInvoiceAttachmentResponse:
+ """
+ Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed only
+ from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to delete the attachment from.
+
+ attachment_id : str
+ The ID of the [attachment](entity:InvoiceAttachment) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteInvoiceAttachmentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.invoices.delete_invoice_attachment(
+ invoice_id="invoice_id",
+ attachment_id="attachment_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete_invoice_attachment(
+ invoice_id, attachment_id, request_options=request_options
+ )
+ return _response.data
+
+ async def cancel(
+ self, invoice_id: str, *, version: int, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelInvoiceResponse:
+ """
+ Cancels an invoice. The seller cannot collect payments for
+ the canceled invoice.
+
+ You cannot cancel an invoice in the `DRAFT` state or in a terminal state: `PAID`, `REFUNDED`, `CANCELED`, or `FAILED`.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to cancel.
+
+ version : int
+ The version of the [invoice](entity:Invoice) to cancel.
+ If you do not know the version, you can call
+ [GetInvoice](api-endpoint:Invoices-GetInvoice) or [ListInvoices](api-endpoint:Invoices-ListInvoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelInvoiceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.invoices.cancel(
+ invoice_id="invoice_id",
+ version=0,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.cancel(invoice_id, version=version, request_options=request_options)
+ return _response.data
+
+ async def publish(
+ self,
+ invoice_id: str,
+ *,
+ version: int,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> PublishInvoiceResponse:
+ """
+ Publishes the specified draft invoice.
+
+ After an invoice is published, Square
+ follows up based on the invoice configuration. For example, Square
+ sends the invoice to the customer's email address, charges the customer's card on file, or does
+ nothing. Square also makes the invoice available on a Square-hosted invoice page.
+
+ The invoice `status` also changes from `DRAFT` to a status
+ based on the invoice configuration. For example, the status changes to `UNPAID` if
+ Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the
+ invoice amount.
+
+ In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ`
+ and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to publish.
+
+ version : int
+ The version of the [invoice](entity:Invoice) to publish.
+ This must match the current version of the invoice; otherwise, the request is rejected.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `PublishInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ PublishInvoiceResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.invoices.publish(
+ invoice_id="invoice_id",
+ version=1,
+ idempotency_key="32da42d0-1997-41b0-826b-f09464fc2c2e",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.publish(
+ invoice_id, version=version, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
diff --git a/src/square/invoices/raw_client.py b/src/square/invoices/raw_client.py
new file mode 100644
index 00000000..a5813087
--- /dev/null
+++ b/src/square/invoices/raw_client.py
@@ -0,0 +1,1281 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import json
+import typing
+from json.decoder import JSONDecodeError
+
+from .. import core
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.create_invoice_attachment_request_data import CreateInvoiceAttachmentRequestDataParams
+from ..requests.invoice import InvoiceParams
+from ..requests.invoice_query import InvoiceQueryParams
+from ..types.cancel_invoice_response import CancelInvoiceResponse
+from ..types.create_invoice_attachment_response import CreateInvoiceAttachmentResponse
+from ..types.create_invoice_response import CreateInvoiceResponse
+from ..types.delete_invoice_attachment_response import DeleteInvoiceAttachmentResponse
+from ..types.delete_invoice_response import DeleteInvoiceResponse
+from ..types.get_invoice_response import GetInvoiceResponse
+from ..types.invoice import Invoice
+from ..types.list_invoices_response import ListInvoicesResponse
+from ..types.publish_invoice_response import PublishInvoiceResponse
+from ..types.search_invoices_response import SearchInvoicesResponse
+from ..types.update_invoice_response import UpdateInvoiceResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawInvoicesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ location_id: str,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Invoice, ListInvoicesResponse]:
+ """
+ Returns a list of invoices for a given location. The response
+ is paginated. If truncated, the response includes a `cursor` that you
+ use in a subsequent request to retrieve the next set of invoices.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location for which to list invoices.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of invoices to return (200 is the maximum `limit`).
+ If not provided, the server uses a default limit of 100 invoices.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Invoice, ListInvoicesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/invoices",
+ method="GET",
+ params={
+ "location_id": location_id,
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListInvoicesResponse,
+ construct_type(
+ type_=ListInvoicesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.invoices
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ location_id=location_id,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ invoice: InvoiceParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateInvoiceResponse]:
+ """
+ Creates a draft [invoice](entity:Invoice)
+ for an order created using the Orders API.
+
+ A draft invoice remains in your account and no action is taken.
+ You must publish the invoice before Square can process it (send it to the customer's email address or charge the customer’s card on file).
+
+ Parameters
+ ----------
+ invoice : InvoiceParams
+ The invoice to create.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `CreateInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateInvoiceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/invoices",
+ method="POST",
+ json={
+ "invoice": convert_and_respect_annotation_metadata(
+ object_=invoice, annotation=InvoiceParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateInvoiceResponse,
+ construct_type(
+ type_=CreateInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ query: InvoiceQueryParams,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchInvoicesResponse]:
+ """
+ Searches for invoices from a location specified in
+ the filter. You can optionally specify customers in the filter for whom to
+ retrieve invoices. In the current implementation, you can only specify one location and
+ optionally one customer.
+
+ The response is paginated. If truncated, the response includes a `cursor`
+ that you use in a subsequent request to retrieve the next set of invoices.
+
+ Parameters
+ ----------
+ query : InvoiceQueryParams
+ Describes the query criteria for searching invoices.
+
+ limit : typing.Optional[int]
+ The maximum number of invoices to return (200 is the maximum `limit`).
+ If not provided, the server uses a default limit of 100 invoices.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchInvoicesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/invoices/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=InvoiceQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchInvoicesResponse,
+ construct_type(
+ type_=SearchInvoicesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, invoice_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetInvoiceResponse]:
+ """
+ Retrieves an invoice by invoice ID.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetInvoiceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetInvoiceResponse,
+ construct_type(
+ type_=GetInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ invoice_id: str,
+ *,
+ invoice: InvoiceParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ fields_to_clear: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateInvoiceResponse]:
+ """
+ Updates an invoice. This endpoint supports sparse updates, so you only need
+ to specify the fields you want to change along with the required `version` field.
+ Some restrictions apply to updating invoices. For example, you cannot change the
+ `order_id` or `location_id` field.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to update.
+
+ invoice : InvoiceParams
+ The invoice fields to add, change, or clear. Fields can be cleared using
+ null values or the `remove` field (for individual payment requests or reminders).
+ The current invoice `version` is also required. For more information, including requirements,
+ limitations, and more examples, see [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices).
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `UpdateInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ fields_to_clear : typing.Optional[typing.Sequence[str]]
+ The list of fields to clear. Although this field is currently supported, we
+ recommend using null values or the `remove` field when possible. For examples, see
+ [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateInvoiceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}",
+ method="PUT",
+ json={
+ "invoice": convert_and_respect_annotation_metadata(
+ object_=invoice, annotation=InvoiceParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ "fields_to_clear": fields_to_clear,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateInvoiceResponse,
+ construct_type(
+ type_=UpdateInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self,
+ invoice_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[DeleteInvoiceResponse]:
+ """
+ Deletes the specified invoice. When an invoice is deleted, the
+ associated order status changes to CANCELED. You can only delete a draft
+ invoice (you cannot delete a published invoice, including one that is scheduled for processing).
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to delete.
+
+ version : typing.Optional[int]
+ The version of the [invoice](entity:Invoice) to delete.
+ If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or
+ [ListInvoices](api-endpoint:Invoices-ListInvoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteInvoiceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}",
+ method="DELETE",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteInvoiceResponse,
+ construct_type(
+ type_=DeleteInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create_invoice_attachment(
+ self,
+ invoice_id: str,
+ *,
+ request: typing.Optional[CreateInvoiceAttachmentRequestDataParams] = OMIT,
+ image_file: typing.Optional[core.File] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateInvoiceAttachmentResponse]:
+ """
+ Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file uploads
+ with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that contains a file
+ in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF.
+
+ Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added only to invoices
+ in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state.
+
+ __NOTE:__ When testing in the Sandbox environment, the total file size is limited to 1 KB.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to attach the file to.
+
+ request : typing.Optional[CreateInvoiceAttachmentRequestDataParams]
+
+ image_file : typing.Optional[core.File]
+ See core.File for more documentation
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateInvoiceAttachmentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}/attachments",
+ method="POST",
+ data={},
+ files={
+ **(
+ {"request": (None, json.dumps(jsonable_encoder(request)), "application/json; charset=utf-8")}
+ if request is not OMIT
+ else {}
+ ),
+ **(
+ {"image_file": core.with_content_type(file=image_file, default_content_type="image/jpeg")}
+ if image_file is not None
+ else {}
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ force_multipart=True,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateInvoiceAttachmentResponse,
+ construct_type(
+ type_=CreateInvoiceAttachmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete_invoice_attachment(
+ self, invoice_id: str, attachment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteInvoiceAttachmentResponse]:
+ """
+ Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed only
+ from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to delete the attachment from.
+
+ attachment_id : str
+ The ID of the [attachment](entity:InvoiceAttachment) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteInvoiceAttachmentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}/attachments/{jsonable_encoder(attachment_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteInvoiceAttachmentResponse,
+ construct_type(
+ type_=DeleteInvoiceAttachmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def cancel(
+ self, invoice_id: str, *, version: int, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[CancelInvoiceResponse]:
+ """
+ Cancels an invoice. The seller cannot collect payments for
+ the canceled invoice.
+
+ You cannot cancel an invoice in the `DRAFT` state or in a terminal state: `PAID`, `REFUNDED`, `CANCELED`, or `FAILED`.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to cancel.
+
+ version : int
+ The version of the [invoice](entity:Invoice) to cancel.
+ If you do not know the version, you can call
+ [GetInvoice](api-endpoint:Invoices-GetInvoice) or [ListInvoices](api-endpoint:Invoices-ListInvoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CancelInvoiceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}/cancel",
+ method="POST",
+ json={
+ "version": version,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelInvoiceResponse,
+ construct_type(
+ type_=CancelInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def publish(
+ self,
+ invoice_id: str,
+ *,
+ version: int,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[PublishInvoiceResponse]:
+ """
+ Publishes the specified draft invoice.
+
+ After an invoice is published, Square
+ follows up based on the invoice configuration. For example, Square
+ sends the invoice to the customer's email address, charges the customer's card on file, or does
+ nothing. Square also makes the invoice available on a Square-hosted invoice page.
+
+ The invoice `status` also changes from `DRAFT` to a status
+ based on the invoice configuration. For example, the status changes to `UNPAID` if
+ Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the
+ invoice amount.
+
+ In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ`
+ and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to publish.
+
+ version : int
+ The version of the [invoice](entity:Invoice) to publish.
+ This must match the current version of the invoice; otherwise, the request is rejected.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `PublishInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[PublishInvoiceResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}/publish",
+ method="POST",
+ json={
+ "version": version,
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ PublishInvoiceResponse,
+ construct_type(
+ type_=PublishInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawInvoicesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ location_id: str,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Invoice, ListInvoicesResponse]:
+ """
+ Returns a list of invoices for a given location. The response
+ is paginated. If truncated, the response includes a `cursor` that you
+ use in a subsequent request to retrieve the next set of invoices.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location for which to list invoices.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of invoices to return (200 is the maximum `limit`).
+ If not provided, the server uses a default limit of 100 invoices.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Invoice, ListInvoicesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/invoices",
+ method="GET",
+ params={
+ "location_id": location_id,
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListInvoicesResponse,
+ construct_type(
+ type_=ListInvoicesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.invoices
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ location_id=location_id,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ invoice: InvoiceParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateInvoiceResponse]:
+ """
+ Creates a draft [invoice](entity:Invoice)
+ for an order created using the Orders API.
+
+ A draft invoice remains in your account and no action is taken.
+ You must publish the invoice before Square can process it (send it to the customer's email address or charge the customer’s card on file).
+
+ Parameters
+ ----------
+ invoice : InvoiceParams
+ The invoice to create.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `CreateInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateInvoiceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/invoices",
+ method="POST",
+ json={
+ "invoice": convert_and_respect_annotation_metadata(
+ object_=invoice, annotation=InvoiceParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateInvoiceResponse,
+ construct_type(
+ type_=CreateInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ query: InvoiceQueryParams,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchInvoicesResponse]:
+ """
+ Searches for invoices from a location specified in
+ the filter. You can optionally specify customers in the filter for whom to
+ retrieve invoices. In the current implementation, you can only specify one location and
+ optionally one customer.
+
+ The response is paginated. If truncated, the response includes a `cursor`
+ that you use in a subsequent request to retrieve the next set of invoices.
+
+ Parameters
+ ----------
+ query : InvoiceQueryParams
+ Describes the query criteria for searching invoices.
+
+ limit : typing.Optional[int]
+ The maximum number of invoices to return (200 is the maximum `limit`).
+ If not provided, the server uses a default limit of 100 invoices.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchInvoicesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/invoices/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=InvoiceQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchInvoicesResponse,
+ construct_type(
+ type_=SearchInvoicesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, invoice_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetInvoiceResponse]:
+ """
+ Retrieves an invoice by invoice ID.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetInvoiceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetInvoiceResponse,
+ construct_type(
+ type_=GetInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ invoice_id: str,
+ *,
+ invoice: InvoiceParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ fields_to_clear: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateInvoiceResponse]:
+ """
+ Updates an invoice. This endpoint supports sparse updates, so you only need
+ to specify the fields you want to change along with the required `version` field.
+ Some restrictions apply to updating invoices. For example, you cannot change the
+ `order_id` or `location_id` field.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to update.
+
+ invoice : InvoiceParams
+ The invoice fields to add, change, or clear. Fields can be cleared using
+ null values or the `remove` field (for individual payment requests or reminders).
+ The current invoice `version` is also required. For more information, including requirements,
+ limitations, and more examples, see [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices).
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `UpdateInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ fields_to_clear : typing.Optional[typing.Sequence[str]]
+ The list of fields to clear. Although this field is currently supported, we
+ recommend using null values or the `remove` field when possible. For examples, see
+ [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateInvoiceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}",
+ method="PUT",
+ json={
+ "invoice": convert_and_respect_annotation_metadata(
+ object_=invoice, annotation=InvoiceParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ "fields_to_clear": fields_to_clear,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateInvoiceResponse,
+ construct_type(
+ type_=UpdateInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self,
+ invoice_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[DeleteInvoiceResponse]:
+ """
+ Deletes the specified invoice. When an invoice is deleted, the
+ associated order status changes to CANCELED. You can only delete a draft
+ invoice (you cannot delete a published invoice, including one that is scheduled for processing).
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to delete.
+
+ version : typing.Optional[int]
+ The version of the [invoice](entity:Invoice) to delete.
+ If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or
+ [ListInvoices](api-endpoint:Invoices-ListInvoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteInvoiceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}",
+ method="DELETE",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteInvoiceResponse,
+ construct_type(
+ type_=DeleteInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create_invoice_attachment(
+ self,
+ invoice_id: str,
+ *,
+ request: typing.Optional[CreateInvoiceAttachmentRequestDataParams] = OMIT,
+ image_file: typing.Optional[core.File] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateInvoiceAttachmentResponse]:
+ """
+ Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file uploads
+ with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that contains a file
+ in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF.
+
+ Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added only to invoices
+ in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state.
+
+ __NOTE:__ When testing in the Sandbox environment, the total file size is limited to 1 KB.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to attach the file to.
+
+ request : typing.Optional[CreateInvoiceAttachmentRequestDataParams]
+
+ image_file : typing.Optional[core.File]
+ See core.File for more documentation
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateInvoiceAttachmentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}/attachments",
+ method="POST",
+ data={},
+ files={
+ **(
+ {"request": (None, json.dumps(jsonable_encoder(request)), "application/json; charset=utf-8")}
+ if request is not OMIT
+ else {}
+ ),
+ **(
+ {"image_file": core.with_content_type(file=image_file, default_content_type="image/jpeg")}
+ if image_file is not None
+ else {}
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ force_multipart=True,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateInvoiceAttachmentResponse,
+ construct_type(
+ type_=CreateInvoiceAttachmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete_invoice_attachment(
+ self, invoice_id: str, attachment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteInvoiceAttachmentResponse]:
+ """
+ Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed only
+ from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to delete the attachment from.
+
+ attachment_id : str
+ The ID of the [attachment](entity:InvoiceAttachment) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteInvoiceAttachmentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}/attachments/{jsonable_encoder(attachment_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteInvoiceAttachmentResponse,
+ construct_type(
+ type_=DeleteInvoiceAttachmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def cancel(
+ self, invoice_id: str, *, version: int, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[CancelInvoiceResponse]:
+ """
+ Cancels an invoice. The seller cannot collect payments for
+ the canceled invoice.
+
+ You cannot cancel an invoice in the `DRAFT` state or in a terminal state: `PAID`, `REFUNDED`, `CANCELED`, or `FAILED`.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the [invoice](entity:Invoice) to cancel.
+
+ version : int
+ The version of the [invoice](entity:Invoice) to cancel.
+ If you do not know the version, you can call
+ [GetInvoice](api-endpoint:Invoices-GetInvoice) or [ListInvoices](api-endpoint:Invoices-ListInvoices).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CancelInvoiceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}/cancel",
+ method="POST",
+ json={
+ "version": version,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelInvoiceResponse,
+ construct_type(
+ type_=CancelInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def publish(
+ self,
+ invoice_id: str,
+ *,
+ version: int,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[PublishInvoiceResponse]:
+ """
+ Publishes the specified draft invoice.
+
+ After an invoice is published, Square
+ follows up based on the invoice configuration. For example, Square
+ sends the invoice to the customer's email address, charges the customer's card on file, or does
+ nothing. Square also makes the invoice available on a Square-hosted invoice page.
+
+ The invoice `status` also changes from `DRAFT` to a status
+ based on the invoice configuration. For example, the status changes to `UNPAID` if
+ Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the
+ invoice amount.
+
+ In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ`
+ and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments.
+
+ Parameters
+ ----------
+ invoice_id : str
+ The ID of the invoice to publish.
+
+ version : int
+ The version of the [invoice](entity:Invoice) to publish.
+ This must match the current version of the invoice; otherwise, the request is rejected.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the `PublishInvoice` request. If you do not
+ provide `idempotency_key` (or provide an empty string as the value), the endpoint
+ treats each request as independent.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[PublishInvoiceResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/invoices/{jsonable_encoder(invoice_id)}/publish",
+ method="POST",
+ json={
+ "version": version,
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ PublishInvoiceResponse,
+ construct_type(
+ type_=PublishInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/labor/__init__.py b/src/square/labor/__init__.py
new file mode 100644
index 00000000..b0129977
--- /dev/null
+++ b/src/square/labor/__init__.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import break_types, employee_wages, shifts, team_member_wages, workweek_configs
+_dynamic_imports: typing.Dict[str, str] = {
+ "break_types": ".break_types",
+ "employee_wages": ".employee_wages",
+ "shifts": ".shifts",
+ "team_member_wages": ".team_member_wages",
+ "workweek_configs": ".workweek_configs",
+}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["break_types", "employee_wages", "shifts", "team_member_wages", "workweek_configs"]
diff --git a/src/square/labor/break_types/__init__.py b/src/square/labor/break_types/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/labor/break_types/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/labor/break_types/client.py b/src/square/labor/break_types/client.py
new file mode 100644
index 00000000..f18a9209
--- /dev/null
+++ b/src/square/labor/break_types/client.py
@@ -0,0 +1,537 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.break_type import BreakTypeParams
+from ...types.break_type import BreakType
+from ...types.create_break_type_response import CreateBreakTypeResponse
+from ...types.delete_break_type_response import DeleteBreakTypeResponse
+from ...types.get_break_type_response import GetBreakTypeResponse
+from ...types.list_break_types_response import ListBreakTypesResponse
+from ...types.update_break_type_response import UpdateBreakTypeResponse
+from .raw_client import AsyncRawBreakTypesClient, RawBreakTypesClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class BreakTypesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawBreakTypesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawBreakTypesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawBreakTypesClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[BreakType, ListBreakTypesResponse]:
+ """
+ Returns a paginated list of `BreakType` instances for a business.
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+ Filter the returned `BreakType` results to only those that are associated with the
+ specified location.
+
+ limit : typing.Optional[int]
+ The maximum number of `BreakType` results to return per page. The number can range between 1
+ and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `BreakType` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[BreakType, ListBreakTypesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.labor.break_types.list(
+ location_id="location_id",
+ limit=1,
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ location_id=location_id, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ def create(
+ self,
+ *,
+ break_type: BreakTypeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateBreakTypeResponse:
+ """
+ Creates a new `BreakType`.
+
+ A `BreakType` is a template for creating `Break` objects.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `break_name`
+ - `expected_duration`
+ - `is_paid`
+
+ You can only have three `BreakType` instances per location. If you attempt to add a fourth
+ `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of 3 breaks per location."
+ is returned.
+
+ Parameters
+ ----------
+ break_type : BreakTypeParams
+ The `BreakType` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateBreakTypeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.break_types.create(
+ idempotency_key="PAD3NG5KSN2GL",
+ break_type={
+ "location_id": "CGJN03P1D08GF",
+ "break_name": "Lunch Break",
+ "expected_duration": "PT30M",
+ "is_paid": True,
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ break_type=break_type, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetBreakTypeResponse:
+ """
+ Returns a single `BreakType` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetBreakTypeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.break_types.get(
+ id="id",
+ )
+ """
+ _response = self._raw_client.get(id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self, id: str, *, break_type: BreakTypeParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateBreakTypeResponse:
+ """
+ Updates an existing `BreakType`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being updated.
+
+ break_type : BreakTypeParams
+ The updated `BreakType`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateBreakTypeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.break_types.update(
+ id="id",
+ break_type={
+ "location_id": "26M7H24AZ9N6R",
+ "break_name": "Lunch",
+ "expected_duration": "PT50M",
+ "is_paid": True,
+ "version": 1,
+ },
+ )
+ """
+ _response = self._raw_client.update(id, break_type=break_type, request_options=request_options)
+ return _response.data
+
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DeleteBreakTypeResponse:
+ """
+ Deletes an existing `BreakType`.
+
+ A `BreakType` can be deleted even if it is referenced from a `Shift`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteBreakTypeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.break_types.delete(
+ id="id",
+ )
+ """
+ _response = self._raw_client.delete(id, request_options=request_options)
+ return _response.data
+
+
+class AsyncBreakTypesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawBreakTypesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawBreakTypesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawBreakTypesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[BreakType, ListBreakTypesResponse]:
+ """
+ Returns a paginated list of `BreakType` instances for a business.
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+ Filter the returned `BreakType` results to only those that are associated with the
+ specified location.
+
+ limit : typing.Optional[int]
+ The maximum number of `BreakType` results to return per page. The number can range between 1
+ and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `BreakType` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[BreakType, ListBreakTypesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.labor.break_types.list(
+ location_id="location_id",
+ limit=1,
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ location_id=location_id, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ async def create(
+ self,
+ *,
+ break_type: BreakTypeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateBreakTypeResponse:
+ """
+ Creates a new `BreakType`.
+
+ A `BreakType` is a template for creating `Break` objects.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `break_name`
+ - `expected_duration`
+ - `is_paid`
+
+ You can only have three `BreakType` instances per location. If you attempt to add a fourth
+ `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of 3 breaks per location."
+ is returned.
+
+ Parameters
+ ----------
+ break_type : BreakTypeParams
+ The `BreakType` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateBreakTypeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.break_types.create(
+ idempotency_key="PAD3NG5KSN2GL",
+ break_type={
+ "location_id": "CGJN03P1D08GF",
+ "break_name": "Lunch Break",
+ "expected_duration": "PT30M",
+ "is_paid": True,
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ break_type=break_type, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetBreakTypeResponse:
+ """
+ Returns a single `BreakType` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetBreakTypeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.break_types.get(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self, id: str, *, break_type: BreakTypeParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateBreakTypeResponse:
+ """
+ Updates an existing `BreakType`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being updated.
+
+ break_type : BreakTypeParams
+ The updated `BreakType`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateBreakTypeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.break_types.update(
+ id="id",
+ break_type={
+ "location_id": "26M7H24AZ9N6R",
+ "break_name": "Lunch",
+ "expected_duration": "PT50M",
+ "is_paid": True,
+ "version": 1,
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(id, break_type=break_type, request_options=request_options)
+ return _response.data
+
+ async def delete(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteBreakTypeResponse:
+ """
+ Deletes an existing `BreakType`.
+
+ A `BreakType` can be deleted even if it is referenced from a `Shift`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteBreakTypeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.break_types.delete(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(id, request_options=request_options)
+ return _response.data
diff --git a/src/square/labor/break_types/raw_client.py b/src/square/labor/break_types/raw_client.py
new file mode 100644
index 00000000..e5c7ddd1
--- /dev/null
+++ b/src/square/labor/break_types/raw_client.py
@@ -0,0 +1,568 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.break_type import BreakTypeParams
+from ...types.break_type import BreakType
+from ...types.create_break_type_response import CreateBreakTypeResponse
+from ...types.delete_break_type_response import DeleteBreakTypeResponse
+from ...types.get_break_type_response import GetBreakTypeResponse
+from ...types.list_break_types_response import ListBreakTypesResponse
+from ...types.update_break_type_response import UpdateBreakTypeResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawBreakTypesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[BreakType, ListBreakTypesResponse]:
+ """
+ Returns a paginated list of `BreakType` instances for a business.
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+ Filter the returned `BreakType` results to only those that are associated with the
+ specified location.
+
+ limit : typing.Optional[int]
+ The maximum number of `BreakType` results to return per page. The number can range between 1
+ and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `BreakType` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[BreakType, ListBreakTypesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/break-types",
+ method="GET",
+ params={
+ "location_id": location_id,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListBreakTypesResponse,
+ construct_type(
+ type_=ListBreakTypesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.break_types
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ location_id=location_id,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ break_type: BreakTypeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateBreakTypeResponse]:
+ """
+ Creates a new `BreakType`.
+
+ A `BreakType` is a template for creating `Break` objects.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `break_name`
+ - `expected_duration`
+ - `is_paid`
+
+ You can only have three `BreakType` instances per location. If you attempt to add a fourth
+ `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of 3 breaks per location."
+ is returned.
+
+ Parameters
+ ----------
+ break_type : BreakTypeParams
+ The `BreakType` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateBreakTypeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/break-types",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "break_type": convert_and_respect_annotation_metadata(
+ object_=break_type, annotation=BreakTypeParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateBreakTypeResponse,
+ construct_type(
+ type_=CreateBreakTypeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetBreakTypeResponse]:
+ """
+ Returns a single `BreakType` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetBreakTypeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/break-types/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetBreakTypeResponse,
+ construct_type(
+ type_=GetBreakTypeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self, id: str, *, break_type: BreakTypeParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[UpdateBreakTypeResponse]:
+ """
+ Updates an existing `BreakType`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being updated.
+
+ break_type : BreakTypeParams
+ The updated `BreakType`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateBreakTypeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/break-types/{jsonable_encoder(id)}",
+ method="PUT",
+ json={
+ "break_type": convert_and_respect_annotation_metadata(
+ object_=break_type, annotation=BreakTypeParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateBreakTypeResponse,
+ construct_type(
+ type_=UpdateBreakTypeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteBreakTypeResponse]:
+ """
+ Deletes an existing `BreakType`.
+
+ A `BreakType` can be deleted even if it is referenced from a `Shift`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteBreakTypeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/break-types/{jsonable_encoder(id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteBreakTypeResponse,
+ construct_type(
+ type_=DeleteBreakTypeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawBreakTypesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[BreakType, ListBreakTypesResponse]:
+ """
+ Returns a paginated list of `BreakType` instances for a business.
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+ Filter the returned `BreakType` results to only those that are associated with the
+ specified location.
+
+ limit : typing.Optional[int]
+ The maximum number of `BreakType` results to return per page. The number can range between 1
+ and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `BreakType` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[BreakType, ListBreakTypesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/break-types",
+ method="GET",
+ params={
+ "location_id": location_id,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListBreakTypesResponse,
+ construct_type(
+ type_=ListBreakTypesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.break_types
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ location_id=location_id,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ break_type: BreakTypeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateBreakTypeResponse]:
+ """
+ Creates a new `BreakType`.
+
+ A `BreakType` is a template for creating `Break` objects.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `break_name`
+ - `expected_duration`
+ - `is_paid`
+
+ You can only have three `BreakType` instances per location. If you attempt to add a fourth
+ `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of 3 breaks per location."
+ is returned.
+
+ Parameters
+ ----------
+ break_type : BreakTypeParams
+ The `BreakType` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateBreakTypeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/break-types",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "break_type": convert_and_respect_annotation_metadata(
+ object_=break_type, annotation=BreakTypeParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateBreakTypeResponse,
+ construct_type(
+ type_=CreateBreakTypeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetBreakTypeResponse]:
+ """
+ Returns a single `BreakType` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetBreakTypeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/break-types/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetBreakTypeResponse,
+ construct_type(
+ type_=GetBreakTypeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self, id: str, *, break_type: BreakTypeParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[UpdateBreakTypeResponse]:
+ """
+ Updates an existing `BreakType`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being updated.
+
+ break_type : BreakTypeParams
+ The updated `BreakType`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateBreakTypeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/break-types/{jsonable_encoder(id)}",
+ method="PUT",
+ json={
+ "break_type": convert_and_respect_annotation_metadata(
+ object_=break_type, annotation=BreakTypeParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateBreakTypeResponse,
+ construct_type(
+ type_=UpdateBreakTypeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteBreakTypeResponse]:
+ """
+ Deletes an existing `BreakType`.
+
+ A `BreakType` can be deleted even if it is referenced from a `Shift`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `BreakType` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteBreakTypeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/break-types/{jsonable_encoder(id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteBreakTypeResponse,
+ construct_type(
+ type_=DeleteBreakTypeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/labor/client.py b/src/square/labor/client.py
new file mode 100644
index 00000000..099ebb40
--- /dev/null
+++ b/src/square/labor/client.py
@@ -0,0 +1,1511 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..requests.bulk_publish_scheduled_shifts_data import BulkPublishScheduledShiftsDataParams
+from ..requests.scheduled_shift import ScheduledShiftParams
+from ..requests.scheduled_shift_query import ScheduledShiftQueryParams
+from ..requests.timecard import TimecardParams
+from ..requests.timecard_query import TimecardQueryParams
+from ..types.bulk_publish_scheduled_shifts_response import BulkPublishScheduledShiftsResponse
+from ..types.create_scheduled_shift_response import CreateScheduledShiftResponse
+from ..types.create_timecard_response import CreateTimecardResponse
+from ..types.delete_timecard_response import DeleteTimecardResponse
+from ..types.publish_scheduled_shift_response import PublishScheduledShiftResponse
+from ..types.retrieve_scheduled_shift_response import RetrieveScheduledShiftResponse
+from ..types.retrieve_timecard_response import RetrieveTimecardResponse
+from ..types.scheduled_shift_notification_audience import ScheduledShiftNotificationAudience
+from ..types.search_scheduled_shifts_response import SearchScheduledShiftsResponse
+from ..types.search_timecards_response import SearchTimecardsResponse
+from ..types.update_scheduled_shift_response import UpdateScheduledShiftResponse
+from ..types.update_timecard_response import UpdateTimecardResponse
+from .raw_client import AsyncRawLaborClient, RawLaborClient
+
+if typing.TYPE_CHECKING:
+ from .break_types.client import AsyncBreakTypesClient, BreakTypesClient
+ from .employee_wages.client import AsyncEmployeeWagesClient, EmployeeWagesClient
+ from .shifts.client import AsyncShiftsClient, ShiftsClient
+ from .team_member_wages.client import AsyncTeamMemberWagesClient, TeamMemberWagesClient
+ from .workweek_configs.client import AsyncWorkweekConfigsClient, WorkweekConfigsClient
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class LaborClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawLaborClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._break_types: typing.Optional[BreakTypesClient] = None
+ self._employee_wages: typing.Optional[EmployeeWagesClient] = None
+ self._shifts: typing.Optional[ShiftsClient] = None
+ self._team_member_wages: typing.Optional[TeamMemberWagesClient] = None
+ self._workweek_configs: typing.Optional[WorkweekConfigsClient] = None
+
+ @property
+ def with_raw_response(self) -> RawLaborClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawLaborClient
+ """
+ return self._raw_client
+
+ def create_scheduled_shift(
+ self,
+ *,
+ scheduled_shift: ScheduledShiftParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateScheduledShiftResponse:
+ """
+ Creates a scheduled shift by providing draft shift details such as job ID,
+ team member assignment, and start and end times.
+
+ The following `draft_shift_details` fields are required:
+ - `location_id`
+ - `job_id`
+ - `start_at`
+ - `end_at`
+
+ Parameters
+ ----------
+ scheduled_shift : ScheduledShiftParams
+ The scheduled shift with `draft_shift_details`.
+ If needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs,
+ [ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get team member IDs and current job assignments.
+
+ The `start_at` and `end_at` timestamps must be provided in the time zone + offset of the
+ shift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for the `CreateScheduledShift` request, used to ensure the
+ [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateScheduledShiftResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.create_scheduled_shift(
+ idempotency_key="HIDSNG5KS478L",
+ scheduled_shift={
+ "draft_shift_details": {
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "location_id": "PAA1RJZZKXBFG",
+ "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M",
+ "start_at": "2019-01-25T03:11:00-05:00",
+ "end_at": "2019-01-25T13:11:00-05:00",
+ "notes": "Dont forget to prep the vegetables",
+ "is_deleted": False,
+ }
+ },
+ )
+ """
+ _response = self._raw_client.create_scheduled_shift(
+ scheduled_shift=scheduled_shift, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def bulk_publish_scheduled_shifts(
+ self,
+ *,
+ scheduled_shifts: typing.Dict[str, BulkPublishScheduledShiftsDataParams],
+ scheduled_shift_notification_audience: typing.Optional[ScheduledShiftNotificationAudience] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkPublishScheduledShiftsResponse:
+ """
+ Publishes 1 - 100 scheduled shifts. This endpoint takes a map of individual publish
+ requests and returns a map of responses. When a scheduled shift is published, Square keeps
+ the `draft_shift_details` field as is and copies it to the `published_shift_details` field.
+
+ The minimum `start_at` and maximum `end_at` timestamps of all shifts in a
+ `BulkPublishScheduledShifts` request must fall within a two-week period.
+
+ Parameters
+ ----------
+ scheduled_shifts : typing.Dict[str, BulkPublishScheduledShiftsDataParams]
+ A map of 1 to 100 key-value pairs that represent individual publish requests.
+
+ - Each key is the ID of a scheduled shift you want to publish.
+ - Each value is a `BulkPublishScheduledShiftsData` object that contains the
+ `version` field or is an empty object.
+
+ scheduled_shift_notification_audience : typing.Optional[ScheduledShiftNotificationAudience]
+ Indicates whether Square should send email notifications to team members and
+ which team members should receive the notifications. This setting applies to all shifts
+ specified in the bulk operation. The default value is `AFFECTED`.
+ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkPublishScheduledShiftsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.bulk_publish_scheduled_shifts(
+ scheduled_shifts={"key": {}},
+ scheduled_shift_notification_audience="AFFECTED",
+ )
+ """
+ _response = self._raw_client.bulk_publish_scheduled_shifts(
+ scheduled_shifts=scheduled_shifts,
+ scheduled_shift_notification_audience=scheduled_shift_notification_audience,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def search_scheduled_shifts(
+ self,
+ *,
+ query: typing.Optional[ScheduledShiftQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchScheduledShiftsResponse:
+ """
+ Returns a paginated list of scheduled shifts, with optional filter and sort settings.
+ By default, results are sorted by `start_at` in ascending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[ScheduledShiftQueryParams]
+ Query conditions used to filter and sort the results.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single response page. The default value is 50.
+
+ cursor : typing.Optional[str]
+ The pagination cursor returned by the previous call to this endpoint. Provide
+ this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchScheduledShiftsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.search_scheduled_shifts(
+ query={
+ "filter": {"assignment_status": "ASSIGNED"},
+ "sort": {"field": "CREATED_AT", "order": "ASC"},
+ },
+ limit=2,
+ cursor="xoxp-1234-5678-90123",
+ )
+ """
+ _response = self._raw_client.search_scheduled_shifts(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ def retrieve_scheduled_shift(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveScheduledShiftResponse:
+ """
+ Retrieves a scheduled shift by ID.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveScheduledShiftResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.retrieve_scheduled_shift(
+ id="id",
+ )
+ """
+ _response = self._raw_client.retrieve_scheduled_shift(id, request_options=request_options)
+ return _response.data
+
+ def update_scheduled_shift(
+ self, id: str, *, scheduled_shift: ScheduledShiftParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateScheduledShiftResponse:
+ """
+ Updates the draft shift details for a scheduled shift. This endpoint supports
+ sparse updates, so only new, changed, or removed fields are required in the request.
+ You must publish the shift to make updates public.
+
+ You can make the following updates to `draft_shift_details`:
+ - Change the `location_id`, `job_id`, `start_at`, and `end_at` fields.
+ - Add, change, or clear the `team_member_id` and `notes` fields. To clear these fields,
+ set the value to null.
+ - Change the `is_deleted` field. To delete a scheduled shift, set `is_deleted` to true
+ and then publish the shift.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to update.
+
+ scheduled_shift : ScheduledShiftParams
+ The scheduled shift with any updates in the `draft_shift_details` field.
+ If needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs,
+ [ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get team member IDs and current job assignments. Updates made to `published_shift_details`
+ are ignored.
+
+ If provided, the `start_at` and `end_at` timestamps must be in the time zone + offset of the
+ shift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for the request, provide the current version of the shift in the `version` field.
+ If the provided version doesn't match the server version, the request fails. If `version` is
+ omitted, Square executes a blind write, potentially overwriting data from another publish request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateScheduledShiftResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.update_scheduled_shift(
+ id="id",
+ scheduled_shift={
+ "draft_shift_details": {
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "location_id": "PAA1RJZZKXBFG",
+ "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M",
+ "start_at": "2019-03-25T03:11:00-05:00",
+ "end_at": "2019-03-25T13:18:00-05:00",
+ "notes": "Dont forget to prep the vegetables",
+ "is_deleted": False,
+ },
+ "version": 1,
+ },
+ )
+ """
+ _response = self._raw_client.update_scheduled_shift(
+ id, scheduled_shift=scheduled_shift, request_options=request_options
+ )
+ return _response.data
+
+ def publish_scheduled_shift(
+ self,
+ id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ scheduled_shift_notification_audience: typing.Optional[ScheduledShiftNotificationAudience] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> PublishScheduledShiftResponse:
+ """
+ Publishes a scheduled shift. When a scheduled shift is published, Square keeps the
+ `draft_shift_details` field as is and copies it to the `published_shift_details` field.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to publish.
+
+ idempotency_key : str
+ A unique identifier for the `PublishScheduledShift` request, used to ensure the
+ [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ of the operation.
+
+ version : typing.Optional[int]
+ The current version of the scheduled shift, used to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control. If the provided version doesn't match the server version, the request fails.
+ If omitted, Square executes a blind write, potentially overwriting data from another publish request.
+
+ scheduled_shift_notification_audience : typing.Optional[ScheduledShiftNotificationAudience]
+ Indicates whether Square should send an email notification to team members and
+ which team members should receive the notification. The default value is `AFFECTED`.
+ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ PublishScheduledShiftResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.publish_scheduled_shift(
+ id="id",
+ idempotency_key="HIDSNG5KS478L",
+ version=2,
+ scheduled_shift_notification_audience="ALL",
+ )
+ """
+ _response = self._raw_client.publish_scheduled_shift(
+ id,
+ idempotency_key=idempotency_key,
+ version=version,
+ scheduled_shift_notification_audience=scheduled_shift_notification_audience,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def create_timecard(
+ self,
+ *,
+ timecard: TimecardParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTimecardResponse:
+ """
+ Creates a new `Timecard`.
+
+ A `Timecard` represents a complete workday for a single team member.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `team_member_id`
+ - `start_at`
+
+ An attempt to create a new `Timecard` can result in a `BAD_REQUEST` error when:
+ - The `status` of the new `Timecard` is `OPEN` and the team member has another
+ timecard with an `OPEN` status.
+ - The `start_at` date is in the future.
+ - The `start_at` or `end_at` date overlaps another timecard for the same team member.
+ - The `Break` instances are set in the request and a break `start_at`
+ is before the `Timecard.start_at`, a break `end_at` is after
+ the `Timecard.end_at`, or both.
+
+ Parameters
+ ----------
+ timecard : TimecardParams
+ The `Timecard` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTimecardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.create_timecard(
+ idempotency_key="HIDSNG5KS478L",
+ timecard={
+ "location_id": "PAA1RJZZKXBFG",
+ "start_at": "2019-01-25T03:11:00-05:00",
+ "end_at": "2019-01-25T13:11:00-05:00",
+ "wage": {
+ "title": "Barista",
+ "hourly_rate": {"amount": 1100, "currency": "USD"},
+ "tip_eligible": True,
+ },
+ "breaks": [
+ {
+ "start_at": "2019-01-25T06:11:00-05:00",
+ "end_at": "2019-01-25T06:16:00-05:00",
+ "break_type_id": "REGS1EQR1TPZ5",
+ "name": "Tea Break",
+ "expected_duration": "PT5M",
+ "is_paid": True,
+ }
+ ],
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "declared_cash_tip_money": {"amount": 500, "currency": "USD"},
+ },
+ )
+ """
+ _response = self._raw_client.create_timecard(
+ timecard=timecard, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def search_timecards(
+ self,
+ *,
+ query: typing.Optional[TimecardQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchTimecardsResponse:
+ """
+ Returns a paginated list of `Timecard` records for a business.
+ The list to be returned can be filtered by:
+ - Location IDs
+ - Team member IDs
+ - Timecard status (`OPEN` or `CLOSED`)
+ - Timecard start
+ - Timecard end
+ - Workday details
+
+ The list can be sorted by:
+ - `START_AT`
+ - `END_AT`
+ - `CREATED_AT`
+ - `UPDATED_AT`
+
+ Parameters
+ ----------
+ query : typing.Optional[TimecardQueryParams]
+ Query filters.
+
+ limit : typing.Optional[int]
+ The number of resources in a page (200 by default).
+
+ cursor : typing.Optional[str]
+ An opaque cursor for fetching the next page.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchTimecardsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.search_timecards(
+ query={
+ "filter": {
+ "workday": {
+ "date_range": {
+ "start_date": "2019-01-20",
+ "end_date": "2019-02-03",
+ },
+ "match_timecards_by": "START_AT",
+ "default_timezone": "America/Los_Angeles",
+ }
+ }
+ },
+ limit=100,
+ )
+ """
+ _response = self._raw_client.search_timecards(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ def retrieve_timecard(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveTimecardResponse:
+ """
+ Returns a single `Timecard` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Timecard` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveTimecardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.retrieve_timecard(
+ id="id",
+ )
+ """
+ _response = self._raw_client.retrieve_timecard(id, request_options=request_options)
+ return _response.data
+
+ def update_timecard(
+ self, id: str, *, timecard: TimecardParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateTimecardResponse:
+ """
+ Updates an existing `Timecard`.
+
+ When adding a `Break` to a `Timecard`, any earlier `Break` instances in the `Timecard` have
+ the `end_at` property set to a valid RFC-3339 datetime string.
+
+ When closing a `Timecard`, all `Break` instances in the `Timecard` must be complete with `end_at`
+ set on each `Break`.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the object being updated.
+
+ timecard : TimecardParams
+ The updated `Timecard` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateTimecardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.update_timecard(
+ id="id",
+ timecard={
+ "location_id": "PAA1RJZZKXBFG",
+ "start_at": "2019-01-25T03:11:00-05:00",
+ "end_at": "2019-01-25T13:11:00-05:00",
+ "wage": {
+ "title": "Bartender",
+ "hourly_rate": {"amount": 1500, "currency": "USD"},
+ "tip_eligible": True,
+ },
+ "breaks": [
+ {
+ "id": "X7GAQYVVRRG6P",
+ "start_at": "2019-01-25T06:11:00-05:00",
+ "end_at": "2019-01-25T06:16:00-05:00",
+ "break_type_id": "REGS1EQR1TPZ5",
+ "name": "Tea Break",
+ "expected_duration": "PT5M",
+ "is_paid": True,
+ }
+ ],
+ "status": "CLOSED",
+ "version": 1,
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "declared_cash_tip_money": {"amount": 500, "currency": "USD"},
+ },
+ )
+ """
+ _response = self._raw_client.update_timecard(id, timecard=timecard, request_options=request_options)
+ return _response.data
+
+ def delete_timecard(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteTimecardResponse:
+ """
+ Deletes a `Timecard`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Timecard` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteTimecardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.delete_timecard(
+ id="id",
+ )
+ """
+ _response = self._raw_client.delete_timecard(id, request_options=request_options)
+ return _response.data
+
+ @property
+ def break_types(self):
+ if self._break_types is None:
+ from .break_types.client import BreakTypesClient # noqa: E402
+
+ self._break_types = BreakTypesClient(client_wrapper=self._client_wrapper)
+ return self._break_types
+
+ @property
+ def employee_wages(self):
+ if self._employee_wages is None:
+ from .employee_wages.client import EmployeeWagesClient # noqa: E402
+
+ self._employee_wages = EmployeeWagesClient(client_wrapper=self._client_wrapper)
+ return self._employee_wages
+
+ @property
+ def shifts(self):
+ if self._shifts is None:
+ from .shifts.client import ShiftsClient # noqa: E402
+
+ self._shifts = ShiftsClient(client_wrapper=self._client_wrapper)
+ return self._shifts
+
+ @property
+ def team_member_wages(self):
+ if self._team_member_wages is None:
+ from .team_member_wages.client import TeamMemberWagesClient # noqa: E402
+
+ self._team_member_wages = TeamMemberWagesClient(client_wrapper=self._client_wrapper)
+ return self._team_member_wages
+
+ @property
+ def workweek_configs(self):
+ if self._workweek_configs is None:
+ from .workweek_configs.client import WorkweekConfigsClient # noqa: E402
+
+ self._workweek_configs = WorkweekConfigsClient(client_wrapper=self._client_wrapper)
+ return self._workweek_configs
+
+
+class AsyncLaborClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawLaborClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._break_types: typing.Optional[AsyncBreakTypesClient] = None
+ self._employee_wages: typing.Optional[AsyncEmployeeWagesClient] = None
+ self._shifts: typing.Optional[AsyncShiftsClient] = None
+ self._team_member_wages: typing.Optional[AsyncTeamMemberWagesClient] = None
+ self._workweek_configs: typing.Optional[AsyncWorkweekConfigsClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawLaborClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawLaborClient
+ """
+ return self._raw_client
+
+ async def create_scheduled_shift(
+ self,
+ *,
+ scheduled_shift: ScheduledShiftParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateScheduledShiftResponse:
+ """
+ Creates a scheduled shift by providing draft shift details such as job ID,
+ team member assignment, and start and end times.
+
+ The following `draft_shift_details` fields are required:
+ - `location_id`
+ - `job_id`
+ - `start_at`
+ - `end_at`
+
+ Parameters
+ ----------
+ scheduled_shift : ScheduledShiftParams
+ The scheduled shift with `draft_shift_details`.
+ If needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs,
+ [ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get team member IDs and current job assignments.
+
+ The `start_at` and `end_at` timestamps must be provided in the time zone + offset of the
+ shift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for the `CreateScheduledShift` request, used to ensure the
+ [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateScheduledShiftResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.create_scheduled_shift(
+ idempotency_key="HIDSNG5KS478L",
+ scheduled_shift={
+ "draft_shift_details": {
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "location_id": "PAA1RJZZKXBFG",
+ "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M",
+ "start_at": "2019-01-25T03:11:00-05:00",
+ "end_at": "2019-01-25T13:11:00-05:00",
+ "notes": "Dont forget to prep the vegetables",
+ "is_deleted": False,
+ }
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create_scheduled_shift(
+ scheduled_shift=scheduled_shift, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def bulk_publish_scheduled_shifts(
+ self,
+ *,
+ scheduled_shifts: typing.Dict[str, BulkPublishScheduledShiftsDataParams],
+ scheduled_shift_notification_audience: typing.Optional[ScheduledShiftNotificationAudience] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkPublishScheduledShiftsResponse:
+ """
+ Publishes 1 - 100 scheduled shifts. This endpoint takes a map of individual publish
+ requests and returns a map of responses. When a scheduled shift is published, Square keeps
+ the `draft_shift_details` field as is and copies it to the `published_shift_details` field.
+
+ The minimum `start_at` and maximum `end_at` timestamps of all shifts in a
+ `BulkPublishScheduledShifts` request must fall within a two-week period.
+
+ Parameters
+ ----------
+ scheduled_shifts : typing.Dict[str, BulkPublishScheduledShiftsDataParams]
+ A map of 1 to 100 key-value pairs that represent individual publish requests.
+
+ - Each key is the ID of a scheduled shift you want to publish.
+ - Each value is a `BulkPublishScheduledShiftsData` object that contains the
+ `version` field or is an empty object.
+
+ scheduled_shift_notification_audience : typing.Optional[ScheduledShiftNotificationAudience]
+ Indicates whether Square should send email notifications to team members and
+ which team members should receive the notifications. This setting applies to all shifts
+ specified in the bulk operation. The default value is `AFFECTED`.
+ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkPublishScheduledShiftsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.bulk_publish_scheduled_shifts(
+ scheduled_shifts={"key": {}},
+ scheduled_shift_notification_audience="AFFECTED",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.bulk_publish_scheduled_shifts(
+ scheduled_shifts=scheduled_shifts,
+ scheduled_shift_notification_audience=scheduled_shift_notification_audience,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def search_scheduled_shifts(
+ self,
+ *,
+ query: typing.Optional[ScheduledShiftQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchScheduledShiftsResponse:
+ """
+ Returns a paginated list of scheduled shifts, with optional filter and sort settings.
+ By default, results are sorted by `start_at` in ascending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[ScheduledShiftQueryParams]
+ Query conditions used to filter and sort the results.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single response page. The default value is 50.
+
+ cursor : typing.Optional[str]
+ The pagination cursor returned by the previous call to this endpoint. Provide
+ this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchScheduledShiftsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.search_scheduled_shifts(
+ query={
+ "filter": {"assignment_status": "ASSIGNED"},
+ "sort": {"field": "CREATED_AT", "order": "ASC"},
+ },
+ limit=2,
+ cursor="xoxp-1234-5678-90123",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search_scheduled_shifts(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ async def retrieve_scheduled_shift(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveScheduledShiftResponse:
+ """
+ Retrieves a scheduled shift by ID.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveScheduledShiftResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.retrieve_scheduled_shift(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.retrieve_scheduled_shift(id, request_options=request_options)
+ return _response.data
+
+ async def update_scheduled_shift(
+ self, id: str, *, scheduled_shift: ScheduledShiftParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateScheduledShiftResponse:
+ """
+ Updates the draft shift details for a scheduled shift. This endpoint supports
+ sparse updates, so only new, changed, or removed fields are required in the request.
+ You must publish the shift to make updates public.
+
+ You can make the following updates to `draft_shift_details`:
+ - Change the `location_id`, `job_id`, `start_at`, and `end_at` fields.
+ - Add, change, or clear the `team_member_id` and `notes` fields. To clear these fields,
+ set the value to null.
+ - Change the `is_deleted` field. To delete a scheduled shift, set `is_deleted` to true
+ and then publish the shift.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to update.
+
+ scheduled_shift : ScheduledShiftParams
+ The scheduled shift with any updates in the `draft_shift_details` field.
+ If needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs,
+ [ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get team member IDs and current job assignments. Updates made to `published_shift_details`
+ are ignored.
+
+ If provided, the `start_at` and `end_at` timestamps must be in the time zone + offset of the
+ shift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for the request, provide the current version of the shift in the `version` field.
+ If the provided version doesn't match the server version, the request fails. If `version` is
+ omitted, Square executes a blind write, potentially overwriting data from another publish request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateScheduledShiftResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.update_scheduled_shift(
+ id="id",
+ scheduled_shift={
+ "draft_shift_details": {
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "location_id": "PAA1RJZZKXBFG",
+ "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M",
+ "start_at": "2019-03-25T03:11:00-05:00",
+ "end_at": "2019-03-25T13:18:00-05:00",
+ "notes": "Dont forget to prep the vegetables",
+ "is_deleted": False,
+ },
+ "version": 1,
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update_scheduled_shift(
+ id, scheduled_shift=scheduled_shift, request_options=request_options
+ )
+ return _response.data
+
+ async def publish_scheduled_shift(
+ self,
+ id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ scheduled_shift_notification_audience: typing.Optional[ScheduledShiftNotificationAudience] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> PublishScheduledShiftResponse:
+ """
+ Publishes a scheduled shift. When a scheduled shift is published, Square keeps the
+ `draft_shift_details` field as is and copies it to the `published_shift_details` field.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to publish.
+
+ idempotency_key : str
+ A unique identifier for the `PublishScheduledShift` request, used to ensure the
+ [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ of the operation.
+
+ version : typing.Optional[int]
+ The current version of the scheduled shift, used to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control. If the provided version doesn't match the server version, the request fails.
+ If omitted, Square executes a blind write, potentially overwriting data from another publish request.
+
+ scheduled_shift_notification_audience : typing.Optional[ScheduledShiftNotificationAudience]
+ Indicates whether Square should send an email notification to team members and
+ which team members should receive the notification. The default value is `AFFECTED`.
+ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ PublishScheduledShiftResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.publish_scheduled_shift(
+ id="id",
+ idempotency_key="HIDSNG5KS478L",
+ version=2,
+ scheduled_shift_notification_audience="ALL",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.publish_scheduled_shift(
+ id,
+ idempotency_key=idempotency_key,
+ version=version,
+ scheduled_shift_notification_audience=scheduled_shift_notification_audience,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def create_timecard(
+ self,
+ *,
+ timecard: TimecardParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTimecardResponse:
+ """
+ Creates a new `Timecard`.
+
+ A `Timecard` represents a complete workday for a single team member.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `team_member_id`
+ - `start_at`
+
+ An attempt to create a new `Timecard` can result in a `BAD_REQUEST` error when:
+ - The `status` of the new `Timecard` is `OPEN` and the team member has another
+ timecard with an `OPEN` status.
+ - The `start_at` date is in the future.
+ - The `start_at` or `end_at` date overlaps another timecard for the same team member.
+ - The `Break` instances are set in the request and a break `start_at`
+ is before the `Timecard.start_at`, a break `end_at` is after
+ the `Timecard.end_at`, or both.
+
+ Parameters
+ ----------
+ timecard : TimecardParams
+ The `Timecard` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTimecardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.create_timecard(
+ idempotency_key="HIDSNG5KS478L",
+ timecard={
+ "location_id": "PAA1RJZZKXBFG",
+ "start_at": "2019-01-25T03:11:00-05:00",
+ "end_at": "2019-01-25T13:11:00-05:00",
+ "wage": {
+ "title": "Barista",
+ "hourly_rate": {"amount": 1100, "currency": "USD"},
+ "tip_eligible": True,
+ },
+ "breaks": [
+ {
+ "start_at": "2019-01-25T06:11:00-05:00",
+ "end_at": "2019-01-25T06:16:00-05:00",
+ "break_type_id": "REGS1EQR1TPZ5",
+ "name": "Tea Break",
+ "expected_duration": "PT5M",
+ "is_paid": True,
+ }
+ ],
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "declared_cash_tip_money": {"amount": 500, "currency": "USD"},
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create_timecard(
+ timecard=timecard, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def search_timecards(
+ self,
+ *,
+ query: typing.Optional[TimecardQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchTimecardsResponse:
+ """
+ Returns a paginated list of `Timecard` records for a business.
+ The list to be returned can be filtered by:
+ - Location IDs
+ - Team member IDs
+ - Timecard status (`OPEN` or `CLOSED`)
+ - Timecard start
+ - Timecard end
+ - Workday details
+
+ The list can be sorted by:
+ - `START_AT`
+ - `END_AT`
+ - `CREATED_AT`
+ - `UPDATED_AT`
+
+ Parameters
+ ----------
+ query : typing.Optional[TimecardQueryParams]
+ Query filters.
+
+ limit : typing.Optional[int]
+ The number of resources in a page (200 by default).
+
+ cursor : typing.Optional[str]
+ An opaque cursor for fetching the next page.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchTimecardsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.search_timecards(
+ query={
+ "filter": {
+ "workday": {
+ "date_range": {
+ "start_date": "2019-01-20",
+ "end_date": "2019-02-03",
+ },
+ "match_timecards_by": "START_AT",
+ "default_timezone": "America/Los_Angeles",
+ }
+ }
+ },
+ limit=100,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search_timecards(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ async def retrieve_timecard(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveTimecardResponse:
+ """
+ Returns a single `Timecard` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Timecard` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveTimecardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.retrieve_timecard(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.retrieve_timecard(id, request_options=request_options)
+ return _response.data
+
+ async def update_timecard(
+ self, id: str, *, timecard: TimecardParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateTimecardResponse:
+ """
+ Updates an existing `Timecard`.
+
+ When adding a `Break` to a `Timecard`, any earlier `Break` instances in the `Timecard` have
+ the `end_at` property set to a valid RFC-3339 datetime string.
+
+ When closing a `Timecard`, all `Break` instances in the `Timecard` must be complete with `end_at`
+ set on each `Break`.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the object being updated.
+
+ timecard : TimecardParams
+ The updated `Timecard` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateTimecardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.update_timecard(
+ id="id",
+ timecard={
+ "location_id": "PAA1RJZZKXBFG",
+ "start_at": "2019-01-25T03:11:00-05:00",
+ "end_at": "2019-01-25T13:11:00-05:00",
+ "wage": {
+ "title": "Bartender",
+ "hourly_rate": {"amount": 1500, "currency": "USD"},
+ "tip_eligible": True,
+ },
+ "breaks": [
+ {
+ "id": "X7GAQYVVRRG6P",
+ "start_at": "2019-01-25T06:11:00-05:00",
+ "end_at": "2019-01-25T06:16:00-05:00",
+ "break_type_id": "REGS1EQR1TPZ5",
+ "name": "Tea Break",
+ "expected_duration": "PT5M",
+ "is_paid": True,
+ }
+ ],
+ "status": "CLOSED",
+ "version": 1,
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "declared_cash_tip_money": {"amount": 500, "currency": "USD"},
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update_timecard(id, timecard=timecard, request_options=request_options)
+ return _response.data
+
+ async def delete_timecard(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteTimecardResponse:
+ """
+ Deletes a `Timecard`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Timecard` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteTimecardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.delete_timecard(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete_timecard(id, request_options=request_options)
+ return _response.data
+
+ @property
+ def break_types(self):
+ if self._break_types is None:
+ from .break_types.client import AsyncBreakTypesClient # noqa: E402
+
+ self._break_types = AsyncBreakTypesClient(client_wrapper=self._client_wrapper)
+ return self._break_types
+
+ @property
+ def employee_wages(self):
+ if self._employee_wages is None:
+ from .employee_wages.client import AsyncEmployeeWagesClient # noqa: E402
+
+ self._employee_wages = AsyncEmployeeWagesClient(client_wrapper=self._client_wrapper)
+ return self._employee_wages
+
+ @property
+ def shifts(self):
+ if self._shifts is None:
+ from .shifts.client import AsyncShiftsClient # noqa: E402
+
+ self._shifts = AsyncShiftsClient(client_wrapper=self._client_wrapper)
+ return self._shifts
+
+ @property
+ def team_member_wages(self):
+ if self._team_member_wages is None:
+ from .team_member_wages.client import AsyncTeamMemberWagesClient # noqa: E402
+
+ self._team_member_wages = AsyncTeamMemberWagesClient(client_wrapper=self._client_wrapper)
+ return self._team_member_wages
+
+ @property
+ def workweek_configs(self):
+ if self._workweek_configs is None:
+ from .workweek_configs.client import AsyncWorkweekConfigsClient # noqa: E402
+
+ self._workweek_configs = AsyncWorkweekConfigsClient(client_wrapper=self._client_wrapper)
+ return self._workweek_configs
diff --git a/src/square/labor/employee_wages/__init__.py b/src/square/labor/employee_wages/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/labor/employee_wages/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/labor/employee_wages/client.py b/src/square/labor/employee_wages/client.py
new file mode 100644
index 00000000..e2b854f5
--- /dev/null
+++ b/src/square/labor/employee_wages/client.py
@@ -0,0 +1,228 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...types.employee_wage import EmployeeWage
+from ...types.get_employee_wage_response import GetEmployeeWageResponse
+from ...types.list_employee_wages_response import ListEmployeeWagesResponse
+from .raw_client import AsyncRawEmployeeWagesClient, RawEmployeeWagesClient
+
+
+class EmployeeWagesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawEmployeeWagesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawEmployeeWagesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawEmployeeWagesClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ employee_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[EmployeeWage, ListEmployeeWagesResponse]:
+ """
+ Returns a paginated list of `EmployeeWage` instances for a business.
+
+ Parameters
+ ----------
+ employee_id : typing.Optional[str]
+ Filter the returned wages to only those that are associated with the specified employee.
+
+ limit : typing.Optional[int]
+ The maximum number of `EmployeeWage` results to return per page. The number can range between
+ 1 and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `EmployeeWage` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[EmployeeWage, ListEmployeeWagesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.labor.employee_wages.list(
+ employee_id="employee_id",
+ limit=1,
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ employee_id=employee_id, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetEmployeeWageResponse:
+ """
+ Returns a single `EmployeeWage` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `EmployeeWage` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetEmployeeWageResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.employee_wages.get(
+ id="id",
+ )
+ """
+ _response = self._raw_client.get(id, request_options=request_options)
+ return _response.data
+
+
+class AsyncEmployeeWagesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawEmployeeWagesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawEmployeeWagesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawEmployeeWagesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ employee_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[EmployeeWage, ListEmployeeWagesResponse]:
+ """
+ Returns a paginated list of `EmployeeWage` instances for a business.
+
+ Parameters
+ ----------
+ employee_id : typing.Optional[str]
+ Filter the returned wages to only those that are associated with the specified employee.
+
+ limit : typing.Optional[int]
+ The maximum number of `EmployeeWage` results to return per page. The number can range between
+ 1 and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `EmployeeWage` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[EmployeeWage, ListEmployeeWagesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.labor.employee_wages.list(
+ employee_id="employee_id",
+ limit=1,
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ employee_id=employee_id, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetEmployeeWageResponse:
+ """
+ Returns a single `EmployeeWage` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `EmployeeWage` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetEmployeeWageResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.employee_wages.get(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(id, request_options=request_options)
+ return _response.data
diff --git a/src/square/labor/employee_wages/raw_client.py b/src/square/labor/employee_wages/raw_client.py
new file mode 100644
index 00000000..bb4985b0
--- /dev/null
+++ b/src/square/labor/employee_wages/raw_client.py
@@ -0,0 +1,236 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.unchecked_base_model import construct_type
+from ...types.employee_wage import EmployeeWage
+from ...types.get_employee_wage_response import GetEmployeeWageResponse
+from ...types.list_employee_wages_response import ListEmployeeWagesResponse
+
+
+class RawEmployeeWagesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ employee_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[EmployeeWage, ListEmployeeWagesResponse]:
+ """
+ Returns a paginated list of `EmployeeWage` instances for a business.
+
+ Parameters
+ ----------
+ employee_id : typing.Optional[str]
+ Filter the returned wages to only those that are associated with the specified employee.
+
+ limit : typing.Optional[int]
+ The maximum number of `EmployeeWage` results to return per page. The number can range between
+ 1 and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `EmployeeWage` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[EmployeeWage, ListEmployeeWagesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/employee-wages",
+ method="GET",
+ params={
+ "employee_id": employee_id,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListEmployeeWagesResponse,
+ construct_type(
+ type_=ListEmployeeWagesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.employee_wages
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ employee_id=employee_id,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetEmployeeWageResponse]:
+ """
+ Returns a single `EmployeeWage` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `EmployeeWage` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetEmployeeWageResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/employee-wages/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetEmployeeWageResponse,
+ construct_type(
+ type_=GetEmployeeWageResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawEmployeeWagesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ employee_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[EmployeeWage, ListEmployeeWagesResponse]:
+ """
+ Returns a paginated list of `EmployeeWage` instances for a business.
+
+ Parameters
+ ----------
+ employee_id : typing.Optional[str]
+ Filter the returned wages to only those that are associated with the specified employee.
+
+ limit : typing.Optional[int]
+ The maximum number of `EmployeeWage` results to return per page. The number can range between
+ 1 and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `EmployeeWage` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[EmployeeWage, ListEmployeeWagesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/employee-wages",
+ method="GET",
+ params={
+ "employee_id": employee_id,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListEmployeeWagesResponse,
+ construct_type(
+ type_=ListEmployeeWagesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.employee_wages
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ employee_id=employee_id,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetEmployeeWageResponse]:
+ """
+ Returns a single `EmployeeWage` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `EmployeeWage` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetEmployeeWageResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/employee-wages/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetEmployeeWageResponse,
+ construct_type(
+ type_=GetEmployeeWageResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/labor/raw_client.py b/src/square/labor/raw_client.py
new file mode 100644
index 00000000..e2013f4d
--- /dev/null
+++ b/src/square/labor/raw_client.py
@@ -0,0 +1,1378 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.bulk_publish_scheduled_shifts_data import BulkPublishScheduledShiftsDataParams
+from ..requests.scheduled_shift import ScheduledShiftParams
+from ..requests.scheduled_shift_query import ScheduledShiftQueryParams
+from ..requests.timecard import TimecardParams
+from ..requests.timecard_query import TimecardQueryParams
+from ..types.bulk_publish_scheduled_shifts_response import BulkPublishScheduledShiftsResponse
+from ..types.create_scheduled_shift_response import CreateScheduledShiftResponse
+from ..types.create_timecard_response import CreateTimecardResponse
+from ..types.delete_timecard_response import DeleteTimecardResponse
+from ..types.publish_scheduled_shift_response import PublishScheduledShiftResponse
+from ..types.retrieve_scheduled_shift_response import RetrieveScheduledShiftResponse
+from ..types.retrieve_timecard_response import RetrieveTimecardResponse
+from ..types.scheduled_shift_notification_audience import ScheduledShiftNotificationAudience
+from ..types.search_scheduled_shifts_response import SearchScheduledShiftsResponse
+from ..types.search_timecards_response import SearchTimecardsResponse
+from ..types.update_scheduled_shift_response import UpdateScheduledShiftResponse
+from ..types.update_timecard_response import UpdateTimecardResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawLaborClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create_scheduled_shift(
+ self,
+ *,
+ scheduled_shift: ScheduledShiftParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateScheduledShiftResponse]:
+ """
+ Creates a scheduled shift by providing draft shift details such as job ID,
+ team member assignment, and start and end times.
+
+ The following `draft_shift_details` fields are required:
+ - `location_id`
+ - `job_id`
+ - `start_at`
+ - `end_at`
+
+ Parameters
+ ----------
+ scheduled_shift : ScheduledShiftParams
+ The scheduled shift with `draft_shift_details`.
+ If needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs,
+ [ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get team member IDs and current job assignments.
+
+ The `start_at` and `end_at` timestamps must be provided in the time zone + offset of the
+ shift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for the `CreateScheduledShift` request, used to ensure the
+ [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateScheduledShiftResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/scheduled-shifts",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "scheduled_shift": convert_and_respect_annotation_metadata(
+ object_=scheduled_shift, annotation=ScheduledShiftParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateScheduledShiftResponse,
+ construct_type(
+ type_=CreateScheduledShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def bulk_publish_scheduled_shifts(
+ self,
+ *,
+ scheduled_shifts: typing.Dict[str, BulkPublishScheduledShiftsDataParams],
+ scheduled_shift_notification_audience: typing.Optional[ScheduledShiftNotificationAudience] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BulkPublishScheduledShiftsResponse]:
+ """
+ Publishes 1 - 100 scheduled shifts. This endpoint takes a map of individual publish
+ requests and returns a map of responses. When a scheduled shift is published, Square keeps
+ the `draft_shift_details` field as is and copies it to the `published_shift_details` field.
+
+ The minimum `start_at` and maximum `end_at` timestamps of all shifts in a
+ `BulkPublishScheduledShifts` request must fall within a two-week period.
+
+ Parameters
+ ----------
+ scheduled_shifts : typing.Dict[str, BulkPublishScheduledShiftsDataParams]
+ A map of 1 to 100 key-value pairs that represent individual publish requests.
+
+ - Each key is the ID of a scheduled shift you want to publish.
+ - Each value is a `BulkPublishScheduledShiftsData` object that contains the
+ `version` field or is an empty object.
+
+ scheduled_shift_notification_audience : typing.Optional[ScheduledShiftNotificationAudience]
+ Indicates whether Square should send email notifications to team members and
+ which team members should receive the notifications. This setting applies to all shifts
+ specified in the bulk operation. The default value is `AFFECTED`.
+ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkPublishScheduledShiftsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/scheduled-shifts/bulk-publish",
+ method="POST",
+ json={
+ "scheduled_shifts": convert_and_respect_annotation_metadata(
+ object_=scheduled_shifts,
+ annotation=typing.Dict[str, BulkPublishScheduledShiftsDataParams],
+ direction="write",
+ ),
+ "scheduled_shift_notification_audience": scheduled_shift_notification_audience,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkPublishScheduledShiftsResponse,
+ construct_type(
+ type_=BulkPublishScheduledShiftsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search_scheduled_shifts(
+ self,
+ *,
+ query: typing.Optional[ScheduledShiftQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchScheduledShiftsResponse]:
+ """
+ Returns a paginated list of scheduled shifts, with optional filter and sort settings.
+ By default, results are sorted by `start_at` in ascending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[ScheduledShiftQueryParams]
+ Query conditions used to filter and sort the results.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single response page. The default value is 50.
+
+ cursor : typing.Optional[str]
+ The pagination cursor returned by the previous call to this endpoint. Provide
+ this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchScheduledShiftsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/scheduled-shifts/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=ScheduledShiftQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchScheduledShiftsResponse,
+ construct_type(
+ type_=SearchScheduledShiftsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def retrieve_scheduled_shift(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RetrieveScheduledShiftResponse]:
+ """
+ Retrieves a scheduled shift by ID.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveScheduledShiftResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/scheduled-shifts/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveScheduledShiftResponse,
+ construct_type(
+ type_=RetrieveScheduledShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update_scheduled_shift(
+ self, id: str, *, scheduled_shift: ScheduledShiftParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[UpdateScheduledShiftResponse]:
+ """
+ Updates the draft shift details for a scheduled shift. This endpoint supports
+ sparse updates, so only new, changed, or removed fields are required in the request.
+ You must publish the shift to make updates public.
+
+ You can make the following updates to `draft_shift_details`:
+ - Change the `location_id`, `job_id`, `start_at`, and `end_at` fields.
+ - Add, change, or clear the `team_member_id` and `notes` fields. To clear these fields,
+ set the value to null.
+ - Change the `is_deleted` field. To delete a scheduled shift, set `is_deleted` to true
+ and then publish the shift.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to update.
+
+ scheduled_shift : ScheduledShiftParams
+ The scheduled shift with any updates in the `draft_shift_details` field.
+ If needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs,
+ [ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get team member IDs and current job assignments. Updates made to `published_shift_details`
+ are ignored.
+
+ If provided, the `start_at` and `end_at` timestamps must be in the time zone + offset of the
+ shift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for the request, provide the current version of the shift in the `version` field.
+ If the provided version doesn't match the server version, the request fails. If `version` is
+ omitted, Square executes a blind write, potentially overwriting data from another publish request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateScheduledShiftResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/scheduled-shifts/{jsonable_encoder(id)}",
+ method="PUT",
+ json={
+ "scheduled_shift": convert_and_respect_annotation_metadata(
+ object_=scheduled_shift, annotation=ScheduledShiftParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateScheduledShiftResponse,
+ construct_type(
+ type_=UpdateScheduledShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def publish_scheduled_shift(
+ self,
+ id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ scheduled_shift_notification_audience: typing.Optional[ScheduledShiftNotificationAudience] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[PublishScheduledShiftResponse]:
+ """
+ Publishes a scheduled shift. When a scheduled shift is published, Square keeps the
+ `draft_shift_details` field as is and copies it to the `published_shift_details` field.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to publish.
+
+ idempotency_key : str
+ A unique identifier for the `PublishScheduledShift` request, used to ensure the
+ [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ of the operation.
+
+ version : typing.Optional[int]
+ The current version of the scheduled shift, used to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control. If the provided version doesn't match the server version, the request fails.
+ If omitted, Square executes a blind write, potentially overwriting data from another publish request.
+
+ scheduled_shift_notification_audience : typing.Optional[ScheduledShiftNotificationAudience]
+ Indicates whether Square should send an email notification to team members and
+ which team members should receive the notification. The default value is `AFFECTED`.
+ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[PublishScheduledShiftResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/scheduled-shifts/{jsonable_encoder(id)}/publish",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "version": version,
+ "scheduled_shift_notification_audience": scheduled_shift_notification_audience,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ PublishScheduledShiftResponse,
+ construct_type(
+ type_=PublishScheduledShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create_timecard(
+ self,
+ *,
+ timecard: TimecardParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateTimecardResponse]:
+ """
+ Creates a new `Timecard`.
+
+ A `Timecard` represents a complete workday for a single team member.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `team_member_id`
+ - `start_at`
+
+ An attempt to create a new `Timecard` can result in a `BAD_REQUEST` error when:
+ - The `status` of the new `Timecard` is `OPEN` and the team member has another
+ timecard with an `OPEN` status.
+ - The `start_at` date is in the future.
+ - The `start_at` or `end_at` date overlaps another timecard for the same team member.
+ - The `Break` instances are set in the request and a break `start_at`
+ is before the `Timecard.start_at`, a break `end_at` is after
+ the `Timecard.end_at`, or both.
+
+ Parameters
+ ----------
+ timecard : TimecardParams
+ The `Timecard` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateTimecardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/timecards",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "timecard": convert_and_respect_annotation_metadata(
+ object_=timecard, annotation=TimecardParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTimecardResponse,
+ construct_type(
+ type_=CreateTimecardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search_timecards(
+ self,
+ *,
+ query: typing.Optional[TimecardQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchTimecardsResponse]:
+ """
+ Returns a paginated list of `Timecard` records for a business.
+ The list to be returned can be filtered by:
+ - Location IDs
+ - Team member IDs
+ - Timecard status (`OPEN` or `CLOSED`)
+ - Timecard start
+ - Timecard end
+ - Workday details
+
+ The list can be sorted by:
+ - `START_AT`
+ - `END_AT`
+ - `CREATED_AT`
+ - `UPDATED_AT`
+
+ Parameters
+ ----------
+ query : typing.Optional[TimecardQueryParams]
+ Query filters.
+
+ limit : typing.Optional[int]
+ The number of resources in a page (200 by default).
+
+ cursor : typing.Optional[str]
+ An opaque cursor for fetching the next page.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchTimecardsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/timecards/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=TimecardQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchTimecardsResponse,
+ construct_type(
+ type_=SearchTimecardsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def retrieve_timecard(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RetrieveTimecardResponse]:
+ """
+ Returns a single `Timecard` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Timecard` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveTimecardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/timecards/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveTimecardResponse,
+ construct_type(
+ type_=RetrieveTimecardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update_timecard(
+ self, id: str, *, timecard: TimecardParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[UpdateTimecardResponse]:
+ """
+ Updates an existing `Timecard`.
+
+ When adding a `Break` to a `Timecard`, any earlier `Break` instances in the `Timecard` have
+ the `end_at` property set to a valid RFC-3339 datetime string.
+
+ When closing a `Timecard`, all `Break` instances in the `Timecard` must be complete with `end_at`
+ set on each `Break`.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the object being updated.
+
+ timecard : TimecardParams
+ The updated `Timecard` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateTimecardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/timecards/{jsonable_encoder(id)}",
+ method="PUT",
+ json={
+ "timecard": convert_and_respect_annotation_metadata(
+ object_=timecard, annotation=TimecardParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateTimecardResponse,
+ construct_type(
+ type_=UpdateTimecardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete_timecard(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteTimecardResponse]:
+ """
+ Deletes a `Timecard`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Timecard` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteTimecardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/timecards/{jsonable_encoder(id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteTimecardResponse,
+ construct_type(
+ type_=DeleteTimecardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawLaborClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create_scheduled_shift(
+ self,
+ *,
+ scheduled_shift: ScheduledShiftParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateScheduledShiftResponse]:
+ """
+ Creates a scheduled shift by providing draft shift details such as job ID,
+ team member assignment, and start and end times.
+
+ The following `draft_shift_details` fields are required:
+ - `location_id`
+ - `job_id`
+ - `start_at`
+ - `end_at`
+
+ Parameters
+ ----------
+ scheduled_shift : ScheduledShiftParams
+ The scheduled shift with `draft_shift_details`.
+ If needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs,
+ [ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get team member IDs and current job assignments.
+
+ The `start_at` and `end_at` timestamps must be provided in the time zone + offset of the
+ shift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for the `CreateScheduledShift` request, used to ensure the
+ [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateScheduledShiftResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/scheduled-shifts",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "scheduled_shift": convert_and_respect_annotation_metadata(
+ object_=scheduled_shift, annotation=ScheduledShiftParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateScheduledShiftResponse,
+ construct_type(
+ type_=CreateScheduledShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def bulk_publish_scheduled_shifts(
+ self,
+ *,
+ scheduled_shifts: typing.Dict[str, BulkPublishScheduledShiftsDataParams],
+ scheduled_shift_notification_audience: typing.Optional[ScheduledShiftNotificationAudience] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BulkPublishScheduledShiftsResponse]:
+ """
+ Publishes 1 - 100 scheduled shifts. This endpoint takes a map of individual publish
+ requests and returns a map of responses. When a scheduled shift is published, Square keeps
+ the `draft_shift_details` field as is and copies it to the `published_shift_details` field.
+
+ The minimum `start_at` and maximum `end_at` timestamps of all shifts in a
+ `BulkPublishScheduledShifts` request must fall within a two-week period.
+
+ Parameters
+ ----------
+ scheduled_shifts : typing.Dict[str, BulkPublishScheduledShiftsDataParams]
+ A map of 1 to 100 key-value pairs that represent individual publish requests.
+
+ - Each key is the ID of a scheduled shift you want to publish.
+ - Each value is a `BulkPublishScheduledShiftsData` object that contains the
+ `version` field or is an empty object.
+
+ scheduled_shift_notification_audience : typing.Optional[ScheduledShiftNotificationAudience]
+ Indicates whether Square should send email notifications to team members and
+ which team members should receive the notifications. This setting applies to all shifts
+ specified in the bulk operation. The default value is `AFFECTED`.
+ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkPublishScheduledShiftsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/scheduled-shifts/bulk-publish",
+ method="POST",
+ json={
+ "scheduled_shifts": convert_and_respect_annotation_metadata(
+ object_=scheduled_shifts,
+ annotation=typing.Dict[str, BulkPublishScheduledShiftsDataParams],
+ direction="write",
+ ),
+ "scheduled_shift_notification_audience": scheduled_shift_notification_audience,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkPublishScheduledShiftsResponse,
+ construct_type(
+ type_=BulkPublishScheduledShiftsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search_scheduled_shifts(
+ self,
+ *,
+ query: typing.Optional[ScheduledShiftQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchScheduledShiftsResponse]:
+ """
+ Returns a paginated list of scheduled shifts, with optional filter and sort settings.
+ By default, results are sorted by `start_at` in ascending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[ScheduledShiftQueryParams]
+ Query conditions used to filter and sort the results.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single response page. The default value is 50.
+
+ cursor : typing.Optional[str]
+ The pagination cursor returned by the previous call to this endpoint. Provide
+ this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchScheduledShiftsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/scheduled-shifts/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=ScheduledShiftQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchScheduledShiftsResponse,
+ construct_type(
+ type_=SearchScheduledShiftsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def retrieve_scheduled_shift(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RetrieveScheduledShiftResponse]:
+ """
+ Retrieves a scheduled shift by ID.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveScheduledShiftResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/scheduled-shifts/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveScheduledShiftResponse,
+ construct_type(
+ type_=RetrieveScheduledShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update_scheduled_shift(
+ self, id: str, *, scheduled_shift: ScheduledShiftParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[UpdateScheduledShiftResponse]:
+ """
+ Updates the draft shift details for a scheduled shift. This endpoint supports
+ sparse updates, so only new, changed, or removed fields are required in the request.
+ You must publish the shift to make updates public.
+
+ You can make the following updates to `draft_shift_details`:
+ - Change the `location_id`, `job_id`, `start_at`, and `end_at` fields.
+ - Add, change, or clear the `team_member_id` and `notes` fields. To clear these fields,
+ set the value to null.
+ - Change the `is_deleted` field. To delete a scheduled shift, set `is_deleted` to true
+ and then publish the shift.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to update.
+
+ scheduled_shift : ScheduledShiftParams
+ The scheduled shift with any updates in the `draft_shift_details` field.
+ If needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs,
+ [ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get team member IDs and current job assignments. Updates made to `published_shift_details`
+ are ignored.
+
+ If provided, the `start_at` and `end_at` timestamps must be in the time zone + offset of the
+ shift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for the request, provide the current version of the shift in the `version` field.
+ If the provided version doesn't match the server version, the request fails. If `version` is
+ omitted, Square executes a blind write, potentially overwriting data from another publish request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateScheduledShiftResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/scheduled-shifts/{jsonable_encoder(id)}",
+ method="PUT",
+ json={
+ "scheduled_shift": convert_and_respect_annotation_metadata(
+ object_=scheduled_shift, annotation=ScheduledShiftParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateScheduledShiftResponse,
+ construct_type(
+ type_=UpdateScheduledShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def publish_scheduled_shift(
+ self,
+ id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ scheduled_shift_notification_audience: typing.Optional[ScheduledShiftNotificationAudience] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[PublishScheduledShiftResponse]:
+ """
+ Publishes a scheduled shift. When a scheduled shift is published, Square keeps the
+ `draft_shift_details` field as is and copies it to the `published_shift_details` field.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the scheduled shift to publish.
+
+ idempotency_key : str
+ A unique identifier for the `PublishScheduledShift` request, used to ensure the
+ [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
+ of the operation.
+
+ version : typing.Optional[int]
+ The current version of the scheduled shift, used to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control. If the provided version doesn't match the server version, the request fails.
+ If omitted, Square executes a blind write, potentially overwriting data from another publish request.
+
+ scheduled_shift_notification_audience : typing.Optional[ScheduledShiftNotificationAudience]
+ Indicates whether Square should send an email notification to team members and
+ which team members should receive the notification. The default value is `AFFECTED`.
+ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[PublishScheduledShiftResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/scheduled-shifts/{jsonable_encoder(id)}/publish",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "version": version,
+ "scheduled_shift_notification_audience": scheduled_shift_notification_audience,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ PublishScheduledShiftResponse,
+ construct_type(
+ type_=PublishScheduledShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create_timecard(
+ self,
+ *,
+ timecard: TimecardParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateTimecardResponse]:
+ """
+ Creates a new `Timecard`.
+
+ A `Timecard` represents a complete workday for a single team member.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `team_member_id`
+ - `start_at`
+
+ An attempt to create a new `Timecard` can result in a `BAD_REQUEST` error when:
+ - The `status` of the new `Timecard` is `OPEN` and the team member has another
+ timecard with an `OPEN` status.
+ - The `start_at` date is in the future.
+ - The `start_at` or `end_at` date overlaps another timecard for the same team member.
+ - The `Break` instances are set in the request and a break `start_at`
+ is before the `Timecard.start_at`, a break `end_at` is after
+ the `Timecard.end_at`, or both.
+
+ Parameters
+ ----------
+ timecard : TimecardParams
+ The `Timecard` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateTimecardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/timecards",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "timecard": convert_and_respect_annotation_metadata(
+ object_=timecard, annotation=TimecardParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTimecardResponse,
+ construct_type(
+ type_=CreateTimecardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search_timecards(
+ self,
+ *,
+ query: typing.Optional[TimecardQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchTimecardsResponse]:
+ """
+ Returns a paginated list of `Timecard` records for a business.
+ The list to be returned can be filtered by:
+ - Location IDs
+ - Team member IDs
+ - Timecard status (`OPEN` or `CLOSED`)
+ - Timecard start
+ - Timecard end
+ - Workday details
+
+ The list can be sorted by:
+ - `START_AT`
+ - `END_AT`
+ - `CREATED_AT`
+ - `UPDATED_AT`
+
+ Parameters
+ ----------
+ query : typing.Optional[TimecardQueryParams]
+ Query filters.
+
+ limit : typing.Optional[int]
+ The number of resources in a page (200 by default).
+
+ cursor : typing.Optional[str]
+ An opaque cursor for fetching the next page.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchTimecardsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/timecards/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=TimecardQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchTimecardsResponse,
+ construct_type(
+ type_=SearchTimecardsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def retrieve_timecard(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RetrieveTimecardResponse]:
+ """
+ Returns a single `Timecard` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Timecard` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveTimecardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/timecards/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveTimecardResponse,
+ construct_type(
+ type_=RetrieveTimecardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update_timecard(
+ self, id: str, *, timecard: TimecardParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[UpdateTimecardResponse]:
+ """
+ Updates an existing `Timecard`.
+
+ When adding a `Break` to a `Timecard`, any earlier `Break` instances in the `Timecard` have
+ the `end_at` property set to a valid RFC-3339 datetime string.
+
+ When closing a `Timecard`, all `Break` instances in the `Timecard` must be complete with `end_at`
+ set on each `Break`.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the object being updated.
+
+ timecard : TimecardParams
+ The updated `Timecard` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateTimecardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/timecards/{jsonable_encoder(id)}",
+ method="PUT",
+ json={
+ "timecard": convert_and_respect_annotation_metadata(
+ object_=timecard, annotation=TimecardParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateTimecardResponse,
+ construct_type(
+ type_=UpdateTimecardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete_timecard(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteTimecardResponse]:
+ """
+ Deletes a `Timecard`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Timecard` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteTimecardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/timecards/{jsonable_encoder(id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteTimecardResponse,
+ construct_type(
+ type_=DeleteTimecardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/labor/shifts/__init__.py b/src/square/labor/shifts/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/labor/shifts/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/labor/shifts/client.py b/src/square/labor/shifts/client.py
new file mode 100644
index 00000000..6ad4f935
--- /dev/null
+++ b/src/square/labor/shifts/client.py
@@ -0,0 +1,647 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...requests.shift import ShiftParams
+from ...requests.shift_query import ShiftQueryParams
+from ...types.create_shift_response import CreateShiftResponse
+from ...types.delete_shift_response import DeleteShiftResponse
+from ...types.get_shift_response import GetShiftResponse
+from ...types.search_shifts_response import SearchShiftsResponse
+from ...types.update_shift_response import UpdateShiftResponse
+from .raw_client import AsyncRawShiftsClient, RawShiftsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class ShiftsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawShiftsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawShiftsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawShiftsClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ *,
+ shift: ShiftParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateShiftResponse:
+ """
+ Creates a new `Shift`.
+
+ A `Shift` represents a complete workday for a single team member.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `team_member_id`
+ - `start_at`
+
+ An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when:
+ - The `status` of the new `Shift` is `OPEN` and the team member has another
+ shift with an `OPEN` status.
+ - The `start_at` date is in the future.
+ - The `start_at` or `end_at` date overlaps another shift for the same team member.
+ - The `Break` instances are set in the request and a break `start_at`
+ is before the `Shift.start_at`, a break `end_at` is after
+ the `Shift.end_at`, or both.
+
+ Parameters
+ ----------
+ shift : ShiftParams
+ The `Shift` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateShiftResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.shifts.create(
+ idempotency_key="HIDSNG5KS478L",
+ shift={
+ "location_id": "PAA1RJZZKXBFG",
+ "start_at": "2019-01-25T03:11:00-05:00",
+ "end_at": "2019-01-25T13:11:00-05:00",
+ "wage": {
+ "title": "Barista",
+ "hourly_rate": {"amount": 1100, "currency": "USD"},
+ "tip_eligible": True,
+ },
+ "breaks": [
+ {
+ "start_at": "2019-01-25T06:11:00-05:00",
+ "end_at": "2019-01-25T06:16:00-05:00",
+ "break_type_id": "REGS1EQR1TPZ5",
+ "name": "Tea Break",
+ "expected_duration": "PT5M",
+ "is_paid": True,
+ }
+ ],
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "declared_cash_tip_money": {"amount": 500, "currency": "USD"},
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ shift=shift, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[ShiftQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchShiftsResponse:
+ """
+ Returns a paginated list of `Shift` records for a business.
+ The list to be returned can be filtered by:
+ - Location IDs
+ - Team member IDs
+ - Shift status (`OPEN` or `CLOSED`)
+ - Shift start
+ - Shift end
+ - Workday details
+
+ The list can be sorted by:
+ - `START_AT`
+ - `END_AT`
+ - `CREATED_AT`
+ - `UPDATED_AT`
+
+ Parameters
+ ----------
+ query : typing.Optional[ShiftQueryParams]
+ Query filters.
+
+ limit : typing.Optional[int]
+ The number of resources in a page (200 by default).
+
+ cursor : typing.Optional[str]
+ An opaque cursor for fetching the next page.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchShiftsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.shifts.search(
+ query={
+ "filter": {
+ "workday": {
+ "date_range": {
+ "start_date": "2019-01-20",
+ "end_date": "2019-02-03",
+ },
+ "match_shifts_by": "START_AT",
+ "default_timezone": "America/Los_Angeles",
+ }
+ }
+ },
+ limit=100,
+ )
+ """
+ _response = self._raw_client.search(query=query, limit=limit, cursor=cursor, request_options=request_options)
+ return _response.data
+
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetShiftResponse:
+ """
+ Returns a single `Shift` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Shift` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetShiftResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.shifts.get(
+ id="id",
+ )
+ """
+ _response = self._raw_client.get(id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self, id: str, *, shift: ShiftParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateShiftResponse:
+ """
+ Updates an existing `Shift`.
+
+ When adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have
+ the `end_at` property set to a valid RFC-3339 datetime string.
+
+ When closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at`
+ set on each `Break`.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the object being updated.
+
+ shift : ShiftParams
+ The updated `Shift` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateShiftResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.shifts.update(
+ id="id",
+ shift={
+ "location_id": "PAA1RJZZKXBFG",
+ "start_at": "2019-01-25T03:11:00-05:00",
+ "end_at": "2019-01-25T13:11:00-05:00",
+ "wage": {
+ "title": "Bartender",
+ "hourly_rate": {"amount": 1500, "currency": "USD"},
+ "tip_eligible": True,
+ },
+ "breaks": [
+ {
+ "id": "X7GAQYVVRRG6P",
+ "start_at": "2019-01-25T06:11:00-05:00",
+ "end_at": "2019-01-25T06:16:00-05:00",
+ "break_type_id": "REGS1EQR1TPZ5",
+ "name": "Tea Break",
+ "expected_duration": "PT5M",
+ "is_paid": True,
+ }
+ ],
+ "version": 1,
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "declared_cash_tip_money": {"amount": 500, "currency": "USD"},
+ },
+ )
+ """
+ _response = self._raw_client.update(id, shift=shift, request_options=request_options)
+ return _response.data
+
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DeleteShiftResponse:
+ """
+ Deletes a `Shift`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Shift` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteShiftResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.shifts.delete(
+ id="id",
+ )
+ """
+ _response = self._raw_client.delete(id, request_options=request_options)
+ return _response.data
+
+
+class AsyncShiftsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawShiftsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawShiftsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawShiftsClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ *,
+ shift: ShiftParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateShiftResponse:
+ """
+ Creates a new `Shift`.
+
+ A `Shift` represents a complete workday for a single team member.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `team_member_id`
+ - `start_at`
+
+ An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when:
+ - The `status` of the new `Shift` is `OPEN` and the team member has another
+ shift with an `OPEN` status.
+ - The `start_at` date is in the future.
+ - The `start_at` or `end_at` date overlaps another shift for the same team member.
+ - The `Break` instances are set in the request and a break `start_at`
+ is before the `Shift.start_at`, a break `end_at` is after
+ the `Shift.end_at`, or both.
+
+ Parameters
+ ----------
+ shift : ShiftParams
+ The `Shift` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateShiftResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.shifts.create(
+ idempotency_key="HIDSNG5KS478L",
+ shift={
+ "location_id": "PAA1RJZZKXBFG",
+ "start_at": "2019-01-25T03:11:00-05:00",
+ "end_at": "2019-01-25T13:11:00-05:00",
+ "wage": {
+ "title": "Barista",
+ "hourly_rate": {"amount": 1100, "currency": "USD"},
+ "tip_eligible": True,
+ },
+ "breaks": [
+ {
+ "start_at": "2019-01-25T06:11:00-05:00",
+ "end_at": "2019-01-25T06:16:00-05:00",
+ "break_type_id": "REGS1EQR1TPZ5",
+ "name": "Tea Break",
+ "expected_duration": "PT5M",
+ "is_paid": True,
+ }
+ ],
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "declared_cash_tip_money": {"amount": 500, "currency": "USD"},
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ shift=shift, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[ShiftQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchShiftsResponse:
+ """
+ Returns a paginated list of `Shift` records for a business.
+ The list to be returned can be filtered by:
+ - Location IDs
+ - Team member IDs
+ - Shift status (`OPEN` or `CLOSED`)
+ - Shift start
+ - Shift end
+ - Workday details
+
+ The list can be sorted by:
+ - `START_AT`
+ - `END_AT`
+ - `CREATED_AT`
+ - `UPDATED_AT`
+
+ Parameters
+ ----------
+ query : typing.Optional[ShiftQueryParams]
+ Query filters.
+
+ limit : typing.Optional[int]
+ The number of resources in a page (200 by default).
+
+ cursor : typing.Optional[str]
+ An opaque cursor for fetching the next page.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchShiftsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.shifts.search(
+ query={
+ "filter": {
+ "workday": {
+ "date_range": {
+ "start_date": "2019-01-20",
+ "end_date": "2019-02-03",
+ },
+ "match_shifts_by": "START_AT",
+ "default_timezone": "America/Los_Angeles",
+ }
+ }
+ },
+ limit=100,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetShiftResponse:
+ """
+ Returns a single `Shift` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Shift` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetShiftResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.shifts.get(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self, id: str, *, shift: ShiftParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateShiftResponse:
+ """
+ Updates an existing `Shift`.
+
+ When adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have
+ the `end_at` property set to a valid RFC-3339 datetime string.
+
+ When closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at`
+ set on each `Break`.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the object being updated.
+
+ shift : ShiftParams
+ The updated `Shift` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateShiftResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.shifts.update(
+ id="id",
+ shift={
+ "location_id": "PAA1RJZZKXBFG",
+ "start_at": "2019-01-25T03:11:00-05:00",
+ "end_at": "2019-01-25T13:11:00-05:00",
+ "wage": {
+ "title": "Bartender",
+ "hourly_rate": {"amount": 1500, "currency": "USD"},
+ "tip_eligible": True,
+ },
+ "breaks": [
+ {
+ "id": "X7GAQYVVRRG6P",
+ "start_at": "2019-01-25T06:11:00-05:00",
+ "end_at": "2019-01-25T06:16:00-05:00",
+ "break_type_id": "REGS1EQR1TPZ5",
+ "name": "Tea Break",
+ "expected_duration": "PT5M",
+ "is_paid": True,
+ }
+ ],
+ "version": 1,
+ "team_member_id": "ormj0jJJZ5OZIzxrZYJI",
+ "declared_cash_tip_money": {"amount": 500, "currency": "USD"},
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(id, shift=shift, request_options=request_options)
+ return _response.data
+
+ async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DeleteShiftResponse:
+ """
+ Deletes a `Shift`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Shift` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteShiftResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.shifts.delete(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(id, request_options=request_options)
+ return _response.data
diff --git a/src/square/labor/shifts/raw_client.py b/src/square/labor/shifts/raw_client.py
new file mode 100644
index 00000000..bad5dc91
--- /dev/null
+++ b/src/square/labor/shifts/raw_client.py
@@ -0,0 +1,596 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.shift import ShiftParams
+from ...requests.shift_query import ShiftQueryParams
+from ...types.create_shift_response import CreateShiftResponse
+from ...types.delete_shift_response import DeleteShiftResponse
+from ...types.get_shift_response import GetShiftResponse
+from ...types.search_shifts_response import SearchShiftsResponse
+from ...types.update_shift_response import UpdateShiftResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawShiftsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ shift: ShiftParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateShiftResponse]:
+ """
+ Creates a new `Shift`.
+
+ A `Shift` represents a complete workday for a single team member.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `team_member_id`
+ - `start_at`
+
+ An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when:
+ - The `status` of the new `Shift` is `OPEN` and the team member has another
+ shift with an `OPEN` status.
+ - The `start_at` date is in the future.
+ - The `start_at` or `end_at` date overlaps another shift for the same team member.
+ - The `Break` instances are set in the request and a break `start_at`
+ is before the `Shift.start_at`, a break `end_at` is after
+ the `Shift.end_at`, or both.
+
+ Parameters
+ ----------
+ shift : ShiftParams
+ The `Shift` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateShiftResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/shifts",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "shift": convert_and_respect_annotation_metadata(
+ object_=shift, annotation=ShiftParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateShiftResponse,
+ construct_type(
+ type_=CreateShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[ShiftQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchShiftsResponse]:
+ """
+ Returns a paginated list of `Shift` records for a business.
+ The list to be returned can be filtered by:
+ - Location IDs
+ - Team member IDs
+ - Shift status (`OPEN` or `CLOSED`)
+ - Shift start
+ - Shift end
+ - Workday details
+
+ The list can be sorted by:
+ - `START_AT`
+ - `END_AT`
+ - `CREATED_AT`
+ - `UPDATED_AT`
+
+ Parameters
+ ----------
+ query : typing.Optional[ShiftQueryParams]
+ Query filters.
+
+ limit : typing.Optional[int]
+ The number of resources in a page (200 by default).
+
+ cursor : typing.Optional[str]
+ An opaque cursor for fetching the next page.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchShiftsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/shifts/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=ShiftQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchShiftsResponse,
+ construct_type(
+ type_=SearchShiftsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetShiftResponse]:
+ """
+ Returns a single `Shift` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Shift` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetShiftResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/shifts/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetShiftResponse,
+ construct_type(
+ type_=GetShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self, id: str, *, shift: ShiftParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[UpdateShiftResponse]:
+ """
+ Updates an existing `Shift`.
+
+ When adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have
+ the `end_at` property set to a valid RFC-3339 datetime string.
+
+ When closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at`
+ set on each `Break`.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the object being updated.
+
+ shift : ShiftParams
+ The updated `Shift` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateShiftResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/shifts/{jsonable_encoder(id)}",
+ method="PUT",
+ json={
+ "shift": convert_and_respect_annotation_metadata(
+ object_=shift, annotation=ShiftParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateShiftResponse,
+ construct_type(
+ type_=UpdateShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteShiftResponse]:
+ """
+ Deletes a `Shift`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Shift` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteShiftResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/shifts/{jsonable_encoder(id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteShiftResponse,
+ construct_type(
+ type_=DeleteShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawShiftsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ shift: ShiftParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateShiftResponse]:
+ """
+ Creates a new `Shift`.
+
+ A `Shift` represents a complete workday for a single team member.
+ You must provide the following values in your request to this
+ endpoint:
+
+ - `location_id`
+ - `team_member_id`
+ - `start_at`
+
+ An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when:
+ - The `status` of the new `Shift` is `OPEN` and the team member has another
+ shift with an `OPEN` status.
+ - The `start_at` date is in the future.
+ - The `start_at` or `end_at` date overlaps another shift for the same team member.
+ - The `Break` instances are set in the request and a break `start_at`
+ is before the `Shift.start_at`, a break `end_at` is after
+ the `Shift.end_at`, or both.
+
+ Parameters
+ ----------
+ shift : ShiftParams
+ The `Shift` to be created.
+
+ idempotency_key : typing.Optional[str]
+ A unique string value to ensure the idempotency of the operation.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateShiftResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/shifts",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "shift": convert_and_respect_annotation_metadata(
+ object_=shift, annotation=ShiftParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateShiftResponse,
+ construct_type(
+ type_=CreateShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[ShiftQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchShiftsResponse]:
+ """
+ Returns a paginated list of `Shift` records for a business.
+ The list to be returned can be filtered by:
+ - Location IDs
+ - Team member IDs
+ - Shift status (`OPEN` or `CLOSED`)
+ - Shift start
+ - Shift end
+ - Workday details
+
+ The list can be sorted by:
+ - `START_AT`
+ - `END_AT`
+ - `CREATED_AT`
+ - `UPDATED_AT`
+
+ Parameters
+ ----------
+ query : typing.Optional[ShiftQueryParams]
+ Query filters.
+
+ limit : typing.Optional[int]
+ The number of resources in a page (200 by default).
+
+ cursor : typing.Optional[str]
+ An opaque cursor for fetching the next page.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchShiftsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/shifts/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=ShiftQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchShiftsResponse,
+ construct_type(
+ type_=SearchShiftsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetShiftResponse]:
+ """
+ Returns a single `Shift` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Shift` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetShiftResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/shifts/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetShiftResponse,
+ construct_type(
+ type_=GetShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self, id: str, *, shift: ShiftParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[UpdateShiftResponse]:
+ """
+ Updates an existing `Shift`.
+
+ When adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have
+ the `end_at` property set to a valid RFC-3339 datetime string.
+
+ When closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at`
+ set on each `Break`.
+
+ Parameters
+ ----------
+ id : str
+ The ID of the object being updated.
+
+ shift : ShiftParams
+ The updated `Shift` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateShiftResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/shifts/{jsonable_encoder(id)}",
+ method="PUT",
+ json={
+ "shift": convert_and_respect_annotation_metadata(
+ object_=shift, annotation=ShiftParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateShiftResponse,
+ construct_type(
+ type_=UpdateShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteShiftResponse]:
+ """
+ Deletes a `Shift`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `Shift` being deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteShiftResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/shifts/{jsonable_encoder(id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteShiftResponse,
+ construct_type(
+ type_=DeleteShiftResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/labor/team_member_wages/__init__.py b/src/square/labor/team_member_wages/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/labor/team_member_wages/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/labor/team_member_wages/client.py b/src/square/labor/team_member_wages/client.py
new file mode 100644
index 00000000..d0b61c42
--- /dev/null
+++ b/src/square/labor/team_member_wages/client.py
@@ -0,0 +1,232 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...types.get_team_member_wage_response import GetTeamMemberWageResponse
+from ...types.list_team_member_wages_response import ListTeamMemberWagesResponse
+from ...types.team_member_wage import TeamMemberWage
+from .raw_client import AsyncRawTeamMemberWagesClient, RawTeamMemberWagesClient
+
+
+class TeamMemberWagesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawTeamMemberWagesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawTeamMemberWagesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawTeamMemberWagesClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ team_member_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[TeamMemberWage, ListTeamMemberWagesResponse]:
+ """
+ Returns a paginated list of `TeamMemberWage` instances for a business.
+
+ Parameters
+ ----------
+ team_member_id : typing.Optional[str]
+ Filter the returned wages to only those that are associated with the
+ specified team member.
+
+ limit : typing.Optional[int]
+ The maximum number of `TeamMemberWage` results to return per page. The number can range between
+ 1 and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `EmployeeWage` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[TeamMemberWage, ListTeamMemberWagesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.labor.team_member_wages.list(
+ team_member_id="team_member_id",
+ limit=1,
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ team_member_id=team_member_id, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetTeamMemberWageResponse:
+ """
+ Returns a single `TeamMemberWage` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `TeamMemberWage` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTeamMemberWageResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.team_member_wages.get(
+ id="id",
+ )
+ """
+ _response = self._raw_client.get(id, request_options=request_options)
+ return _response.data
+
+
+class AsyncTeamMemberWagesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawTeamMemberWagesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawTeamMemberWagesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawTeamMemberWagesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ team_member_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[TeamMemberWage, ListTeamMemberWagesResponse]:
+ """
+ Returns a paginated list of `TeamMemberWage` instances for a business.
+
+ Parameters
+ ----------
+ team_member_id : typing.Optional[str]
+ Filter the returned wages to only those that are associated with the
+ specified team member.
+
+ limit : typing.Optional[int]
+ The maximum number of `TeamMemberWage` results to return per page. The number can range between
+ 1 and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `EmployeeWage` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[TeamMemberWage, ListTeamMemberWagesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.labor.team_member_wages.list(
+ team_member_id="team_member_id",
+ limit=1,
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ team_member_id=team_member_id, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ async def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTeamMemberWageResponse:
+ """
+ Returns a single `TeamMemberWage` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `TeamMemberWage` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTeamMemberWageResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.team_member_wages.get(
+ id="id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(id, request_options=request_options)
+ return _response.data
diff --git a/src/square/labor/team_member_wages/raw_client.py b/src/square/labor/team_member_wages/raw_client.py
new file mode 100644
index 00000000..d28f5217
--- /dev/null
+++ b/src/square/labor/team_member_wages/raw_client.py
@@ -0,0 +1,238 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.unchecked_base_model import construct_type
+from ...types.get_team_member_wage_response import GetTeamMemberWageResponse
+from ...types.list_team_member_wages_response import ListTeamMemberWagesResponse
+from ...types.team_member_wage import TeamMemberWage
+
+
+class RawTeamMemberWagesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ team_member_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[TeamMemberWage, ListTeamMemberWagesResponse]:
+ """
+ Returns a paginated list of `TeamMemberWage` instances for a business.
+
+ Parameters
+ ----------
+ team_member_id : typing.Optional[str]
+ Filter the returned wages to only those that are associated with the
+ specified team member.
+
+ limit : typing.Optional[int]
+ The maximum number of `TeamMemberWage` results to return per page. The number can range between
+ 1 and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `EmployeeWage` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[TeamMemberWage, ListTeamMemberWagesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/team-member-wages",
+ method="GET",
+ params={
+ "team_member_id": team_member_id,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListTeamMemberWagesResponse,
+ construct_type(
+ type_=ListTeamMemberWagesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.team_member_wages
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ team_member_id=team_member_id,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetTeamMemberWageResponse]:
+ """
+ Returns a single `TeamMemberWage` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `TeamMemberWage` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetTeamMemberWageResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/team-member-wages/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTeamMemberWageResponse,
+ construct_type(
+ type_=GetTeamMemberWageResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawTeamMemberWagesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ team_member_id: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[TeamMemberWage, ListTeamMemberWagesResponse]:
+ """
+ Returns a paginated list of `TeamMemberWage` instances for a business.
+
+ Parameters
+ ----------
+ team_member_id : typing.Optional[str]
+ Filter the returned wages to only those that are associated with the
+ specified team member.
+
+ limit : typing.Optional[int]
+ The maximum number of `TeamMemberWage` results to return per page. The number can range between
+ 1 and 200. The default is 200.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `EmployeeWage` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[TeamMemberWage, ListTeamMemberWagesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/team-member-wages",
+ method="GET",
+ params={
+ "team_member_id": team_member_id,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListTeamMemberWagesResponse,
+ construct_type(
+ type_=ListTeamMemberWagesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.team_member_wages
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ team_member_id=team_member_id,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetTeamMemberWageResponse]:
+ """
+ Returns a single `TeamMemberWage` specified by `id`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `TeamMemberWage` being retrieved.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetTeamMemberWageResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/team-member-wages/{jsonable_encoder(id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTeamMemberWageResponse,
+ construct_type(
+ type_=GetTeamMemberWageResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/labor/workweek_configs/__init__.py b/src/square/labor/workweek_configs/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/labor/workweek_configs/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/labor/workweek_configs/client.py b/src/square/labor/workweek_configs/client.py
new file mode 100644
index 00000000..7e539bb5
--- /dev/null
+++ b/src/square/labor/workweek_configs/client.py
@@ -0,0 +1,236 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.workweek_config import WorkweekConfigParams
+from ...types.list_workweek_configs_response import ListWorkweekConfigsResponse
+from ...types.update_workweek_config_response import UpdateWorkweekConfigResponse
+from ...types.workweek_config import WorkweekConfig
+from .raw_client import AsyncRawWorkweekConfigsClient, RawWorkweekConfigsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class WorkweekConfigsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawWorkweekConfigsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawWorkweekConfigsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawWorkweekConfigsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[WorkweekConfig, ListWorkweekConfigsResponse]:
+ """
+ Returns a list of `WorkweekConfig` instances for a business.
+
+ Parameters
+ ----------
+ limit : typing.Optional[int]
+ The maximum number of `WorkweekConfigs` results to return per page.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `WorkweekConfig` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[WorkweekConfig, ListWorkweekConfigsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.labor.workweek_configs.list(
+ limit=1,
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(limit=limit, cursor=cursor, request_options=request_options)
+
+ def get(
+ self, id: str, *, workweek_config: WorkweekConfigParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateWorkweekConfigResponse:
+ """
+ Updates a `WorkweekConfig`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `WorkweekConfig` object being updated.
+
+ workweek_config : WorkweekConfigParams
+ The updated `WorkweekConfig` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateWorkweekConfigResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.labor.workweek_configs.get(
+ id="id",
+ workweek_config={
+ "start_of_week": "MON",
+ "start_of_day_local_time": "10:00",
+ "version": 10,
+ },
+ )
+ """
+ _response = self._raw_client.get(id, workweek_config=workweek_config, request_options=request_options)
+ return _response.data
+
+
+class AsyncWorkweekConfigsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawWorkweekConfigsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawWorkweekConfigsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawWorkweekConfigsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[WorkweekConfig, ListWorkweekConfigsResponse]:
+ """
+ Returns a list of `WorkweekConfig` instances for a business.
+
+ Parameters
+ ----------
+ limit : typing.Optional[int]
+ The maximum number of `WorkweekConfigs` results to return per page.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `WorkweekConfig` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[WorkweekConfig, ListWorkweekConfigsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.labor.workweek_configs.list(
+ limit=1,
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(limit=limit, cursor=cursor, request_options=request_options)
+
+ async def get(
+ self, id: str, *, workweek_config: WorkweekConfigParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateWorkweekConfigResponse:
+ """
+ Updates a `WorkweekConfig`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `WorkweekConfig` object being updated.
+
+ workweek_config : WorkweekConfigParams
+ The updated `WorkweekConfig` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateWorkweekConfigResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.labor.workweek_configs.get(
+ id="id",
+ workweek_config={
+ "start_of_week": "MON",
+ "start_of_day_local_time": "10:00",
+ "version": 10,
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(id, workweek_config=workweek_config, request_options=request_options)
+ return _response.data
diff --git a/src/square/labor/workweek_configs/raw_client.py b/src/square/labor/workweek_configs/raw_client.py
new file mode 100644
index 00000000..6e767b14
--- /dev/null
+++ b/src/square/labor/workweek_configs/raw_client.py
@@ -0,0 +1,251 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.workweek_config import WorkweekConfigParams
+from ...types.list_workweek_configs_response import ListWorkweekConfigsResponse
+from ...types.update_workweek_config_response import UpdateWorkweekConfigResponse
+from ...types.workweek_config import WorkweekConfig
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawWorkweekConfigsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[WorkweekConfig, ListWorkweekConfigsResponse]:
+ """
+ Returns a list of `WorkweekConfig` instances for a business.
+
+ Parameters
+ ----------
+ limit : typing.Optional[int]
+ The maximum number of `WorkweekConfigs` results to return per page.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `WorkweekConfig` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[WorkweekConfig, ListWorkweekConfigsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/labor/workweek-configs",
+ method="GET",
+ params={
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListWorkweekConfigsResponse,
+ construct_type(
+ type_=ListWorkweekConfigsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.workweek_configs
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, id: str, *, workweek_config: WorkweekConfigParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[UpdateWorkweekConfigResponse]:
+ """
+ Updates a `WorkweekConfig`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `WorkweekConfig` object being updated.
+
+ workweek_config : WorkweekConfigParams
+ The updated `WorkweekConfig` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateWorkweekConfigResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/labor/workweek-configs/{jsonable_encoder(id)}",
+ method="PUT",
+ json={
+ "workweek_config": convert_and_respect_annotation_metadata(
+ object_=workweek_config, annotation=WorkweekConfigParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateWorkweekConfigResponse,
+ construct_type(
+ type_=UpdateWorkweekConfigResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawWorkweekConfigsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[WorkweekConfig, ListWorkweekConfigsResponse]:
+ """
+ Returns a list of `WorkweekConfig` instances for a business.
+
+ Parameters
+ ----------
+ limit : typing.Optional[int]
+ The maximum number of `WorkweekConfigs` results to return per page.
+
+ cursor : typing.Optional[str]
+ A pointer to the next page of `WorkweekConfig` results to fetch.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[WorkweekConfig, ListWorkweekConfigsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/labor/workweek-configs",
+ method="GET",
+ params={
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListWorkweekConfigsResponse,
+ construct_type(
+ type_=ListWorkweekConfigsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.workweek_configs
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, id: str, *, workweek_config: WorkweekConfigParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[UpdateWorkweekConfigResponse]:
+ """
+ Updates a `WorkweekConfig`.
+
+ Parameters
+ ----------
+ id : str
+ The UUID for the `WorkweekConfig` object being updated.
+
+ workweek_config : WorkweekConfigParams
+ The updated `WorkweekConfig` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateWorkweekConfigResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/labor/workweek-configs/{jsonable_encoder(id)}",
+ method="PUT",
+ json={
+ "workweek_config": convert_and_respect_annotation_metadata(
+ object_=workweek_config, annotation=WorkweekConfigParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateWorkweekConfigResponse,
+ construct_type(
+ type_=UpdateWorkweekConfigResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/locations/__init__.py b/src/square/locations/__init__.py
new file mode 100644
index 00000000..8deb140c
--- /dev/null
+++ b/src/square/locations/__init__.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import custom_attribute_definitions, custom_attributes, transactions
+_dynamic_imports: typing.Dict[str, str] = {
+ "custom_attribute_definitions": ".custom_attribute_definitions",
+ "custom_attributes": ".custom_attributes",
+ "transactions": ".transactions",
+}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["custom_attribute_definitions", "custom_attributes", "transactions"]
diff --git a/src/square/locations/client.py b/src/square/locations/client.py
new file mode 100644
index 00000000..b97d01a8
--- /dev/null
+++ b/src/square/locations/client.py
@@ -0,0 +1,926 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..requests.address import AddressParams
+from ..requests.charge_request_additional_recipient import ChargeRequestAdditionalRecipientParams
+from ..requests.create_order_request import CreateOrderRequestParams
+from ..requests.location import LocationParams
+from ..types.create_checkout_response import CreateCheckoutResponse
+from ..types.create_location_response import CreateLocationResponse
+from ..types.get_location_response import GetLocationResponse
+from ..types.list_locations_response import ListLocationsResponse
+from ..types.update_location_response import UpdateLocationResponse
+from .raw_client import AsyncRawLocationsClient, RawLocationsClient
+
+if typing.TYPE_CHECKING:
+ from .custom_attribute_definitions.client import (
+ AsyncCustomAttributeDefinitionsClient,
+ CustomAttributeDefinitionsClient,
+ )
+ from .custom_attributes.client import AsyncCustomAttributesClient, CustomAttributesClient
+ from .transactions.client import AsyncTransactionsClient, TransactionsClient
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class LocationsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawLocationsClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._custom_attribute_definitions: typing.Optional[CustomAttributeDefinitionsClient] = None
+ self._custom_attributes: typing.Optional[CustomAttributesClient] = None
+ self._transactions: typing.Optional[TransactionsClient] = None
+
+ @property
+ def with_raw_response(self) -> RawLocationsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawLocationsClient
+ """
+ return self._raw_client
+
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListLocationsResponse:
+ """
+ Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
+ including those with an inactive status. Locations are listed alphabetically by `name`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListLocationsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.list()
+ """
+ _response = self._raw_client.list(request_options=request_options)
+ return _response.data
+
+ def create(
+ self,
+ *,
+ location: typing.Optional[LocationParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateLocationResponse:
+ """
+ Creates a [location](https://developer.squareup.com/docs/locations-api).
+ Creating new locations allows for separate configuration of receipt layouts, item prices,
+ and sales reports. Developers can use locations to separate sales activity through applications
+ that integrate with Square from sales activity elsewhere in a seller's account.
+ Locations created programmatically with the Locations API last forever and
+ are visible to the seller for their own management. Therefore, ensure that
+ each location has a sensible and unique name.
+
+ Parameters
+ ----------
+ location : typing.Optional[LocationParams]
+ The initial values of the location being created. The `name` field is required and must be unique within a seller account.
+ All other fields are optional, but any information you care about for the location should be included.
+ The remaining fields are automatically added based on the data from the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateLocationResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.create(
+ location={
+ "name": "Midtown",
+ "address": {
+ "address_line1": "1234 Peachtree St. NE",
+ "locality": "Atlanta",
+ "administrative_district_level1": "GA",
+ "postal_code": "30309",
+ },
+ "description": "Midtown Atlanta store",
+ },
+ )
+ """
+ _response = self._raw_client.create(location=location, request_options=request_options)
+ return _response.data
+
+ def get(self, location_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetLocationResponse:
+ """
+ Retrieves details of a single location. Specify "main"
+ as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to retrieve. Specify the string
+ "main" to return the main location.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetLocationResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.get(
+ location_id="location_id",
+ )
+ """
+ _response = self._raw_client.get(location_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ location_id: str,
+ *,
+ location: typing.Optional[LocationParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateLocationResponse:
+ """
+ Updates a [location](https://developer.squareup.com/docs/locations-api).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to update.
+
+ location : typing.Optional[LocationParams]
+ The `Location` object with only the fields to update.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateLocationResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.update(
+ location_id="location_id",
+ location={
+ "business_hours": {
+ "periods": [
+ {
+ "day_of_week": "FRI",
+ "start_local_time": "07:00",
+ "end_local_time": "18:00",
+ },
+ {
+ "day_of_week": "SAT",
+ "start_local_time": "07:00",
+ "end_local_time": "18:00",
+ },
+ {
+ "day_of_week": "SUN",
+ "start_local_time": "09:00",
+ "end_local_time": "15:00",
+ },
+ ]
+ },
+ "description": "Midtown Atlanta store - Open weekends",
+ },
+ )
+ """
+ _response = self._raw_client.update(location_id, location=location, request_options=request_options)
+ return _response.data
+
+ def checkouts(
+ self,
+ location_id: str,
+ *,
+ idempotency_key: str,
+ order: CreateOrderRequestParams,
+ ask_for_shipping_address: typing.Optional[bool] = OMIT,
+ merchant_support_email: typing.Optional[str] = OMIT,
+ pre_populate_buyer_email: typing.Optional[str] = OMIT,
+ pre_populate_shipping_address: typing.Optional[AddressParams] = OMIT,
+ redirect_url: typing.Optional[str] = OMIT,
+ additional_recipients: typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateCheckoutResponse:
+ """
+ Links a `checkoutId` to a `checkout_page_url` that customers are
+ directed to in order to provide their payment information using a
+ payment processing workflow hosted on connect.squareup.com.
+
+
+ NOTE: The Checkout API has been updated with new features.
+ For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the business location to associate the checkout with.
+
+ idempotency_key : str
+ A unique string that identifies this checkout among others you have created. It can be
+ any valid string but must be unique for every order sent to Square Checkout for a given location ID.
+
+ The idempotency key is used to avoid processing the same order more than once. If you are
+ unsure whether a particular checkout was created successfully, you can attempt it again with
+ the same idempotency key and all the same other parameters without worrying about creating duplicates.
+
+ You should use a random number/string generator native to the language
+ you are working in to generate strings for your idempotency keys.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ order : CreateOrderRequestParams
+ The order including line items to be checked out.
+
+ ask_for_shipping_address : typing.Optional[bool]
+ If `true`, Square Checkout collects shipping information on your behalf and stores
+ that information with the transaction information in the Square Seller Dashboard.
+
+ Default: `false`.
+
+ merchant_support_email : typing.Optional[str]
+ The email address to display on the Square Checkout confirmation page
+ and confirmation email that the buyer can use to contact the seller.
+
+ If this value is not set, the confirmation page and email display the
+ primary email address associated with the seller's Square account.
+
+ Default: none; only exists if explicitly set.
+
+ pre_populate_buyer_email : typing.Optional[str]
+ If provided, the buyer's email is prepopulated on the checkout page
+ as an editable text field.
+
+ Default: none; only exists if explicitly set.
+
+ pre_populate_shipping_address : typing.Optional[AddressParams]
+ If provided, the buyer's shipping information is prepopulated on the
+ checkout page as editable text fields.
+
+ Default: none; only exists if explicitly set.
+
+ redirect_url : typing.Optional[str]
+ The URL to redirect to after the checkout is completed with `checkoutId`,
+ `transactionId`, and `referenceId` appended as URL parameters. For example,
+ if the provided redirect URL is `http://www.example.com/order-complete`, a
+ successful transaction redirects the customer to:
+
+ `http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx`
+
+ If you do not provide a redirect URL, Square Checkout displays an order
+ confirmation page on your behalf; however, it is strongly recommended that
+ you provide a redirect URL so you can verify the transaction results and
+ finalize the order through your existing/normal confirmation workflow.
+
+ Default: none; only exists if explicitly set.
+
+ additional_recipients : typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]]
+ The basic primitive of a multi-party transaction. The value is optional.
+ The transaction facilitated by you can be split from here.
+
+ If you provide this value, the `amount_money` value in your `additional_recipients` field
+ cannot be more than 90% of the `total_money` calculated by Square for your order.
+ The `location_id` must be a valid seller location where the checkout is occurring.
+
+ This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission.
+
+ This field is currently not supported in the Square Sandbox.
+
+ note : typing.Optional[str]
+ An optional note to associate with the `checkout` object.
+
+ This value cannot exceed 60 characters.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateCheckoutResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.checkouts(
+ location_id="location_id",
+ idempotency_key="86ae1696-b1e3-4328-af6d-f1e04d947ad6",
+ order={
+ "order": {
+ "location_id": "location_id",
+ "reference_id": "reference_id",
+ "customer_id": "customer_id",
+ "line_items": [
+ {
+ "name": "Printed T Shirt",
+ "quantity": "2",
+ "applied_taxes": [
+ {"tax_uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3"}
+ ],
+ "applied_discounts": [
+ {"discount_uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4"}
+ ],
+ "base_price_money": {"amount": 1500, "currency": "USD"},
+ },
+ {
+ "name": "Slim Jeans",
+ "quantity": "1",
+ "base_price_money": {"amount": 2500, "currency": "USD"},
+ },
+ {
+ "name": "Woven Sweater",
+ "quantity": "3",
+ "base_price_money": {"amount": 3500, "currency": "USD"},
+ },
+ ],
+ "taxes": [
+ {
+ "uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3",
+ "type": "INCLUSIVE",
+ "percentage": "7.75",
+ "scope": "LINE_ITEM",
+ }
+ ],
+ "discounts": [
+ {
+ "uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4",
+ "type": "FIXED_AMOUNT",
+ "amount_money": {"amount": 100, "currency": "USD"},
+ "scope": "LINE_ITEM",
+ }
+ ],
+ },
+ "idempotency_key": "12ae1696-z1e3-4328-af6d-f1e04d947gd4",
+ },
+ ask_for_shipping_address=True,
+ merchant_support_email="merchant+support@website.com",
+ pre_populate_buyer_email="example@email.com",
+ pre_populate_shipping_address={
+ "address_line1": "1455 Market St.",
+ "address_line2": "Suite 600",
+ "locality": "San Francisco",
+ "administrative_district_level1": "CA",
+ "postal_code": "94103",
+ "country": "US",
+ "first_name": "Jane",
+ "last_name": "Doe",
+ },
+ redirect_url="https://merchant.website.com/order-confirm",
+ additional_recipients=[
+ {
+ "location_id": "057P5VYJ4A5X1",
+ "description": "Application fees",
+ "amount_money": {"amount": 60, "currency": "USD"},
+ }
+ ],
+ )
+ """
+ _response = self._raw_client.checkouts(
+ location_id,
+ idempotency_key=idempotency_key,
+ order=order,
+ ask_for_shipping_address=ask_for_shipping_address,
+ merchant_support_email=merchant_support_email,
+ pre_populate_buyer_email=pre_populate_buyer_email,
+ pre_populate_shipping_address=pre_populate_shipping_address,
+ redirect_url=redirect_url,
+ additional_recipients=additional_recipients,
+ note=note,
+ request_options=request_options,
+ )
+ return _response.data
+
+ @property
+ def custom_attribute_definitions(self):
+ if self._custom_attribute_definitions is None:
+ from .custom_attribute_definitions.client import CustomAttributeDefinitionsClient # noqa: E402
+
+ self._custom_attribute_definitions = CustomAttributeDefinitionsClient(client_wrapper=self._client_wrapper)
+ return self._custom_attribute_definitions
+
+ @property
+ def custom_attributes(self):
+ if self._custom_attributes is None:
+ from .custom_attributes.client import CustomAttributesClient # noqa: E402
+
+ self._custom_attributes = CustomAttributesClient(client_wrapper=self._client_wrapper)
+ return self._custom_attributes
+
+ @property
+ def transactions(self):
+ if self._transactions is None:
+ from .transactions.client import TransactionsClient # noqa: E402
+
+ self._transactions = TransactionsClient(client_wrapper=self._client_wrapper)
+ return self._transactions
+
+
+class AsyncLocationsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawLocationsClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._custom_attribute_definitions: typing.Optional[AsyncCustomAttributeDefinitionsClient] = None
+ self._custom_attributes: typing.Optional[AsyncCustomAttributesClient] = None
+ self._transactions: typing.Optional[AsyncTransactionsClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawLocationsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawLocationsClient
+ """
+ return self._raw_client
+
+ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListLocationsResponse:
+ """
+ Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
+ including those with an inactive status. Locations are listed alphabetically by `name`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListLocationsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.list()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.list(request_options=request_options)
+ return _response.data
+
+ async def create(
+ self,
+ *,
+ location: typing.Optional[LocationParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateLocationResponse:
+ """
+ Creates a [location](https://developer.squareup.com/docs/locations-api).
+ Creating new locations allows for separate configuration of receipt layouts, item prices,
+ and sales reports. Developers can use locations to separate sales activity through applications
+ that integrate with Square from sales activity elsewhere in a seller's account.
+ Locations created programmatically with the Locations API last forever and
+ are visible to the seller for their own management. Therefore, ensure that
+ each location has a sensible and unique name.
+
+ Parameters
+ ----------
+ location : typing.Optional[LocationParams]
+ The initial values of the location being created. The `name` field is required and must be unique within a seller account.
+ All other fields are optional, but any information you care about for the location should be included.
+ The remaining fields are automatically added based on the data from the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateLocationResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.create(
+ location={
+ "name": "Midtown",
+ "address": {
+ "address_line1": "1234 Peachtree St. NE",
+ "locality": "Atlanta",
+ "administrative_district_level1": "GA",
+ "postal_code": "30309",
+ },
+ "description": "Midtown Atlanta store",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(location=location, request_options=request_options)
+ return _response.data
+
+ async def get(
+ self, location_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetLocationResponse:
+ """
+ Retrieves details of a single location. Specify "main"
+ as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to retrieve. Specify the string
+ "main" to return the main location.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetLocationResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.get(
+ location_id="location_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(location_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ location_id: str,
+ *,
+ location: typing.Optional[LocationParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateLocationResponse:
+ """
+ Updates a [location](https://developer.squareup.com/docs/locations-api).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to update.
+
+ location : typing.Optional[LocationParams]
+ The `Location` object with only the fields to update.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateLocationResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.update(
+ location_id="location_id",
+ location={
+ "business_hours": {
+ "periods": [
+ {
+ "day_of_week": "FRI",
+ "start_local_time": "07:00",
+ "end_local_time": "18:00",
+ },
+ {
+ "day_of_week": "SAT",
+ "start_local_time": "07:00",
+ "end_local_time": "18:00",
+ },
+ {
+ "day_of_week": "SUN",
+ "start_local_time": "09:00",
+ "end_local_time": "15:00",
+ },
+ ]
+ },
+ "description": "Midtown Atlanta store - Open weekends",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(location_id, location=location, request_options=request_options)
+ return _response.data
+
+ async def checkouts(
+ self,
+ location_id: str,
+ *,
+ idempotency_key: str,
+ order: CreateOrderRequestParams,
+ ask_for_shipping_address: typing.Optional[bool] = OMIT,
+ merchant_support_email: typing.Optional[str] = OMIT,
+ pre_populate_buyer_email: typing.Optional[str] = OMIT,
+ pre_populate_shipping_address: typing.Optional[AddressParams] = OMIT,
+ redirect_url: typing.Optional[str] = OMIT,
+ additional_recipients: typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateCheckoutResponse:
+ """
+ Links a `checkoutId` to a `checkout_page_url` that customers are
+ directed to in order to provide their payment information using a
+ payment processing workflow hosted on connect.squareup.com.
+
+
+ NOTE: The Checkout API has been updated with new features.
+ For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the business location to associate the checkout with.
+
+ idempotency_key : str
+ A unique string that identifies this checkout among others you have created. It can be
+ any valid string but must be unique for every order sent to Square Checkout for a given location ID.
+
+ The idempotency key is used to avoid processing the same order more than once. If you are
+ unsure whether a particular checkout was created successfully, you can attempt it again with
+ the same idempotency key and all the same other parameters without worrying about creating duplicates.
+
+ You should use a random number/string generator native to the language
+ you are working in to generate strings for your idempotency keys.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ order : CreateOrderRequestParams
+ The order including line items to be checked out.
+
+ ask_for_shipping_address : typing.Optional[bool]
+ If `true`, Square Checkout collects shipping information on your behalf and stores
+ that information with the transaction information in the Square Seller Dashboard.
+
+ Default: `false`.
+
+ merchant_support_email : typing.Optional[str]
+ The email address to display on the Square Checkout confirmation page
+ and confirmation email that the buyer can use to contact the seller.
+
+ If this value is not set, the confirmation page and email display the
+ primary email address associated with the seller's Square account.
+
+ Default: none; only exists if explicitly set.
+
+ pre_populate_buyer_email : typing.Optional[str]
+ If provided, the buyer's email is prepopulated on the checkout page
+ as an editable text field.
+
+ Default: none; only exists if explicitly set.
+
+ pre_populate_shipping_address : typing.Optional[AddressParams]
+ If provided, the buyer's shipping information is prepopulated on the
+ checkout page as editable text fields.
+
+ Default: none; only exists if explicitly set.
+
+ redirect_url : typing.Optional[str]
+ The URL to redirect to after the checkout is completed with `checkoutId`,
+ `transactionId`, and `referenceId` appended as URL parameters. For example,
+ if the provided redirect URL is `http://www.example.com/order-complete`, a
+ successful transaction redirects the customer to:
+
+ `http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx`
+
+ If you do not provide a redirect URL, Square Checkout displays an order
+ confirmation page on your behalf; however, it is strongly recommended that
+ you provide a redirect URL so you can verify the transaction results and
+ finalize the order through your existing/normal confirmation workflow.
+
+ Default: none; only exists if explicitly set.
+
+ additional_recipients : typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]]
+ The basic primitive of a multi-party transaction. The value is optional.
+ The transaction facilitated by you can be split from here.
+
+ If you provide this value, the `amount_money` value in your `additional_recipients` field
+ cannot be more than 90% of the `total_money` calculated by Square for your order.
+ The `location_id` must be a valid seller location where the checkout is occurring.
+
+ This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission.
+
+ This field is currently not supported in the Square Sandbox.
+
+ note : typing.Optional[str]
+ An optional note to associate with the `checkout` object.
+
+ This value cannot exceed 60 characters.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateCheckoutResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.checkouts(
+ location_id="location_id",
+ idempotency_key="86ae1696-b1e3-4328-af6d-f1e04d947ad6",
+ order={
+ "order": {
+ "location_id": "location_id",
+ "reference_id": "reference_id",
+ "customer_id": "customer_id",
+ "line_items": [
+ {
+ "name": "Printed T Shirt",
+ "quantity": "2",
+ "applied_taxes": [
+ {"tax_uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3"}
+ ],
+ "applied_discounts": [
+ {
+ "discount_uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4"
+ }
+ ],
+ "base_price_money": {"amount": 1500, "currency": "USD"},
+ },
+ {
+ "name": "Slim Jeans",
+ "quantity": "1",
+ "base_price_money": {"amount": 2500, "currency": "USD"},
+ },
+ {
+ "name": "Woven Sweater",
+ "quantity": "3",
+ "base_price_money": {"amount": 3500, "currency": "USD"},
+ },
+ ],
+ "taxes": [
+ {
+ "uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3",
+ "type": "INCLUSIVE",
+ "percentage": "7.75",
+ "scope": "LINE_ITEM",
+ }
+ ],
+ "discounts": [
+ {
+ "uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4",
+ "type": "FIXED_AMOUNT",
+ "amount_money": {"amount": 100, "currency": "USD"},
+ "scope": "LINE_ITEM",
+ }
+ ],
+ },
+ "idempotency_key": "12ae1696-z1e3-4328-af6d-f1e04d947gd4",
+ },
+ ask_for_shipping_address=True,
+ merchant_support_email="merchant+support@website.com",
+ pre_populate_buyer_email="example@email.com",
+ pre_populate_shipping_address={
+ "address_line1": "1455 Market St.",
+ "address_line2": "Suite 600",
+ "locality": "San Francisco",
+ "administrative_district_level1": "CA",
+ "postal_code": "94103",
+ "country": "US",
+ "first_name": "Jane",
+ "last_name": "Doe",
+ },
+ redirect_url="https://merchant.website.com/order-confirm",
+ additional_recipients=[
+ {
+ "location_id": "057P5VYJ4A5X1",
+ "description": "Application fees",
+ "amount_money": {"amount": 60, "currency": "USD"},
+ }
+ ],
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.checkouts(
+ location_id,
+ idempotency_key=idempotency_key,
+ order=order,
+ ask_for_shipping_address=ask_for_shipping_address,
+ merchant_support_email=merchant_support_email,
+ pre_populate_buyer_email=pre_populate_buyer_email,
+ pre_populate_shipping_address=pre_populate_shipping_address,
+ redirect_url=redirect_url,
+ additional_recipients=additional_recipients,
+ note=note,
+ request_options=request_options,
+ )
+ return _response.data
+
+ @property
+ def custom_attribute_definitions(self):
+ if self._custom_attribute_definitions is None:
+ from .custom_attribute_definitions.client import AsyncCustomAttributeDefinitionsClient # noqa: E402
+
+ self._custom_attribute_definitions = AsyncCustomAttributeDefinitionsClient(
+ client_wrapper=self._client_wrapper
+ )
+ return self._custom_attribute_definitions
+
+ @property
+ def custom_attributes(self):
+ if self._custom_attributes is None:
+ from .custom_attributes.client import AsyncCustomAttributesClient # noqa: E402
+
+ self._custom_attributes = AsyncCustomAttributesClient(client_wrapper=self._client_wrapper)
+ return self._custom_attributes
+
+ @property
+ def transactions(self):
+ if self._transactions is None:
+ from .transactions.client import AsyncTransactionsClient # noqa: E402
+
+ self._transactions = AsyncTransactionsClient(client_wrapper=self._client_wrapper)
+ return self._transactions
diff --git a/src/square/locations/custom_attribute_definitions/__init__.py b/src/square/locations/custom_attribute_definitions/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/locations/custom_attribute_definitions/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/locations/custom_attribute_definitions/client.py b/src/square/locations/custom_attribute_definitions/client.py
new file mode 100644
index 00000000..7233ff94
--- /dev/null
+++ b/src/square/locations/custom_attribute_definitions/client.py
@@ -0,0 +1,642 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.custom_attribute_definition import CustomAttributeDefinitionParams
+from ...types.create_location_custom_attribute_definition_response import (
+ CreateLocationCustomAttributeDefinitionResponse,
+)
+from ...types.custom_attribute_definition import CustomAttributeDefinition
+from ...types.delete_location_custom_attribute_definition_response import (
+ DeleteLocationCustomAttributeDefinitionResponse,
+)
+from ...types.list_location_custom_attribute_definitions_response import ListLocationCustomAttributeDefinitionsResponse
+from ...types.retrieve_location_custom_attribute_definition_response import (
+ RetrieveLocationCustomAttributeDefinitionResponse,
+)
+from ...types.update_location_custom_attribute_definition_response import (
+ UpdateLocationCustomAttributeDefinitionResponse,
+)
+from ...types.visibility_filter import VisibilityFilter
+from .raw_client import AsyncRawCustomAttributeDefinitionsClient, RawCustomAttributeDefinitionsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCustomAttributeDefinitionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCustomAttributeDefinitionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCustomAttributeDefinitionsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttributeDefinition, ListLocationCustomAttributeDefinitionsResponse]:
+ """
+ Lists the location-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttributeDefinition, ListLocationCustomAttributeDefinitionsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.locations.custom_attribute_definitions.list(
+ visibility_filter="ALL",
+ limit=1,
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ visibility_filter=visibility_filter, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateLocationCustomAttributeDefinitionResponse:
+ """
+ Creates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with locations.
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) or
+ [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes)
+ to set the custom attribute for locations.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateLocationCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.custom_attribute_definitions.create(
+ custom_attribute_definition={
+ "key": "bestseller",
+ "schema": {
+ "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"
+ },
+ "name": "Bestseller",
+ "description": "Bestselling item at location",
+ "visibility": "VISIBILITY_READ_WRITE_VALUES",
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveLocationCustomAttributeDefinitionResponse:
+ """
+ Retrieves a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveLocationCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.custom_attribute_definitions.get(
+ key="key",
+ version=1,
+ )
+ """
+ _response = self._raw_client.get(key, version=version, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateLocationCustomAttributeDefinitionResponse:
+ """
+ Updates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+ Only the definition owner can update a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+
+ For more information, see
+ [Update a location custom attribute definition](https://developer.squareup.com/docs/location-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition).
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, specify the current version of the custom attribute definition.
+ If this is not important for your application, `version` can be set to -1.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateLocationCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.custom_attribute_definitions.update(
+ key="key",
+ custom_attribute_definition={
+ "description": "Update the description as desired.",
+ "visibility": "VISIBILITY_READ_ONLY",
+ },
+ )
+ """
+ _response = self._raw_client.update(
+ key,
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteLocationCustomAttributeDefinitionResponse:
+ """
+ Deletes a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ all locations.
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteLocationCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.custom_attribute_definitions.delete(
+ key="key",
+ )
+ """
+ _response = self._raw_client.delete(key, request_options=request_options)
+ return _response.data
+
+
+class AsyncCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCustomAttributeDefinitionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCustomAttributeDefinitionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCustomAttributeDefinitionsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttributeDefinition, ListLocationCustomAttributeDefinitionsResponse]:
+ """
+ Lists the location-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttributeDefinition, ListLocationCustomAttributeDefinitionsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.locations.custom_attribute_definitions.list(
+ visibility_filter="ALL",
+ limit=1,
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ visibility_filter=visibility_filter, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ async def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateLocationCustomAttributeDefinitionResponse:
+ """
+ Creates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with locations.
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) or
+ [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes)
+ to set the custom attribute for locations.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateLocationCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.custom_attribute_definitions.create(
+ custom_attribute_definition={
+ "key": "bestseller",
+ "schema": {
+ "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"
+ },
+ "name": "Bestseller",
+ "description": "Bestselling item at location",
+ "visibility": "VISIBILITY_READ_WRITE_VALUES",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveLocationCustomAttributeDefinitionResponse:
+ """
+ Retrieves a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveLocationCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.custom_attribute_definitions.get(
+ key="key",
+ version=1,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(key, version=version, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateLocationCustomAttributeDefinitionResponse:
+ """
+ Updates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+ Only the definition owner can update a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+
+ For more information, see
+ [Update a location custom attribute definition](https://developer.squareup.com/docs/location-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition).
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, specify the current version of the custom attribute definition.
+ If this is not important for your application, `version` can be set to -1.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateLocationCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.custom_attribute_definitions.update(
+ key="key",
+ custom_attribute_definition={
+ "description": "Update the description as desired.",
+ "visibility": "VISIBILITY_READ_ONLY",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ key,
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteLocationCustomAttributeDefinitionResponse:
+ """
+ Deletes a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ all locations.
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteLocationCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.custom_attribute_definitions.delete(
+ key="key",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(key, request_options=request_options)
+ return _response.data
diff --git a/src/square/locations/custom_attribute_definitions/raw_client.py b/src/square/locations/custom_attribute_definitions/raw_client.py
new file mode 100644
index 00000000..7af097a2
--- /dev/null
+++ b/src/square/locations/custom_attribute_definitions/raw_client.py
@@ -0,0 +1,661 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.custom_attribute_definition import CustomAttributeDefinitionParams
+from ...types.create_location_custom_attribute_definition_response import (
+ CreateLocationCustomAttributeDefinitionResponse,
+)
+from ...types.custom_attribute_definition import CustomAttributeDefinition
+from ...types.delete_location_custom_attribute_definition_response import (
+ DeleteLocationCustomAttributeDefinitionResponse,
+)
+from ...types.list_location_custom_attribute_definitions_response import ListLocationCustomAttributeDefinitionsResponse
+from ...types.retrieve_location_custom_attribute_definition_response import (
+ RetrieveLocationCustomAttributeDefinitionResponse,
+)
+from ...types.update_location_custom_attribute_definition_response import (
+ UpdateLocationCustomAttributeDefinitionResponse,
+)
+from ...types.visibility_filter import VisibilityFilter
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttributeDefinition, ListLocationCustomAttributeDefinitionsResponse]:
+ """
+ Lists the location-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttributeDefinition, ListLocationCustomAttributeDefinitionsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/locations/custom-attribute-definitions",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListLocationCustomAttributeDefinitionsResponse,
+ construct_type(
+ type_=ListLocationCustomAttributeDefinitionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attribute_definitions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateLocationCustomAttributeDefinitionResponse]:
+ """
+ Creates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with locations.
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) or
+ [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes)
+ to set the custom attribute for locations.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateLocationCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/locations/custom-attribute-definitions",
+ method="POST",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateLocationCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=CreateLocationCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RetrieveLocationCustomAttributeDefinitionResponse]:
+ """
+ Retrieves a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveLocationCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveLocationCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=RetrieveLocationCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateLocationCustomAttributeDefinitionResponse]:
+ """
+ Updates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+ Only the definition owner can update a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+
+ For more information, see
+ [Update a location custom attribute definition](https://developer.squareup.com/docs/location-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition).
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, specify the current version of the custom attribute definition.
+ If this is not important for your application, `version` can be set to -1.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateLocationCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="PUT",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateLocationCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=UpdateLocationCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteLocationCustomAttributeDefinitionResponse]:
+ """
+ Deletes a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ all locations.
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteLocationCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteLocationCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=DeleteLocationCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttributeDefinition, ListLocationCustomAttributeDefinitionsResponse]:
+ """
+ Lists the location-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttributeDefinition, ListLocationCustomAttributeDefinitionsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/locations/custom-attribute-definitions",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListLocationCustomAttributeDefinitionsResponse,
+ construct_type(
+ type_=ListLocationCustomAttributeDefinitionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attribute_definitions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateLocationCustomAttributeDefinitionResponse]:
+ """
+ Creates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with locations.
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) or
+ [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes)
+ to set the custom attribute for locations.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateLocationCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/locations/custom-attribute-definitions",
+ method="POST",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateLocationCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=CreateLocationCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RetrieveLocationCustomAttributeDefinitionResponse]:
+ """
+ Retrieves a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveLocationCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveLocationCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=RetrieveLocationCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateLocationCustomAttributeDefinitionResponse]:
+ """
+ Updates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+ Only the definition owner can update a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+
+ For more information, see
+ [Update a location custom attribute definition](https://developer.squareup.com/docs/location-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition).
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, specify the current version of the custom attribute definition.
+ If this is not important for your application, `version` can be set to -1.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateLocationCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="PUT",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateLocationCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=UpdateLocationCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteLocationCustomAttributeDefinitionResponse]:
+ """
+ Deletes a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ all locations.
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteLocationCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteLocationCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=DeleteLocationCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/locations/custom_attributes/__init__.py b/src/square/locations/custom_attributes/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/locations/custom_attributes/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/locations/custom_attributes/client.py b/src/square/locations/custom_attributes/client.py
new file mode 100644
index 00000000..1ec6dfcb
--- /dev/null
+++ b/src/square/locations/custom_attributes/client.py
@@ -0,0 +1,829 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request import (
+ BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams,
+)
+from ...requests.bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request import (
+ BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams,
+)
+from ...requests.custom_attribute import CustomAttributeParams
+from ...types.bulk_delete_location_custom_attributes_response import BulkDeleteLocationCustomAttributesResponse
+from ...types.bulk_upsert_location_custom_attributes_response import BulkUpsertLocationCustomAttributesResponse
+from ...types.custom_attribute import CustomAttribute
+from ...types.delete_location_custom_attribute_response import DeleteLocationCustomAttributeResponse
+from ...types.list_location_custom_attributes_response import ListLocationCustomAttributesResponse
+from ...types.retrieve_location_custom_attribute_response import RetrieveLocationCustomAttributeResponse
+from ...types.upsert_location_custom_attribute_response import UpsertLocationCustomAttributeResponse
+from ...types.visibility_filter import VisibilityFilter
+from .raw_client import AsyncRawCustomAttributesClient, RawCustomAttributesClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CustomAttributesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCustomAttributesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCustomAttributesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCustomAttributesClient
+ """
+ return self._raw_client
+
+ def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkDeleteLocationCustomAttributesResponse:
+ """
+ Deletes [custom attributes](entity:CustomAttribute) for locations as a bulk operation.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams]
+ The data used to update the `CustomAttribute` objects.
+ The keys must be unique and are used to map to the corresponding response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkDeleteLocationCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.custom_attributes.batch_delete(
+ values={
+ "id1": {"key": "bestseller"},
+ "id2": {"key": "bestseller"},
+ "id3": {"key": "phone-number"},
+ },
+ )
+ """
+ _response = self._raw_client.batch_delete(values=values, request_options=request_options)
+ return _response.data
+
+ def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkUpsertLocationCustomAttributesResponse:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for locations as a bulk operation.
+ Use this endpoint to set the value of one or more custom attributes for one or more locations.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint.
+ This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a location ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkUpsertLocationCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.custom_attributes.batch_upsert(
+ values={
+ "id1": {
+ "location_id": "L0TBCBTB7P8RQ",
+ "custom_attribute": {"key": "bestseller", "value": "hot cocoa"},
+ },
+ "id2": {
+ "location_id": "L9XMD04V3STJX",
+ "custom_attribute": {
+ "key": "bestseller",
+ "value": "berry smoothie",
+ },
+ },
+ "id3": {
+ "location_id": "L0TBCBTB7P8RQ",
+ "custom_attribute": {
+ "key": "phone-number",
+ "value": "+12223334444",
+ },
+ },
+ },
+ )
+ """
+ _response = self._raw_client.batch_upsert(values=values, request_options=request_options)
+ return _response.data
+
+ def list(
+ self,
+ location_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttribute, ListLocationCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a location.
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttribute, ListLocationCustomAttributesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.locations.custom_attributes.list(
+ location_id="location_id",
+ visibility_filter="ALL",
+ limit=1,
+ cursor="cursor",
+ with_definitions=True,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ location_id,
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=cursor,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+
+ def get(
+ self,
+ location_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RetrieveLocationCustomAttributeResponse:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a location.
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveLocationCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.custom_attributes.get(
+ location_id="location_id",
+ key="key",
+ with_definition=True,
+ version=1,
+ )
+ """
+ _response = self._raw_client.get(
+ location_id, key, with_definition=with_definition, version=version, request_options=request_options
+ )
+ return _response.data
+
+ def upsert(
+ self,
+ location_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpsertLocationCustomAttributeResponse:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a location.
+ Use this endpoint to set the value of a custom attribute for a specified location.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for an update operation, include the current version of the custom attribute.
+ If this is not important for your application, version can be set to -1.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpsertLocationCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.custom_attributes.upsert(
+ location_id="location_id",
+ key="key",
+ custom_attribute={"value": "hot cocoa"},
+ )
+ """
+ _response = self._raw_client.upsert(
+ location_id,
+ key,
+ custom_attribute=custom_attribute,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self, location_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteLocationCustomAttributeResponse:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a location.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteLocationCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.custom_attributes.delete(
+ location_id="location_id",
+ key="key",
+ )
+ """
+ _response = self._raw_client.delete(location_id, key, request_options=request_options)
+ return _response.data
+
+
+class AsyncCustomAttributesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCustomAttributesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCustomAttributesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCustomAttributesClient
+ """
+ return self._raw_client
+
+ async def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkDeleteLocationCustomAttributesResponse:
+ """
+ Deletes [custom attributes](entity:CustomAttribute) for locations as a bulk operation.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams]
+ The data used to update the `CustomAttribute` objects.
+ The keys must be unique and are used to map to the corresponding response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkDeleteLocationCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.custom_attributes.batch_delete(
+ values={
+ "id1": {"key": "bestseller"},
+ "id2": {"key": "bestseller"},
+ "id3": {"key": "phone-number"},
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_delete(values=values, request_options=request_options)
+ return _response.data
+
+ async def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkUpsertLocationCustomAttributesResponse:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for locations as a bulk operation.
+ Use this endpoint to set the value of one or more custom attributes for one or more locations.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint.
+ This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a location ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkUpsertLocationCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.custom_attributes.batch_upsert(
+ values={
+ "id1": {
+ "location_id": "L0TBCBTB7P8RQ",
+ "custom_attribute": {"key": "bestseller", "value": "hot cocoa"},
+ },
+ "id2": {
+ "location_id": "L9XMD04V3STJX",
+ "custom_attribute": {
+ "key": "bestseller",
+ "value": "berry smoothie",
+ },
+ },
+ "id3": {
+ "location_id": "L0TBCBTB7P8RQ",
+ "custom_attribute": {
+ "key": "phone-number",
+ "value": "+12223334444",
+ },
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_upsert(values=values, request_options=request_options)
+ return _response.data
+
+ async def list(
+ self,
+ location_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttribute, ListLocationCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a location.
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttribute, ListLocationCustomAttributesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.locations.custom_attributes.list(
+ location_id="location_id",
+ visibility_filter="ALL",
+ limit=1,
+ cursor="cursor",
+ with_definitions=True,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ location_id,
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=cursor,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+
+ async def get(
+ self,
+ location_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RetrieveLocationCustomAttributeResponse:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a location.
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveLocationCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.custom_attributes.get(
+ location_id="location_id",
+ key="key",
+ with_definition=True,
+ version=1,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(
+ location_id, key, with_definition=with_definition, version=version, request_options=request_options
+ )
+ return _response.data
+
+ async def upsert(
+ self,
+ location_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpsertLocationCustomAttributeResponse:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a location.
+ Use this endpoint to set the value of a custom attribute for a specified location.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for an update operation, include the current version of the custom attribute.
+ If this is not important for your application, version can be set to -1.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpsertLocationCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.custom_attributes.upsert(
+ location_id="location_id",
+ key="key",
+ custom_attribute={"value": "hot cocoa"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.upsert(
+ location_id,
+ key,
+ custom_attribute=custom_attribute,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self, location_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteLocationCustomAttributeResponse:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a location.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteLocationCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.custom_attributes.delete(
+ location_id="location_id",
+ key="key",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(location_id, key, request_options=request_options)
+ return _response.data
diff --git a/src/square/locations/custom_attributes/raw_client.py b/src/square/locations/custom_attributes/raw_client.py
new file mode 100644
index 00000000..4476e8db
--- /dev/null
+++ b/src/square/locations/custom_attributes/raw_client.py
@@ -0,0 +1,848 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request import (
+ BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams,
+)
+from ...requests.bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request import (
+ BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams,
+)
+from ...requests.custom_attribute import CustomAttributeParams
+from ...types.bulk_delete_location_custom_attributes_response import BulkDeleteLocationCustomAttributesResponse
+from ...types.bulk_upsert_location_custom_attributes_response import BulkUpsertLocationCustomAttributesResponse
+from ...types.custom_attribute import CustomAttribute
+from ...types.delete_location_custom_attribute_response import DeleteLocationCustomAttributeResponse
+from ...types.list_location_custom_attributes_response import ListLocationCustomAttributesResponse
+from ...types.retrieve_location_custom_attribute_response import RetrieveLocationCustomAttributeResponse
+from ...types.upsert_location_custom_attribute_response import UpsertLocationCustomAttributeResponse
+from ...types.visibility_filter import VisibilityFilter
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCustomAttributesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BulkDeleteLocationCustomAttributesResponse]:
+ """
+ Deletes [custom attributes](entity:CustomAttribute) for locations as a bulk operation.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams]
+ The data used to update the `CustomAttribute` objects.
+ The keys must be unique and are used to map to the corresponding response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkDeleteLocationCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/locations/custom-attributes/bulk-delete",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[
+ str, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams
+ ],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkDeleteLocationCustomAttributesResponse,
+ construct_type(
+ type_=BulkDeleteLocationCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BulkUpsertLocationCustomAttributesResponse]:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for locations as a bulk operation.
+ Use this endpoint to set the value of one or more custom attributes for one or more locations.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint.
+ This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a location ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkUpsertLocationCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/locations/custom-attributes/bulk-upsert",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[
+ str, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams
+ ],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkUpsertLocationCustomAttributesResponse,
+ construct_type(
+ type_=BulkUpsertLocationCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def list(
+ self,
+ location_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttribute, ListLocationCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a location.
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttribute, ListLocationCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/custom-attributes",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "limit": limit,
+ "cursor": cursor,
+ "with_definitions": with_definitions,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListLocationCustomAttributesResponse,
+ construct_type(
+ type_=ListLocationCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attributes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ location_id,
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=_parsed_next,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self,
+ location_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[RetrieveLocationCustomAttributeResponse]:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a location.
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveLocationCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "with_definition": with_definition,
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveLocationCustomAttributeResponse,
+ construct_type(
+ type_=RetrieveLocationCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def upsert(
+ self,
+ location_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpsertLocationCustomAttributeResponse]:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a location.
+ Use this endpoint to set the value of a custom attribute for a specified location.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for an update operation, include the current version of the custom attribute.
+ If this is not important for your application, version can be set to -1.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpsertLocationCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="POST",
+ json={
+ "custom_attribute": convert_and_respect_annotation_metadata(
+ object_=custom_attribute, annotation=CustomAttributeParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertLocationCustomAttributeResponse,
+ construct_type(
+ type_=UpsertLocationCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, location_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteLocationCustomAttributeResponse]:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a location.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteLocationCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteLocationCustomAttributeResponse,
+ construct_type(
+ type_=DeleteLocationCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCustomAttributesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BulkDeleteLocationCustomAttributesResponse]:
+ """
+ Deletes [custom attributes](entity:CustomAttribute) for locations as a bulk operation.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams]
+ The data used to update the `CustomAttribute` objects.
+ The keys must be unique and are used to map to the corresponding response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkDeleteLocationCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/locations/custom-attributes/bulk-delete",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[
+ str, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams
+ ],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkDeleteLocationCustomAttributesResponse,
+ construct_type(
+ type_=BulkDeleteLocationCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BulkUpsertLocationCustomAttributesResponse]:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for locations as a bulk operation.
+ Use this endpoint to set the value of one or more custom attributes for one or more locations.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint.
+ This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a location ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkUpsertLocationCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/locations/custom-attributes/bulk-upsert",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[
+ str, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams
+ ],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkUpsertLocationCustomAttributesResponse,
+ construct_type(
+ type_=BulkUpsertLocationCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def list(
+ self,
+ location_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttribute, ListLocationCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a location.
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttribute, ListLocationCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/custom-attributes",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "limit": limit,
+ "cursor": cursor,
+ "with_definitions": with_definitions,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListLocationCustomAttributesResponse,
+ construct_type(
+ type_=ListLocationCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attributes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ location_id,
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=_parsed_next,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self,
+ location_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[RetrieveLocationCustomAttributeResponse]:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a location.
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveLocationCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "with_definition": with_definition,
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveLocationCustomAttributeResponse,
+ construct_type(
+ type_=RetrieveLocationCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def upsert(
+ self,
+ location_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpsertLocationCustomAttributeResponse]:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a location.
+ Use this endpoint to set the value of a custom attribute for a specified location.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for an update operation, include the current version of the custom attribute.
+ If this is not important for your application, version can be set to -1.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpsertLocationCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="POST",
+ json={
+ "custom_attribute": convert_and_respect_annotation_metadata(
+ object_=custom_attribute, annotation=CustomAttributeParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertLocationCustomAttributeResponse,
+ construct_type(
+ type_=UpsertLocationCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, location_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteLocationCustomAttributeResponse]:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a location.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the target [location](entity:Location).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteLocationCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteLocationCustomAttributeResponse,
+ construct_type(
+ type_=DeleteLocationCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/locations/raw_client.py b/src/square/locations/raw_client.py
new file mode 100644
index 00000000..d2488275
--- /dev/null
+++ b/src/square/locations/raw_client.py
@@ -0,0 +1,726 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.address import AddressParams
+from ..requests.charge_request_additional_recipient import ChargeRequestAdditionalRecipientParams
+from ..requests.create_order_request import CreateOrderRequestParams
+from ..requests.location import LocationParams
+from ..types.create_checkout_response import CreateCheckoutResponse
+from ..types.create_location_response import CreateLocationResponse
+from ..types.get_location_response import GetLocationResponse
+from ..types.list_locations_response import ListLocationsResponse
+from ..types.update_location_response import UpdateLocationResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawLocationsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[ListLocationsResponse]:
+ """
+ Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
+ including those with an inactive status. Locations are listed alphabetically by `name`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ListLocationsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/locations",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListLocationsResponse,
+ construct_type(
+ type_=ListLocationsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ location: typing.Optional[LocationParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateLocationResponse]:
+ """
+ Creates a [location](https://developer.squareup.com/docs/locations-api).
+ Creating new locations allows for separate configuration of receipt layouts, item prices,
+ and sales reports. Developers can use locations to separate sales activity through applications
+ that integrate with Square from sales activity elsewhere in a seller's account.
+ Locations created programmatically with the Locations API last forever and
+ are visible to the seller for their own management. Therefore, ensure that
+ each location has a sensible and unique name.
+
+ Parameters
+ ----------
+ location : typing.Optional[LocationParams]
+ The initial values of the location being created. The `name` field is required and must be unique within a seller account.
+ All other fields are optional, but any information you care about for the location should be included.
+ The remaining fields are automatically added based on the data from the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateLocationResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/locations",
+ method="POST",
+ json={
+ "location": convert_and_respect_annotation_metadata(
+ object_=location, annotation=LocationParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateLocationResponse,
+ construct_type(
+ type_=CreateLocationResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, location_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetLocationResponse]:
+ """
+ Retrieves details of a single location. Specify "main"
+ as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to retrieve. Specify the string
+ "main" to return the main location.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetLocationResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetLocationResponse,
+ construct_type(
+ type_=GetLocationResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ location_id: str,
+ *,
+ location: typing.Optional[LocationParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateLocationResponse]:
+ """
+ Updates a [location](https://developer.squareup.com/docs/locations-api).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to update.
+
+ location : typing.Optional[LocationParams]
+ The `Location` object with only the fields to update.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateLocationResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}",
+ method="PUT",
+ json={
+ "location": convert_and_respect_annotation_metadata(
+ object_=location, annotation=LocationParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateLocationResponse,
+ construct_type(
+ type_=UpdateLocationResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def checkouts(
+ self,
+ location_id: str,
+ *,
+ idempotency_key: str,
+ order: CreateOrderRequestParams,
+ ask_for_shipping_address: typing.Optional[bool] = OMIT,
+ merchant_support_email: typing.Optional[str] = OMIT,
+ pre_populate_buyer_email: typing.Optional[str] = OMIT,
+ pre_populate_shipping_address: typing.Optional[AddressParams] = OMIT,
+ redirect_url: typing.Optional[str] = OMIT,
+ additional_recipients: typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateCheckoutResponse]:
+ """
+ Links a `checkoutId` to a `checkout_page_url` that customers are
+ directed to in order to provide their payment information using a
+ payment processing workflow hosted on connect.squareup.com.
+
+
+ NOTE: The Checkout API has been updated with new features.
+ For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the business location to associate the checkout with.
+
+ idempotency_key : str
+ A unique string that identifies this checkout among others you have created. It can be
+ any valid string but must be unique for every order sent to Square Checkout for a given location ID.
+
+ The idempotency key is used to avoid processing the same order more than once. If you are
+ unsure whether a particular checkout was created successfully, you can attempt it again with
+ the same idempotency key and all the same other parameters without worrying about creating duplicates.
+
+ You should use a random number/string generator native to the language
+ you are working in to generate strings for your idempotency keys.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ order : CreateOrderRequestParams
+ The order including line items to be checked out.
+
+ ask_for_shipping_address : typing.Optional[bool]
+ If `true`, Square Checkout collects shipping information on your behalf and stores
+ that information with the transaction information in the Square Seller Dashboard.
+
+ Default: `false`.
+
+ merchant_support_email : typing.Optional[str]
+ The email address to display on the Square Checkout confirmation page
+ and confirmation email that the buyer can use to contact the seller.
+
+ If this value is not set, the confirmation page and email display the
+ primary email address associated with the seller's Square account.
+
+ Default: none; only exists if explicitly set.
+
+ pre_populate_buyer_email : typing.Optional[str]
+ If provided, the buyer's email is prepopulated on the checkout page
+ as an editable text field.
+
+ Default: none; only exists if explicitly set.
+
+ pre_populate_shipping_address : typing.Optional[AddressParams]
+ If provided, the buyer's shipping information is prepopulated on the
+ checkout page as editable text fields.
+
+ Default: none; only exists if explicitly set.
+
+ redirect_url : typing.Optional[str]
+ The URL to redirect to after the checkout is completed with `checkoutId`,
+ `transactionId`, and `referenceId` appended as URL parameters. For example,
+ if the provided redirect URL is `http://www.example.com/order-complete`, a
+ successful transaction redirects the customer to:
+
+ `http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx`
+
+ If you do not provide a redirect URL, Square Checkout displays an order
+ confirmation page on your behalf; however, it is strongly recommended that
+ you provide a redirect URL so you can verify the transaction results and
+ finalize the order through your existing/normal confirmation workflow.
+
+ Default: none; only exists if explicitly set.
+
+ additional_recipients : typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]]
+ The basic primitive of a multi-party transaction. The value is optional.
+ The transaction facilitated by you can be split from here.
+
+ If you provide this value, the `amount_money` value in your `additional_recipients` field
+ cannot be more than 90% of the `total_money` calculated by Square for your order.
+ The `location_id` must be a valid seller location where the checkout is occurring.
+
+ This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission.
+
+ This field is currently not supported in the Square Sandbox.
+
+ note : typing.Optional[str]
+ An optional note to associate with the `checkout` object.
+
+ This value cannot exceed 60 characters.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateCheckoutResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/checkouts",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "order": convert_and_respect_annotation_metadata(
+ object_=order, annotation=CreateOrderRequestParams, direction="write"
+ ),
+ "ask_for_shipping_address": ask_for_shipping_address,
+ "merchant_support_email": merchant_support_email,
+ "pre_populate_buyer_email": pre_populate_buyer_email,
+ "pre_populate_shipping_address": convert_and_respect_annotation_metadata(
+ object_=pre_populate_shipping_address, annotation=AddressParams, direction="write"
+ ),
+ "redirect_url": redirect_url,
+ "additional_recipients": convert_and_respect_annotation_metadata(
+ object_=additional_recipients,
+ annotation=typing.Sequence[ChargeRequestAdditionalRecipientParams],
+ direction="write",
+ ),
+ "note": note,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateCheckoutResponse,
+ construct_type(
+ type_=CreateCheckoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawLocationsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[ListLocationsResponse]:
+ """
+ Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
+ including those with an inactive status. Locations are listed alphabetically by `name`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ListLocationsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/locations",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListLocationsResponse,
+ construct_type(
+ type_=ListLocationsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ location: typing.Optional[LocationParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateLocationResponse]:
+ """
+ Creates a [location](https://developer.squareup.com/docs/locations-api).
+ Creating new locations allows for separate configuration of receipt layouts, item prices,
+ and sales reports. Developers can use locations to separate sales activity through applications
+ that integrate with Square from sales activity elsewhere in a seller's account.
+ Locations created programmatically with the Locations API last forever and
+ are visible to the seller for their own management. Therefore, ensure that
+ each location has a sensible and unique name.
+
+ Parameters
+ ----------
+ location : typing.Optional[LocationParams]
+ The initial values of the location being created. The `name` field is required and must be unique within a seller account.
+ All other fields are optional, but any information you care about for the location should be included.
+ The remaining fields are automatically added based on the data from the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateLocationResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/locations",
+ method="POST",
+ json={
+ "location": convert_and_respect_annotation_metadata(
+ object_=location, annotation=LocationParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateLocationResponse,
+ construct_type(
+ type_=CreateLocationResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, location_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetLocationResponse]:
+ """
+ Retrieves details of a single location. Specify "main"
+ as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to retrieve. Specify the string
+ "main" to return the main location.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetLocationResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetLocationResponse,
+ construct_type(
+ type_=GetLocationResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ location_id: str,
+ *,
+ location: typing.Optional[LocationParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateLocationResponse]:
+ """
+ Updates a [location](https://developer.squareup.com/docs/locations-api).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to update.
+
+ location : typing.Optional[LocationParams]
+ The `Location` object with only the fields to update.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateLocationResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}",
+ method="PUT",
+ json={
+ "location": convert_and_respect_annotation_metadata(
+ object_=location, annotation=LocationParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateLocationResponse,
+ construct_type(
+ type_=UpdateLocationResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def checkouts(
+ self,
+ location_id: str,
+ *,
+ idempotency_key: str,
+ order: CreateOrderRequestParams,
+ ask_for_shipping_address: typing.Optional[bool] = OMIT,
+ merchant_support_email: typing.Optional[str] = OMIT,
+ pre_populate_buyer_email: typing.Optional[str] = OMIT,
+ pre_populate_shipping_address: typing.Optional[AddressParams] = OMIT,
+ redirect_url: typing.Optional[str] = OMIT,
+ additional_recipients: typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateCheckoutResponse]:
+ """
+ Links a `checkoutId` to a `checkout_page_url` that customers are
+ directed to in order to provide their payment information using a
+ payment processing workflow hosted on connect.squareup.com.
+
+
+ NOTE: The Checkout API has been updated with new features.
+ For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the business location to associate the checkout with.
+
+ idempotency_key : str
+ A unique string that identifies this checkout among others you have created. It can be
+ any valid string but must be unique for every order sent to Square Checkout for a given location ID.
+
+ The idempotency key is used to avoid processing the same order more than once. If you are
+ unsure whether a particular checkout was created successfully, you can attempt it again with
+ the same idempotency key and all the same other parameters without worrying about creating duplicates.
+
+ You should use a random number/string generator native to the language
+ you are working in to generate strings for your idempotency keys.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ order : CreateOrderRequestParams
+ The order including line items to be checked out.
+
+ ask_for_shipping_address : typing.Optional[bool]
+ If `true`, Square Checkout collects shipping information on your behalf and stores
+ that information with the transaction information in the Square Seller Dashboard.
+
+ Default: `false`.
+
+ merchant_support_email : typing.Optional[str]
+ The email address to display on the Square Checkout confirmation page
+ and confirmation email that the buyer can use to contact the seller.
+
+ If this value is not set, the confirmation page and email display the
+ primary email address associated with the seller's Square account.
+
+ Default: none; only exists if explicitly set.
+
+ pre_populate_buyer_email : typing.Optional[str]
+ If provided, the buyer's email is prepopulated on the checkout page
+ as an editable text field.
+
+ Default: none; only exists if explicitly set.
+
+ pre_populate_shipping_address : typing.Optional[AddressParams]
+ If provided, the buyer's shipping information is prepopulated on the
+ checkout page as editable text fields.
+
+ Default: none; only exists if explicitly set.
+
+ redirect_url : typing.Optional[str]
+ The URL to redirect to after the checkout is completed with `checkoutId`,
+ `transactionId`, and `referenceId` appended as URL parameters. For example,
+ if the provided redirect URL is `http://www.example.com/order-complete`, a
+ successful transaction redirects the customer to:
+
+ `http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx`
+
+ If you do not provide a redirect URL, Square Checkout displays an order
+ confirmation page on your behalf; however, it is strongly recommended that
+ you provide a redirect URL so you can verify the transaction results and
+ finalize the order through your existing/normal confirmation workflow.
+
+ Default: none; only exists if explicitly set.
+
+ additional_recipients : typing.Optional[typing.Sequence[ChargeRequestAdditionalRecipientParams]]
+ The basic primitive of a multi-party transaction. The value is optional.
+ The transaction facilitated by you can be split from here.
+
+ If you provide this value, the `amount_money` value in your `additional_recipients` field
+ cannot be more than 90% of the `total_money` calculated by Square for your order.
+ The `location_id` must be a valid seller location where the checkout is occurring.
+
+ This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission.
+
+ This field is currently not supported in the Square Sandbox.
+
+ note : typing.Optional[str]
+ An optional note to associate with the `checkout` object.
+
+ This value cannot exceed 60 characters.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateCheckoutResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/checkouts",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "order": convert_and_respect_annotation_metadata(
+ object_=order, annotation=CreateOrderRequestParams, direction="write"
+ ),
+ "ask_for_shipping_address": ask_for_shipping_address,
+ "merchant_support_email": merchant_support_email,
+ "pre_populate_buyer_email": pre_populate_buyer_email,
+ "pre_populate_shipping_address": convert_and_respect_annotation_metadata(
+ object_=pre_populate_shipping_address, annotation=AddressParams, direction="write"
+ ),
+ "redirect_url": redirect_url,
+ "additional_recipients": convert_and_respect_annotation_metadata(
+ object_=additional_recipients,
+ annotation=typing.Sequence[ChargeRequestAdditionalRecipientParams],
+ direction="write",
+ ),
+ "note": note,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateCheckoutResponse,
+ construct_type(
+ type_=CreateCheckoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/locations/transactions/__init__.py b/src/square/locations/transactions/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/locations/transactions/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/locations/transactions/client.py b/src/square/locations/transactions/client.py
new file mode 100644
index 00000000..2777b102
--- /dev/null
+++ b/src/square/locations/transactions/client.py
@@ -0,0 +1,482 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...types.capture_transaction_response import CaptureTransactionResponse
+from ...types.get_transaction_response import GetTransactionResponse
+from ...types.list_transactions_response import ListTransactionsResponse
+from ...types.sort_order import SortOrder
+from ...types.void_transaction_response import VoidTransactionResponse
+from .raw_client import AsyncRawTransactionsClient, RawTransactionsClient
+
+
+class TransactionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawTransactionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawTransactionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawTransactionsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ location_id: str,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ListTransactionsResponse:
+ """
+ Lists transactions for a particular location.
+
+ Transactions include payment information from sales and exchanges and refund
+ information from returns and exchanges.
+
+ Max results per [page](https://developer.squareup.com/docs/working-with-apis/pagination): 50
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to list transactions for.
+
+ begin_time : typing.Optional[str]
+ The beginning of the requested reporting period, in RFC 3339 format.
+
+ See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.
+
+ Default value: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ The end of the requested reporting period, in RFC 3339 format.
+
+ See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.
+
+ Default value: The current time.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which results are listed in the response (`ASC` for
+ oldest first, `DESC` for newest first).
+
+ Default value: `DESC`
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListTransactionsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.transactions.list(
+ location_id="location_id",
+ begin_time="begin_time",
+ end_time="end_time",
+ sort_order="DESC",
+ cursor="cursor",
+ )
+ """
+ _response = self._raw_client.list(
+ location_id,
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=cursor,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def get(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTransactionResponse:
+ """
+ Retrieves details for a single transaction.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the transaction's associated location.
+
+ transaction_id : str
+ The ID of the transaction to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTransactionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.transactions.get(
+ location_id="location_id",
+ transaction_id="transaction_id",
+ )
+ """
+ _response = self._raw_client.get(location_id, transaction_id, request_options=request_options)
+ return _response.data
+
+ def capture(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CaptureTransactionResponse:
+ """
+ Captures a transaction that was created with the [Charge](api-endpoint:Transactions-Charge)
+ endpoint with a `delay_capture` value of `true`.
+
+
+ See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture)
+ for more information.
+
+ Parameters
+ ----------
+ location_id : str
+
+
+ transaction_id : str
+
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CaptureTransactionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.transactions.capture(
+ location_id="location_id",
+ transaction_id="transaction_id",
+ )
+ """
+ _response = self._raw_client.capture(location_id, transaction_id, request_options=request_options)
+ return _response.data
+
+ def void(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> VoidTransactionResponse:
+ """
+ Cancels a transaction that was created with the [Charge](api-endpoint:Transactions-Charge)
+ endpoint with a `delay_capture` value of `true`.
+
+
+ See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture)
+ for more information.
+
+ Parameters
+ ----------
+ location_id : str
+
+
+ transaction_id : str
+
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ VoidTransactionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.locations.transactions.void(
+ location_id="location_id",
+ transaction_id="transaction_id",
+ )
+ """
+ _response = self._raw_client.void(location_id, transaction_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncTransactionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawTransactionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawTransactionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawTransactionsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ location_id: str,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ListTransactionsResponse:
+ """
+ Lists transactions for a particular location.
+
+ Transactions include payment information from sales and exchanges and refund
+ information from returns and exchanges.
+
+ Max results per [page](https://developer.squareup.com/docs/working-with-apis/pagination): 50
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to list transactions for.
+
+ begin_time : typing.Optional[str]
+ The beginning of the requested reporting period, in RFC 3339 format.
+
+ See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.
+
+ Default value: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ The end of the requested reporting period, in RFC 3339 format.
+
+ See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.
+
+ Default value: The current time.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which results are listed in the response (`ASC` for
+ oldest first, `DESC` for newest first).
+
+ Default value: `DESC`
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListTransactionsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.transactions.list(
+ location_id="location_id",
+ begin_time="begin_time",
+ end_time="end_time",
+ sort_order="DESC",
+ cursor="cursor",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.list(
+ location_id,
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=cursor,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def get(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTransactionResponse:
+ """
+ Retrieves details for a single transaction.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the transaction's associated location.
+
+ transaction_id : str
+ The ID of the transaction to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTransactionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.transactions.get(
+ location_id="location_id",
+ transaction_id="transaction_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(location_id, transaction_id, request_options=request_options)
+ return _response.data
+
+ async def capture(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CaptureTransactionResponse:
+ """
+ Captures a transaction that was created with the [Charge](api-endpoint:Transactions-Charge)
+ endpoint with a `delay_capture` value of `true`.
+
+
+ See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture)
+ for more information.
+
+ Parameters
+ ----------
+ location_id : str
+
+
+ transaction_id : str
+
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CaptureTransactionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.transactions.capture(
+ location_id="location_id",
+ transaction_id="transaction_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.capture(location_id, transaction_id, request_options=request_options)
+ return _response.data
+
+ async def void(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> VoidTransactionResponse:
+ """
+ Cancels a transaction that was created with the [Charge](api-endpoint:Transactions-Charge)
+ endpoint with a `delay_capture` value of `true`.
+
+
+ See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture)
+ for more information.
+
+ Parameters
+ ----------
+ location_id : str
+
+
+ transaction_id : str
+
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ VoidTransactionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.locations.transactions.void(
+ location_id="location_id",
+ transaction_id="transaction_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.void(location_id, transaction_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/locations/transactions/raw_client.py b/src/square/locations/transactions/raw_client.py
new file mode 100644
index 00000000..3a0563b0
--- /dev/null
+++ b/src/square/locations/transactions/raw_client.py
@@ -0,0 +1,464 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.request_options import RequestOptions
+from ...core.unchecked_base_model import construct_type
+from ...types.capture_transaction_response import CaptureTransactionResponse
+from ...types.get_transaction_response import GetTransactionResponse
+from ...types.list_transactions_response import ListTransactionsResponse
+from ...types.sort_order import SortOrder
+from ...types.void_transaction_response import VoidTransactionResponse
+
+
+class RawTransactionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ location_id: str,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[ListTransactionsResponse]:
+ """
+ Lists transactions for a particular location.
+
+ Transactions include payment information from sales and exchanges and refund
+ information from returns and exchanges.
+
+ Max results per [page](https://developer.squareup.com/docs/working-with-apis/pagination): 50
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to list transactions for.
+
+ begin_time : typing.Optional[str]
+ The beginning of the requested reporting period, in RFC 3339 format.
+
+ See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.
+
+ Default value: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ The end of the requested reporting period, in RFC 3339 format.
+
+ See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.
+
+ Default value: The current time.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which results are listed in the response (`ASC` for
+ oldest first, `DESC` for newest first).
+
+ Default value: `DESC`
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ListTransactionsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/transactions",
+ method="GET",
+ params={
+ "begin_time": begin_time,
+ "end_time": end_time,
+ "sort_order": sort_order,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListTransactionsResponse,
+ construct_type(
+ type_=ListTransactionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetTransactionResponse]:
+ """
+ Retrieves details for a single transaction.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the transaction's associated location.
+
+ transaction_id : str
+ The ID of the transaction to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetTransactionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/transactions/{jsonable_encoder(transaction_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTransactionResponse,
+ construct_type(
+ type_=GetTransactionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def capture(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[CaptureTransactionResponse]:
+ """
+ Captures a transaction that was created with the [Charge](api-endpoint:Transactions-Charge)
+ endpoint with a `delay_capture` value of `true`.
+
+
+ See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture)
+ for more information.
+
+ Parameters
+ ----------
+ location_id : str
+
+
+ transaction_id : str
+
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CaptureTransactionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/transactions/{jsonable_encoder(transaction_id)}/capture",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CaptureTransactionResponse,
+ construct_type(
+ type_=CaptureTransactionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def void(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[VoidTransactionResponse]:
+ """
+ Cancels a transaction that was created with the [Charge](api-endpoint:Transactions-Charge)
+ endpoint with a `delay_capture` value of `true`.
+
+
+ See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture)
+ for more information.
+
+ Parameters
+ ----------
+ location_id : str
+
+
+ transaction_id : str
+
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[VoidTransactionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/transactions/{jsonable_encoder(transaction_id)}/void",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ VoidTransactionResponse,
+ construct_type(
+ type_=VoidTransactionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawTransactionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ location_id: str,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[ListTransactionsResponse]:
+ """
+ Lists transactions for a particular location.
+
+ Transactions include payment information from sales and exchanges and refund
+ information from returns and exchanges.
+
+ Max results per [page](https://developer.squareup.com/docs/working-with-apis/pagination): 50
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to list transactions for.
+
+ begin_time : typing.Optional[str]
+ The beginning of the requested reporting period, in RFC 3339 format.
+
+ See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.
+
+ Default value: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ The end of the requested reporting period, in RFC 3339 format.
+
+ See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.
+
+ Default value: The current time.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which results are listed in the response (`ASC` for
+ oldest first, `DESC` for newest first).
+
+ Default value: `DESC`
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ListTransactionsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/transactions",
+ method="GET",
+ params={
+ "begin_time": begin_time,
+ "end_time": end_time,
+ "sort_order": sort_order,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListTransactionsResponse,
+ construct_type(
+ type_=ListTransactionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetTransactionResponse]:
+ """
+ Retrieves details for a single transaction.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the transaction's associated location.
+
+ transaction_id : str
+ The ID of the transaction to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetTransactionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/transactions/{jsonable_encoder(transaction_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTransactionResponse,
+ construct_type(
+ type_=GetTransactionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def capture(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[CaptureTransactionResponse]:
+ """
+ Captures a transaction that was created with the [Charge](api-endpoint:Transactions-Charge)
+ endpoint with a `delay_capture` value of `true`.
+
+
+ See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture)
+ for more information.
+
+ Parameters
+ ----------
+ location_id : str
+
+
+ transaction_id : str
+
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CaptureTransactionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/transactions/{jsonable_encoder(transaction_id)}/capture",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CaptureTransactionResponse,
+ construct_type(
+ type_=CaptureTransactionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def void(
+ self, location_id: str, transaction_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[VoidTransactionResponse]:
+ """
+ Cancels a transaction that was created with the [Charge](api-endpoint:Transactions-Charge)
+ endpoint with a `delay_capture` value of `true`.
+
+
+ See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture)
+ for more information.
+
+ Parameters
+ ----------
+ location_id : str
+
+
+ transaction_id : str
+
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[VoidTransactionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/locations/{jsonable_encoder(location_id)}/transactions/{jsonable_encoder(transaction_id)}/void",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ VoidTransactionResponse,
+ construct_type(
+ type_=VoidTransactionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/loyalty/__init__.py b/src/square/loyalty/__init__.py
new file mode 100644
index 00000000..e68adcb7
--- /dev/null
+++ b/src/square/loyalty/__init__.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import accounts, programs, rewards
+_dynamic_imports: typing.Dict[str, str] = {"accounts": ".accounts", "programs": ".programs", "rewards": ".rewards"}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["accounts", "programs", "rewards"]
diff --git a/src/square/loyalty/accounts/__init__.py b/src/square/loyalty/accounts/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/loyalty/accounts/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/loyalty/accounts/client.py b/src/square/loyalty/accounts/client.py
new file mode 100644
index 00000000..e0c6a3fa
--- /dev/null
+++ b/src/square/loyalty/accounts/client.py
@@ -0,0 +1,637 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...requests.loyalty_account import LoyaltyAccountParams
+from ...requests.loyalty_event_accumulate_points import LoyaltyEventAccumulatePointsParams
+from ...requests.loyalty_event_adjust_points import LoyaltyEventAdjustPointsParams
+from ...requests.search_loyalty_accounts_request_loyalty_account_query import (
+ SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams,
+)
+from ...types.accumulate_loyalty_points_response import AccumulateLoyaltyPointsResponse
+from ...types.adjust_loyalty_points_response import AdjustLoyaltyPointsResponse
+from ...types.create_loyalty_account_response import CreateLoyaltyAccountResponse
+from ...types.get_loyalty_account_response import GetLoyaltyAccountResponse
+from ...types.search_loyalty_accounts_response import SearchLoyaltyAccountsResponse
+from .raw_client import AsyncRawAccountsClient, RawAccountsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class AccountsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawAccountsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawAccountsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawAccountsClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ *,
+ loyalty_account: LoyaltyAccountParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateLoyaltyAccountResponse:
+ """
+ Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and a `mapping` with the `phone_number` of the buyer.
+
+ Parameters
+ ----------
+ loyalty_account : LoyaltyAccountParams
+ The loyalty account to create.
+
+ idempotency_key : str
+ A unique string that identifies this `CreateLoyaltyAccount` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateLoyaltyAccountResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.accounts.create(
+ loyalty_account={
+ "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
+ "mapping": {"phone_number": "+14155551234"},
+ },
+ idempotency_key="ec78c477-b1c3-4899-a209-a4e71337c996",
+ )
+ """
+ _response = self._raw_client.create(
+ loyalty_account=loyalty_account, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchLoyaltyAccountsResponse:
+ """
+ Searches for loyalty accounts in a loyalty program.
+
+ You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty `query` object or omit it entirely.
+
+ Search results are sorted by `created_at` in ascending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams]
+ The search criteria for the request.
+
+ limit : typing.Optional[int]
+ The maximum number of results to include in the response. The default value is 30.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to
+ this endpoint. Provide this to retrieve the next set of
+ results for the original query.
+
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchLoyaltyAccountsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.accounts.search(
+ query={"mappings": [{"phone_number": "+14155551234"}]},
+ limit=10,
+ )
+ """
+ _response = self._raw_client.search(query=query, limit=limit, cursor=cursor, request_options=request_options)
+ return _response.data
+
+ def get(
+ self, account_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetLoyaltyAccountResponse:
+ """
+ Retrieves a loyalty account.
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the [loyalty account](entity:LoyaltyAccount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetLoyaltyAccountResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.accounts.get(
+ account_id="account_id",
+ )
+ """
+ _response = self._raw_client.get(account_id, request_options=request_options)
+ return _response.data
+
+ def accumulate_points(
+ self,
+ account_id: str,
+ *,
+ accumulate_points: LoyaltyEventAccumulatePointsParams,
+ idempotency_key: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AccumulateLoyaltyPointsResponse:
+ """
+ Adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount).
+
+ - If you are using the Orders API to manage orders, provide the `order_id`. Square reads the order
+ to compute the points earned from both the base loyalty program and an associated
+ [loyalty promotion](entity:LoyaltyPromotion). For purchases that qualify for multiple accrual
+ rules, Square computes points based on the accrual rule that grants the most points.
+ For purchases that qualify for multiple promotions, Square computes points based on the most
+ recently created promotion. A purchase must first qualify for program points to be eligible for promotion points.
+
+ - If you are not using the Orders API to manage orders, provide `points` with the number of points to add.
+ You must first perform a client-side computation of the points earned from the loyalty program and
+ loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints)
+ to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see
+ [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points).
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the target [loyalty account](entity:LoyaltyAccount).
+
+ accumulate_points : LoyaltyEventAccumulatePointsParams
+ The points to add to the account.
+ If you are using the Orders API to manage orders, specify the order ID.
+ Otherwise, specify the points to add.
+
+ idempotency_key : str
+ A unique string that identifies the `AccumulateLoyaltyPoints` request.
+ Keys can be any valid string but must be unique for every request.
+
+ location_id : str
+ The [location](entity:Location) where the purchase was made.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AccumulateLoyaltyPointsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.accounts.accumulate_points(
+ account_id="account_id",
+ accumulate_points={"order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY"},
+ idempotency_key="58b90739-c3e8-4b11-85f7-e636d48d72cb",
+ location_id="P034NEENMD09F",
+ )
+ """
+ _response = self._raw_client.accumulate_points(
+ account_id,
+ accumulate_points=accumulate_points,
+ idempotency_key=idempotency_key,
+ location_id=location_id,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def adjust(
+ self,
+ account_id: str,
+ *,
+ idempotency_key: str,
+ adjust_points: LoyaltyEventAdjustPointsParams,
+ allow_negative_balance: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AdjustLoyaltyPointsResponse:
+ """
+ Adds points to or subtracts points from a buyer's account.
+
+ Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call
+ [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints)
+ to add points when a buyer pays for the purchase.
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the target [loyalty account](entity:LoyaltyAccount).
+
+ idempotency_key : str
+ A unique string that identifies this `AdjustLoyaltyPoints` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ adjust_points : LoyaltyEventAdjustPointsParams
+ The points to add or subtract and the reason for the adjustment. To add points, specify a positive integer.
+ To subtract points, specify a negative integer.
+
+ allow_negative_balance : typing.Optional[bool]
+ Indicates whether to allow a negative adjustment to result in a negative balance. If `true`, a negative
+ balance is allowed when subtracting points. If `false`, Square returns a `BAD_REQUEST` error when subtracting
+ the specified number of points would result in a negative balance. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AdjustLoyaltyPointsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.accounts.adjust(
+ account_id="account_id",
+ idempotency_key="bc29a517-3dc9-450e-aa76-fae39ee849d1",
+ adjust_points={"points": 10, "reason": "Complimentary points"},
+ )
+ """
+ _response = self._raw_client.adjust(
+ account_id,
+ idempotency_key=idempotency_key,
+ adjust_points=adjust_points,
+ allow_negative_balance=allow_negative_balance,
+ request_options=request_options,
+ )
+ return _response.data
+
+
+class AsyncAccountsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawAccountsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawAccountsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawAccountsClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ *,
+ loyalty_account: LoyaltyAccountParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateLoyaltyAccountResponse:
+ """
+ Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and a `mapping` with the `phone_number` of the buyer.
+
+ Parameters
+ ----------
+ loyalty_account : LoyaltyAccountParams
+ The loyalty account to create.
+
+ idempotency_key : str
+ A unique string that identifies this `CreateLoyaltyAccount` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateLoyaltyAccountResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.accounts.create(
+ loyalty_account={
+ "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
+ "mapping": {"phone_number": "+14155551234"},
+ },
+ idempotency_key="ec78c477-b1c3-4899-a209-a4e71337c996",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ loyalty_account=loyalty_account, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchLoyaltyAccountsResponse:
+ """
+ Searches for loyalty accounts in a loyalty program.
+
+ You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty `query` object or omit it entirely.
+
+ Search results are sorted by `created_at` in ascending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams]
+ The search criteria for the request.
+
+ limit : typing.Optional[int]
+ The maximum number of results to include in the response. The default value is 30.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to
+ this endpoint. Provide this to retrieve the next set of
+ results for the original query.
+
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchLoyaltyAccountsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.accounts.search(
+ query={"mappings": [{"phone_number": "+14155551234"}]},
+ limit=10,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, account_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetLoyaltyAccountResponse:
+ """
+ Retrieves a loyalty account.
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the [loyalty account](entity:LoyaltyAccount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetLoyaltyAccountResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.accounts.get(
+ account_id="account_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(account_id, request_options=request_options)
+ return _response.data
+
+ async def accumulate_points(
+ self,
+ account_id: str,
+ *,
+ accumulate_points: LoyaltyEventAccumulatePointsParams,
+ idempotency_key: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AccumulateLoyaltyPointsResponse:
+ """
+ Adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount).
+
+ - If you are using the Orders API to manage orders, provide the `order_id`. Square reads the order
+ to compute the points earned from both the base loyalty program and an associated
+ [loyalty promotion](entity:LoyaltyPromotion). For purchases that qualify for multiple accrual
+ rules, Square computes points based on the accrual rule that grants the most points.
+ For purchases that qualify for multiple promotions, Square computes points based on the most
+ recently created promotion. A purchase must first qualify for program points to be eligible for promotion points.
+
+ - If you are not using the Orders API to manage orders, provide `points` with the number of points to add.
+ You must first perform a client-side computation of the points earned from the loyalty program and
+ loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints)
+ to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see
+ [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points).
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the target [loyalty account](entity:LoyaltyAccount).
+
+ accumulate_points : LoyaltyEventAccumulatePointsParams
+ The points to add to the account.
+ If you are using the Orders API to manage orders, specify the order ID.
+ Otherwise, specify the points to add.
+
+ idempotency_key : str
+ A unique string that identifies the `AccumulateLoyaltyPoints` request.
+ Keys can be any valid string but must be unique for every request.
+
+ location_id : str
+ The [location](entity:Location) where the purchase was made.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AccumulateLoyaltyPointsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.accounts.accumulate_points(
+ account_id="account_id",
+ accumulate_points={"order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY"},
+ idempotency_key="58b90739-c3e8-4b11-85f7-e636d48d72cb",
+ location_id="P034NEENMD09F",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.accumulate_points(
+ account_id,
+ accumulate_points=accumulate_points,
+ idempotency_key=idempotency_key,
+ location_id=location_id,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def adjust(
+ self,
+ account_id: str,
+ *,
+ idempotency_key: str,
+ adjust_points: LoyaltyEventAdjustPointsParams,
+ allow_negative_balance: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AdjustLoyaltyPointsResponse:
+ """
+ Adds points to or subtracts points from a buyer's account.
+
+ Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call
+ [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints)
+ to add points when a buyer pays for the purchase.
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the target [loyalty account](entity:LoyaltyAccount).
+
+ idempotency_key : str
+ A unique string that identifies this `AdjustLoyaltyPoints` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ adjust_points : LoyaltyEventAdjustPointsParams
+ The points to add or subtract and the reason for the adjustment. To add points, specify a positive integer.
+ To subtract points, specify a negative integer.
+
+ allow_negative_balance : typing.Optional[bool]
+ Indicates whether to allow a negative adjustment to result in a negative balance. If `true`, a negative
+ balance is allowed when subtracting points. If `false`, Square returns a `BAD_REQUEST` error when subtracting
+ the specified number of points would result in a negative balance. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AdjustLoyaltyPointsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.accounts.adjust(
+ account_id="account_id",
+ idempotency_key="bc29a517-3dc9-450e-aa76-fae39ee849d1",
+ adjust_points={"points": 10, "reason": "Complimentary points"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.adjust(
+ account_id,
+ idempotency_key=idempotency_key,
+ adjust_points=adjust_points,
+ allow_negative_balance=allow_negative_balance,
+ request_options=request_options,
+ )
+ return _response.data
diff --git a/src/square/loyalty/accounts/raw_client.py b/src/square/loyalty/accounts/raw_client.py
new file mode 100644
index 00000000..5e20b466
--- /dev/null
+++ b/src/square/loyalty/accounts/raw_client.py
@@ -0,0 +1,676 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.loyalty_account import LoyaltyAccountParams
+from ...requests.loyalty_event_accumulate_points import LoyaltyEventAccumulatePointsParams
+from ...requests.loyalty_event_adjust_points import LoyaltyEventAdjustPointsParams
+from ...requests.search_loyalty_accounts_request_loyalty_account_query import (
+ SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams,
+)
+from ...types.accumulate_loyalty_points_response import AccumulateLoyaltyPointsResponse
+from ...types.adjust_loyalty_points_response import AdjustLoyaltyPointsResponse
+from ...types.create_loyalty_account_response import CreateLoyaltyAccountResponse
+from ...types.get_loyalty_account_response import GetLoyaltyAccountResponse
+from ...types.search_loyalty_accounts_response import SearchLoyaltyAccountsResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawAccountsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ loyalty_account: LoyaltyAccountParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateLoyaltyAccountResponse]:
+ """
+ Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and a `mapping` with the `phone_number` of the buyer.
+
+ Parameters
+ ----------
+ loyalty_account : LoyaltyAccountParams
+ The loyalty account to create.
+
+ idempotency_key : str
+ A unique string that identifies this `CreateLoyaltyAccount` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateLoyaltyAccountResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/loyalty/accounts",
+ method="POST",
+ json={
+ "loyalty_account": convert_and_respect_annotation_metadata(
+ object_=loyalty_account, annotation=LoyaltyAccountParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateLoyaltyAccountResponse,
+ construct_type(
+ type_=CreateLoyaltyAccountResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchLoyaltyAccountsResponse]:
+ """
+ Searches for loyalty accounts in a loyalty program.
+
+ You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty `query` object or omit it entirely.
+
+ Search results are sorted by `created_at` in ascending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams]
+ The search criteria for the request.
+
+ limit : typing.Optional[int]
+ The maximum number of results to include in the response. The default value is 30.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to
+ this endpoint. Provide this to retrieve the next set of
+ results for the original query.
+
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchLoyaltyAccountsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/loyalty/accounts/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchLoyaltyAccountsResponse,
+ construct_type(
+ type_=SearchLoyaltyAccountsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, account_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetLoyaltyAccountResponse]:
+ """
+ Retrieves a loyalty account.
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the [loyalty account](entity:LoyaltyAccount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetLoyaltyAccountResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/accounts/{jsonable_encoder(account_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetLoyaltyAccountResponse,
+ construct_type(
+ type_=GetLoyaltyAccountResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def accumulate_points(
+ self,
+ account_id: str,
+ *,
+ accumulate_points: LoyaltyEventAccumulatePointsParams,
+ idempotency_key: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[AccumulateLoyaltyPointsResponse]:
+ """
+ Adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount).
+
+ - If you are using the Orders API to manage orders, provide the `order_id`. Square reads the order
+ to compute the points earned from both the base loyalty program and an associated
+ [loyalty promotion](entity:LoyaltyPromotion). For purchases that qualify for multiple accrual
+ rules, Square computes points based on the accrual rule that grants the most points.
+ For purchases that qualify for multiple promotions, Square computes points based on the most
+ recently created promotion. A purchase must first qualify for program points to be eligible for promotion points.
+
+ - If you are not using the Orders API to manage orders, provide `points` with the number of points to add.
+ You must first perform a client-side computation of the points earned from the loyalty program and
+ loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints)
+ to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see
+ [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points).
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the target [loyalty account](entity:LoyaltyAccount).
+
+ accumulate_points : LoyaltyEventAccumulatePointsParams
+ The points to add to the account.
+ If you are using the Orders API to manage orders, specify the order ID.
+ Otherwise, specify the points to add.
+
+ idempotency_key : str
+ A unique string that identifies the `AccumulateLoyaltyPoints` request.
+ Keys can be any valid string but must be unique for every request.
+
+ location_id : str
+ The [location](entity:Location) where the purchase was made.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[AccumulateLoyaltyPointsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/accounts/{jsonable_encoder(account_id)}/accumulate",
+ method="POST",
+ json={
+ "accumulate_points": convert_and_respect_annotation_metadata(
+ object_=accumulate_points, annotation=LoyaltyEventAccumulatePointsParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ "location_id": location_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ AccumulateLoyaltyPointsResponse,
+ construct_type(
+ type_=AccumulateLoyaltyPointsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def adjust(
+ self,
+ account_id: str,
+ *,
+ idempotency_key: str,
+ adjust_points: LoyaltyEventAdjustPointsParams,
+ allow_negative_balance: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[AdjustLoyaltyPointsResponse]:
+ """
+ Adds points to or subtracts points from a buyer's account.
+
+ Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call
+ [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints)
+ to add points when a buyer pays for the purchase.
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the target [loyalty account](entity:LoyaltyAccount).
+
+ idempotency_key : str
+ A unique string that identifies this `AdjustLoyaltyPoints` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ adjust_points : LoyaltyEventAdjustPointsParams
+ The points to add or subtract and the reason for the adjustment. To add points, specify a positive integer.
+ To subtract points, specify a negative integer.
+
+ allow_negative_balance : typing.Optional[bool]
+ Indicates whether to allow a negative adjustment to result in a negative balance. If `true`, a negative
+ balance is allowed when subtracting points. If `false`, Square returns a `BAD_REQUEST` error when subtracting
+ the specified number of points would result in a negative balance. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[AdjustLoyaltyPointsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/accounts/{jsonable_encoder(account_id)}/adjust",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "adjust_points": convert_and_respect_annotation_metadata(
+ object_=adjust_points, annotation=LoyaltyEventAdjustPointsParams, direction="write"
+ ),
+ "allow_negative_balance": allow_negative_balance,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ AdjustLoyaltyPointsResponse,
+ construct_type(
+ type_=AdjustLoyaltyPointsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawAccountsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ loyalty_account: LoyaltyAccountParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateLoyaltyAccountResponse]:
+ """
+ Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and a `mapping` with the `phone_number` of the buyer.
+
+ Parameters
+ ----------
+ loyalty_account : LoyaltyAccountParams
+ The loyalty account to create.
+
+ idempotency_key : str
+ A unique string that identifies this `CreateLoyaltyAccount` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateLoyaltyAccountResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/loyalty/accounts",
+ method="POST",
+ json={
+ "loyalty_account": convert_and_respect_annotation_metadata(
+ object_=loyalty_account, annotation=LoyaltyAccountParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateLoyaltyAccountResponse,
+ construct_type(
+ type_=CreateLoyaltyAccountResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchLoyaltyAccountsResponse]:
+ """
+ Searches for loyalty accounts in a loyalty program.
+
+ You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty `query` object or omit it entirely.
+
+ Search results are sorted by `created_at` in ascending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams]
+ The search criteria for the request.
+
+ limit : typing.Optional[int]
+ The maximum number of results to include in the response. The default value is 30.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to
+ this endpoint. Provide this to retrieve the next set of
+ results for the original query.
+
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchLoyaltyAccountsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/loyalty/accounts/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchLoyaltyAccountsResponse,
+ construct_type(
+ type_=SearchLoyaltyAccountsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, account_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetLoyaltyAccountResponse]:
+ """
+ Retrieves a loyalty account.
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the [loyalty account](entity:LoyaltyAccount) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetLoyaltyAccountResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/accounts/{jsonable_encoder(account_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetLoyaltyAccountResponse,
+ construct_type(
+ type_=GetLoyaltyAccountResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def accumulate_points(
+ self,
+ account_id: str,
+ *,
+ accumulate_points: LoyaltyEventAccumulatePointsParams,
+ idempotency_key: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[AccumulateLoyaltyPointsResponse]:
+ """
+ Adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount).
+
+ - If you are using the Orders API to manage orders, provide the `order_id`. Square reads the order
+ to compute the points earned from both the base loyalty program and an associated
+ [loyalty promotion](entity:LoyaltyPromotion). For purchases that qualify for multiple accrual
+ rules, Square computes points based on the accrual rule that grants the most points.
+ For purchases that qualify for multiple promotions, Square computes points based on the most
+ recently created promotion. A purchase must first qualify for program points to be eligible for promotion points.
+
+ - If you are not using the Orders API to manage orders, provide `points` with the number of points to add.
+ You must first perform a client-side computation of the points earned from the loyalty program and
+ loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints)
+ to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see
+ [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points).
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the target [loyalty account](entity:LoyaltyAccount).
+
+ accumulate_points : LoyaltyEventAccumulatePointsParams
+ The points to add to the account.
+ If you are using the Orders API to manage orders, specify the order ID.
+ Otherwise, specify the points to add.
+
+ idempotency_key : str
+ A unique string that identifies the `AccumulateLoyaltyPoints` request.
+ Keys can be any valid string but must be unique for every request.
+
+ location_id : str
+ The [location](entity:Location) where the purchase was made.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[AccumulateLoyaltyPointsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/accounts/{jsonable_encoder(account_id)}/accumulate",
+ method="POST",
+ json={
+ "accumulate_points": convert_and_respect_annotation_metadata(
+ object_=accumulate_points, annotation=LoyaltyEventAccumulatePointsParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ "location_id": location_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ AccumulateLoyaltyPointsResponse,
+ construct_type(
+ type_=AccumulateLoyaltyPointsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def adjust(
+ self,
+ account_id: str,
+ *,
+ idempotency_key: str,
+ adjust_points: LoyaltyEventAdjustPointsParams,
+ allow_negative_balance: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[AdjustLoyaltyPointsResponse]:
+ """
+ Adds points to or subtracts points from a buyer's account.
+
+ Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call
+ [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints)
+ to add points when a buyer pays for the purchase.
+
+ Parameters
+ ----------
+ account_id : str
+ The ID of the target [loyalty account](entity:LoyaltyAccount).
+
+ idempotency_key : str
+ A unique string that identifies this `AdjustLoyaltyPoints` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ adjust_points : LoyaltyEventAdjustPointsParams
+ The points to add or subtract and the reason for the adjustment. To add points, specify a positive integer.
+ To subtract points, specify a negative integer.
+
+ allow_negative_balance : typing.Optional[bool]
+ Indicates whether to allow a negative adjustment to result in a negative balance. If `true`, a negative
+ balance is allowed when subtracting points. If `false`, Square returns a `BAD_REQUEST` error when subtracting
+ the specified number of points would result in a negative balance. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[AdjustLoyaltyPointsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/accounts/{jsonable_encoder(account_id)}/adjust",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "adjust_points": convert_and_respect_annotation_metadata(
+ object_=adjust_points, annotation=LoyaltyEventAdjustPointsParams, direction="write"
+ ),
+ "allow_negative_balance": allow_negative_balance,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ AdjustLoyaltyPointsResponse,
+ construct_type(
+ type_=AdjustLoyaltyPointsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/loyalty/client.py b/src/square/loyalty/client.py
new file mode 100644
index 00000000..972ba866
--- /dev/null
+++ b/src/square/loyalty/client.py
@@ -0,0 +1,244 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..requests.loyalty_event_query import LoyaltyEventQueryParams
+from ..types.search_loyalty_events_response import SearchLoyaltyEventsResponse
+from .raw_client import AsyncRawLoyaltyClient, RawLoyaltyClient
+
+if typing.TYPE_CHECKING:
+ from .accounts.client import AccountsClient, AsyncAccountsClient
+ from .programs.client import AsyncProgramsClient, ProgramsClient
+ from .rewards.client import AsyncRewardsClient, RewardsClient
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class LoyaltyClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawLoyaltyClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._accounts: typing.Optional[AccountsClient] = None
+ self._programs: typing.Optional[ProgramsClient] = None
+ self._rewards: typing.Optional[RewardsClient] = None
+
+ @property
+ def with_raw_response(self) -> RawLoyaltyClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawLoyaltyClient
+ """
+ return self._raw_client
+
+ def search_events(
+ self,
+ *,
+ query: typing.Optional[LoyaltyEventQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchLoyaltyEventsResponse:
+ """
+ Searches for loyalty events.
+
+ A Square loyalty program maintains a ledger of events that occur during the lifetime of a
+ buyer's loyalty account. Each change in the point balance
+ (for example, points earned, points redeemed, and points expired) is
+ recorded in the ledger. Using this endpoint, you can search the ledger for events.
+
+ Search results are sorted by `created_at` in descending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[LoyaltyEventQueryParams]
+ A set of one or more predefined query filters to apply when
+ searching for loyalty events. The endpoint performs a logical AND to
+ evaluate multiple filters and performs a logical OR on arrays
+ that specifies multiple field values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to include in the response.
+ The last page might contain fewer events.
+ The default is 30 events.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchLoyaltyEventsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.search_events(
+ query={
+ "filter": {
+ "order_filter": {"order_id": "PyATxhYLfsMqpVkcKJITPydgEYfZY"}
+ }
+ },
+ limit=30,
+ )
+ """
+ _response = self._raw_client.search_events(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ @property
+ def accounts(self):
+ if self._accounts is None:
+ from .accounts.client import AccountsClient # noqa: E402
+
+ self._accounts = AccountsClient(client_wrapper=self._client_wrapper)
+ return self._accounts
+
+ @property
+ def programs(self):
+ if self._programs is None:
+ from .programs.client import ProgramsClient # noqa: E402
+
+ self._programs = ProgramsClient(client_wrapper=self._client_wrapper)
+ return self._programs
+
+ @property
+ def rewards(self):
+ if self._rewards is None:
+ from .rewards.client import RewardsClient # noqa: E402
+
+ self._rewards = RewardsClient(client_wrapper=self._client_wrapper)
+ return self._rewards
+
+
+class AsyncLoyaltyClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawLoyaltyClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._accounts: typing.Optional[AsyncAccountsClient] = None
+ self._programs: typing.Optional[AsyncProgramsClient] = None
+ self._rewards: typing.Optional[AsyncRewardsClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawLoyaltyClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawLoyaltyClient
+ """
+ return self._raw_client
+
+ async def search_events(
+ self,
+ *,
+ query: typing.Optional[LoyaltyEventQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchLoyaltyEventsResponse:
+ """
+ Searches for loyalty events.
+
+ A Square loyalty program maintains a ledger of events that occur during the lifetime of a
+ buyer's loyalty account. Each change in the point balance
+ (for example, points earned, points redeemed, and points expired) is
+ recorded in the ledger. Using this endpoint, you can search the ledger for events.
+
+ Search results are sorted by `created_at` in descending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[LoyaltyEventQueryParams]
+ A set of one or more predefined query filters to apply when
+ searching for loyalty events. The endpoint performs a logical AND to
+ evaluate multiple filters and performs a logical OR on arrays
+ that specifies multiple field values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to include in the response.
+ The last page might contain fewer events.
+ The default is 30 events.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchLoyaltyEventsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.search_events(
+ query={
+ "filter": {
+ "order_filter": {"order_id": "PyATxhYLfsMqpVkcKJITPydgEYfZY"}
+ }
+ },
+ limit=30,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search_events(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ @property
+ def accounts(self):
+ if self._accounts is None:
+ from .accounts.client import AsyncAccountsClient # noqa: E402
+
+ self._accounts = AsyncAccountsClient(client_wrapper=self._client_wrapper)
+ return self._accounts
+
+ @property
+ def programs(self):
+ if self._programs is None:
+ from .programs.client import AsyncProgramsClient # noqa: E402
+
+ self._programs = AsyncProgramsClient(client_wrapper=self._client_wrapper)
+ return self._programs
+
+ @property
+ def rewards(self):
+ if self._rewards is None:
+ from .rewards.client import AsyncRewardsClient # noqa: E402
+
+ self._rewards = AsyncRewardsClient(client_wrapper=self._client_wrapper)
+ return self._rewards
diff --git a/src/square/loyalty/programs/__init__.py b/src/square/loyalty/programs/__init__.py
new file mode 100644
index 00000000..4d547aec
--- /dev/null
+++ b/src/square/loyalty/programs/__init__.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import promotions
+_dynamic_imports: typing.Dict[str, str] = {"promotions": ".promotions"}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["promotions"]
diff --git a/src/square/loyalty/programs/client.py b/src/square/loyalty/programs/client.py
new file mode 100644
index 00000000..f438bc15
--- /dev/null
+++ b/src/square/loyalty/programs/client.py
@@ -0,0 +1,386 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...requests.money import MoneyParams
+from ...types.calculate_loyalty_points_response import CalculateLoyaltyPointsResponse
+from ...types.get_loyalty_program_response import GetLoyaltyProgramResponse
+from ...types.list_loyalty_programs_response import ListLoyaltyProgramsResponse
+from .raw_client import AsyncRawProgramsClient, RawProgramsClient
+
+if typing.TYPE_CHECKING:
+ from .promotions.client import AsyncPromotionsClient, PromotionsClient
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class ProgramsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawProgramsClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._promotions: typing.Optional[PromotionsClient] = None
+
+ @property
+ def with_raw_response(self) -> RawProgramsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawProgramsClient
+ """
+ return self._raw_client
+
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListLoyaltyProgramsResponse:
+ """
+ Returns a list of loyalty programs in the seller's account.
+ Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
+
+
+ Replaced with [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) when used with the keyword `main`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListLoyaltyProgramsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.programs.list()
+ """
+ _response = self._raw_client.list(request_options=request_options)
+ return _response.data
+
+ def get(
+ self, program_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetLoyaltyProgramResponse:
+ """
+ Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword `main`.
+
+ Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the loyalty program or the keyword `main`. Either value can be used to retrieve the single loyalty program that belongs to the seller.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetLoyaltyProgramResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.programs.get(
+ program_id="program_id",
+ )
+ """
+ _response = self._raw_client.get(program_id, request_options=request_options)
+ return _response.data
+
+ def calculate(
+ self,
+ program_id: str,
+ *,
+ order_id: typing.Optional[str] = OMIT,
+ transaction_amount_money: typing.Optional[MoneyParams] = OMIT,
+ loyalty_account_id: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CalculateLoyaltyPointsResponse:
+ """
+ Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint
+ to display the points to the buyer.
+
+ - If you are using the Orders API to manage orders, provide the `order_id` and (optional) `loyalty_account_id`.
+ Square reads the order to compute the points earned from the base loyalty program and an associated
+ [loyalty promotion](entity:LoyaltyPromotion).
+
+ - If you are not using the Orders API to manage orders, provide `transaction_amount_money` with the
+ purchase amount. Square uses this amount to calculate the points earned from the base loyalty program,
+ but not points earned from a loyalty promotion. For spend-based and visit-based programs, the `tax_mode`
+ setting of the accrual rule indicates how taxes should be treated for loyalty points accrual.
+ If the purchase qualifies for program points, call
+ [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) and perform a client-side computation
+ to calculate whether the purchase also qualifies for promotion points. For more information, see
+ [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the [loyalty program](entity:LoyaltyProgram), which defines the rules for accruing points.
+
+ order_id : typing.Optional[str]
+ The [order](entity:Order) ID for which to calculate the points.
+ Specify this field if your application uses the Orders API to process orders.
+ Otherwise, specify the `transaction_amount_money`.
+
+ transaction_amount_money : typing.Optional[MoneyParams]
+ The purchase amount for which to calculate the points.
+ Specify this field if your application does not use the Orders API to process orders.
+ Otherwise, specify the `order_id`.
+
+ loyalty_account_id : typing.Optional[str]
+ The ID of the target [loyalty account](entity:LoyaltyAccount). Optionally specify this field
+ if your application uses the Orders API to process orders.
+
+ If specified, the `promotion_points` field in the response shows the number of points the buyer would
+ earn from the purchase. In this case, Square uses the account ID to determine whether the promotion's
+ `trigger_limit` (the maximum number of times that a buyer can trigger the promotion) has been reached.
+ If not specified, the `promotion_points` field shows the number of points the purchase qualifies
+ for regardless of the trigger limit.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CalculateLoyaltyPointsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.programs.calculate(
+ program_id="program_id",
+ order_id="RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY",
+ loyalty_account_id="79b807d2-d786-46a9-933b-918028d7a8c5",
+ )
+ """
+ _response = self._raw_client.calculate(
+ program_id,
+ order_id=order_id,
+ transaction_amount_money=transaction_amount_money,
+ loyalty_account_id=loyalty_account_id,
+ request_options=request_options,
+ )
+ return _response.data
+
+ @property
+ def promotions(self):
+ if self._promotions is None:
+ from .promotions.client import PromotionsClient # noqa: E402
+
+ self._promotions = PromotionsClient(client_wrapper=self._client_wrapper)
+ return self._promotions
+
+
+class AsyncProgramsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawProgramsClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._promotions: typing.Optional[AsyncPromotionsClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawProgramsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawProgramsClient
+ """
+ return self._raw_client
+
+ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListLoyaltyProgramsResponse:
+ """
+ Returns a list of loyalty programs in the seller's account.
+ Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
+
+
+ Replaced with [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) when used with the keyword `main`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListLoyaltyProgramsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.programs.list()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.list(request_options=request_options)
+ return _response.data
+
+ async def get(
+ self, program_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetLoyaltyProgramResponse:
+ """
+ Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword `main`.
+
+ Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the loyalty program or the keyword `main`. Either value can be used to retrieve the single loyalty program that belongs to the seller.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetLoyaltyProgramResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.programs.get(
+ program_id="program_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(program_id, request_options=request_options)
+ return _response.data
+
+ async def calculate(
+ self,
+ program_id: str,
+ *,
+ order_id: typing.Optional[str] = OMIT,
+ transaction_amount_money: typing.Optional[MoneyParams] = OMIT,
+ loyalty_account_id: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CalculateLoyaltyPointsResponse:
+ """
+ Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint
+ to display the points to the buyer.
+
+ - If you are using the Orders API to manage orders, provide the `order_id` and (optional) `loyalty_account_id`.
+ Square reads the order to compute the points earned from the base loyalty program and an associated
+ [loyalty promotion](entity:LoyaltyPromotion).
+
+ - If you are not using the Orders API to manage orders, provide `transaction_amount_money` with the
+ purchase amount. Square uses this amount to calculate the points earned from the base loyalty program,
+ but not points earned from a loyalty promotion. For spend-based and visit-based programs, the `tax_mode`
+ setting of the accrual rule indicates how taxes should be treated for loyalty points accrual.
+ If the purchase qualifies for program points, call
+ [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) and perform a client-side computation
+ to calculate whether the purchase also qualifies for promotion points. For more information, see
+ [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the [loyalty program](entity:LoyaltyProgram), which defines the rules for accruing points.
+
+ order_id : typing.Optional[str]
+ The [order](entity:Order) ID for which to calculate the points.
+ Specify this field if your application uses the Orders API to process orders.
+ Otherwise, specify the `transaction_amount_money`.
+
+ transaction_amount_money : typing.Optional[MoneyParams]
+ The purchase amount for which to calculate the points.
+ Specify this field if your application does not use the Orders API to process orders.
+ Otherwise, specify the `order_id`.
+
+ loyalty_account_id : typing.Optional[str]
+ The ID of the target [loyalty account](entity:LoyaltyAccount). Optionally specify this field
+ if your application uses the Orders API to process orders.
+
+ If specified, the `promotion_points` field in the response shows the number of points the buyer would
+ earn from the purchase. In this case, Square uses the account ID to determine whether the promotion's
+ `trigger_limit` (the maximum number of times that a buyer can trigger the promotion) has been reached.
+ If not specified, the `promotion_points` field shows the number of points the purchase qualifies
+ for regardless of the trigger limit.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CalculateLoyaltyPointsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.programs.calculate(
+ program_id="program_id",
+ order_id="RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY",
+ loyalty_account_id="79b807d2-d786-46a9-933b-918028d7a8c5",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.calculate(
+ program_id,
+ order_id=order_id,
+ transaction_amount_money=transaction_amount_money,
+ loyalty_account_id=loyalty_account_id,
+ request_options=request_options,
+ )
+ return _response.data
+
+ @property
+ def promotions(self):
+ if self._promotions is None:
+ from .promotions.client import AsyncPromotionsClient # noqa: E402
+
+ self._promotions = AsyncPromotionsClient(client_wrapper=self._client_wrapper)
+ return self._promotions
diff --git a/src/square/loyalty/programs/promotions/__init__.py b/src/square/loyalty/programs/promotions/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/loyalty/programs/promotions/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/loyalty/programs/promotions/client.py b/src/square/loyalty/programs/promotions/client.py
new file mode 100644
index 00000000..3030ab2a
--- /dev/null
+++ b/src/square/loyalty/programs/promotions/client.py
@@ -0,0 +1,521 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ....core.pagination import AsyncPager, SyncPager
+from ....core.request_options import RequestOptions
+from ....requests.loyalty_promotion import LoyaltyPromotionParams
+from ....types.cancel_loyalty_promotion_response import CancelLoyaltyPromotionResponse
+from ....types.create_loyalty_promotion_response import CreateLoyaltyPromotionResponse
+from ....types.get_loyalty_promotion_response import GetLoyaltyPromotionResponse
+from ....types.list_loyalty_promotions_response import ListLoyaltyPromotionsResponse
+from ....types.loyalty_promotion import LoyaltyPromotion
+from ....types.loyalty_promotion_status import LoyaltyPromotionStatus
+from .raw_client import AsyncRawPromotionsClient, RawPromotionsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class PromotionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawPromotionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawPromotionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawPromotionsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ program_id: str,
+ *,
+ status: typing.Optional[LoyaltyPromotionStatus] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[LoyaltyPromotion, ListLoyaltyPromotionsResponse]:
+ """
+ Lists the loyalty promotions associated with a [loyalty program](entity:LoyaltyProgram).
+ Results are sorted by the `created_at` date in descending order (newest to oldest).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID,
+ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword.
+
+ status : typing.Optional[LoyaltyPromotionStatus]
+ The status to filter the results by. If a status is provided, only loyalty promotions
+ with the specified status are returned. Otherwise, all loyalty promotions associated with
+ the loyalty program are returned.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response.
+ The minimum value is 1 and the maximum value is 30. The default value is 30.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[LoyaltyPromotion, ListLoyaltyPromotionsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.loyalty.programs.promotions.list(
+ program_id="program_id",
+ status="ACTIVE",
+ cursor="cursor",
+ limit=1,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ program_id, status=status, cursor=cursor, limit=limit, request_options=request_options
+ )
+
+ def create(
+ self,
+ program_id: str,
+ *,
+ loyalty_promotion: LoyaltyPromotionParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateLoyaltyPromotionResponse:
+ """
+ Creates a loyalty promotion for a [loyalty program](entity:LoyaltyProgram). A loyalty promotion
+ enables buyers to earn points in addition to those earned from the base loyalty program.
+
+ This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, depending on the
+ `available_time` setting. A loyalty program can have a maximum of 10 loyalty promotions with an
+ `ACTIVE` or `SCHEDULED` status.
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the [loyalty program](entity:LoyaltyProgram) to associate with the promotion.
+ To get the program ID, call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram)
+ using the `main` keyword.
+
+ loyalty_promotion : LoyaltyPromotionParams
+ The loyalty promotion to create.
+
+ idempotency_key : str
+ A unique identifier for this request, which is used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateLoyaltyPromotionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.programs.promotions.create(
+ program_id="program_id",
+ loyalty_promotion={
+ "name": "Tuesday Happy Hour Promo",
+ "incentive": {
+ "type": "POINTS_MULTIPLIER",
+ "points_multiplier_data": {"multiplier": "3.0"},
+ },
+ "available_time": {
+ "time_periods": [
+ "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT"
+ ]
+ },
+ "trigger_limit": {"times": 1, "interval": "DAY"},
+ "minimum_spend_amount_money": {"amount": 2000, "currency": "USD"},
+ "qualifying_category_ids": ["XTQPYLR3IIU9C44VRCB3XD12"],
+ },
+ idempotency_key="ec78c477-b1c3-4899-a209-a4e71337c996",
+ )
+ """
+ _response = self._raw_client.create(
+ program_id,
+ loyalty_promotion=loyalty_promotion,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def get(
+ self, program_id: str, promotion_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetLoyaltyPromotionResponse:
+ """
+ Retrieves a loyalty promotion.
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID,
+ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword.
+
+ promotion_id : str
+ The ID of the [loyalty promotion](entity:LoyaltyPromotion) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetLoyaltyPromotionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.programs.promotions.get(
+ program_id="program_id",
+ promotion_id="promotion_id",
+ )
+ """
+ _response = self._raw_client.get(program_id, promotion_id, request_options=request_options)
+ return _response.data
+
+ def cancel(
+ self, program_id: str, promotion_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelLoyaltyPromotionResponse:
+ """
+ Cancels a loyalty promotion. Use this endpoint to cancel an `ACTIVE` promotion earlier than the
+ end date, cancel an `ACTIVE` promotion when an end date is not specified, or cancel a `SCHEDULED` promotion.
+ Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion before
+ you create a new one.
+
+ This endpoint sets the loyalty promotion to the `CANCELED` state
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram).
+
+ promotion_id : str
+ The ID of the [loyalty promotion](entity:LoyaltyPromotion) to cancel. You can cancel a
+ promotion that has an `ACTIVE` or `SCHEDULED` status.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelLoyaltyPromotionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.programs.promotions.cancel(
+ program_id="program_id",
+ promotion_id="promotion_id",
+ )
+ """
+ _response = self._raw_client.cancel(program_id, promotion_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncPromotionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawPromotionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawPromotionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawPromotionsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ program_id: str,
+ *,
+ status: typing.Optional[LoyaltyPromotionStatus] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[LoyaltyPromotion, ListLoyaltyPromotionsResponse]:
+ """
+ Lists the loyalty promotions associated with a [loyalty program](entity:LoyaltyProgram).
+ Results are sorted by the `created_at` date in descending order (newest to oldest).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID,
+ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword.
+
+ status : typing.Optional[LoyaltyPromotionStatus]
+ The status to filter the results by. If a status is provided, only loyalty promotions
+ with the specified status are returned. Otherwise, all loyalty promotions associated with
+ the loyalty program are returned.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response.
+ The minimum value is 1 and the maximum value is 30. The default value is 30.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[LoyaltyPromotion, ListLoyaltyPromotionsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.loyalty.programs.promotions.list(
+ program_id="program_id",
+ status="ACTIVE",
+ cursor="cursor",
+ limit=1,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ program_id, status=status, cursor=cursor, limit=limit, request_options=request_options
+ )
+
+ async def create(
+ self,
+ program_id: str,
+ *,
+ loyalty_promotion: LoyaltyPromotionParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateLoyaltyPromotionResponse:
+ """
+ Creates a loyalty promotion for a [loyalty program](entity:LoyaltyProgram). A loyalty promotion
+ enables buyers to earn points in addition to those earned from the base loyalty program.
+
+ This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, depending on the
+ `available_time` setting. A loyalty program can have a maximum of 10 loyalty promotions with an
+ `ACTIVE` or `SCHEDULED` status.
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the [loyalty program](entity:LoyaltyProgram) to associate with the promotion.
+ To get the program ID, call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram)
+ using the `main` keyword.
+
+ loyalty_promotion : LoyaltyPromotionParams
+ The loyalty promotion to create.
+
+ idempotency_key : str
+ A unique identifier for this request, which is used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateLoyaltyPromotionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.programs.promotions.create(
+ program_id="program_id",
+ loyalty_promotion={
+ "name": "Tuesday Happy Hour Promo",
+ "incentive": {
+ "type": "POINTS_MULTIPLIER",
+ "points_multiplier_data": {"multiplier": "3.0"},
+ },
+ "available_time": {
+ "time_periods": [
+ "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT"
+ ]
+ },
+ "trigger_limit": {"times": 1, "interval": "DAY"},
+ "minimum_spend_amount_money": {"amount": 2000, "currency": "USD"},
+ "qualifying_category_ids": ["XTQPYLR3IIU9C44VRCB3XD12"],
+ },
+ idempotency_key="ec78c477-b1c3-4899-a209-a4e71337c996",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ program_id,
+ loyalty_promotion=loyalty_promotion,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def get(
+ self, program_id: str, promotion_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetLoyaltyPromotionResponse:
+ """
+ Retrieves a loyalty promotion.
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID,
+ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword.
+
+ promotion_id : str
+ The ID of the [loyalty promotion](entity:LoyaltyPromotion) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetLoyaltyPromotionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.programs.promotions.get(
+ program_id="program_id",
+ promotion_id="promotion_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(program_id, promotion_id, request_options=request_options)
+ return _response.data
+
+ async def cancel(
+ self, program_id: str, promotion_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelLoyaltyPromotionResponse:
+ """
+ Cancels a loyalty promotion. Use this endpoint to cancel an `ACTIVE` promotion earlier than the
+ end date, cancel an `ACTIVE` promotion when an end date is not specified, or cancel a `SCHEDULED` promotion.
+ Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion before
+ you create a new one.
+
+ This endpoint sets the loyalty promotion to the `CANCELED` state
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram).
+
+ promotion_id : str
+ The ID of the [loyalty promotion](entity:LoyaltyPromotion) to cancel. You can cancel a
+ promotion that has an `ACTIVE` or `SCHEDULED` status.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelLoyaltyPromotionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.programs.promotions.cancel(
+ program_id="program_id",
+ promotion_id="promotion_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.cancel(program_id, promotion_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/loyalty/programs/promotions/raw_client.py b/src/square/loyalty/programs/promotions/raw_client.py
new file mode 100644
index 00000000..3e60a737
--- /dev/null
+++ b/src/square/loyalty/programs/promotions/raw_client.py
@@ -0,0 +1,508 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ....core.api_error import ApiError
+from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ....core.http_response import AsyncHttpResponse, HttpResponse
+from ....core.jsonable_encoder import jsonable_encoder
+from ....core.pagination import AsyncPager, SyncPager
+from ....core.request_options import RequestOptions
+from ....core.serialization import convert_and_respect_annotation_metadata
+from ....core.unchecked_base_model import construct_type
+from ....requests.loyalty_promotion import LoyaltyPromotionParams
+from ....types.cancel_loyalty_promotion_response import CancelLoyaltyPromotionResponse
+from ....types.create_loyalty_promotion_response import CreateLoyaltyPromotionResponse
+from ....types.get_loyalty_promotion_response import GetLoyaltyPromotionResponse
+from ....types.list_loyalty_promotions_response import ListLoyaltyPromotionsResponse
+from ....types.loyalty_promotion import LoyaltyPromotion
+from ....types.loyalty_promotion_status import LoyaltyPromotionStatus
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawPromotionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ program_id: str,
+ *,
+ status: typing.Optional[LoyaltyPromotionStatus] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[LoyaltyPromotion, ListLoyaltyPromotionsResponse]:
+ """
+ Lists the loyalty promotions associated with a [loyalty program](entity:LoyaltyProgram).
+ Results are sorted by the `created_at` date in descending order (newest to oldest).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID,
+ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword.
+
+ status : typing.Optional[LoyaltyPromotionStatus]
+ The status to filter the results by. If a status is provided, only loyalty promotions
+ with the specified status are returned. Otherwise, all loyalty promotions associated with
+ the loyalty program are returned.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response.
+ The minimum value is 1 and the maximum value is 30. The default value is 30.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[LoyaltyPromotion, ListLoyaltyPromotionsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}/promotions",
+ method="GET",
+ params={
+ "status": status,
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListLoyaltyPromotionsResponse,
+ construct_type(
+ type_=ListLoyaltyPromotionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.loyalty_promotions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ program_id,
+ status=status,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ program_id: str,
+ *,
+ loyalty_promotion: LoyaltyPromotionParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateLoyaltyPromotionResponse]:
+ """
+ Creates a loyalty promotion for a [loyalty program](entity:LoyaltyProgram). A loyalty promotion
+ enables buyers to earn points in addition to those earned from the base loyalty program.
+
+ This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, depending on the
+ `available_time` setting. A loyalty program can have a maximum of 10 loyalty promotions with an
+ `ACTIVE` or `SCHEDULED` status.
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the [loyalty program](entity:LoyaltyProgram) to associate with the promotion.
+ To get the program ID, call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram)
+ using the `main` keyword.
+
+ loyalty_promotion : LoyaltyPromotionParams
+ The loyalty promotion to create.
+
+ idempotency_key : str
+ A unique identifier for this request, which is used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateLoyaltyPromotionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}/promotions",
+ method="POST",
+ json={
+ "loyalty_promotion": convert_and_respect_annotation_metadata(
+ object_=loyalty_promotion, annotation=LoyaltyPromotionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateLoyaltyPromotionResponse,
+ construct_type(
+ type_=CreateLoyaltyPromotionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, program_id: str, promotion_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetLoyaltyPromotionResponse]:
+ """
+ Retrieves a loyalty promotion.
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID,
+ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword.
+
+ promotion_id : str
+ The ID of the [loyalty promotion](entity:LoyaltyPromotion) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetLoyaltyPromotionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}/promotions/{jsonable_encoder(promotion_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetLoyaltyPromotionResponse,
+ construct_type(
+ type_=GetLoyaltyPromotionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def cancel(
+ self, program_id: str, promotion_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[CancelLoyaltyPromotionResponse]:
+ """
+ Cancels a loyalty promotion. Use this endpoint to cancel an `ACTIVE` promotion earlier than the
+ end date, cancel an `ACTIVE` promotion when an end date is not specified, or cancel a `SCHEDULED` promotion.
+ Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion before
+ you create a new one.
+
+ This endpoint sets the loyalty promotion to the `CANCELED` state
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram).
+
+ promotion_id : str
+ The ID of the [loyalty promotion](entity:LoyaltyPromotion) to cancel. You can cancel a
+ promotion that has an `ACTIVE` or `SCHEDULED` status.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CancelLoyaltyPromotionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}/promotions/{jsonable_encoder(promotion_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelLoyaltyPromotionResponse,
+ construct_type(
+ type_=CancelLoyaltyPromotionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawPromotionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ program_id: str,
+ *,
+ status: typing.Optional[LoyaltyPromotionStatus] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[LoyaltyPromotion, ListLoyaltyPromotionsResponse]:
+ """
+ Lists the loyalty promotions associated with a [loyalty program](entity:LoyaltyProgram).
+ Results are sorted by the `created_at` date in descending order (newest to oldest).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID,
+ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword.
+
+ status : typing.Optional[LoyaltyPromotionStatus]
+ The status to filter the results by. If a status is provided, only loyalty promotions
+ with the specified status are returned. Otherwise, all loyalty promotions associated with
+ the loyalty program are returned.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response.
+ The minimum value is 1 and the maximum value is 30. The default value is 30.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[LoyaltyPromotion, ListLoyaltyPromotionsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}/promotions",
+ method="GET",
+ params={
+ "status": status,
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListLoyaltyPromotionsResponse,
+ construct_type(
+ type_=ListLoyaltyPromotionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.loyalty_promotions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ program_id,
+ status=status,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ program_id: str,
+ *,
+ loyalty_promotion: LoyaltyPromotionParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateLoyaltyPromotionResponse]:
+ """
+ Creates a loyalty promotion for a [loyalty program](entity:LoyaltyProgram). A loyalty promotion
+ enables buyers to earn points in addition to those earned from the base loyalty program.
+
+ This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, depending on the
+ `available_time` setting. A loyalty program can have a maximum of 10 loyalty promotions with an
+ `ACTIVE` or `SCHEDULED` status.
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the [loyalty program](entity:LoyaltyProgram) to associate with the promotion.
+ To get the program ID, call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram)
+ using the `main` keyword.
+
+ loyalty_promotion : LoyaltyPromotionParams
+ The loyalty promotion to create.
+
+ idempotency_key : str
+ A unique identifier for this request, which is used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateLoyaltyPromotionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}/promotions",
+ method="POST",
+ json={
+ "loyalty_promotion": convert_and_respect_annotation_metadata(
+ object_=loyalty_promotion, annotation=LoyaltyPromotionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateLoyaltyPromotionResponse,
+ construct_type(
+ type_=CreateLoyaltyPromotionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, program_id: str, promotion_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetLoyaltyPromotionResponse]:
+ """
+ Retrieves a loyalty promotion.
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID,
+ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword.
+
+ promotion_id : str
+ The ID of the [loyalty promotion](entity:LoyaltyPromotion) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetLoyaltyPromotionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}/promotions/{jsonable_encoder(promotion_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetLoyaltyPromotionResponse,
+ construct_type(
+ type_=GetLoyaltyPromotionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def cancel(
+ self, program_id: str, promotion_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[CancelLoyaltyPromotionResponse]:
+ """
+ Cancels a loyalty promotion. Use this endpoint to cancel an `ACTIVE` promotion earlier than the
+ end date, cancel an `ACTIVE` promotion when an end date is not specified, or cancel a `SCHEDULED` promotion.
+ Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion before
+ you create a new one.
+
+ This endpoint sets the loyalty promotion to the `CANCELED` state
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the base [loyalty program](entity:LoyaltyProgram).
+
+ promotion_id : str
+ The ID of the [loyalty promotion](entity:LoyaltyPromotion) to cancel. You can cancel a
+ promotion that has an `ACTIVE` or `SCHEDULED` status.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CancelLoyaltyPromotionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}/promotions/{jsonable_encoder(promotion_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelLoyaltyPromotionResponse,
+ construct_type(
+ type_=CancelLoyaltyPromotionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/loyalty/programs/raw_client.py b/src/square/loyalty/programs/raw_client.py
new file mode 100644
index 00000000..eb3d48e5
--- /dev/null
+++ b/src/square/loyalty/programs/raw_client.py
@@ -0,0 +1,371 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.money import MoneyParams
+from ...types.calculate_loyalty_points_response import CalculateLoyaltyPointsResponse
+from ...types.get_loyalty_program_response import GetLoyaltyProgramResponse
+from ...types.list_loyalty_programs_response import ListLoyaltyProgramsResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawProgramsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[ListLoyaltyProgramsResponse]:
+ """
+ Returns a list of loyalty programs in the seller's account.
+ Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
+
+
+ Replaced with [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) when used with the keyword `main`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ListLoyaltyProgramsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/loyalty/programs",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListLoyaltyProgramsResponse,
+ construct_type(
+ type_=ListLoyaltyProgramsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, program_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetLoyaltyProgramResponse]:
+ """
+ Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword `main`.
+
+ Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the loyalty program or the keyword `main`. Either value can be used to retrieve the single loyalty program that belongs to the seller.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetLoyaltyProgramResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetLoyaltyProgramResponse,
+ construct_type(
+ type_=GetLoyaltyProgramResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def calculate(
+ self,
+ program_id: str,
+ *,
+ order_id: typing.Optional[str] = OMIT,
+ transaction_amount_money: typing.Optional[MoneyParams] = OMIT,
+ loyalty_account_id: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CalculateLoyaltyPointsResponse]:
+ """
+ Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint
+ to display the points to the buyer.
+
+ - If you are using the Orders API to manage orders, provide the `order_id` and (optional) `loyalty_account_id`.
+ Square reads the order to compute the points earned from the base loyalty program and an associated
+ [loyalty promotion](entity:LoyaltyPromotion).
+
+ - If you are not using the Orders API to manage orders, provide `transaction_amount_money` with the
+ purchase amount. Square uses this amount to calculate the points earned from the base loyalty program,
+ but not points earned from a loyalty promotion. For spend-based and visit-based programs, the `tax_mode`
+ setting of the accrual rule indicates how taxes should be treated for loyalty points accrual.
+ If the purchase qualifies for program points, call
+ [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) and perform a client-side computation
+ to calculate whether the purchase also qualifies for promotion points. For more information, see
+ [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the [loyalty program](entity:LoyaltyProgram), which defines the rules for accruing points.
+
+ order_id : typing.Optional[str]
+ The [order](entity:Order) ID for which to calculate the points.
+ Specify this field if your application uses the Orders API to process orders.
+ Otherwise, specify the `transaction_amount_money`.
+
+ transaction_amount_money : typing.Optional[MoneyParams]
+ The purchase amount for which to calculate the points.
+ Specify this field if your application does not use the Orders API to process orders.
+ Otherwise, specify the `order_id`.
+
+ loyalty_account_id : typing.Optional[str]
+ The ID of the target [loyalty account](entity:LoyaltyAccount). Optionally specify this field
+ if your application uses the Orders API to process orders.
+
+ If specified, the `promotion_points` field in the response shows the number of points the buyer would
+ earn from the purchase. In this case, Square uses the account ID to determine whether the promotion's
+ `trigger_limit` (the maximum number of times that a buyer can trigger the promotion) has been reached.
+ If not specified, the `promotion_points` field shows the number of points the purchase qualifies
+ for regardless of the trigger limit.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CalculateLoyaltyPointsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}/calculate",
+ method="POST",
+ json={
+ "order_id": order_id,
+ "transaction_amount_money": convert_and_respect_annotation_metadata(
+ object_=transaction_amount_money, annotation=MoneyParams, direction="write"
+ ),
+ "loyalty_account_id": loyalty_account_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CalculateLoyaltyPointsResponse,
+ construct_type(
+ type_=CalculateLoyaltyPointsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawProgramsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[ListLoyaltyProgramsResponse]:
+ """
+ Returns a list of loyalty programs in the seller's account.
+ Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
+
+
+ Replaced with [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) when used with the keyword `main`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ListLoyaltyProgramsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/loyalty/programs",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListLoyaltyProgramsResponse,
+ construct_type(
+ type_=ListLoyaltyProgramsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, program_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetLoyaltyProgramResponse]:
+ """
+ Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword `main`.
+
+ Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the loyalty program or the keyword `main`. Either value can be used to retrieve the single loyalty program that belongs to the seller.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetLoyaltyProgramResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetLoyaltyProgramResponse,
+ construct_type(
+ type_=GetLoyaltyProgramResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def calculate(
+ self,
+ program_id: str,
+ *,
+ order_id: typing.Optional[str] = OMIT,
+ transaction_amount_money: typing.Optional[MoneyParams] = OMIT,
+ loyalty_account_id: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CalculateLoyaltyPointsResponse]:
+ """
+ Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint
+ to display the points to the buyer.
+
+ - If you are using the Orders API to manage orders, provide the `order_id` and (optional) `loyalty_account_id`.
+ Square reads the order to compute the points earned from the base loyalty program and an associated
+ [loyalty promotion](entity:LoyaltyPromotion).
+
+ - If you are not using the Orders API to manage orders, provide `transaction_amount_money` with the
+ purchase amount. Square uses this amount to calculate the points earned from the base loyalty program,
+ but not points earned from a loyalty promotion. For spend-based and visit-based programs, the `tax_mode`
+ setting of the accrual rule indicates how taxes should be treated for loyalty points accrual.
+ If the purchase qualifies for program points, call
+ [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) and perform a client-side computation
+ to calculate whether the purchase also qualifies for promotion points. For more information, see
+ [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points).
+
+ Parameters
+ ----------
+ program_id : str
+ The ID of the [loyalty program](entity:LoyaltyProgram), which defines the rules for accruing points.
+
+ order_id : typing.Optional[str]
+ The [order](entity:Order) ID for which to calculate the points.
+ Specify this field if your application uses the Orders API to process orders.
+ Otherwise, specify the `transaction_amount_money`.
+
+ transaction_amount_money : typing.Optional[MoneyParams]
+ The purchase amount for which to calculate the points.
+ Specify this field if your application does not use the Orders API to process orders.
+ Otherwise, specify the `order_id`.
+
+ loyalty_account_id : typing.Optional[str]
+ The ID of the target [loyalty account](entity:LoyaltyAccount). Optionally specify this field
+ if your application uses the Orders API to process orders.
+
+ If specified, the `promotion_points` field in the response shows the number of points the buyer would
+ earn from the purchase. In this case, Square uses the account ID to determine whether the promotion's
+ `trigger_limit` (the maximum number of times that a buyer can trigger the promotion) has been reached.
+ If not specified, the `promotion_points` field shows the number of points the purchase qualifies
+ for regardless of the trigger limit.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CalculateLoyaltyPointsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/programs/{jsonable_encoder(program_id)}/calculate",
+ method="POST",
+ json={
+ "order_id": order_id,
+ "transaction_amount_money": convert_and_respect_annotation_metadata(
+ object_=transaction_amount_money, annotation=MoneyParams, direction="write"
+ ),
+ "loyalty_account_id": loyalty_account_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CalculateLoyaltyPointsResponse,
+ construct_type(
+ type_=CalculateLoyaltyPointsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/loyalty/raw_client.py b/src/square/loyalty/raw_client.py
new file mode 100644
index 00000000..7782050f
--- /dev/null
+++ b/src/square/loyalty/raw_client.py
@@ -0,0 +1,176 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.loyalty_event_query import LoyaltyEventQueryParams
+from ..types.search_loyalty_events_response import SearchLoyaltyEventsResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawLoyaltyClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def search_events(
+ self,
+ *,
+ query: typing.Optional[LoyaltyEventQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchLoyaltyEventsResponse]:
+ """
+ Searches for loyalty events.
+
+ A Square loyalty program maintains a ledger of events that occur during the lifetime of a
+ buyer's loyalty account. Each change in the point balance
+ (for example, points earned, points redeemed, and points expired) is
+ recorded in the ledger. Using this endpoint, you can search the ledger for events.
+
+ Search results are sorted by `created_at` in descending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[LoyaltyEventQueryParams]
+ A set of one or more predefined query filters to apply when
+ searching for loyalty events. The endpoint performs a logical AND to
+ evaluate multiple filters and performs a logical OR on arrays
+ that specifies multiple field values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to include in the response.
+ The last page might contain fewer events.
+ The default is 30 events.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchLoyaltyEventsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/loyalty/events/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=LoyaltyEventQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchLoyaltyEventsResponse,
+ construct_type(
+ type_=SearchLoyaltyEventsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawLoyaltyClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def search_events(
+ self,
+ *,
+ query: typing.Optional[LoyaltyEventQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchLoyaltyEventsResponse]:
+ """
+ Searches for loyalty events.
+
+ A Square loyalty program maintains a ledger of events that occur during the lifetime of a
+ buyer's loyalty account. Each change in the point balance
+ (for example, points earned, points redeemed, and points expired) is
+ recorded in the ledger. Using this endpoint, you can search the ledger for events.
+
+ Search results are sorted by `created_at` in descending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[LoyaltyEventQueryParams]
+ A set of one or more predefined query filters to apply when
+ searching for loyalty events. The endpoint performs a logical AND to
+ evaluate multiple filters and performs a logical OR on arrays
+ that specifies multiple field values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to include in the response.
+ The last page might contain fewer events.
+ The default is 30 events.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchLoyaltyEventsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/loyalty/events/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=LoyaltyEventQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchLoyaltyEventsResponse,
+ construct_type(
+ type_=SearchLoyaltyEventsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/loyalty/rewards/__init__.py b/src/square/loyalty/rewards/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/loyalty/rewards/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/loyalty/rewards/client.py b/src/square/loyalty/rewards/client.py
new file mode 100644
index 00000000..4182121d
--- /dev/null
+++ b/src/square/loyalty/rewards/client.py
@@ -0,0 +1,581 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...requests.loyalty_reward import LoyaltyRewardParams
+from ...requests.search_loyalty_rewards_request_loyalty_reward_query import (
+ SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams,
+)
+from ...types.create_loyalty_reward_response import CreateLoyaltyRewardResponse
+from ...types.delete_loyalty_reward_response import DeleteLoyaltyRewardResponse
+from ...types.get_loyalty_reward_response import GetLoyaltyRewardResponse
+from ...types.redeem_loyalty_reward_response import RedeemLoyaltyRewardResponse
+from ...types.search_loyalty_rewards_response import SearchLoyaltyRewardsResponse
+from .raw_client import AsyncRawRewardsClient, RawRewardsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RewardsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawRewardsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawRewardsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawRewardsClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ *,
+ reward: LoyaltyRewardParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateLoyaltyRewardResponse:
+ """
+ Creates a loyalty reward. In the process, the endpoint does following:
+
+ - Uses the `reward_tier_id` in the request to determine the number of points
+ to lock for this reward.
+ - If the request includes `order_id`, it adds the reward and related discount to the order.
+
+ After a reward is created, the points are locked and
+ not available for the buyer to redeem another reward.
+
+ Parameters
+ ----------
+ reward : LoyaltyRewardParams
+ The reward to create.
+
+ idempotency_key : str
+ A unique string that identifies this `CreateLoyaltyReward` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateLoyaltyRewardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.rewards.create(
+ reward={
+ "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
+ "reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
+ "order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY",
+ },
+ idempotency_key="18c2e5ea-a620-4b1f-ad60-7b167285e451",
+ )
+ """
+ _response = self._raw_client.create(
+ reward=reward, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchLoyaltyRewardsResponse:
+ """
+ Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts.
+ If you include a `query` object, `loyalty_account_id` is required and `status` is optional.
+
+ If you know a reward ID, use the
+ [RetrieveLoyaltyReward](api-endpoint:Loyalty-RetrieveLoyaltyReward) endpoint.
+
+ Search results are sorted by `updated_at` in descending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams]
+ The search criteria for the request.
+ If empty, the endpoint retrieves all loyalty rewards in the loyalty program.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in the response. The default value is 30.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to
+ this endpoint. Provide this to retrieve the next set of
+ results for the original query.
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchLoyaltyRewardsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.rewards.search(
+ query={"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd"},
+ limit=10,
+ )
+ """
+ _response = self._raw_client.search(query=query, limit=limit, cursor=cursor, request_options=request_options)
+ return _response.data
+
+ def get(
+ self, reward_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetLoyaltyRewardResponse:
+ """
+ Retrieves a loyalty reward.
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetLoyaltyRewardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.rewards.get(
+ reward_id="reward_id",
+ )
+ """
+ _response = self._raw_client.get(reward_id, request_options=request_options)
+ return _response.data
+
+ def delete(
+ self, reward_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteLoyaltyRewardResponse:
+ """
+ Deletes a loyalty reward by doing the following:
+
+ - Returns the loyalty points back to the loyalty account.
+ - If an order ID was specified when the reward was created
+ (see [CreateLoyaltyReward](api-endpoint:Loyalty-CreateLoyaltyReward)),
+ it updates the order by removing the reward and related
+ discounts.
+
+ You cannot delete a reward that has reached the terminal state (REDEEMED).
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteLoyaltyRewardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.rewards.delete(
+ reward_id="reward_id",
+ )
+ """
+ _response = self._raw_client.delete(reward_id, request_options=request_options)
+ return _response.data
+
+ def redeem(
+ self,
+ reward_id: str,
+ *,
+ idempotency_key: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RedeemLoyaltyRewardResponse:
+ """
+ Redeems a loyalty reward.
+
+ The endpoint sets the reward to the `REDEEMED` terminal state.
+
+ If you are using your own order processing system (not using the
+ Orders API), you call this endpoint after the buyer paid for the
+ purchase.
+
+ After the reward reaches the terminal state, it cannot be deleted.
+ In other words, points used for the reward cannot be returned
+ to the account.
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to redeem.
+
+ idempotency_key : str
+ A unique string that identifies this `RedeemLoyaltyReward` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ location_id : str
+ The ID of the [location](entity:Location) where the reward is redeemed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RedeemLoyaltyRewardResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.loyalty.rewards.redeem(
+ reward_id="reward_id",
+ idempotency_key="98adc7f7-6963-473b-b29c-f3c9cdd7d994",
+ location_id="P034NEENMD09F",
+ )
+ """
+ _response = self._raw_client.redeem(
+ reward_id, idempotency_key=idempotency_key, location_id=location_id, request_options=request_options
+ )
+ return _response.data
+
+
+class AsyncRewardsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawRewardsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawRewardsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawRewardsClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ *,
+ reward: LoyaltyRewardParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateLoyaltyRewardResponse:
+ """
+ Creates a loyalty reward. In the process, the endpoint does following:
+
+ - Uses the `reward_tier_id` in the request to determine the number of points
+ to lock for this reward.
+ - If the request includes `order_id`, it adds the reward and related discount to the order.
+
+ After a reward is created, the points are locked and
+ not available for the buyer to redeem another reward.
+
+ Parameters
+ ----------
+ reward : LoyaltyRewardParams
+ The reward to create.
+
+ idempotency_key : str
+ A unique string that identifies this `CreateLoyaltyReward` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateLoyaltyRewardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.rewards.create(
+ reward={
+ "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
+ "reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
+ "order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY",
+ },
+ idempotency_key="18c2e5ea-a620-4b1f-ad60-7b167285e451",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ reward=reward, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchLoyaltyRewardsResponse:
+ """
+ Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts.
+ If you include a `query` object, `loyalty_account_id` is required and `status` is optional.
+
+ If you know a reward ID, use the
+ [RetrieveLoyaltyReward](api-endpoint:Loyalty-RetrieveLoyaltyReward) endpoint.
+
+ Search results are sorted by `updated_at` in descending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams]
+ The search criteria for the request.
+ If empty, the endpoint retrieves all loyalty rewards in the loyalty program.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in the response. The default value is 30.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to
+ this endpoint. Provide this to retrieve the next set of
+ results for the original query.
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchLoyaltyRewardsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.rewards.search(
+ query={"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd"},
+ limit=10,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, reward_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetLoyaltyRewardResponse:
+ """
+ Retrieves a loyalty reward.
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetLoyaltyRewardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.rewards.get(
+ reward_id="reward_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(reward_id, request_options=request_options)
+ return _response.data
+
+ async def delete(
+ self, reward_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteLoyaltyRewardResponse:
+ """
+ Deletes a loyalty reward by doing the following:
+
+ - Returns the loyalty points back to the loyalty account.
+ - If an order ID was specified when the reward was created
+ (see [CreateLoyaltyReward](api-endpoint:Loyalty-CreateLoyaltyReward)),
+ it updates the order by removing the reward and related
+ discounts.
+
+ You cannot delete a reward that has reached the terminal state (REDEEMED).
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteLoyaltyRewardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.rewards.delete(
+ reward_id="reward_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(reward_id, request_options=request_options)
+ return _response.data
+
+ async def redeem(
+ self,
+ reward_id: str,
+ *,
+ idempotency_key: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RedeemLoyaltyRewardResponse:
+ """
+ Redeems a loyalty reward.
+
+ The endpoint sets the reward to the `REDEEMED` terminal state.
+
+ If you are using your own order processing system (not using the
+ Orders API), you call this endpoint after the buyer paid for the
+ purchase.
+
+ After the reward reaches the terminal state, it cannot be deleted.
+ In other words, points used for the reward cannot be returned
+ to the account.
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to redeem.
+
+ idempotency_key : str
+ A unique string that identifies this `RedeemLoyaltyReward` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ location_id : str
+ The ID of the [location](entity:Location) where the reward is redeemed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RedeemLoyaltyRewardResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.loyalty.rewards.redeem(
+ reward_id="reward_id",
+ idempotency_key="98adc7f7-6963-473b-b29c-f3c9cdd7d994",
+ location_id="P034NEENMD09F",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.redeem(
+ reward_id, idempotency_key=idempotency_key, location_id=location_id, request_options=request_options
+ )
+ return _response.data
diff --git a/src/square/loyalty/rewards/raw_client.py b/src/square/loyalty/rewards/raw_client.py
new file mode 100644
index 00000000..d9d7f343
--- /dev/null
+++ b/src/square/loyalty/rewards/raw_client.py
@@ -0,0 +1,616 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.loyalty_reward import LoyaltyRewardParams
+from ...requests.search_loyalty_rewards_request_loyalty_reward_query import (
+ SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams,
+)
+from ...types.create_loyalty_reward_response import CreateLoyaltyRewardResponse
+from ...types.delete_loyalty_reward_response import DeleteLoyaltyRewardResponse
+from ...types.get_loyalty_reward_response import GetLoyaltyRewardResponse
+from ...types.redeem_loyalty_reward_response import RedeemLoyaltyRewardResponse
+from ...types.search_loyalty_rewards_response import SearchLoyaltyRewardsResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawRewardsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ reward: LoyaltyRewardParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateLoyaltyRewardResponse]:
+ """
+ Creates a loyalty reward. In the process, the endpoint does following:
+
+ - Uses the `reward_tier_id` in the request to determine the number of points
+ to lock for this reward.
+ - If the request includes `order_id`, it adds the reward and related discount to the order.
+
+ After a reward is created, the points are locked and
+ not available for the buyer to redeem another reward.
+
+ Parameters
+ ----------
+ reward : LoyaltyRewardParams
+ The reward to create.
+
+ idempotency_key : str
+ A unique string that identifies this `CreateLoyaltyReward` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateLoyaltyRewardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/loyalty/rewards",
+ method="POST",
+ json={
+ "reward": convert_and_respect_annotation_metadata(
+ object_=reward, annotation=LoyaltyRewardParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateLoyaltyRewardResponse,
+ construct_type(
+ type_=CreateLoyaltyRewardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchLoyaltyRewardsResponse]:
+ """
+ Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts.
+ If you include a `query` object, `loyalty_account_id` is required and `status` is optional.
+
+ If you know a reward ID, use the
+ [RetrieveLoyaltyReward](api-endpoint:Loyalty-RetrieveLoyaltyReward) endpoint.
+
+ Search results are sorted by `updated_at` in descending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams]
+ The search criteria for the request.
+ If empty, the endpoint retrieves all loyalty rewards in the loyalty program.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in the response. The default value is 30.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to
+ this endpoint. Provide this to retrieve the next set of
+ results for the original query.
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchLoyaltyRewardsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/loyalty/rewards/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchLoyaltyRewardsResponse,
+ construct_type(
+ type_=SearchLoyaltyRewardsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, reward_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetLoyaltyRewardResponse]:
+ """
+ Retrieves a loyalty reward.
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetLoyaltyRewardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/rewards/{jsonable_encoder(reward_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetLoyaltyRewardResponse,
+ construct_type(
+ type_=GetLoyaltyRewardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, reward_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteLoyaltyRewardResponse]:
+ """
+ Deletes a loyalty reward by doing the following:
+
+ - Returns the loyalty points back to the loyalty account.
+ - If an order ID was specified when the reward was created
+ (see [CreateLoyaltyReward](api-endpoint:Loyalty-CreateLoyaltyReward)),
+ it updates the order by removing the reward and related
+ discounts.
+
+ You cannot delete a reward that has reached the terminal state (REDEEMED).
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteLoyaltyRewardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/rewards/{jsonable_encoder(reward_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteLoyaltyRewardResponse,
+ construct_type(
+ type_=DeleteLoyaltyRewardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def redeem(
+ self,
+ reward_id: str,
+ *,
+ idempotency_key: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[RedeemLoyaltyRewardResponse]:
+ """
+ Redeems a loyalty reward.
+
+ The endpoint sets the reward to the `REDEEMED` terminal state.
+
+ If you are using your own order processing system (not using the
+ Orders API), you call this endpoint after the buyer paid for the
+ purchase.
+
+ After the reward reaches the terminal state, it cannot be deleted.
+ In other words, points used for the reward cannot be returned
+ to the account.
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to redeem.
+
+ idempotency_key : str
+ A unique string that identifies this `RedeemLoyaltyReward` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ location_id : str
+ The ID of the [location](entity:Location) where the reward is redeemed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RedeemLoyaltyRewardResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/rewards/{jsonable_encoder(reward_id)}/redeem",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "location_id": location_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RedeemLoyaltyRewardResponse,
+ construct_type(
+ type_=RedeemLoyaltyRewardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawRewardsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ reward: LoyaltyRewardParams,
+ idempotency_key: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateLoyaltyRewardResponse]:
+ """
+ Creates a loyalty reward. In the process, the endpoint does following:
+
+ - Uses the `reward_tier_id` in the request to determine the number of points
+ to lock for this reward.
+ - If the request includes `order_id`, it adds the reward and related discount to the order.
+
+ After a reward is created, the points are locked and
+ not available for the buyer to redeem another reward.
+
+ Parameters
+ ----------
+ reward : LoyaltyRewardParams
+ The reward to create.
+
+ idempotency_key : str
+ A unique string that identifies this `CreateLoyaltyReward` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateLoyaltyRewardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/loyalty/rewards",
+ method="POST",
+ json={
+ "reward": convert_and_respect_annotation_metadata(
+ object_=reward, annotation=LoyaltyRewardParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateLoyaltyRewardResponse,
+ construct_type(
+ type_=CreateLoyaltyRewardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchLoyaltyRewardsResponse]:
+ """
+ Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts.
+ If you include a `query` object, `loyalty_account_id` is required and `status` is optional.
+
+ If you know a reward ID, use the
+ [RetrieveLoyaltyReward](api-endpoint:Loyalty-RetrieveLoyaltyReward) endpoint.
+
+ Search results are sorted by `updated_at` in descending order.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams]
+ The search criteria for the request.
+ If empty, the endpoint retrieves all loyalty rewards in the loyalty program.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in the response. The default value is 30.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to
+ this endpoint. Provide this to retrieve the next set of
+ results for the original query.
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchLoyaltyRewardsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/loyalty/rewards/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchLoyaltyRewardsResponse,
+ construct_type(
+ type_=SearchLoyaltyRewardsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, reward_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetLoyaltyRewardResponse]:
+ """
+ Retrieves a loyalty reward.
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetLoyaltyRewardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/rewards/{jsonable_encoder(reward_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetLoyaltyRewardResponse,
+ construct_type(
+ type_=GetLoyaltyRewardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, reward_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteLoyaltyRewardResponse]:
+ """
+ Deletes a loyalty reward by doing the following:
+
+ - Returns the loyalty points back to the loyalty account.
+ - If an order ID was specified when the reward was created
+ (see [CreateLoyaltyReward](api-endpoint:Loyalty-CreateLoyaltyReward)),
+ it updates the order by removing the reward and related
+ discounts.
+
+ You cannot delete a reward that has reached the terminal state (REDEEMED).
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteLoyaltyRewardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/rewards/{jsonable_encoder(reward_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteLoyaltyRewardResponse,
+ construct_type(
+ type_=DeleteLoyaltyRewardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def redeem(
+ self,
+ reward_id: str,
+ *,
+ idempotency_key: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[RedeemLoyaltyRewardResponse]:
+ """
+ Redeems a loyalty reward.
+
+ The endpoint sets the reward to the `REDEEMED` terminal state.
+
+ If you are using your own order processing system (not using the
+ Orders API), you call this endpoint after the buyer paid for the
+ purchase.
+
+ After the reward reaches the terminal state, it cannot be deleted.
+ In other words, points used for the reward cannot be returned
+ to the account.
+
+ Parameters
+ ----------
+ reward_id : str
+ The ID of the [loyalty reward](entity:LoyaltyReward) to redeem.
+
+ idempotency_key : str
+ A unique string that identifies this `RedeemLoyaltyReward` request.
+ Keys can be any valid string, but must be unique for every request.
+
+ location_id : str
+ The ID of the [location](entity:Location) where the reward is redeemed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RedeemLoyaltyRewardResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/loyalty/rewards/{jsonable_encoder(reward_id)}/redeem",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "location_id": location_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RedeemLoyaltyRewardResponse,
+ construct_type(
+ type_=RedeemLoyaltyRewardResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/merchants/__init__.py b/src/square/merchants/__init__.py
new file mode 100644
index 00000000..762ae6a5
--- /dev/null
+++ b/src/square/merchants/__init__.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import custom_attribute_definitions, custom_attributes
+_dynamic_imports: typing.Dict[str, str] = {
+ "custom_attribute_definitions": ".custom_attribute_definitions",
+ "custom_attributes": ".custom_attributes",
+}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["custom_attribute_definitions", "custom_attributes"]
diff --git a/src/square/merchants/client.py b/src/square/merchants/client.py
new file mode 100644
index 00000000..3288f1a1
--- /dev/null
+++ b/src/square/merchants/client.py
@@ -0,0 +1,267 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..types.get_merchant_response import GetMerchantResponse
+from ..types.list_merchants_response import ListMerchantsResponse
+from ..types.merchant import Merchant
+from .raw_client import AsyncRawMerchantsClient, RawMerchantsClient
+
+if typing.TYPE_CHECKING:
+ from .custom_attribute_definitions.client import (
+ AsyncCustomAttributeDefinitionsClient,
+ CustomAttributeDefinitionsClient,
+ )
+ from .custom_attributes.client import AsyncCustomAttributesClient, CustomAttributesClient
+
+
+class MerchantsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawMerchantsClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._custom_attribute_definitions: typing.Optional[CustomAttributeDefinitionsClient] = None
+ self._custom_attributes: typing.Optional[CustomAttributesClient] = None
+
+ @property
+ def with_raw_response(self) -> RawMerchantsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawMerchantsClient
+ """
+ return self._raw_client
+
+ def list(
+ self, *, cursor: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> SyncPager[Merchant, ListMerchantsResponse]:
+ """
+ Provides details about the merchant associated with a given access token.
+
+ The access token used to connect your application to a Square seller is associated
+ with a single merchant. That means that `ListMerchants` returns a list
+ with a single `Merchant` object. You can specify your personal access token
+ to get your own merchant information or specify an OAuth token to get the
+ information for the merchant that granted your application access.
+
+ If you know the merchant ID, you can also use the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant)
+ endpoint to retrieve the merchant information.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[int]
+ The cursor generated by the previous response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Merchant, ListMerchantsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.merchants.list(
+ cursor=1,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(cursor=cursor, request_options=request_options)
+
+ def get(self, merchant_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetMerchantResponse:
+ """
+ Retrieves the `Merchant` object for the given `merchant_id`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the merchant to retrieve. If the string "me" is supplied as the ID,
+ then retrieve the merchant that is currently accessible to this call.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetMerchantResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.merchants.get(
+ merchant_id="merchant_id",
+ )
+ """
+ _response = self._raw_client.get(merchant_id, request_options=request_options)
+ return _response.data
+
+ @property
+ def custom_attribute_definitions(self):
+ if self._custom_attribute_definitions is None:
+ from .custom_attribute_definitions.client import CustomAttributeDefinitionsClient # noqa: E402
+
+ self._custom_attribute_definitions = CustomAttributeDefinitionsClient(client_wrapper=self._client_wrapper)
+ return self._custom_attribute_definitions
+
+ @property
+ def custom_attributes(self):
+ if self._custom_attributes is None:
+ from .custom_attributes.client import CustomAttributesClient # noqa: E402
+
+ self._custom_attributes = CustomAttributesClient(client_wrapper=self._client_wrapper)
+ return self._custom_attributes
+
+
+class AsyncMerchantsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawMerchantsClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._custom_attribute_definitions: typing.Optional[AsyncCustomAttributeDefinitionsClient] = None
+ self._custom_attributes: typing.Optional[AsyncCustomAttributesClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawMerchantsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawMerchantsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self, *, cursor: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncPager[Merchant, ListMerchantsResponse]:
+ """
+ Provides details about the merchant associated with a given access token.
+
+ The access token used to connect your application to a Square seller is associated
+ with a single merchant. That means that `ListMerchants` returns a list
+ with a single `Merchant` object. You can specify your personal access token
+ to get your own merchant information or specify an OAuth token to get the
+ information for the merchant that granted your application access.
+
+ If you know the merchant ID, you can also use the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant)
+ endpoint to retrieve the merchant information.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[int]
+ The cursor generated by the previous response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Merchant, ListMerchantsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.merchants.list(
+ cursor=1,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(cursor=cursor, request_options=request_options)
+
+ async def get(
+ self, merchant_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetMerchantResponse:
+ """
+ Retrieves the `Merchant` object for the given `merchant_id`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the merchant to retrieve. If the string "me" is supplied as the ID,
+ then retrieve the merchant that is currently accessible to this call.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetMerchantResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.merchants.get(
+ merchant_id="merchant_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(merchant_id, request_options=request_options)
+ return _response.data
+
+ @property
+ def custom_attribute_definitions(self):
+ if self._custom_attribute_definitions is None:
+ from .custom_attribute_definitions.client import AsyncCustomAttributeDefinitionsClient # noqa: E402
+
+ self._custom_attribute_definitions = AsyncCustomAttributeDefinitionsClient(
+ client_wrapper=self._client_wrapper
+ )
+ return self._custom_attribute_definitions
+
+ @property
+ def custom_attributes(self):
+ if self._custom_attributes is None:
+ from .custom_attributes.client import AsyncCustomAttributesClient # noqa: E402
+
+ self._custom_attributes = AsyncCustomAttributesClient(client_wrapper=self._client_wrapper)
+ return self._custom_attributes
diff --git a/src/square/merchants/custom_attribute_definitions/__init__.py b/src/square/merchants/custom_attribute_definitions/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/merchants/custom_attribute_definitions/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/merchants/custom_attribute_definitions/client.py b/src/square/merchants/custom_attribute_definitions/client.py
new file mode 100644
index 00000000..d515b707
--- /dev/null
+++ b/src/square/merchants/custom_attribute_definitions/client.py
@@ -0,0 +1,640 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.custom_attribute_definition import CustomAttributeDefinitionParams
+from ...types.create_merchant_custom_attribute_definition_response import (
+ CreateMerchantCustomAttributeDefinitionResponse,
+)
+from ...types.custom_attribute_definition import CustomAttributeDefinition
+from ...types.delete_merchant_custom_attribute_definition_response import (
+ DeleteMerchantCustomAttributeDefinitionResponse,
+)
+from ...types.list_merchant_custom_attribute_definitions_response import ListMerchantCustomAttributeDefinitionsResponse
+from ...types.retrieve_merchant_custom_attribute_definition_response import (
+ RetrieveMerchantCustomAttributeDefinitionResponse,
+)
+from ...types.update_merchant_custom_attribute_definition_response import (
+ UpdateMerchantCustomAttributeDefinitionResponse,
+)
+from ...types.visibility_filter import VisibilityFilter
+from .raw_client import AsyncRawCustomAttributeDefinitionsClient, RawCustomAttributeDefinitionsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCustomAttributeDefinitionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCustomAttributeDefinitionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCustomAttributeDefinitionsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttributeDefinition, ListMerchantCustomAttributeDefinitionsResponse]:
+ """
+ Lists the merchant-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttributeDefinition, ListMerchantCustomAttributeDefinitionsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.merchants.custom_attribute_definitions.list(
+ visibility_filter="ALL",
+ limit=1,
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ visibility_filter=visibility_filter, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateMerchantCustomAttributeDefinitionResponse:
+ """
+ Creates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with a merchant connecting to your application.
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) or
+ [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes)
+ to set the custom attribute for a merchant.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateMerchantCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.merchants.custom_attribute_definitions.create(
+ custom_attribute_definition={
+ "key": "alternative_seller_name",
+ "schema": {
+ "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"
+ },
+ "name": "Alternative Merchant Name",
+ "description": "This is the other name this merchant goes by.",
+ "visibility": "VISIBILITY_READ_ONLY",
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveMerchantCustomAttributeDefinitionResponse:
+ """
+ Retrieves a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveMerchantCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.merchants.custom_attribute_definitions.get(
+ key="key",
+ version=1,
+ )
+ """
+ _response = self._raw_client.get(key, version=version, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateMerchantCustomAttributeDefinitionResponse:
+ """
+ Updates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+ Only the definition owner can update a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+ For more information, see
+ [Update a merchant custom attribute definition](https://developer.squareup.com/docs/merchant-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition).
+ The version field must match the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateMerchantCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.merchants.custom_attribute_definitions.update(
+ key="key",
+ custom_attribute_definition={
+ "description": "Update the description as desired.",
+ "visibility": "VISIBILITY_READ_ONLY",
+ },
+ )
+ """
+ _response = self._raw_client.update(
+ key,
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteMerchantCustomAttributeDefinitionResponse:
+ """
+ Deletes a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ the merchant.
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteMerchantCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.merchants.custom_attribute_definitions.delete(
+ key="key",
+ )
+ """
+ _response = self._raw_client.delete(key, request_options=request_options)
+ return _response.data
+
+
+class AsyncCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCustomAttributeDefinitionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCustomAttributeDefinitionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCustomAttributeDefinitionsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttributeDefinition, ListMerchantCustomAttributeDefinitionsResponse]:
+ """
+ Lists the merchant-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttributeDefinition, ListMerchantCustomAttributeDefinitionsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.merchants.custom_attribute_definitions.list(
+ visibility_filter="ALL",
+ limit=1,
+ cursor="cursor",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ visibility_filter=visibility_filter, limit=limit, cursor=cursor, request_options=request_options
+ )
+
+ async def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateMerchantCustomAttributeDefinitionResponse:
+ """
+ Creates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with a merchant connecting to your application.
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) or
+ [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes)
+ to set the custom attribute for a merchant.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateMerchantCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.merchants.custom_attribute_definitions.create(
+ custom_attribute_definition={
+ "key": "alternative_seller_name",
+ "schema": {
+ "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"
+ },
+ "name": "Alternative Merchant Name",
+ "description": "This is the other name this merchant goes by.",
+ "visibility": "VISIBILITY_READ_ONLY",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveMerchantCustomAttributeDefinitionResponse:
+ """
+ Retrieves a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveMerchantCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.merchants.custom_attribute_definitions.get(
+ key="key",
+ version=1,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(key, version=version, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateMerchantCustomAttributeDefinitionResponse:
+ """
+ Updates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+ Only the definition owner can update a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+ For more information, see
+ [Update a merchant custom attribute definition](https://developer.squareup.com/docs/merchant-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition).
+ The version field must match the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateMerchantCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.merchants.custom_attribute_definitions.update(
+ key="key",
+ custom_attribute_definition={
+ "description": "Update the description as desired.",
+ "visibility": "VISIBILITY_READ_ONLY",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ key,
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteMerchantCustomAttributeDefinitionResponse:
+ """
+ Deletes a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ the merchant.
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteMerchantCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.merchants.custom_attribute_definitions.delete(
+ key="key",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(key, request_options=request_options)
+ return _response.data
diff --git a/src/square/merchants/custom_attribute_definitions/raw_client.py b/src/square/merchants/custom_attribute_definitions/raw_client.py
new file mode 100644
index 00000000..776a97fd
--- /dev/null
+++ b/src/square/merchants/custom_attribute_definitions/raw_client.py
@@ -0,0 +1,659 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.custom_attribute_definition import CustomAttributeDefinitionParams
+from ...types.create_merchant_custom_attribute_definition_response import (
+ CreateMerchantCustomAttributeDefinitionResponse,
+)
+from ...types.custom_attribute_definition import CustomAttributeDefinition
+from ...types.delete_merchant_custom_attribute_definition_response import (
+ DeleteMerchantCustomAttributeDefinitionResponse,
+)
+from ...types.list_merchant_custom_attribute_definitions_response import ListMerchantCustomAttributeDefinitionsResponse
+from ...types.retrieve_merchant_custom_attribute_definition_response import (
+ RetrieveMerchantCustomAttributeDefinitionResponse,
+)
+from ...types.update_merchant_custom_attribute_definition_response import (
+ UpdateMerchantCustomAttributeDefinitionResponse,
+)
+from ...types.visibility_filter import VisibilityFilter
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttributeDefinition, ListMerchantCustomAttributeDefinitionsResponse]:
+ """
+ Lists the merchant-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttributeDefinition, ListMerchantCustomAttributeDefinitionsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/merchants/custom-attribute-definitions",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListMerchantCustomAttributeDefinitionsResponse,
+ construct_type(
+ type_=ListMerchantCustomAttributeDefinitionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attribute_definitions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateMerchantCustomAttributeDefinitionResponse]:
+ """
+ Creates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with a merchant connecting to your application.
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) or
+ [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes)
+ to set the custom attribute for a merchant.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateMerchantCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/merchants/custom-attribute-definitions",
+ method="POST",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateMerchantCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=CreateMerchantCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RetrieveMerchantCustomAttributeDefinitionResponse]:
+ """
+ Retrieves a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveMerchantCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/merchants/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveMerchantCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=RetrieveMerchantCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateMerchantCustomAttributeDefinitionResponse]:
+ """
+ Updates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+ Only the definition owner can update a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+ For more information, see
+ [Update a merchant custom attribute definition](https://developer.squareup.com/docs/merchant-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition).
+ The version field must match the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateMerchantCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/merchants/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="PUT",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateMerchantCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=UpdateMerchantCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteMerchantCustomAttributeDefinitionResponse]:
+ """
+ Deletes a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ the merchant.
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteMerchantCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/merchants/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteMerchantCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=DeleteMerchantCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttributeDefinition, ListMerchantCustomAttributeDefinitionsResponse]:
+ """
+ Lists the merchant-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttributeDefinition, ListMerchantCustomAttributeDefinitionsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/merchants/custom-attribute-definitions",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "limit": limit,
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListMerchantCustomAttributeDefinitionsResponse,
+ construct_type(
+ type_=ListMerchantCustomAttributeDefinitionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attribute_definitions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateMerchantCustomAttributeDefinitionResponse]:
+ """
+ Creates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to define a custom attribute that can be associated with a merchant connecting to your application.
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
+ for a custom attribute. After the definition is created, you can call
+ [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) or
+ [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes)
+ to set the custom attribute for a merchant.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateMerchantCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/merchants/custom-attribute-definitions",
+ method="POST",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateMerchantCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=CreateMerchantCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RetrieveMerchantCustomAttributeDefinitionResponse]:
+ """
+ Retrieves a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve. If the requesting application
+ is not the definition owner, you must use the qualified key.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute definition, which is used for strongly consistent
+ reads to guarantee that you receive the most up-to-date data. When included in the request,
+ Square returns the specified version or a higher version if one exists. If the specified version
+ is higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveMerchantCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/merchants/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveMerchantCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=RetrieveMerchantCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateMerchantCustomAttributeDefinitionResponse]:
+ """
+ Updates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
+ `schema` for a `Selection` data type.
+ Only the definition owner can update a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint
+ supports sparse updates, so only new or changed fields need to be included in the request.
+ Only the following fields can be updated:
+ - `name`
+ - `description`
+ - `visibility`
+ - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed
+ selections are supported.
+ For more information, see
+ [Update a merchant custom attribute definition](https://developer.squareup.com/docs/merchant-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition).
+ The version field must match the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateMerchantCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/merchants/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="PUT",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateMerchantCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=UpdateMerchantCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteMerchantCustomAttributeDefinitionResponse]:
+ """
+ Deletes a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
+ the merchant.
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteMerchantCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/merchants/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteMerchantCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=DeleteMerchantCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/merchants/custom_attributes/__init__.py b/src/square/merchants/custom_attributes/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/merchants/custom_attributes/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/merchants/custom_attributes/client.py b/src/square/merchants/custom_attributes/client.py
new file mode 100644
index 00000000..85788bd1
--- /dev/null
+++ b/src/square/merchants/custom_attributes/client.py
@@ -0,0 +1,813 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request import (
+ BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams,
+)
+from ...requests.bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request import (
+ BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams,
+)
+from ...requests.custom_attribute import CustomAttributeParams
+from ...types.bulk_delete_merchant_custom_attributes_response import BulkDeleteMerchantCustomAttributesResponse
+from ...types.bulk_upsert_merchant_custom_attributes_response import BulkUpsertMerchantCustomAttributesResponse
+from ...types.custom_attribute import CustomAttribute
+from ...types.delete_merchant_custom_attribute_response import DeleteMerchantCustomAttributeResponse
+from ...types.list_merchant_custom_attributes_response import ListMerchantCustomAttributesResponse
+from ...types.retrieve_merchant_custom_attribute_response import RetrieveMerchantCustomAttributeResponse
+from ...types.upsert_merchant_custom_attribute_response import UpsertMerchantCustomAttributeResponse
+from ...types.visibility_filter import VisibilityFilter
+from .raw_client import AsyncRawCustomAttributesClient, RawCustomAttributesClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CustomAttributesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCustomAttributesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCustomAttributesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCustomAttributesClient
+ """
+ return self._raw_client
+
+ def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkDeleteMerchantCustomAttributesResponse:
+ """
+ Deletes [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams]
+ The data used to update the `CustomAttribute` objects.
+ The keys must be unique and are used to map to the corresponding response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkDeleteMerchantCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.merchants.custom_attributes.batch_delete(
+ values={
+ "id1": {"key": "alternative_seller_name"},
+ "id2": {"key": "has_seen_tutorial"},
+ },
+ )
+ """
+ _response = self._raw_client.batch_delete(values=values, request_options=request_options)
+ return _response.data
+
+ def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkUpsertMerchantCustomAttributesResponse:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation.
+ Use this endpoint to set the value of one or more custom attributes for a merchant.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint.
+ This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a merchant ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertMerchantCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkUpsertMerchantCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.merchants.custom_attributes.batch_upsert(
+ values={
+ "id1": {
+ "merchant_id": "DM7VKY8Q63GNP",
+ "custom_attribute": {
+ "key": "alternative_seller_name",
+ "value": "Ultimate Sneaker Store",
+ },
+ },
+ "id2": {
+ "merchant_id": "DM7VKY8Q63GNP",
+ "custom_attribute": {"key": "has_seen_tutorial", "value": True},
+ },
+ },
+ )
+ """
+ _response = self._raw_client.batch_upsert(values=values, request_options=request_options)
+ return _response.data
+
+ def list(
+ self,
+ merchant_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttribute, ListMerchantCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a merchant.
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttribute, ListMerchantCustomAttributesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.merchants.custom_attributes.list(
+ merchant_id="merchant_id",
+ visibility_filter="ALL",
+ limit=1,
+ cursor="cursor",
+ with_definitions=True,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ merchant_id,
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=cursor,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+
+ def get(
+ self,
+ merchant_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RetrieveMerchantCustomAttributeResponse:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a merchant.
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveMerchantCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.merchants.custom_attributes.get(
+ merchant_id="merchant_id",
+ key="key",
+ with_definition=True,
+ version=1,
+ )
+ """
+ _response = self._raw_client.get(
+ merchant_id, key, with_definition=with_definition, version=version, request_options=request_options
+ )
+ return _response.data
+
+ def upsert(
+ self,
+ merchant_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpsertMerchantCustomAttributeResponse:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a merchant.
+ Use this endpoint to set the value of a custom attribute for a specified merchant.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - The version field must match the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpsertMerchantCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.merchants.custom_attributes.upsert(
+ merchant_id="merchant_id",
+ key="key",
+ custom_attribute={"value": "Ultimate Sneaker Store"},
+ )
+ """
+ _response = self._raw_client.upsert(
+ merchant_id,
+ key,
+ custom_attribute=custom_attribute,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self, merchant_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteMerchantCustomAttributeResponse:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a merchant.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteMerchantCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.merchants.custom_attributes.delete(
+ merchant_id="merchant_id",
+ key="key",
+ )
+ """
+ _response = self._raw_client.delete(merchant_id, key, request_options=request_options)
+ return _response.data
+
+
+class AsyncCustomAttributesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCustomAttributesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCustomAttributesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCustomAttributesClient
+ """
+ return self._raw_client
+
+ async def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkDeleteMerchantCustomAttributesResponse:
+ """
+ Deletes [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams]
+ The data used to update the `CustomAttribute` objects.
+ The keys must be unique and are used to map to the corresponding response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkDeleteMerchantCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.merchants.custom_attributes.batch_delete(
+ values={
+ "id1": {"key": "alternative_seller_name"},
+ "id2": {"key": "has_seen_tutorial"},
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_delete(values=values, request_options=request_options)
+ return _response.data
+
+ async def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkUpsertMerchantCustomAttributesResponse:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation.
+ Use this endpoint to set the value of one or more custom attributes for a merchant.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint.
+ This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a merchant ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertMerchantCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkUpsertMerchantCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.merchants.custom_attributes.batch_upsert(
+ values={
+ "id1": {
+ "merchant_id": "DM7VKY8Q63GNP",
+ "custom_attribute": {
+ "key": "alternative_seller_name",
+ "value": "Ultimate Sneaker Store",
+ },
+ },
+ "id2": {
+ "merchant_id": "DM7VKY8Q63GNP",
+ "custom_attribute": {"key": "has_seen_tutorial", "value": True},
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_upsert(values=values, request_options=request_options)
+ return _response.data
+
+ async def list(
+ self,
+ merchant_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttribute, ListMerchantCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a merchant.
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttribute, ListMerchantCustomAttributesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.merchants.custom_attributes.list(
+ merchant_id="merchant_id",
+ visibility_filter="ALL",
+ limit=1,
+ cursor="cursor",
+ with_definitions=True,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ merchant_id,
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=cursor,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+
+ async def get(
+ self,
+ merchant_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RetrieveMerchantCustomAttributeResponse:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a merchant.
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveMerchantCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.merchants.custom_attributes.get(
+ merchant_id="merchant_id",
+ key="key",
+ with_definition=True,
+ version=1,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(
+ merchant_id, key, with_definition=with_definition, version=version, request_options=request_options
+ )
+ return _response.data
+
+ async def upsert(
+ self,
+ merchant_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpsertMerchantCustomAttributeResponse:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a merchant.
+ Use this endpoint to set the value of a custom attribute for a specified merchant.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - The version field must match the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpsertMerchantCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.merchants.custom_attributes.upsert(
+ merchant_id="merchant_id",
+ key="key",
+ custom_attribute={"value": "Ultimate Sneaker Store"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.upsert(
+ merchant_id,
+ key,
+ custom_attribute=custom_attribute,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self, merchant_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteMerchantCustomAttributeResponse:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a merchant.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteMerchantCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.merchants.custom_attributes.delete(
+ merchant_id="merchant_id",
+ key="key",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(merchant_id, key, request_options=request_options)
+ return _response.data
diff --git a/src/square/merchants/custom_attributes/raw_client.py b/src/square/merchants/custom_attributes/raw_client.py
new file mode 100644
index 00000000..35e4b219
--- /dev/null
+++ b/src/square/merchants/custom_attributes/raw_client.py
@@ -0,0 +1,848 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request import (
+ BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams,
+)
+from ...requests.bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request import (
+ BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams,
+)
+from ...requests.custom_attribute import CustomAttributeParams
+from ...types.bulk_delete_merchant_custom_attributes_response import BulkDeleteMerchantCustomAttributesResponse
+from ...types.bulk_upsert_merchant_custom_attributes_response import BulkUpsertMerchantCustomAttributesResponse
+from ...types.custom_attribute import CustomAttribute
+from ...types.delete_merchant_custom_attribute_response import DeleteMerchantCustomAttributeResponse
+from ...types.list_merchant_custom_attributes_response import ListMerchantCustomAttributesResponse
+from ...types.retrieve_merchant_custom_attribute_response import RetrieveMerchantCustomAttributeResponse
+from ...types.upsert_merchant_custom_attribute_response import UpsertMerchantCustomAttributeResponse
+from ...types.visibility_filter import VisibilityFilter
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCustomAttributesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BulkDeleteMerchantCustomAttributesResponse]:
+ """
+ Deletes [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams]
+ The data used to update the `CustomAttribute` objects.
+ The keys must be unique and are used to map to the corresponding response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkDeleteMerchantCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/merchants/custom-attributes/bulk-delete",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[
+ str, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams
+ ],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkDeleteMerchantCustomAttributesResponse,
+ construct_type(
+ type_=BulkDeleteMerchantCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BulkUpsertMerchantCustomAttributesResponse]:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation.
+ Use this endpoint to set the value of one or more custom attributes for a merchant.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint.
+ This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a merchant ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertMerchantCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkUpsertMerchantCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/merchants/custom-attributes/bulk-upsert",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[
+ str, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams
+ ],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkUpsertMerchantCustomAttributesResponse,
+ construct_type(
+ type_=BulkUpsertMerchantCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def list(
+ self,
+ merchant_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttribute, ListMerchantCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a merchant.
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttribute, ListMerchantCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/merchants/{jsonable_encoder(merchant_id)}/custom-attributes",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "limit": limit,
+ "cursor": cursor,
+ "with_definitions": with_definitions,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListMerchantCustomAttributesResponse,
+ construct_type(
+ type_=ListMerchantCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attributes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ merchant_id,
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=_parsed_next,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self,
+ merchant_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[RetrieveMerchantCustomAttributeResponse]:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a merchant.
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveMerchantCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/merchants/{jsonable_encoder(merchant_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "with_definition": with_definition,
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveMerchantCustomAttributeResponse,
+ construct_type(
+ type_=RetrieveMerchantCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def upsert(
+ self,
+ merchant_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpsertMerchantCustomAttributeResponse]:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a merchant.
+ Use this endpoint to set the value of a custom attribute for a specified merchant.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - The version field must match the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpsertMerchantCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/merchants/{jsonable_encoder(merchant_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="POST",
+ json={
+ "custom_attribute": convert_and_respect_annotation_metadata(
+ object_=custom_attribute, annotation=CustomAttributeParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertMerchantCustomAttributeResponse,
+ construct_type(
+ type_=UpsertMerchantCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, merchant_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteMerchantCustomAttributeResponse]:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a merchant.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteMerchantCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/merchants/{jsonable_encoder(merchant_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteMerchantCustomAttributeResponse,
+ construct_type(
+ type_=DeleteMerchantCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCustomAttributesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BulkDeleteMerchantCustomAttributesResponse]:
+ """
+ Deletes [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams]
+ The data used to update the `CustomAttribute` objects.
+ The keys must be unique and are used to map to the corresponding response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkDeleteMerchantCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/merchants/custom-attributes/bulk-delete",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[
+ str, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams
+ ],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkDeleteMerchantCustomAttributesResponse,
+ construct_type(
+ type_=BulkDeleteMerchantCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BulkUpsertMerchantCustomAttributesResponse]:
+ """
+ Creates or updates [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation.
+ Use this endpoint to set the value of one or more custom attributes for a merchant.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
+ created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint.
+ This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides a merchant ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams]
+ A map containing 1 to 25 individual upsert requests. For each request, provide an
+ arbitrary ID that is unique for this `BulkUpsertMerchantCustomAttributes` request and the
+ information needed to create or update a custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkUpsertMerchantCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/merchants/custom-attributes/bulk-upsert",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[
+ str, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams
+ ],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkUpsertMerchantCustomAttributesResponse,
+ construct_type(
+ type_=BulkUpsertMerchantCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def list(
+ self,
+ merchant_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ limit: typing.Optional[int] = None,
+ cursor: typing.Optional[str] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttribute, ListMerchantCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with a merchant.
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Filters the `CustomAttributeDefinition` results by their `visibility` values.
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request. For more
+ information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttribute, ListMerchantCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/merchants/{jsonable_encoder(merchant_id)}/custom-attributes",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "limit": limit,
+ "cursor": cursor,
+ "with_definitions": with_definitions,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListMerchantCustomAttributesResponse,
+ construct_type(
+ type_=ListMerchantCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attributes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ merchant_id,
+ visibility_filter=visibility_filter,
+ limit=limit,
+ cursor=_parsed_next,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self,
+ merchant_id: str,
+ key: str,
+ *,
+ with_definition: typing.Optional[bool] = None,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[RetrieveMerchantCustomAttributeResponse]:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with a merchant.
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to retrieve. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
+ the custom attribute. Set this parameter to `true` to get the name and description of the custom
+ attribute, information about the data type, or other definition details. The default value is `false`.
+
+ version : typing.Optional[int]
+ The current version of the custom attribute, which is used for strongly consistent reads to
+ guarantee that you receive the most up-to-date data. When included in the request, Square
+ returns the specified version or a higher version if one exists. If the specified version is
+ higher than the current version, Square returns a `BAD_REQUEST` error.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveMerchantCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/merchants/{jsonable_encoder(merchant_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "with_definition": with_definition,
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveMerchantCustomAttributeResponse,
+ construct_type(
+ type_=RetrieveMerchantCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def upsert(
+ self,
+ merchant_id: str,
+ key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpsertMerchantCustomAttributeResponse]:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for a merchant.
+ Use this endpoint to set the value of a custom attribute for a specified merchant.
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
+ is created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint.
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to create or update. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - The version field must match the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency. For more information,
+ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpsertMerchantCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/merchants/{jsonable_encoder(merchant_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="POST",
+ json={
+ "custom_attribute": convert_and_respect_annotation_metadata(
+ object_=custom_attribute, annotation=CustomAttributeParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertMerchantCustomAttributeResponse,
+ construct_type(
+ type_=UpsertMerchantCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, merchant_id: str, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteMerchantCustomAttributeResponse]:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a merchant.
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the target [merchant](entity:Merchant).
+
+ key : str
+ The key of the custom attribute to delete. This key must match the `key` of a custom
+ attribute definition in the Square seller account. If the requesting application is not the
+ definition owner, you must use the qualified key.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteMerchantCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/merchants/{jsonable_encoder(merchant_id)}/custom-attributes/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteMerchantCustomAttributeResponse,
+ construct_type(
+ type_=DeleteMerchantCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/merchants/raw_client.py b/src/square/merchants/raw_client.py
new file mode 100644
index 00000000..f196f44b
--- /dev/null
+++ b/src/square/merchants/raw_client.py
@@ -0,0 +1,224 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.unchecked_base_model import construct_type
+from ..types.get_merchant_response import GetMerchantResponse
+from ..types.list_merchants_response import ListMerchantsResponse
+from ..types.merchant import Merchant
+
+
+class RawMerchantsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self, *, cursor: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> SyncPager[Merchant, ListMerchantsResponse]:
+ """
+ Provides details about the merchant associated with a given access token.
+
+ The access token used to connect your application to a Square seller is associated
+ with a single merchant. That means that `ListMerchants` returns a list
+ with a single `Merchant` object. You can specify your personal access token
+ to get your own merchant information or specify an OAuth token to get the
+ information for the merchant that granted your application access.
+
+ If you know the merchant ID, you can also use the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant)
+ endpoint to retrieve the merchant information.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[int]
+ The cursor generated by the previous response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Merchant, ListMerchantsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/merchants",
+ method="GET",
+ params={
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListMerchantsResponse,
+ construct_type(
+ type_=ListMerchantsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.merchant
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, merchant_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetMerchantResponse]:
+ """
+ Retrieves the `Merchant` object for the given `merchant_id`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the merchant to retrieve. If the string "me" is supplied as the ID,
+ then retrieve the merchant that is currently accessible to this call.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetMerchantResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/merchants/{jsonable_encoder(merchant_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetMerchantResponse,
+ construct_type(
+ type_=GetMerchantResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawMerchantsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self, *, cursor: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncPager[Merchant, ListMerchantsResponse]:
+ """
+ Provides details about the merchant associated with a given access token.
+
+ The access token used to connect your application to a Square seller is associated
+ with a single merchant. That means that `ListMerchants` returns a list
+ with a single `Merchant` object. You can specify your personal access token
+ to get your own merchant information or specify an OAuth token to get the
+ information for the merchant that granted your application access.
+
+ If you know the merchant ID, you can also use the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant)
+ endpoint to retrieve the merchant information.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[int]
+ The cursor generated by the previous response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Merchant, ListMerchantsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/merchants",
+ method="GET",
+ params={
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListMerchantsResponse,
+ construct_type(
+ type_=ListMerchantsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.merchant
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ cursor=_parsed_next,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, merchant_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetMerchantResponse]:
+ """
+ Retrieves the `Merchant` object for the given `merchant_id`.
+
+ Parameters
+ ----------
+ merchant_id : str
+ The ID of the merchant to retrieve. If the string "me" is supplied as the ID,
+ then retrieve the merchant that is currently accessible to this call.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetMerchantResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/merchants/{jsonable_encoder(merchant_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetMerchantResponse,
+ construct_type(
+ type_=GetMerchantResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/o_auth/__init__.py b/src/square/o_auth/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/o_auth/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/o_auth/client.py b/src/square/o_auth/client.py
new file mode 100644
index 00000000..26fabf91
--- /dev/null
+++ b/src/square/o_auth/client.py
@@ -0,0 +1,655 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..types.obtain_token_response import ObtainTokenResponse
+from ..types.retrieve_token_status_response import RetrieveTokenStatusResponse
+from ..types.revoke_token_response import RevokeTokenResponse
+from .raw_client import AsyncRawOAuthClient, RawOAuthClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class OAuthClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawOAuthClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawOAuthClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawOAuthClient
+ """
+ return self._raw_client
+
+ def revoke_token(
+ self,
+ *,
+ client_id: typing.Optional[str] = OMIT,
+ access_token: typing.Optional[str] = OMIT,
+ merchant_id: typing.Optional[str] = OMIT,
+ revoke_only_access_token: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RevokeTokenResponse:
+ """
+ Revokes an access token generated with the OAuth flow.
+
+ If an account has more than one OAuth access token for your application, this
+ endpoint revokes all of them, regardless of which token you specify.
+
+ __Important:__ The `Authorization` header for this endpoint must have the
+ following format:
+
+ ```
+ Authorization: Client APPLICATION_SECRET
+ ```
+
+ Replace `APPLICATION_SECRET` with the application secret on the **OAuth**
+ page for your application in the Developer Dashboard.
+
+ Parameters
+ ----------
+ client_id : typing.Optional[str]
+ The Square-issued ID for your application, which is available on the **OAuth** page in the
+ [Developer Dashboard](https://developer.squareup.com/apps).
+
+ access_token : typing.Optional[str]
+ The access token of the merchant whose token you want to revoke.
+ Do not provide a value for `merchant_id` if you provide this parameter.
+
+ merchant_id : typing.Optional[str]
+ The ID of the merchant whose token you want to revoke.
+ Do not provide a value for `access_token` if you provide this parameter.
+
+ revoke_only_access_token : typing.Optional[bool]
+ If `true`, terminate the given single access token, but do not
+ terminate the entire authorization.
+ Default: `false`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RevokeTokenResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.o_auth.revoke_token(
+ client_id="CLIENT_ID",
+ access_token="ACCESS_TOKEN",
+ )
+ """
+ _response = self._raw_client.revoke_token(
+ client_id=client_id,
+ access_token=access_token,
+ merchant_id=merchant_id,
+ revoke_only_access_token=revoke_only_access_token,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def obtain_token(
+ self,
+ *,
+ client_id: str,
+ grant_type: str,
+ client_secret: typing.Optional[str] = OMIT,
+ code: typing.Optional[str] = OMIT,
+ redirect_uri: typing.Optional[str] = OMIT,
+ refresh_token: typing.Optional[str] = OMIT,
+ migration_token: typing.Optional[str] = OMIT,
+ scopes: typing.Optional[typing.Sequence[str]] = OMIT,
+ short_lived: typing.Optional[bool] = OMIT,
+ code_verifier: typing.Optional[str] = OMIT,
+ use_jwt: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ObtainTokenResponse:
+ """
+ Returns an OAuth access token and refresh token using the `authorization_code`
+ or `refresh_token` grant type.
+
+ When `grant_type` is `authorization_code`:
+ - With the [code flow](https://developer.squareup.com/docs/oauth-api/overview#code-flow),
+ provide `code`, `client_id`, and `client_secret`.
+ - With the [PKCE flow](https://developer.squareup.com/docs/oauth-api/overview#pkce-flow),
+ provide `code`, `client_id`, and `code_verifier`.
+
+ When `grant_type` is `refresh_token`:
+ - With the code flow, provide `refresh_token`, `client_id`, and `client_secret`.
+ The response returns the same refresh token provided in the request.
+ - With the PKCE flow, provide `refresh_token` and `client_id`. The response returns
+ a new refresh token.
+
+ You can use the `scopes` parameter to limit the set of permissions authorized by the
+ access token. You can use the `short_lived` parameter to create an access token that
+ expires in 24 hours.
+
+ __Important:__ OAuth tokens should be encrypted and stored on a secure server.
+ Application clients should never interact directly with OAuth tokens.
+
+ Parameters
+ ----------
+ client_id : str
+ The Square-issued ID of your application, which is available as the **Application ID**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow and PKCE flow for any grant type.
+
+ grant_type : str
+ The method used to obtain an OAuth access token. The request must include the
+ credential that corresponds to the specified grant type. Valid values are:
+ - `authorization_code` - Requires the `code` field.
+ - `refresh_token` - Requires the `refresh_token` field.
+ - `migration_token` - LEGACY for access tokens obtained using a Square API version prior
+ to 2019-03-13. Requires the `migration_token` field.
+
+ client_secret : typing.Optional[str]
+ The secret key for your application, which is available as the **Application secret**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow for any grant type. Don't confuse your client secret with your
+ personal access token.
+
+ code : typing.Optional[str]
+ The authorization code to exchange for an OAuth access token. This is the `code`
+ value that Square sent to your redirect URL in the authorization response.
+
+ Required for the code flow and PKCE flow if `grant_type` is `authorization_code`.
+
+ redirect_uri : typing.Optional[str]
+ The redirect URL for your application, which you registered as the **Redirect URL**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow and PKCE flow if `grant_type` is `authorization_code` and
+ you provided the `redirect_uri` parameter in your authorization URL.
+
+ refresh_token : typing.Optional[str]
+ A valid refresh token used to generate a new OAuth access token. This is a
+ refresh token that was returned in a previous `ObtainToken` response.
+
+ Required for the code flow and PKCE flow if `grant_type` is `refresh_token`.
+
+ migration_token : typing.Optional[str]
+ __LEGACY__ A valid access token (obtained using a Square API version prior to 2019-03-13)
+ used to generate a new OAuth access token.
+
+ Required if `grant_type` is `migration_token`. For more information, see
+ [Migrate to Using Refresh Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens).
+
+ scopes : typing.Optional[typing.Sequence[str]]
+ The list of permissions that are explicitly requested for the access token.
+ For example, ["MERCHANT_PROFILE_READ","PAYMENTS_READ","BANK_ACCOUNTS_READ"].
+
+ The returned access token is limited to the permissions that are the intersection
+ of these requested permissions and those authorized by the provided `refresh_token`.
+
+ Optional for the code flow and PKCE flow if `grant_type` is `refresh_token`.
+
+ short_lived : typing.Optional[bool]
+ Indicates whether the returned access token should expire in 24 hours.
+
+ Optional for the code flow and PKCE flow for any grant type. The default value is `false`.
+
+ code_verifier : typing.Optional[str]
+ The secret your application generated for the authorization request used to
+ obtain the authorization code. This is the source of the `code_challenge` hash you
+ provided in your authorization URL.
+
+ Required for the PKCE flow if `grant_type` is `authorization_code`.
+
+ use_jwt : typing.Optional[bool]
+ Indicates whether to use a JWT (JSON Web Token) as the OAuth access token.
+ When set to `true`, the OAuth flow returns a JWT to your application, used in the
+ same way as a regular token. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ObtainTokenResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.o_auth.obtain_token(
+ client_id="sq0idp-uaPHILoPzWZk3tlJqlML0g",
+ client_secret="sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM",
+ code="sq0cgb-l0SBqxs4uwxErTVyYOdemg",
+ grant_type="authorization_code",
+ )
+ """
+ _response = self._raw_client.obtain_token(
+ client_id=client_id,
+ grant_type=grant_type,
+ client_secret=client_secret,
+ code=code,
+ redirect_uri=redirect_uri,
+ refresh_token=refresh_token,
+ migration_token=migration_token,
+ scopes=scopes,
+ short_lived=short_lived,
+ code_verifier=code_verifier,
+ use_jwt=use_jwt,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def retrieve_token_status(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveTokenStatusResponse:
+ """
+ Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token).
+
+ Add the access token to the Authorization header of the request.
+
+ __Important:__ The `Authorization` header you provide to this endpoint must have the following format:
+
+ ```
+ Authorization: Bearer ACCESS_TOKEN
+ ```
+
+ where `ACCESS_TOKEN` is a
+ [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens).
+
+ If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveTokenStatusResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.o_auth.retrieve_token_status()
+ """
+ _response = self._raw_client.retrieve_token_status(request_options=request_options)
+ return _response.data
+
+ def authorize(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
+ """
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ None
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.o_auth.authorize()
+ """
+ _response = self._raw_client.authorize(request_options=request_options)
+ return _response.data
+
+
+class AsyncOAuthClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawOAuthClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawOAuthClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawOAuthClient
+ """
+ return self._raw_client
+
+ async def revoke_token(
+ self,
+ *,
+ client_id: typing.Optional[str] = OMIT,
+ access_token: typing.Optional[str] = OMIT,
+ merchant_id: typing.Optional[str] = OMIT,
+ revoke_only_access_token: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RevokeTokenResponse:
+ """
+ Revokes an access token generated with the OAuth flow.
+
+ If an account has more than one OAuth access token for your application, this
+ endpoint revokes all of them, regardless of which token you specify.
+
+ __Important:__ The `Authorization` header for this endpoint must have the
+ following format:
+
+ ```
+ Authorization: Client APPLICATION_SECRET
+ ```
+
+ Replace `APPLICATION_SECRET` with the application secret on the **OAuth**
+ page for your application in the Developer Dashboard.
+
+ Parameters
+ ----------
+ client_id : typing.Optional[str]
+ The Square-issued ID for your application, which is available on the **OAuth** page in the
+ [Developer Dashboard](https://developer.squareup.com/apps).
+
+ access_token : typing.Optional[str]
+ The access token of the merchant whose token you want to revoke.
+ Do not provide a value for `merchant_id` if you provide this parameter.
+
+ merchant_id : typing.Optional[str]
+ The ID of the merchant whose token you want to revoke.
+ Do not provide a value for `access_token` if you provide this parameter.
+
+ revoke_only_access_token : typing.Optional[bool]
+ If `true`, terminate the given single access token, but do not
+ terminate the entire authorization.
+ Default: `false`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RevokeTokenResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.o_auth.revoke_token(
+ client_id="CLIENT_ID",
+ access_token="ACCESS_TOKEN",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.revoke_token(
+ client_id=client_id,
+ access_token=access_token,
+ merchant_id=merchant_id,
+ revoke_only_access_token=revoke_only_access_token,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def obtain_token(
+ self,
+ *,
+ client_id: str,
+ grant_type: str,
+ client_secret: typing.Optional[str] = OMIT,
+ code: typing.Optional[str] = OMIT,
+ redirect_uri: typing.Optional[str] = OMIT,
+ refresh_token: typing.Optional[str] = OMIT,
+ migration_token: typing.Optional[str] = OMIT,
+ scopes: typing.Optional[typing.Sequence[str]] = OMIT,
+ short_lived: typing.Optional[bool] = OMIT,
+ code_verifier: typing.Optional[str] = OMIT,
+ use_jwt: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ObtainTokenResponse:
+ """
+ Returns an OAuth access token and refresh token using the `authorization_code`
+ or `refresh_token` grant type.
+
+ When `grant_type` is `authorization_code`:
+ - With the [code flow](https://developer.squareup.com/docs/oauth-api/overview#code-flow),
+ provide `code`, `client_id`, and `client_secret`.
+ - With the [PKCE flow](https://developer.squareup.com/docs/oauth-api/overview#pkce-flow),
+ provide `code`, `client_id`, and `code_verifier`.
+
+ When `grant_type` is `refresh_token`:
+ - With the code flow, provide `refresh_token`, `client_id`, and `client_secret`.
+ The response returns the same refresh token provided in the request.
+ - With the PKCE flow, provide `refresh_token` and `client_id`. The response returns
+ a new refresh token.
+
+ You can use the `scopes` parameter to limit the set of permissions authorized by the
+ access token. You can use the `short_lived` parameter to create an access token that
+ expires in 24 hours.
+
+ __Important:__ OAuth tokens should be encrypted and stored on a secure server.
+ Application clients should never interact directly with OAuth tokens.
+
+ Parameters
+ ----------
+ client_id : str
+ The Square-issued ID of your application, which is available as the **Application ID**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow and PKCE flow for any grant type.
+
+ grant_type : str
+ The method used to obtain an OAuth access token. The request must include the
+ credential that corresponds to the specified grant type. Valid values are:
+ - `authorization_code` - Requires the `code` field.
+ - `refresh_token` - Requires the `refresh_token` field.
+ - `migration_token` - LEGACY for access tokens obtained using a Square API version prior
+ to 2019-03-13. Requires the `migration_token` field.
+
+ client_secret : typing.Optional[str]
+ The secret key for your application, which is available as the **Application secret**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow for any grant type. Don't confuse your client secret with your
+ personal access token.
+
+ code : typing.Optional[str]
+ The authorization code to exchange for an OAuth access token. This is the `code`
+ value that Square sent to your redirect URL in the authorization response.
+
+ Required for the code flow and PKCE flow if `grant_type` is `authorization_code`.
+
+ redirect_uri : typing.Optional[str]
+ The redirect URL for your application, which you registered as the **Redirect URL**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow and PKCE flow if `grant_type` is `authorization_code` and
+ you provided the `redirect_uri` parameter in your authorization URL.
+
+ refresh_token : typing.Optional[str]
+ A valid refresh token used to generate a new OAuth access token. This is a
+ refresh token that was returned in a previous `ObtainToken` response.
+
+ Required for the code flow and PKCE flow if `grant_type` is `refresh_token`.
+
+ migration_token : typing.Optional[str]
+ __LEGACY__ A valid access token (obtained using a Square API version prior to 2019-03-13)
+ used to generate a new OAuth access token.
+
+ Required if `grant_type` is `migration_token`. For more information, see
+ [Migrate to Using Refresh Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens).
+
+ scopes : typing.Optional[typing.Sequence[str]]
+ The list of permissions that are explicitly requested for the access token.
+ For example, ["MERCHANT_PROFILE_READ","PAYMENTS_READ","BANK_ACCOUNTS_READ"].
+
+ The returned access token is limited to the permissions that are the intersection
+ of these requested permissions and those authorized by the provided `refresh_token`.
+
+ Optional for the code flow and PKCE flow if `grant_type` is `refresh_token`.
+
+ short_lived : typing.Optional[bool]
+ Indicates whether the returned access token should expire in 24 hours.
+
+ Optional for the code flow and PKCE flow for any grant type. The default value is `false`.
+
+ code_verifier : typing.Optional[str]
+ The secret your application generated for the authorization request used to
+ obtain the authorization code. This is the source of the `code_challenge` hash you
+ provided in your authorization URL.
+
+ Required for the PKCE flow if `grant_type` is `authorization_code`.
+
+ use_jwt : typing.Optional[bool]
+ Indicates whether to use a JWT (JSON Web Token) as the OAuth access token.
+ When set to `true`, the OAuth flow returns a JWT to your application, used in the
+ same way as a regular token. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ObtainTokenResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.o_auth.obtain_token(
+ client_id="sq0idp-uaPHILoPzWZk3tlJqlML0g",
+ client_secret="sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM",
+ code="sq0cgb-l0SBqxs4uwxErTVyYOdemg",
+ grant_type="authorization_code",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.obtain_token(
+ client_id=client_id,
+ grant_type=grant_type,
+ client_secret=client_secret,
+ code=code,
+ redirect_uri=redirect_uri,
+ refresh_token=refresh_token,
+ migration_token=migration_token,
+ scopes=scopes,
+ short_lived=short_lived,
+ code_verifier=code_verifier,
+ use_jwt=use_jwt,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def retrieve_token_status(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveTokenStatusResponse:
+ """
+ Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token).
+
+ Add the access token to the Authorization header of the request.
+
+ __Important:__ The `Authorization` header you provide to this endpoint must have the following format:
+
+ ```
+ Authorization: Bearer ACCESS_TOKEN
+ ```
+
+ where `ACCESS_TOKEN` is a
+ [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens).
+
+ If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveTokenStatusResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.o_auth.retrieve_token_status()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.retrieve_token_status(request_options=request_options)
+ return _response.data
+
+ async def authorize(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
+ """
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ None
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.o_auth.authorize()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.authorize(request_options=request_options)
+ return _response.data
diff --git a/src/square/o_auth/raw_client.py b/src/square/o_auth/raw_client.py
new file mode 100644
index 00000000..06b05d6f
--- /dev/null
+++ b/src/square/o_auth/raw_client.py
@@ -0,0 +1,654 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.request_options import RequestOptions
+from ..core.unchecked_base_model import construct_type
+from ..types.obtain_token_response import ObtainTokenResponse
+from ..types.retrieve_token_status_response import RetrieveTokenStatusResponse
+from ..types.revoke_token_response import RevokeTokenResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawOAuthClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def revoke_token(
+ self,
+ *,
+ client_id: typing.Optional[str] = OMIT,
+ access_token: typing.Optional[str] = OMIT,
+ merchant_id: typing.Optional[str] = OMIT,
+ revoke_only_access_token: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[RevokeTokenResponse]:
+ """
+ Revokes an access token generated with the OAuth flow.
+
+ If an account has more than one OAuth access token for your application, this
+ endpoint revokes all of them, regardless of which token you specify.
+
+ __Important:__ The `Authorization` header for this endpoint must have the
+ following format:
+
+ ```
+ Authorization: Client APPLICATION_SECRET
+ ```
+
+ Replace `APPLICATION_SECRET` with the application secret on the **OAuth**
+ page for your application in the Developer Dashboard.
+
+ Parameters
+ ----------
+ client_id : typing.Optional[str]
+ The Square-issued ID for your application, which is available on the **OAuth** page in the
+ [Developer Dashboard](https://developer.squareup.com/apps).
+
+ access_token : typing.Optional[str]
+ The access token of the merchant whose token you want to revoke.
+ Do not provide a value for `merchant_id` if you provide this parameter.
+
+ merchant_id : typing.Optional[str]
+ The ID of the merchant whose token you want to revoke.
+ Do not provide a value for `access_token` if you provide this parameter.
+
+ revoke_only_access_token : typing.Optional[bool]
+ If `true`, terminate the given single access token, but do not
+ terminate the entire authorization.
+ Default: `false`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RevokeTokenResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "oauth2/revoke",
+ method="POST",
+ json={
+ "client_id": client_id,
+ "access_token": access_token,
+ "merchant_id": merchant_id,
+ "revoke_only_access_token": revoke_only_access_token,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RevokeTokenResponse,
+ construct_type(
+ type_=RevokeTokenResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def obtain_token(
+ self,
+ *,
+ client_id: str,
+ grant_type: str,
+ client_secret: typing.Optional[str] = OMIT,
+ code: typing.Optional[str] = OMIT,
+ redirect_uri: typing.Optional[str] = OMIT,
+ refresh_token: typing.Optional[str] = OMIT,
+ migration_token: typing.Optional[str] = OMIT,
+ scopes: typing.Optional[typing.Sequence[str]] = OMIT,
+ short_lived: typing.Optional[bool] = OMIT,
+ code_verifier: typing.Optional[str] = OMIT,
+ use_jwt: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[ObtainTokenResponse]:
+ """
+ Returns an OAuth access token and refresh token using the `authorization_code`
+ or `refresh_token` grant type.
+
+ When `grant_type` is `authorization_code`:
+ - With the [code flow](https://developer.squareup.com/docs/oauth-api/overview#code-flow),
+ provide `code`, `client_id`, and `client_secret`.
+ - With the [PKCE flow](https://developer.squareup.com/docs/oauth-api/overview#pkce-flow),
+ provide `code`, `client_id`, and `code_verifier`.
+
+ When `grant_type` is `refresh_token`:
+ - With the code flow, provide `refresh_token`, `client_id`, and `client_secret`.
+ The response returns the same refresh token provided in the request.
+ - With the PKCE flow, provide `refresh_token` and `client_id`. The response returns
+ a new refresh token.
+
+ You can use the `scopes` parameter to limit the set of permissions authorized by the
+ access token. You can use the `short_lived` parameter to create an access token that
+ expires in 24 hours.
+
+ __Important:__ OAuth tokens should be encrypted and stored on a secure server.
+ Application clients should never interact directly with OAuth tokens.
+
+ Parameters
+ ----------
+ client_id : str
+ The Square-issued ID of your application, which is available as the **Application ID**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow and PKCE flow for any grant type.
+
+ grant_type : str
+ The method used to obtain an OAuth access token. The request must include the
+ credential that corresponds to the specified grant type. Valid values are:
+ - `authorization_code` - Requires the `code` field.
+ - `refresh_token` - Requires the `refresh_token` field.
+ - `migration_token` - LEGACY for access tokens obtained using a Square API version prior
+ to 2019-03-13. Requires the `migration_token` field.
+
+ client_secret : typing.Optional[str]
+ The secret key for your application, which is available as the **Application secret**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow for any grant type. Don't confuse your client secret with your
+ personal access token.
+
+ code : typing.Optional[str]
+ The authorization code to exchange for an OAuth access token. This is the `code`
+ value that Square sent to your redirect URL in the authorization response.
+
+ Required for the code flow and PKCE flow if `grant_type` is `authorization_code`.
+
+ redirect_uri : typing.Optional[str]
+ The redirect URL for your application, which you registered as the **Redirect URL**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow and PKCE flow if `grant_type` is `authorization_code` and
+ you provided the `redirect_uri` parameter in your authorization URL.
+
+ refresh_token : typing.Optional[str]
+ A valid refresh token used to generate a new OAuth access token. This is a
+ refresh token that was returned in a previous `ObtainToken` response.
+
+ Required for the code flow and PKCE flow if `grant_type` is `refresh_token`.
+
+ migration_token : typing.Optional[str]
+ __LEGACY__ A valid access token (obtained using a Square API version prior to 2019-03-13)
+ used to generate a new OAuth access token.
+
+ Required if `grant_type` is `migration_token`. For more information, see
+ [Migrate to Using Refresh Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens).
+
+ scopes : typing.Optional[typing.Sequence[str]]
+ The list of permissions that are explicitly requested for the access token.
+ For example, ["MERCHANT_PROFILE_READ","PAYMENTS_READ","BANK_ACCOUNTS_READ"].
+
+ The returned access token is limited to the permissions that are the intersection
+ of these requested permissions and those authorized by the provided `refresh_token`.
+
+ Optional for the code flow and PKCE flow if `grant_type` is `refresh_token`.
+
+ short_lived : typing.Optional[bool]
+ Indicates whether the returned access token should expire in 24 hours.
+
+ Optional for the code flow and PKCE flow for any grant type. The default value is `false`.
+
+ code_verifier : typing.Optional[str]
+ The secret your application generated for the authorization request used to
+ obtain the authorization code. This is the source of the `code_challenge` hash you
+ provided in your authorization URL.
+
+ Required for the PKCE flow if `grant_type` is `authorization_code`.
+
+ use_jwt : typing.Optional[bool]
+ Indicates whether to use a JWT (JSON Web Token) as the OAuth access token.
+ When set to `true`, the OAuth flow returns a JWT to your application, used in the
+ same way as a regular token. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ObtainTokenResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "oauth2/token",
+ method="POST",
+ json={
+ "client_id": client_id,
+ "client_secret": client_secret,
+ "code": code,
+ "redirect_uri": redirect_uri,
+ "grant_type": grant_type,
+ "refresh_token": refresh_token,
+ "migration_token": migration_token,
+ "scopes": scopes,
+ "short_lived": short_lived,
+ "code_verifier": code_verifier,
+ "use_jwt": use_jwt,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ObtainTokenResponse,
+ construct_type(
+ type_=ObtainTokenResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def retrieve_token_status(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RetrieveTokenStatusResponse]:
+ """
+ Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token).
+
+ Add the access token to the Authorization header of the request.
+
+ __Important:__ The `Authorization` header you provide to this endpoint must have the following format:
+
+ ```
+ Authorization: Bearer ACCESS_TOKEN
+ ```
+
+ where `ACCESS_TOKEN` is a
+ [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens).
+
+ If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveTokenStatusResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "oauth2/token/status",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveTokenStatusResponse,
+ construct_type(
+ type_=RetrieveTokenStatusResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def authorize(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
+ """
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[None]
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "oauth2/authorize",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ return HttpResponse(response=_response, data=None)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawOAuthClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def revoke_token(
+ self,
+ *,
+ client_id: typing.Optional[str] = OMIT,
+ access_token: typing.Optional[str] = OMIT,
+ merchant_id: typing.Optional[str] = OMIT,
+ revoke_only_access_token: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[RevokeTokenResponse]:
+ """
+ Revokes an access token generated with the OAuth flow.
+
+ If an account has more than one OAuth access token for your application, this
+ endpoint revokes all of them, regardless of which token you specify.
+
+ __Important:__ The `Authorization` header for this endpoint must have the
+ following format:
+
+ ```
+ Authorization: Client APPLICATION_SECRET
+ ```
+
+ Replace `APPLICATION_SECRET` with the application secret on the **OAuth**
+ page for your application in the Developer Dashboard.
+
+ Parameters
+ ----------
+ client_id : typing.Optional[str]
+ The Square-issued ID for your application, which is available on the **OAuth** page in the
+ [Developer Dashboard](https://developer.squareup.com/apps).
+
+ access_token : typing.Optional[str]
+ The access token of the merchant whose token you want to revoke.
+ Do not provide a value for `merchant_id` if you provide this parameter.
+
+ merchant_id : typing.Optional[str]
+ The ID of the merchant whose token you want to revoke.
+ Do not provide a value for `access_token` if you provide this parameter.
+
+ revoke_only_access_token : typing.Optional[bool]
+ If `true`, terminate the given single access token, but do not
+ terminate the entire authorization.
+ Default: `false`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RevokeTokenResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "oauth2/revoke",
+ method="POST",
+ json={
+ "client_id": client_id,
+ "access_token": access_token,
+ "merchant_id": merchant_id,
+ "revoke_only_access_token": revoke_only_access_token,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RevokeTokenResponse,
+ construct_type(
+ type_=RevokeTokenResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def obtain_token(
+ self,
+ *,
+ client_id: str,
+ grant_type: str,
+ client_secret: typing.Optional[str] = OMIT,
+ code: typing.Optional[str] = OMIT,
+ redirect_uri: typing.Optional[str] = OMIT,
+ refresh_token: typing.Optional[str] = OMIT,
+ migration_token: typing.Optional[str] = OMIT,
+ scopes: typing.Optional[typing.Sequence[str]] = OMIT,
+ short_lived: typing.Optional[bool] = OMIT,
+ code_verifier: typing.Optional[str] = OMIT,
+ use_jwt: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[ObtainTokenResponse]:
+ """
+ Returns an OAuth access token and refresh token using the `authorization_code`
+ or `refresh_token` grant type.
+
+ When `grant_type` is `authorization_code`:
+ - With the [code flow](https://developer.squareup.com/docs/oauth-api/overview#code-flow),
+ provide `code`, `client_id`, and `client_secret`.
+ - With the [PKCE flow](https://developer.squareup.com/docs/oauth-api/overview#pkce-flow),
+ provide `code`, `client_id`, and `code_verifier`.
+
+ When `grant_type` is `refresh_token`:
+ - With the code flow, provide `refresh_token`, `client_id`, and `client_secret`.
+ The response returns the same refresh token provided in the request.
+ - With the PKCE flow, provide `refresh_token` and `client_id`. The response returns
+ a new refresh token.
+
+ You can use the `scopes` parameter to limit the set of permissions authorized by the
+ access token. You can use the `short_lived` parameter to create an access token that
+ expires in 24 hours.
+
+ __Important:__ OAuth tokens should be encrypted and stored on a secure server.
+ Application clients should never interact directly with OAuth tokens.
+
+ Parameters
+ ----------
+ client_id : str
+ The Square-issued ID of your application, which is available as the **Application ID**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow and PKCE flow for any grant type.
+
+ grant_type : str
+ The method used to obtain an OAuth access token. The request must include the
+ credential that corresponds to the specified grant type. Valid values are:
+ - `authorization_code` - Requires the `code` field.
+ - `refresh_token` - Requires the `refresh_token` field.
+ - `migration_token` - LEGACY for access tokens obtained using a Square API version prior
+ to 2019-03-13. Requires the `migration_token` field.
+
+ client_secret : typing.Optional[str]
+ The secret key for your application, which is available as the **Application secret**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow for any grant type. Don't confuse your client secret with your
+ personal access token.
+
+ code : typing.Optional[str]
+ The authorization code to exchange for an OAuth access token. This is the `code`
+ value that Square sent to your redirect URL in the authorization response.
+
+ Required for the code flow and PKCE flow if `grant_type` is `authorization_code`.
+
+ redirect_uri : typing.Optional[str]
+ The redirect URL for your application, which you registered as the **Redirect URL**
+ on the **OAuth** page in the [Developer Console](https://developer.squareup.com/apps).
+
+ Required for the code flow and PKCE flow if `grant_type` is `authorization_code` and
+ you provided the `redirect_uri` parameter in your authorization URL.
+
+ refresh_token : typing.Optional[str]
+ A valid refresh token used to generate a new OAuth access token. This is a
+ refresh token that was returned in a previous `ObtainToken` response.
+
+ Required for the code flow and PKCE flow if `grant_type` is `refresh_token`.
+
+ migration_token : typing.Optional[str]
+ __LEGACY__ A valid access token (obtained using a Square API version prior to 2019-03-13)
+ used to generate a new OAuth access token.
+
+ Required if `grant_type` is `migration_token`. For more information, see
+ [Migrate to Using Refresh Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens).
+
+ scopes : typing.Optional[typing.Sequence[str]]
+ The list of permissions that are explicitly requested for the access token.
+ For example, ["MERCHANT_PROFILE_READ","PAYMENTS_READ","BANK_ACCOUNTS_READ"].
+
+ The returned access token is limited to the permissions that are the intersection
+ of these requested permissions and those authorized by the provided `refresh_token`.
+
+ Optional for the code flow and PKCE flow if `grant_type` is `refresh_token`.
+
+ short_lived : typing.Optional[bool]
+ Indicates whether the returned access token should expire in 24 hours.
+
+ Optional for the code flow and PKCE flow for any grant type. The default value is `false`.
+
+ code_verifier : typing.Optional[str]
+ The secret your application generated for the authorization request used to
+ obtain the authorization code. This is the source of the `code_challenge` hash you
+ provided in your authorization URL.
+
+ Required for the PKCE flow if `grant_type` is `authorization_code`.
+
+ use_jwt : typing.Optional[bool]
+ Indicates whether to use a JWT (JSON Web Token) as the OAuth access token.
+ When set to `true`, the OAuth flow returns a JWT to your application, used in the
+ same way as a regular token. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ObtainTokenResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "oauth2/token",
+ method="POST",
+ json={
+ "client_id": client_id,
+ "client_secret": client_secret,
+ "code": code,
+ "redirect_uri": redirect_uri,
+ "grant_type": grant_type,
+ "refresh_token": refresh_token,
+ "migration_token": migration_token,
+ "scopes": scopes,
+ "short_lived": short_lived,
+ "code_verifier": code_verifier,
+ "use_jwt": use_jwt,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ObtainTokenResponse,
+ construct_type(
+ type_=ObtainTokenResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def retrieve_token_status(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RetrieveTokenStatusResponse]:
+ """
+ Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token).
+
+ Add the access token to the Authorization header of the request.
+
+ __Important:__ The `Authorization` header you provide to this endpoint must have the following format:
+
+ ```
+ Authorization: Bearer ACCESS_TOKEN
+ ```
+
+ where `ACCESS_TOKEN` is a
+ [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens).
+
+ If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveTokenStatusResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "oauth2/token/status",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveTokenStatusResponse,
+ construct_type(
+ type_=RetrieveTokenStatusResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def authorize(self, *, request_options: typing.Optional[RequestOptions] = None) -> AsyncHttpResponse[None]:
+ """
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[None]
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "oauth2/authorize",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ return AsyncHttpResponse(response=_response, data=None)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/orders/__init__.py b/src/square/orders/__init__.py
new file mode 100644
index 00000000..762ae6a5
--- /dev/null
+++ b/src/square/orders/__init__.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import custom_attribute_definitions, custom_attributes
+_dynamic_imports: typing.Dict[str, str] = {
+ "custom_attribute_definitions": ".custom_attribute_definitions",
+ "custom_attributes": ".custom_attributes",
+}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["custom_attribute_definitions", "custom_attributes"]
diff --git a/src/square/orders/client.py b/src/square/orders/client.py
new file mode 100644
index 00000000..3537c4af
--- /dev/null
+++ b/src/square/orders/client.py
@@ -0,0 +1,1311 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..requests.order import OrderParams
+from ..requests.order_reward import OrderRewardParams
+from ..requests.search_orders_query import SearchOrdersQueryParams
+from ..types.batch_get_orders_response import BatchGetOrdersResponse
+from ..types.calculate_order_response import CalculateOrderResponse
+from ..types.clone_order_response import CloneOrderResponse
+from ..types.create_order_response import CreateOrderResponse
+from ..types.get_order_response import GetOrderResponse
+from ..types.pay_order_response import PayOrderResponse
+from ..types.search_orders_response import SearchOrdersResponse
+from ..types.update_order_response import UpdateOrderResponse
+from .raw_client import AsyncRawOrdersClient, RawOrdersClient
+
+if typing.TYPE_CHECKING:
+ from .custom_attribute_definitions.client import (
+ AsyncCustomAttributeDefinitionsClient,
+ CustomAttributeDefinitionsClient,
+ )
+ from .custom_attributes.client import AsyncCustomAttributesClient, CustomAttributesClient
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class OrdersClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawOrdersClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._custom_attribute_definitions: typing.Optional[CustomAttributeDefinitionsClient] = None
+ self._custom_attributes: typing.Optional[CustomAttributesClient] = None
+
+ @property
+ def with_raw_response(self) -> RawOrdersClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawOrdersClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ *,
+ order: typing.Optional[OrderParams] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateOrderResponse:
+ """
+ Creates a new [order](entity:Order) that can include information about products for
+ purchase and settings to apply to the purchase.
+
+ To pay for a created order, see
+ [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
+
+ You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint.
+
+ Parameters
+ ----------
+ order : typing.Optional[OrderParams]
+ The order to create. If this field is set, the only other top-level field that can be
+ set is the `idempotency_key`.
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this
+ order among orders you have created.
+
+ If you are unsure whether a particular order was created successfully,
+ you can try it again with the same idempotency key without
+ worrying about creating duplicate orders.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.create(
+ order={
+ "location_id": "057P5VYJ4A5X1",
+ "reference_id": "my-order-001",
+ "line_items": [
+ {
+ "name": "New York Strip Steak",
+ "quantity": "1",
+ "base_price_money": {"amount": 1599, "currency": "USD"},
+ },
+ {
+ "quantity": "2",
+ "catalog_object_id": "BEMYCSMIJL46OCDV4KYIKXIB",
+ "modifiers": [
+ {"catalog_object_id": "CHQX7Y4KY6N5KINJKZCFURPZ"}
+ ],
+ "applied_discounts": [{"discount_uid": "one-dollar-off"}],
+ },
+ ],
+ "taxes": [
+ {
+ "uid": "state-sales-tax",
+ "name": "State Sales Tax",
+ "percentage": "9",
+ "scope": "ORDER",
+ }
+ ],
+ "discounts": [
+ {
+ "uid": "labor-day-sale",
+ "name": "Labor Day Sale",
+ "percentage": "5",
+ "scope": "ORDER",
+ },
+ {
+ "uid": "membership-discount",
+ "catalog_object_id": "DB7L55ZH2BGWI4H23ULIWOQ7",
+ "scope": "ORDER",
+ },
+ {
+ "uid": "one-dollar-off",
+ "name": "Sale - $1.00 off",
+ "amount_money": {"amount": 100, "currency": "USD"},
+ "scope": "LINE_ITEM",
+ },
+ ],
+ },
+ idempotency_key="8193148c-9586-11e6-99f9-28cfe92138cf",
+ )
+ """
+ _response = self._raw_client.create(
+ order=order, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def batch_get(
+ self,
+ *,
+ order_ids: typing.Sequence[str],
+ location_id: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchGetOrdersResponse:
+ """
+ Retrieves a set of [orders](entity:Order) by their IDs.
+
+ If a given order ID does not exist, the ID is ignored instead of generating an error.
+
+ Parameters
+ ----------
+ order_ids : typing.Sequence[str]
+ The IDs of the orders to retrieve. A maximum of 100 orders can be retrieved per request.
+
+ location_id : typing.Optional[str]
+ The ID of the location for these orders. This field is optional: omit it to retrieve
+ orders within the scope of the current authorization's merchant ID.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchGetOrdersResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.batch_get(
+ location_id="057P5VYJ4A5X1",
+ order_ids=["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"],
+ )
+ """
+ _response = self._raw_client.batch_get(
+ order_ids=order_ids, location_id=location_id, request_options=request_options
+ )
+ return _response.data
+
+ def calculate(
+ self,
+ *,
+ order: OrderParams,
+ proposed_rewards: typing.Optional[typing.Sequence[OrderRewardParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CalculateOrderResponse:
+ """
+ Enables applications to preview order pricing without creating an order.
+
+ Parameters
+ ----------
+ order : OrderParams
+ The order to be calculated. Expects the entire order, not a sparse update.
+
+ proposed_rewards : typing.Optional[typing.Sequence[OrderRewardParams]]
+ Identifies one or more loyalty reward tiers to apply during the order calculation.
+ The discounts defined by the reward tiers are added to the order only to preview the
+ effect of applying the specified rewards. The rewards do not correspond to actual
+ redemptions; that is, no `reward`s are created. Therefore, the reward `id`s are
+ random strings used only to reference the reward tier.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CalculateOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.calculate(
+ order={
+ "location_id": "D7AVYMEAPJ3A3",
+ "line_items": [
+ {
+ "name": "Item 1",
+ "quantity": "1",
+ "base_price_money": {"amount": 500, "currency": "USD"},
+ },
+ {
+ "name": "Item 2",
+ "quantity": "2",
+ "base_price_money": {"amount": 300, "currency": "USD"},
+ },
+ ],
+ "discounts": [
+ {"name": "50% Off", "percentage": "50", "scope": "ORDER"}
+ ],
+ },
+ )
+ """
+ _response = self._raw_client.calculate(
+ order=order, proposed_rewards=proposed_rewards, request_options=request_options
+ )
+ return _response.data
+
+ def clone(
+ self,
+ *,
+ order_id: str,
+ version: typing.Optional[int] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CloneOrderResponse:
+ """
+ Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order has
+ only the core fields (such as line items, taxes, and discounts) copied from the original order.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to clone.
+
+ version : typing.Optional[int]
+ An optional order version for concurrency protection.
+
+ If a version is provided, it must match the latest stored version of the order to clone.
+ If a version is not provided, the API clones the latest version.
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this clone request.
+
+ If you are unsure whether a particular order was cloned successfully,
+ you can reattempt the call with the same idempotency key without
+ worrying about creating duplicate cloned orders.
+ The originally cloned order is returned.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CloneOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.clone(
+ order_id="ZAISEM52YcpmcWAzERDOyiWS123",
+ version=3,
+ idempotency_key="UNIQUE_STRING",
+ )
+ """
+ _response = self._raw_client.clone(
+ order_id=order_id, version=version, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ query: typing.Optional[SearchOrdersQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ return_entries: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchOrdersResponse:
+ """
+ Search all orders for one or more locations. Orders include all sales,
+ returns, and exchanges regardless of how or when they entered the Square
+ ecosystem (such as Point of Sale, Invoices, and Connect APIs).
+
+ `SearchOrders` requests need to specify which locations to search and define a
+ [SearchOrdersQuery](entity:SearchOrdersQuery) object that controls
+ how to sort or filter the results. Your `SearchOrdersQuery` can:
+
+ Set filter criteria.
+ Set the sort order.
+ Determine whether to return results as complete `Order` objects or as
+ [OrderEntry](entity:OrderEntry) objects.
+
+ Note that details for orders processed with Square Point of Sale while in
+ offline mode might not be transmitted to Square for up to 72 hours. Offline
+ orders have a `created_at` value that reflects the time the order was created,
+ not the time it was subsequently transmitted to Square.
+
+ Parameters
+ ----------
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The location IDs for the orders to query. All locations must belong to
+ the same merchant.
+
+ Max: 10 location IDs.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ query : typing.Optional[SearchOrdersQueryParams]
+ Query conditions used to filter or sort the results. Note that when
+ retrieving additional pages using a cursor, you must use the original query.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+
+ Default: `500`
+ Max: `1000`
+
+ return_entries : typing.Optional[bool]
+ A Boolean that controls the format of the search results. If `true`,
+ `SearchOrders` returns [OrderEntry](entity:OrderEntry) objects. If `false`, `SearchOrders`
+ returns complete order objects.
+
+ Default: `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchOrdersResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.search(
+ location_ids=["057P5VYJ4A5X1", "18YC4JDH91E1H"],
+ query={
+ "filter": {
+ "state_filter": {"states": ["COMPLETED"]},
+ "date_time_filter": {
+ "closed_at": {
+ "start_at": "2018-03-03T20:00:00+00:00",
+ "end_at": "2019-03-04T21:54:45+00:00",
+ }
+ },
+ },
+ "sort": {"sort_field": "CLOSED_AT", "sort_order": "DESC"},
+ },
+ limit=3,
+ return_entries=True,
+ )
+ """
+ _response = self._raw_client.search(
+ location_ids=location_ids,
+ cursor=cursor,
+ query=query,
+ limit=limit,
+ return_entries=return_entries,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def get(self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetOrderResponse:
+ """
+ Retrieves an [Order](entity:Order) by ID.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.get(
+ order_id="order_id",
+ )
+ """
+ _response = self._raw_client.get(order_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ order_id: str,
+ *,
+ order: typing.Optional[OrderParams] = OMIT,
+ fields_to_clear: typing.Optional[typing.Sequence[str]] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateOrderResponse:
+ """
+ Updates an open [order](entity:Order) by adding, replacing, or deleting
+ fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated.
+
+ An `UpdateOrder` request requires the following:
+
+ - The `order_id` in the endpoint path, identifying the order to update.
+ - The latest `version` of the order to update.
+ - The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects)
+ containing only the fields to update and the version to which the update is
+ being applied.
+ - If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete)
+ identifying the fields to clear.
+
+ To pay for an order, see
+ [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to update.
+
+ order : typing.Optional[OrderParams]
+ The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects)
+ containing only the fields to update and the version to which the update is
+ being applied.
+
+ fields_to_clear : typing.Optional[typing.Sequence[str]]
+ The [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete)
+ fields to clear. For example, `line_items[uid].note`.
+ For more information, see [Deleting fields](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#deleting-fields).
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this update request.
+
+ If you are unsure whether a particular update was applied to an order successfully,
+ you can reattempt it with the same idempotency key without
+ worrying about creating duplicate updates to the order.
+ The latest order version is returned.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.update(
+ order_id="order_id",
+ order={
+ "location_id": "location_id",
+ "line_items": [
+ {
+ "uid": "cookie_uid",
+ "name": "COOKIE",
+ "quantity": "2",
+ "base_price_money": {"amount": 200, "currency": "USD"},
+ }
+ ],
+ "version": 1,
+ },
+ fields_to_clear=["discounts"],
+ idempotency_key="UNIQUE_STRING",
+ )
+ """
+ _response = self._raw_client.update(
+ order_id,
+ order=order,
+ fields_to_clear=fields_to_clear,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def pay(
+ self,
+ order_id: str,
+ *,
+ idempotency_key: str,
+ order_version: typing.Optional[int] = OMIT,
+ payment_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> PayOrderResponse:
+ """
+ Pay for an [order](entity:Order) using one or more approved [payments](entity:Payment)
+ or settle an order with a total of `0`.
+
+ The total of the `payment_ids` listed in the request must be equal to the order
+ total. Orders with a total amount of `0` can be marked as paid by specifying an empty
+ array of `payment_ids` in the request.
+
+ To be used with `PayOrder`, a payment must:
+
+ - Reference the order by specifying the `order_id` when [creating the payment](api-endpoint:Payments-CreatePayment).
+ Any approved payments that reference the same `order_id` not specified in the
+ `payment_ids` is canceled.
+ - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture).
+ Using a delayed capture payment with `PayOrder` completes the approved payment.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order being paid.
+
+ idempotency_key : str
+ A value you specify that uniquely identifies this request among requests you have sent. If
+ you are unsure whether a particular payment request was completed successfully, you can reattempt
+ it with the same idempotency key without worrying about duplicate payments.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ order_version : typing.Optional[int]
+ The version of the order being paid. If not supplied, the latest version will be paid.
+
+ payment_ids : typing.Optional[typing.Sequence[str]]
+ The IDs of the [payments](entity:Payment) to collect.
+ The payment total must match the order total.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ PayOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.pay(
+ order_id="order_id",
+ idempotency_key="c043a359-7ad9-4136-82a9-c3f1d66dcbff",
+ payment_ids=["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"],
+ )
+ """
+ _response = self._raw_client.pay(
+ order_id,
+ idempotency_key=idempotency_key,
+ order_version=order_version,
+ payment_ids=payment_ids,
+ request_options=request_options,
+ )
+ return _response.data
+
+ @property
+ def custom_attribute_definitions(self):
+ if self._custom_attribute_definitions is None:
+ from .custom_attribute_definitions.client import CustomAttributeDefinitionsClient # noqa: E402
+
+ self._custom_attribute_definitions = CustomAttributeDefinitionsClient(client_wrapper=self._client_wrapper)
+ return self._custom_attribute_definitions
+
+ @property
+ def custom_attributes(self):
+ if self._custom_attributes is None:
+ from .custom_attributes.client import CustomAttributesClient # noqa: E402
+
+ self._custom_attributes = CustomAttributesClient(client_wrapper=self._client_wrapper)
+ return self._custom_attributes
+
+
+class AsyncOrdersClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawOrdersClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._custom_attribute_definitions: typing.Optional[AsyncCustomAttributeDefinitionsClient] = None
+ self._custom_attributes: typing.Optional[AsyncCustomAttributesClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawOrdersClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawOrdersClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ *,
+ order: typing.Optional[OrderParams] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateOrderResponse:
+ """
+ Creates a new [order](entity:Order) that can include information about products for
+ purchase and settings to apply to the purchase.
+
+ To pay for a created order, see
+ [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
+
+ You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint.
+
+ Parameters
+ ----------
+ order : typing.Optional[OrderParams]
+ The order to create. If this field is set, the only other top-level field that can be
+ set is the `idempotency_key`.
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this
+ order among orders you have created.
+
+ If you are unsure whether a particular order was created successfully,
+ you can try it again with the same idempotency key without
+ worrying about creating duplicate orders.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.create(
+ order={
+ "location_id": "057P5VYJ4A5X1",
+ "reference_id": "my-order-001",
+ "line_items": [
+ {
+ "name": "New York Strip Steak",
+ "quantity": "1",
+ "base_price_money": {"amount": 1599, "currency": "USD"},
+ },
+ {
+ "quantity": "2",
+ "catalog_object_id": "BEMYCSMIJL46OCDV4KYIKXIB",
+ "modifiers": [
+ {"catalog_object_id": "CHQX7Y4KY6N5KINJKZCFURPZ"}
+ ],
+ "applied_discounts": [{"discount_uid": "one-dollar-off"}],
+ },
+ ],
+ "taxes": [
+ {
+ "uid": "state-sales-tax",
+ "name": "State Sales Tax",
+ "percentage": "9",
+ "scope": "ORDER",
+ }
+ ],
+ "discounts": [
+ {
+ "uid": "labor-day-sale",
+ "name": "Labor Day Sale",
+ "percentage": "5",
+ "scope": "ORDER",
+ },
+ {
+ "uid": "membership-discount",
+ "catalog_object_id": "DB7L55ZH2BGWI4H23ULIWOQ7",
+ "scope": "ORDER",
+ },
+ {
+ "uid": "one-dollar-off",
+ "name": "Sale - $1.00 off",
+ "amount_money": {"amount": 100, "currency": "USD"},
+ "scope": "LINE_ITEM",
+ },
+ ],
+ },
+ idempotency_key="8193148c-9586-11e6-99f9-28cfe92138cf",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ order=order, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def batch_get(
+ self,
+ *,
+ order_ids: typing.Sequence[str],
+ location_id: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchGetOrdersResponse:
+ """
+ Retrieves a set of [orders](entity:Order) by their IDs.
+
+ If a given order ID does not exist, the ID is ignored instead of generating an error.
+
+ Parameters
+ ----------
+ order_ids : typing.Sequence[str]
+ The IDs of the orders to retrieve. A maximum of 100 orders can be retrieved per request.
+
+ location_id : typing.Optional[str]
+ The ID of the location for these orders. This field is optional: omit it to retrieve
+ orders within the scope of the current authorization's merchant ID.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchGetOrdersResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.batch_get(
+ location_id="057P5VYJ4A5X1",
+ order_ids=[
+ "CAISEM82RcpmcFBM0TfOyiHV3es",
+ "CAISENgvlJ6jLWAzERDzjyHVybY",
+ ],
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_get(
+ order_ids=order_ids, location_id=location_id, request_options=request_options
+ )
+ return _response.data
+
+ async def calculate(
+ self,
+ *,
+ order: OrderParams,
+ proposed_rewards: typing.Optional[typing.Sequence[OrderRewardParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CalculateOrderResponse:
+ """
+ Enables applications to preview order pricing without creating an order.
+
+ Parameters
+ ----------
+ order : OrderParams
+ The order to be calculated. Expects the entire order, not a sparse update.
+
+ proposed_rewards : typing.Optional[typing.Sequence[OrderRewardParams]]
+ Identifies one or more loyalty reward tiers to apply during the order calculation.
+ The discounts defined by the reward tiers are added to the order only to preview the
+ effect of applying the specified rewards. The rewards do not correspond to actual
+ redemptions; that is, no `reward`s are created. Therefore, the reward `id`s are
+ random strings used only to reference the reward tier.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CalculateOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.calculate(
+ order={
+ "location_id": "D7AVYMEAPJ3A3",
+ "line_items": [
+ {
+ "name": "Item 1",
+ "quantity": "1",
+ "base_price_money": {"amount": 500, "currency": "USD"},
+ },
+ {
+ "name": "Item 2",
+ "quantity": "2",
+ "base_price_money": {"amount": 300, "currency": "USD"},
+ },
+ ],
+ "discounts": [
+ {"name": "50% Off", "percentage": "50", "scope": "ORDER"}
+ ],
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.calculate(
+ order=order, proposed_rewards=proposed_rewards, request_options=request_options
+ )
+ return _response.data
+
+ async def clone(
+ self,
+ *,
+ order_id: str,
+ version: typing.Optional[int] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CloneOrderResponse:
+ """
+ Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order has
+ only the core fields (such as line items, taxes, and discounts) copied from the original order.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to clone.
+
+ version : typing.Optional[int]
+ An optional order version for concurrency protection.
+
+ If a version is provided, it must match the latest stored version of the order to clone.
+ If a version is not provided, the API clones the latest version.
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this clone request.
+
+ If you are unsure whether a particular order was cloned successfully,
+ you can reattempt the call with the same idempotency key without
+ worrying about creating duplicate cloned orders.
+ The originally cloned order is returned.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CloneOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.clone(
+ order_id="ZAISEM52YcpmcWAzERDOyiWS123",
+ version=3,
+ idempotency_key="UNIQUE_STRING",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.clone(
+ order_id=order_id, version=version, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ query: typing.Optional[SearchOrdersQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ return_entries: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchOrdersResponse:
+ """
+ Search all orders for one or more locations. Orders include all sales,
+ returns, and exchanges regardless of how or when they entered the Square
+ ecosystem (such as Point of Sale, Invoices, and Connect APIs).
+
+ `SearchOrders` requests need to specify which locations to search and define a
+ [SearchOrdersQuery](entity:SearchOrdersQuery) object that controls
+ how to sort or filter the results. Your `SearchOrdersQuery` can:
+
+ Set filter criteria.
+ Set the sort order.
+ Determine whether to return results as complete `Order` objects or as
+ [OrderEntry](entity:OrderEntry) objects.
+
+ Note that details for orders processed with Square Point of Sale while in
+ offline mode might not be transmitted to Square for up to 72 hours. Offline
+ orders have a `created_at` value that reflects the time the order was created,
+ not the time it was subsequently transmitted to Square.
+
+ Parameters
+ ----------
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The location IDs for the orders to query. All locations must belong to
+ the same merchant.
+
+ Max: 10 location IDs.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ query : typing.Optional[SearchOrdersQueryParams]
+ Query conditions used to filter or sort the results. Note that when
+ retrieving additional pages using a cursor, you must use the original query.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+
+ Default: `500`
+ Max: `1000`
+
+ return_entries : typing.Optional[bool]
+ A Boolean that controls the format of the search results. If `true`,
+ `SearchOrders` returns [OrderEntry](entity:OrderEntry) objects. If `false`, `SearchOrders`
+ returns complete order objects.
+
+ Default: `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchOrdersResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.search(
+ location_ids=["057P5VYJ4A5X1", "18YC4JDH91E1H"],
+ query={
+ "filter": {
+ "state_filter": {"states": ["COMPLETED"]},
+ "date_time_filter": {
+ "closed_at": {
+ "start_at": "2018-03-03T20:00:00+00:00",
+ "end_at": "2019-03-04T21:54:45+00:00",
+ }
+ },
+ },
+ "sort": {"sort_field": "CLOSED_AT", "sort_order": "DESC"},
+ },
+ limit=3,
+ return_entries=True,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ location_ids=location_ids,
+ cursor=cursor,
+ query=query,
+ limit=limit,
+ return_entries=return_entries,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def get(self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetOrderResponse:
+ """
+ Retrieves an [Order](entity:Order) by ID.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.get(
+ order_id="order_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(order_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ order_id: str,
+ *,
+ order: typing.Optional[OrderParams] = OMIT,
+ fields_to_clear: typing.Optional[typing.Sequence[str]] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateOrderResponse:
+ """
+ Updates an open [order](entity:Order) by adding, replacing, or deleting
+ fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated.
+
+ An `UpdateOrder` request requires the following:
+
+ - The `order_id` in the endpoint path, identifying the order to update.
+ - The latest `version` of the order to update.
+ - The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects)
+ containing only the fields to update and the version to which the update is
+ being applied.
+ - If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete)
+ identifying the fields to clear.
+
+ To pay for an order, see
+ [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to update.
+
+ order : typing.Optional[OrderParams]
+ The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects)
+ containing only the fields to update and the version to which the update is
+ being applied.
+
+ fields_to_clear : typing.Optional[typing.Sequence[str]]
+ The [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete)
+ fields to clear. For example, `line_items[uid].note`.
+ For more information, see [Deleting fields](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#deleting-fields).
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this update request.
+
+ If you are unsure whether a particular update was applied to an order successfully,
+ you can reattempt it with the same idempotency key without
+ worrying about creating duplicate updates to the order.
+ The latest order version is returned.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.update(
+ order_id="order_id",
+ order={
+ "location_id": "location_id",
+ "line_items": [
+ {
+ "uid": "cookie_uid",
+ "name": "COOKIE",
+ "quantity": "2",
+ "base_price_money": {"amount": 200, "currency": "USD"},
+ }
+ ],
+ "version": 1,
+ },
+ fields_to_clear=["discounts"],
+ idempotency_key="UNIQUE_STRING",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ order_id,
+ order=order,
+ fields_to_clear=fields_to_clear,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def pay(
+ self,
+ order_id: str,
+ *,
+ idempotency_key: str,
+ order_version: typing.Optional[int] = OMIT,
+ payment_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> PayOrderResponse:
+ """
+ Pay for an [order](entity:Order) using one or more approved [payments](entity:Payment)
+ or settle an order with a total of `0`.
+
+ The total of the `payment_ids` listed in the request must be equal to the order
+ total. Orders with a total amount of `0` can be marked as paid by specifying an empty
+ array of `payment_ids` in the request.
+
+ To be used with `PayOrder`, a payment must:
+
+ - Reference the order by specifying the `order_id` when [creating the payment](api-endpoint:Payments-CreatePayment).
+ Any approved payments that reference the same `order_id` not specified in the
+ `payment_ids` is canceled.
+ - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture).
+ Using a delayed capture payment with `PayOrder` completes the approved payment.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order being paid.
+
+ idempotency_key : str
+ A value you specify that uniquely identifies this request among requests you have sent. If
+ you are unsure whether a particular payment request was completed successfully, you can reattempt
+ it with the same idempotency key without worrying about duplicate payments.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ order_version : typing.Optional[int]
+ The version of the order being paid. If not supplied, the latest version will be paid.
+
+ payment_ids : typing.Optional[typing.Sequence[str]]
+ The IDs of the [payments](entity:Payment) to collect.
+ The payment total must match the order total.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ PayOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.pay(
+ order_id="order_id",
+ idempotency_key="c043a359-7ad9-4136-82a9-c3f1d66dcbff",
+ payment_ids=[
+ "EnZdNAlWCmfh6Mt5FMNST1o7taB",
+ "0LRiVlbXVwe8ozu4KbZxd12mvaB",
+ ],
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.pay(
+ order_id,
+ idempotency_key=idempotency_key,
+ order_version=order_version,
+ payment_ids=payment_ids,
+ request_options=request_options,
+ )
+ return _response.data
+
+ @property
+ def custom_attribute_definitions(self):
+ if self._custom_attribute_definitions is None:
+ from .custom_attribute_definitions.client import AsyncCustomAttributeDefinitionsClient # noqa: E402
+
+ self._custom_attribute_definitions = AsyncCustomAttributeDefinitionsClient(
+ client_wrapper=self._client_wrapper
+ )
+ return self._custom_attribute_definitions
+
+ @property
+ def custom_attributes(self):
+ if self._custom_attributes is None:
+ from .custom_attributes.client import AsyncCustomAttributesClient # noqa: E402
+
+ self._custom_attributes = AsyncCustomAttributesClient(client_wrapper=self._client_wrapper)
+ return self._custom_attributes
diff --git a/src/square/orders/custom_attribute_definitions/__init__.py b/src/square/orders/custom_attribute_definitions/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/orders/custom_attribute_definitions/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/orders/custom_attribute_definitions/client.py b/src/square/orders/custom_attribute_definitions/client.py
new file mode 100644
index 00000000..2803b2a4
--- /dev/null
+++ b/src/square/orders/custom_attribute_definitions/client.py
@@ -0,0 +1,620 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.custom_attribute_definition import CustomAttributeDefinitionParams
+from ...types.create_order_custom_attribute_definition_response import CreateOrderCustomAttributeDefinitionResponse
+from ...types.custom_attribute_definition import CustomAttributeDefinition
+from ...types.delete_order_custom_attribute_definition_response import DeleteOrderCustomAttributeDefinitionResponse
+from ...types.list_order_custom_attribute_definitions_response import ListOrderCustomAttributeDefinitionsResponse
+from ...types.retrieve_order_custom_attribute_definition_response import RetrieveOrderCustomAttributeDefinitionResponse
+from ...types.update_order_custom_attribute_definition_response import UpdateOrderCustomAttributeDefinitionResponse
+from ...types.visibility_filter import VisibilityFilter
+from .raw_client import AsyncRawCustomAttributeDefinitionsClient, RawCustomAttributeDefinitionsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCustomAttributeDefinitionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCustomAttributeDefinitionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCustomAttributeDefinitionsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttributeDefinition, ListOrderCustomAttributeDefinitionsResponse]:
+ """
+ Lists the order-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that
+ seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Requests that all of the custom attributes be returned, or only those that are read-only or read-write.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttributeDefinition, ListOrderCustomAttributeDefinitionsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.orders.custom_attribute_definitions.list(
+ visibility_filter="ALL",
+ cursor="cursor",
+ limit=1,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ visibility_filter=visibility_filter, cursor=cursor, limit=limit, request_options=request_options
+ )
+
+ def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateOrderCustomAttributeDefinitionResponse:
+ """
+ Creates an order-related custom attribute definition. Use this endpoint to
+ define a custom attribute that can be associated with orders.
+
+ After creating a custom attribute definition, you can set the custom attribute for orders
+ in the Square seller account.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema).
+ - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller.
+ - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateOrderCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.custom_attribute_definitions.create(
+ custom_attribute_definition={
+ "key": "cover-count",
+ "schema": {
+ "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Number"
+ },
+ "name": "Cover count",
+ "description": "The number of people seated at a table",
+ "visibility": "VISIBILITY_READ_WRITE_VALUES",
+ },
+ idempotency_key="IDEMPOTENCY_KEY",
+ )
+ """
+ _response = self._raw_client.create(
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveOrderCustomAttributeDefinitionResponse:
+ """
+ Retrieves an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve.
+
+ version : typing.Optional[int]
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveOrderCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.custom_attribute_definitions.get(
+ key="key",
+ version=1,
+ )
+ """
+ _response = self._raw_client.get(key, version=version, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateOrderCustomAttributeDefinitionResponse:
+ """
+ Updates an order-related custom attribute definition for a Square seller account.
+
+ Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint supports sparse updates,
+ so only new or changed fields need to be included in the request. For more information, see
+ [Updatable definition fields](https://developer.squareup.com/docs/orders-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields).
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control, include the optional `version` field and specify the current version of the custom attribute definition.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateOrderCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.custom_attribute_definitions.update(
+ key="key",
+ custom_attribute_definition={
+ "key": "cover-count",
+ "visibility": "VISIBILITY_READ_ONLY",
+ "version": 1,
+ },
+ idempotency_key="IDEMPOTENCY_KEY",
+ )
+ """
+ _response = self._raw_client.update(
+ key,
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteOrderCustomAttributeDefinitionResponse:
+ """
+ Deletes an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteOrderCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.custom_attribute_definitions.delete(
+ key="key",
+ )
+ """
+ _response = self._raw_client.delete(key, request_options=request_options)
+ return _response.data
+
+
+class AsyncCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCustomAttributeDefinitionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCustomAttributeDefinitionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCustomAttributeDefinitionsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttributeDefinition, ListOrderCustomAttributeDefinitionsResponse]:
+ """
+ Lists the order-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that
+ seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Requests that all of the custom attributes be returned, or only those that are read-only or read-write.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttributeDefinition, ListOrderCustomAttributeDefinitionsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.orders.custom_attribute_definitions.list(
+ visibility_filter="ALL",
+ cursor="cursor",
+ limit=1,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ visibility_filter=visibility_filter, cursor=cursor, limit=limit, request_options=request_options
+ )
+
+ async def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateOrderCustomAttributeDefinitionResponse:
+ """
+ Creates an order-related custom attribute definition. Use this endpoint to
+ define a custom attribute that can be associated with orders.
+
+ After creating a custom attribute definition, you can set the custom attribute for orders
+ in the Square seller account.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema).
+ - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller.
+ - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateOrderCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.custom_attribute_definitions.create(
+ custom_attribute_definition={
+ "key": "cover-count",
+ "schema": {
+ "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Number"
+ },
+ "name": "Cover count",
+ "description": "The number of people seated at a table",
+ "visibility": "VISIBILITY_READ_WRITE_VALUES",
+ },
+ idempotency_key="IDEMPOTENCY_KEY",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveOrderCustomAttributeDefinitionResponse:
+ """
+ Retrieves an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve.
+
+ version : typing.Optional[int]
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveOrderCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.custom_attribute_definitions.get(
+ key="key",
+ version=1,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(key, version=version, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateOrderCustomAttributeDefinitionResponse:
+ """
+ Updates an order-related custom attribute definition for a Square seller account.
+
+ Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint supports sparse updates,
+ so only new or changed fields need to be included in the request. For more information, see
+ [Updatable definition fields](https://developer.squareup.com/docs/orders-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields).
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control, include the optional `version` field and specify the current version of the custom attribute definition.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateOrderCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.custom_attribute_definitions.update(
+ key="key",
+ custom_attribute_definition={
+ "key": "cover-count",
+ "visibility": "VISIBILITY_READ_ONLY",
+ "version": 1,
+ },
+ idempotency_key="IDEMPOTENCY_KEY",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ key,
+ custom_attribute_definition=custom_attribute_definition,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteOrderCustomAttributeDefinitionResponse:
+ """
+ Deletes an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteOrderCustomAttributeDefinitionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.custom_attribute_definitions.delete(
+ key="key",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(key, request_options=request_options)
+ return _response.data
diff --git a/src/square/orders/custom_attribute_definitions/raw_client.py b/src/square/orders/custom_attribute_definitions/raw_client.py
new file mode 100644
index 00000000..b5f799ad
--- /dev/null
+++ b/src/square/orders/custom_attribute_definitions/raw_client.py
@@ -0,0 +1,633 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.custom_attribute_definition import CustomAttributeDefinitionParams
+from ...types.create_order_custom_attribute_definition_response import CreateOrderCustomAttributeDefinitionResponse
+from ...types.custom_attribute_definition import CustomAttributeDefinition
+from ...types.delete_order_custom_attribute_definition_response import DeleteOrderCustomAttributeDefinitionResponse
+from ...types.list_order_custom_attribute_definitions_response import ListOrderCustomAttributeDefinitionsResponse
+from ...types.retrieve_order_custom_attribute_definition_response import RetrieveOrderCustomAttributeDefinitionResponse
+from ...types.update_order_custom_attribute_definition_response import UpdateOrderCustomAttributeDefinitionResponse
+from ...types.visibility_filter import VisibilityFilter
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttributeDefinition, ListOrderCustomAttributeDefinitionsResponse]:
+ """
+ Lists the order-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that
+ seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Requests that all of the custom attributes be returned, or only those that are read-only or read-write.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttributeDefinition, ListOrderCustomAttributeDefinitionsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/orders/custom-attribute-definitions",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListOrderCustomAttributeDefinitionsResponse,
+ construct_type(
+ type_=ListOrderCustomAttributeDefinitionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attribute_definitions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ visibility_filter=visibility_filter,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateOrderCustomAttributeDefinitionResponse]:
+ """
+ Creates an order-related custom attribute definition. Use this endpoint to
+ define a custom attribute that can be associated with orders.
+
+ After creating a custom attribute definition, you can set the custom attribute for orders
+ in the Square seller account.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema).
+ - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller.
+ - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateOrderCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/orders/custom-attribute-definitions",
+ method="POST",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateOrderCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=CreateOrderCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RetrieveOrderCustomAttributeDefinitionResponse]:
+ """
+ Retrieves an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve.
+
+ version : typing.Optional[int]
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveOrderCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/orders/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveOrderCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=RetrieveOrderCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateOrderCustomAttributeDefinitionResponse]:
+ """
+ Updates an order-related custom attribute definition for a Square seller account.
+
+ Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint supports sparse updates,
+ so only new or changed fields need to be included in the request. For more information, see
+ [Updatable definition fields](https://developer.squareup.com/docs/orders-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields).
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control, include the optional `version` field and specify the current version of the custom attribute definition.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateOrderCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/orders/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="PUT",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateOrderCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=UpdateOrderCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteOrderCustomAttributeDefinitionResponse]:
+ """
+ Deletes an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteOrderCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/orders/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteOrderCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=DeleteOrderCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCustomAttributeDefinitionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttributeDefinition, ListOrderCustomAttributeDefinitionsResponse]:
+ """
+ Lists the order-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
+
+ When all response pages are retrieved, the results include all custom attribute definitions
+ that are visible to the requesting application, including those that are created by other
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that
+ seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Requests that all of the custom attributes be returned, or only those that are read-only or read-write.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttributeDefinition, ListOrderCustomAttributeDefinitionsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/orders/custom-attribute-definitions",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListOrderCustomAttributeDefinitionsResponse,
+ construct_type(
+ type_=ListOrderCustomAttributeDefinitionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attribute_definitions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ visibility_filter=visibility_filter,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateOrderCustomAttributeDefinitionResponse]:
+ """
+ Creates an order-related custom attribute definition. Use this endpoint to
+ define a custom attribute that can be associated with orders.
+
+ After creating a custom attribute definition, you can set the custom attribute for orders
+ in the Square seller account.
+
+ Parameters
+ ----------
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition to create. Note the following:
+ - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema
+ definition hosted on the Square CDN. For more information, including supported values and constraints, see
+ [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema).
+ - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller.
+ - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateOrderCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/orders/custom-attribute-definitions",
+ method="POST",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateOrderCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=CreateOrderCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, key: str, *, version: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RetrieveOrderCustomAttributeDefinitionResponse]:
+ """
+ Retrieves an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ To retrieve a custom attribute definition created by another application, the `visibility`
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to retrieve.
+
+ version : typing.Optional[int]
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveOrderCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/orders/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="GET",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveOrderCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=RetrieveOrderCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ key: str,
+ *,
+ custom_attribute_definition: CustomAttributeDefinitionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateOrderCustomAttributeDefinitionResponse]:
+ """
+ Updates an order-related custom attribute definition for a Square seller account.
+
+ Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to update.
+
+ custom_attribute_definition : CustomAttributeDefinitionParams
+ The custom attribute definition that contains the fields to update. This endpoint supports sparse updates,
+ so only new or changed fields need to be included in the request. For more information, see
+ [Updatable definition fields](https://developer.squareup.com/docs/orders-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields).
+
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control, include the optional `version` field and specify the current version of the custom attribute definition.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateOrderCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/orders/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="PUT",
+ json={
+ "custom_attribute_definition": convert_and_respect_annotation_metadata(
+ object_=custom_attribute_definition, annotation=CustomAttributeDefinitionParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateOrderCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=UpdateOrderCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteOrderCustomAttributeDefinitionResponse]:
+ """
+ Deletes an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
+
+ Only the definition owner can delete a custom attribute definition.
+
+ Parameters
+ ----------
+ key : str
+ The key of the custom attribute definition to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteOrderCustomAttributeDefinitionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/orders/custom-attribute-definitions/{jsonable_encoder(key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteOrderCustomAttributeDefinitionResponse,
+ construct_type(
+ type_=DeleteOrderCustomAttributeDefinitionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/orders/custom_attributes/__init__.py b/src/square/orders/custom_attributes/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/orders/custom_attributes/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/orders/custom_attributes/client.py b/src/square/orders/custom_attributes/client.py
new file mode 100644
index 00000000..403a2d91
--- /dev/null
+++ b/src/square/orders/custom_attributes/client.py
@@ -0,0 +1,881 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.bulk_delete_order_custom_attributes_request_delete_custom_attribute import (
+ BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams,
+)
+from ...requests.bulk_upsert_order_custom_attributes_request_upsert_custom_attribute import (
+ BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams,
+)
+from ...requests.custom_attribute import CustomAttributeParams
+from ...types.bulk_delete_order_custom_attributes_response import BulkDeleteOrderCustomAttributesResponse
+from ...types.bulk_upsert_order_custom_attributes_response import BulkUpsertOrderCustomAttributesResponse
+from ...types.custom_attribute import CustomAttribute
+from ...types.delete_order_custom_attribute_response import DeleteOrderCustomAttributeResponse
+from ...types.list_order_custom_attributes_response import ListOrderCustomAttributesResponse
+from ...types.retrieve_order_custom_attribute_response import RetrieveOrderCustomAttributeResponse
+from ...types.upsert_order_custom_attribute_response import UpsertOrderCustomAttributeResponse
+from ...types.visibility_filter import VisibilityFilter
+from .raw_client import AsyncRawCustomAttributesClient, RawCustomAttributesClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CustomAttributesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCustomAttributesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCustomAttributesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCustomAttributesClient
+ """
+ return self._raw_client
+
+ def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkDeleteOrderCustomAttributesResponse:
+ """
+ Deletes order [custom attributes](entity:CustomAttribute) as a bulk operation.
+
+ Use this endpoint to delete one or more custom attributes from one or more orders.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ This `BulkDeleteOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual delete
+ requests and returns a map of individual delete responses. Each delete request has a unique ID
+ and provides an order ID and custom attribute. Each delete response is returned with the ID
+ of the corresponding request.
+
+ To delete a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams]
+ A map of requests that correspond to individual delete operations for custom attributes.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkDeleteOrderCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.custom_attributes.batch_delete(
+ values={
+ "cover-count": {
+ "key": "cover-count",
+ "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F",
+ },
+ "table-number": {
+ "key": "table-number",
+ "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F",
+ },
+ },
+ )
+ """
+ _response = self._raw_client.batch_delete(values=values, request_options=request_options)
+ return _response.data
+
+ def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkUpsertOrderCustomAttributesResponse:
+ """
+ Creates or updates order [custom attributes](entity:CustomAttribute) as a bulk operation.
+
+ Use this endpoint to delete one or more custom attributes from one or more orders.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ This `BulkUpsertOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides an order ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams]
+ A map of requests that correspond to individual upsert operations for custom attributes.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkUpsertOrderCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.custom_attributes.batch_upsert(
+ values={
+ "cover-count": {
+ "custom_attribute": {
+ "key": "cover-count",
+ "value": "6",
+ "version": 2,
+ },
+ "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F",
+ },
+ "table-number": {
+ "custom_attribute": {
+ "key": "table-number",
+ "value": "11",
+ "version": 4,
+ },
+ "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F",
+ },
+ },
+ )
+ """
+ _response = self._raw_client.batch_upsert(values=values, request_options=request_options)
+ return _response.data
+
+ def list(
+ self,
+ order_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttribute, ListOrderCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with an order.
+
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Requests that all of the custom attributes be returned, or only those that are read-only or read-write.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
+ information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttribute, ListOrderCustomAttributesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.orders.custom_attributes.list(
+ order_id="order_id",
+ visibility_filter="ALL",
+ cursor="cursor",
+ limit=1,
+ with_definitions=True,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ order_id,
+ visibility_filter=visibility_filter,
+ cursor=cursor,
+ limit=limit,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+
+ def get(
+ self,
+ order_id: str,
+ custom_attribute_key: str,
+ *,
+ version: typing.Optional[int] = None,
+ with_definition: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RetrieveOrderCustomAttributeResponse:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with an order.
+
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to retrieve. This key must match the key of an
+ existing custom attribute definition.
+
+ version : typing.Optional[int]
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
+ information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveOrderCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.custom_attributes.get(
+ order_id="order_id",
+ custom_attribute_key="custom_attribute_key",
+ version=1,
+ with_definition=True,
+ )
+ """
+ _response = self._raw_client.get(
+ order_id,
+ custom_attribute_key,
+ version=version,
+ with_definition=with_definition,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def upsert(
+ self,
+ order_id: str,
+ custom_attribute_key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpsertOrderCustomAttributeResponse:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for an order.
+
+ Use this endpoint to set the value of a custom attribute for a specific order.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to create or update. This key must match the key
+ of an existing custom attribute definition.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpsertOrderCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.custom_attributes.upsert(
+ order_id="order_id",
+ custom_attribute_key="custom_attribute_key",
+ custom_attribute={"key": "table-number", "value": "42", "version": 1},
+ )
+ """
+ _response = self._raw_client.upsert(
+ order_id,
+ custom_attribute_key,
+ custom_attribute=custom_attribute,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self, order_id: str, custom_attribute_key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteOrderCustomAttributeResponse:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to delete. This key must match the key of an
+ existing custom attribute definition.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteOrderCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.orders.custom_attributes.delete(
+ order_id="order_id",
+ custom_attribute_key="custom_attribute_key",
+ )
+ """
+ _response = self._raw_client.delete(order_id, custom_attribute_key, request_options=request_options)
+ return _response.data
+
+
+class AsyncCustomAttributesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCustomAttributesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCustomAttributesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCustomAttributesClient
+ """
+ return self._raw_client
+
+ async def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkDeleteOrderCustomAttributesResponse:
+ """
+ Deletes order [custom attributes](entity:CustomAttribute) as a bulk operation.
+
+ Use this endpoint to delete one or more custom attributes from one or more orders.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ This `BulkDeleteOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual delete
+ requests and returns a map of individual delete responses. Each delete request has a unique ID
+ and provides an order ID and custom attribute. Each delete response is returned with the ID
+ of the corresponding request.
+
+ To delete a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams]
+ A map of requests that correspond to individual delete operations for custom attributes.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkDeleteOrderCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.custom_attributes.batch_delete(
+ values={
+ "cover-count": {
+ "key": "cover-count",
+ "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F",
+ },
+ "table-number": {
+ "key": "table-number",
+ "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F",
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_delete(values=values, request_options=request_options)
+ return _response.data
+
+ async def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkUpsertOrderCustomAttributesResponse:
+ """
+ Creates or updates order [custom attributes](entity:CustomAttribute) as a bulk operation.
+
+ Use this endpoint to delete one or more custom attributes from one or more orders.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ This `BulkUpsertOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides an order ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams]
+ A map of requests that correspond to individual upsert operations for custom attributes.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkUpsertOrderCustomAttributesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.custom_attributes.batch_upsert(
+ values={
+ "cover-count": {
+ "custom_attribute": {
+ "key": "cover-count",
+ "value": "6",
+ "version": 2,
+ },
+ "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F",
+ },
+ "table-number": {
+ "custom_attribute": {
+ "key": "table-number",
+ "value": "11",
+ "version": 4,
+ },
+ "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F",
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_upsert(values=values, request_options=request_options)
+ return _response.data
+
+ async def list(
+ self,
+ order_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttribute, ListOrderCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with an order.
+
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Requests that all of the custom attributes be returned, or only those that are read-only or read-write.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
+ information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttribute, ListOrderCustomAttributesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.orders.custom_attributes.list(
+ order_id="order_id",
+ visibility_filter="ALL",
+ cursor="cursor",
+ limit=1,
+ with_definitions=True,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ order_id,
+ visibility_filter=visibility_filter,
+ cursor=cursor,
+ limit=limit,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+
+ async def get(
+ self,
+ order_id: str,
+ custom_attribute_key: str,
+ *,
+ version: typing.Optional[int] = None,
+ with_definition: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RetrieveOrderCustomAttributeResponse:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with an order.
+
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to retrieve. This key must match the key of an
+ existing custom attribute definition.
+
+ version : typing.Optional[int]
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
+ information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveOrderCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.custom_attributes.get(
+ order_id="order_id",
+ custom_attribute_key="custom_attribute_key",
+ version=1,
+ with_definition=True,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(
+ order_id,
+ custom_attribute_key,
+ version=version,
+ with_definition=with_definition,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def upsert(
+ self,
+ order_id: str,
+ custom_attribute_key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpsertOrderCustomAttributeResponse:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for an order.
+
+ Use this endpoint to set the value of a custom attribute for a specific order.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to create or update. This key must match the key
+ of an existing custom attribute definition.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpsertOrderCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.custom_attributes.upsert(
+ order_id="order_id",
+ custom_attribute_key="custom_attribute_key",
+ custom_attribute={"key": "table-number", "value": "42", "version": 1},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.upsert(
+ order_id,
+ custom_attribute_key,
+ custom_attribute=custom_attribute,
+ idempotency_key=idempotency_key,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self, order_id: str, custom_attribute_key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteOrderCustomAttributeResponse:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to delete. This key must match the key of an
+ existing custom attribute definition.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteOrderCustomAttributeResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.orders.custom_attributes.delete(
+ order_id="order_id",
+ custom_attribute_key="custom_attribute_key",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(order_id, custom_attribute_key, request_options=request_options)
+ return _response.data
diff --git a/src/square/orders/custom_attributes/raw_client.py b/src/square/orders/custom_attributes/raw_client.py
new file mode 100644
index 00000000..213dc970
--- /dev/null
+++ b/src/square/orders/custom_attributes/raw_client.py
@@ -0,0 +1,878 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.bulk_delete_order_custom_attributes_request_delete_custom_attribute import (
+ BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams,
+)
+from ...requests.bulk_upsert_order_custom_attributes_request_upsert_custom_attribute import (
+ BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams,
+)
+from ...requests.custom_attribute import CustomAttributeParams
+from ...types.bulk_delete_order_custom_attributes_response import BulkDeleteOrderCustomAttributesResponse
+from ...types.bulk_upsert_order_custom_attributes_response import BulkUpsertOrderCustomAttributesResponse
+from ...types.custom_attribute import CustomAttribute
+from ...types.delete_order_custom_attribute_response import DeleteOrderCustomAttributeResponse
+from ...types.list_order_custom_attributes_response import ListOrderCustomAttributesResponse
+from ...types.retrieve_order_custom_attribute_response import RetrieveOrderCustomAttributeResponse
+from ...types.upsert_order_custom_attribute_response import UpsertOrderCustomAttributeResponse
+from ...types.visibility_filter import VisibilityFilter
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCustomAttributesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BulkDeleteOrderCustomAttributesResponse]:
+ """
+ Deletes order [custom attributes](entity:CustomAttribute) as a bulk operation.
+
+ Use this endpoint to delete one or more custom attributes from one or more orders.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ This `BulkDeleteOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual delete
+ requests and returns a map of individual delete responses. Each delete request has a unique ID
+ and provides an order ID and custom attribute. Each delete response is returned with the ID
+ of the corresponding request.
+
+ To delete a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams]
+ A map of requests that correspond to individual delete operations for custom attributes.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkDeleteOrderCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/orders/custom-attributes/bulk-delete",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[str, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkDeleteOrderCustomAttributesResponse,
+ construct_type(
+ type_=BulkDeleteOrderCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BulkUpsertOrderCustomAttributesResponse]:
+ """
+ Creates or updates order [custom attributes](entity:CustomAttribute) as a bulk operation.
+
+ Use this endpoint to delete one or more custom attributes from one or more orders.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ This `BulkUpsertOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides an order ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams]
+ A map of requests that correspond to individual upsert operations for custom attributes.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkUpsertOrderCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/orders/custom-attributes/bulk-upsert",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[str, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkUpsertOrderCustomAttributesResponse,
+ construct_type(
+ type_=BulkUpsertOrderCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def list(
+ self,
+ order_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[CustomAttribute, ListOrderCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with an order.
+
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Requests that all of the custom attributes be returned, or only those that are read-only or read-write.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
+ information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[CustomAttribute, ListOrderCustomAttributesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}/custom-attributes",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "cursor": cursor,
+ "limit": limit,
+ "with_definitions": with_definitions,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListOrderCustomAttributesResponse,
+ construct_type(
+ type_=ListOrderCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attributes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ order_id,
+ visibility_filter=visibility_filter,
+ cursor=_parsed_next,
+ limit=limit,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self,
+ order_id: str,
+ custom_attribute_key: str,
+ *,
+ version: typing.Optional[int] = None,
+ with_definition: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[RetrieveOrderCustomAttributeResponse]:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with an order.
+
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to retrieve. This key must match the key of an
+ existing custom attribute definition.
+
+ version : typing.Optional[int]
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
+ information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveOrderCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}/custom-attributes/{jsonable_encoder(custom_attribute_key)}",
+ method="GET",
+ params={
+ "version": version,
+ "with_definition": with_definition,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveOrderCustomAttributeResponse,
+ construct_type(
+ type_=RetrieveOrderCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def upsert(
+ self,
+ order_id: str,
+ custom_attribute_key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpsertOrderCustomAttributeResponse]:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for an order.
+
+ Use this endpoint to set the value of a custom attribute for a specific order.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to create or update. This key must match the key
+ of an existing custom attribute definition.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpsertOrderCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}/custom-attributes/{jsonable_encoder(custom_attribute_key)}",
+ method="POST",
+ json={
+ "custom_attribute": convert_and_respect_annotation_metadata(
+ object_=custom_attribute, annotation=CustomAttributeParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertOrderCustomAttributeResponse,
+ construct_type(
+ type_=UpsertOrderCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, order_id: str, custom_attribute_key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteOrderCustomAttributeResponse]:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to delete. This key must match the key of an
+ existing custom attribute definition.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteOrderCustomAttributeResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}/custom-attributes/{jsonable_encoder(custom_attribute_key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteOrderCustomAttributeResponse,
+ construct_type(
+ type_=DeleteOrderCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCustomAttributesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def batch_delete(
+ self,
+ *,
+ values: typing.Dict[str, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BulkDeleteOrderCustomAttributesResponse]:
+ """
+ Deletes order [custom attributes](entity:CustomAttribute) as a bulk operation.
+
+ Use this endpoint to delete one or more custom attributes from one or more orders.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ This `BulkDeleteOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual delete
+ requests and returns a map of individual delete responses. Each delete request has a unique ID
+ and provides an order ID and custom attribute. Each delete response is returned with the ID
+ of the corresponding request.
+
+ To delete a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams]
+ A map of requests that correspond to individual delete operations for custom attributes.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkDeleteOrderCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/orders/custom-attributes/bulk-delete",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[str, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkDeleteOrderCustomAttributesResponse,
+ construct_type(
+ type_=BulkDeleteOrderCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_upsert(
+ self,
+ *,
+ values: typing.Dict[str, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BulkUpsertOrderCustomAttributesResponse]:
+ """
+ Creates or updates order [custom attributes](entity:CustomAttribute) as a bulk operation.
+
+ Use this endpoint to delete one or more custom attributes from one or more orders.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ This `BulkUpsertOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
+ and provides an order ID and custom attribute. Each upsert response is returned with the ID
+ of the corresponding request.
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ values : typing.Dict[str, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams]
+ A map of requests that correspond to individual upsert operations for custom attributes.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkUpsertOrderCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/orders/custom-attributes/bulk-upsert",
+ method="POST",
+ json={
+ "values": convert_and_respect_annotation_metadata(
+ object_=values,
+ annotation=typing.Dict[str, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkUpsertOrderCustomAttributesResponse,
+ construct_type(
+ type_=BulkUpsertOrderCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def list(
+ self,
+ order_id: str,
+ *,
+ visibility_filter: typing.Optional[VisibilityFilter] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ with_definitions: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[CustomAttribute, ListOrderCustomAttributesResponse]:
+ """
+ Lists the [custom attributes](entity:CustomAttribute) associated with an order.
+
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
+ in the same call.
+
+ When all response pages are retrieved, the results include all custom attributes that are
+ visible to the requesting application, including those that are owned by other applications
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ visibility_filter : typing.Optional[VisibilityFilter]
+ Requests that all of the custom attributes be returned, or only those that are read-only or read-write.
+
+ cursor : typing.Optional[str]
+ The cursor returned in the paged response from the previous call to this endpoint.
+ Provide this cursor to retrieve the next page of results for your original request.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ limit : typing.Optional[int]
+ The maximum number of results to return in a single paged response. This limit is advisory.
+ The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
+ The default value is 20.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ with_definitions : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
+ information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[CustomAttribute, ListOrderCustomAttributesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}/custom-attributes",
+ method="GET",
+ params={
+ "visibility_filter": visibility_filter,
+ "cursor": cursor,
+ "limit": limit,
+ "with_definitions": with_definitions,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListOrderCustomAttributesResponse,
+ construct_type(
+ type_=ListOrderCustomAttributesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.custom_attributes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ order_id,
+ visibility_filter=visibility_filter,
+ cursor=_parsed_next,
+ limit=limit,
+ with_definitions=with_definitions,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self,
+ order_id: str,
+ custom_attribute_key: str,
+ *,
+ version: typing.Optional[int] = None,
+ with_definition: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[RetrieveOrderCustomAttributeResponse]:
+ """
+ Retrieves a [custom attribute](entity:CustomAttribute) associated with an order.
+
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
+ in the same call.
+
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to retrieve. This key must match the key of an
+ existing custom attribute definition.
+
+ version : typing.Optional[int]
+ To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ with_definition : typing.Optional[bool]
+ Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
+ custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
+ information about the data type, or other definition details. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveOrderCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}/custom-attributes/{jsonable_encoder(custom_attribute_key)}",
+ method="GET",
+ params={
+ "version": version,
+ "with_definition": with_definition,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveOrderCustomAttributeResponse,
+ construct_type(
+ type_=RetrieveOrderCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def upsert(
+ self,
+ order_id: str,
+ custom_attribute_key: str,
+ *,
+ custom_attribute: CustomAttributeParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpsertOrderCustomAttributeResponse]:
+ """
+ Creates or updates a [custom attribute](entity:CustomAttribute) for an order.
+
+ Use this endpoint to set the value of a custom attribute for a specific order.
+ A custom attribute is based on a custom attribute definition in a Square seller account. (To create a
+ custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.)
+
+ To create or update a custom attribute owned by another application, the `visibility` setting
+ must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to create or update. This key must match the key
+ of an existing custom attribute definition.
+
+ custom_attribute : CustomAttributeParams
+ The custom attribute to create or update, with the following fields:
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+
+ idempotency_key : typing.Optional[str]
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpsertOrderCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}/custom-attributes/{jsonable_encoder(custom_attribute_key)}",
+ method="POST",
+ json={
+ "custom_attribute": convert_and_respect_annotation_metadata(
+ object_=custom_attribute, annotation=CustomAttributeParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertOrderCustomAttributeResponse,
+ construct_type(
+ type_=UpsertOrderCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, order_id: str, custom_attribute_key: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteOrderCustomAttributeResponse]:
+ """
+ Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile.
+
+ To delete a custom attribute owned by another application, the `visibility` setting must be
+ `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
+ (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the target [order](entity:Order).
+
+ custom_attribute_key : str
+ The key of the custom attribute to delete. This key must match the key of an
+ existing custom attribute definition.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteOrderCustomAttributeResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}/custom-attributes/{jsonable_encoder(custom_attribute_key)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteOrderCustomAttributeResponse,
+ construct_type(
+ type_=DeleteOrderCustomAttributeResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/orders/raw_client.py b/src/square/orders/raw_client.py
new file mode 100644
index 00000000..cfa9f709
--- /dev/null
+++ b/src/square/orders/raw_client.py
@@ -0,0 +1,1172 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.order import OrderParams
+from ..requests.order_reward import OrderRewardParams
+from ..requests.search_orders_query import SearchOrdersQueryParams
+from ..types.batch_get_orders_response import BatchGetOrdersResponse
+from ..types.calculate_order_response import CalculateOrderResponse
+from ..types.clone_order_response import CloneOrderResponse
+from ..types.create_order_response import CreateOrderResponse
+from ..types.get_order_response import GetOrderResponse
+from ..types.pay_order_response import PayOrderResponse
+from ..types.search_orders_response import SearchOrdersResponse
+from ..types.update_order_response import UpdateOrderResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawOrdersClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ order: typing.Optional[OrderParams] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateOrderResponse]:
+ """
+ Creates a new [order](entity:Order) that can include information about products for
+ purchase and settings to apply to the purchase.
+
+ To pay for a created order, see
+ [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
+
+ You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint.
+
+ Parameters
+ ----------
+ order : typing.Optional[OrderParams]
+ The order to create. If this field is set, the only other top-level field that can be
+ set is the `idempotency_key`.
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this
+ order among orders you have created.
+
+ If you are unsure whether a particular order was created successfully,
+ you can try it again with the same idempotency key without
+ worrying about creating duplicate orders.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/orders",
+ method="POST",
+ json={
+ "order": convert_and_respect_annotation_metadata(
+ object_=order, annotation=OrderParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateOrderResponse,
+ construct_type(
+ type_=CreateOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_get(
+ self,
+ *,
+ order_ids: typing.Sequence[str],
+ location_id: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BatchGetOrdersResponse]:
+ """
+ Retrieves a set of [orders](entity:Order) by their IDs.
+
+ If a given order ID does not exist, the ID is ignored instead of generating an error.
+
+ Parameters
+ ----------
+ order_ids : typing.Sequence[str]
+ The IDs of the orders to retrieve. A maximum of 100 orders can be retrieved per request.
+
+ location_id : typing.Optional[str]
+ The ID of the location for these orders. This field is optional: omit it to retrieve
+ orders within the scope of the current authorization's merchant ID.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchGetOrdersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/orders/batch-retrieve",
+ method="POST",
+ json={
+ "location_id": location_id,
+ "order_ids": order_ids,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchGetOrdersResponse,
+ construct_type(
+ type_=BatchGetOrdersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def calculate(
+ self,
+ *,
+ order: OrderParams,
+ proposed_rewards: typing.Optional[typing.Sequence[OrderRewardParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CalculateOrderResponse]:
+ """
+ Enables applications to preview order pricing without creating an order.
+
+ Parameters
+ ----------
+ order : OrderParams
+ The order to be calculated. Expects the entire order, not a sparse update.
+
+ proposed_rewards : typing.Optional[typing.Sequence[OrderRewardParams]]
+ Identifies one or more loyalty reward tiers to apply during the order calculation.
+ The discounts defined by the reward tiers are added to the order only to preview the
+ effect of applying the specified rewards. The rewards do not correspond to actual
+ redemptions; that is, no `reward`s are created. Therefore, the reward `id`s are
+ random strings used only to reference the reward tier.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CalculateOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/orders/calculate",
+ method="POST",
+ json={
+ "order": convert_and_respect_annotation_metadata(
+ object_=order, annotation=OrderParams, direction="write"
+ ),
+ "proposed_rewards": convert_and_respect_annotation_metadata(
+ object_=proposed_rewards,
+ annotation=typing.Optional[typing.Sequence[OrderRewardParams]],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CalculateOrderResponse,
+ construct_type(
+ type_=CalculateOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def clone(
+ self,
+ *,
+ order_id: str,
+ version: typing.Optional[int] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CloneOrderResponse]:
+ """
+ Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order has
+ only the core fields (such as line items, taxes, and discounts) copied from the original order.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to clone.
+
+ version : typing.Optional[int]
+ An optional order version for concurrency protection.
+
+ If a version is provided, it must match the latest stored version of the order to clone.
+ If a version is not provided, the API clones the latest version.
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this clone request.
+
+ If you are unsure whether a particular order was cloned successfully,
+ you can reattempt the call with the same idempotency key without
+ worrying about creating duplicate cloned orders.
+ The originally cloned order is returned.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CloneOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/orders/clone",
+ method="POST",
+ json={
+ "order_id": order_id,
+ "version": version,
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CloneOrderResponse,
+ construct_type(
+ type_=CloneOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ query: typing.Optional[SearchOrdersQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ return_entries: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchOrdersResponse]:
+ """
+ Search all orders for one or more locations. Orders include all sales,
+ returns, and exchanges regardless of how or when they entered the Square
+ ecosystem (such as Point of Sale, Invoices, and Connect APIs).
+
+ `SearchOrders` requests need to specify which locations to search and define a
+ [SearchOrdersQuery](entity:SearchOrdersQuery) object that controls
+ how to sort or filter the results. Your `SearchOrdersQuery` can:
+
+ Set filter criteria.
+ Set the sort order.
+ Determine whether to return results as complete `Order` objects or as
+ [OrderEntry](entity:OrderEntry) objects.
+
+ Note that details for orders processed with Square Point of Sale while in
+ offline mode might not be transmitted to Square for up to 72 hours. Offline
+ orders have a `created_at` value that reflects the time the order was created,
+ not the time it was subsequently transmitted to Square.
+
+ Parameters
+ ----------
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The location IDs for the orders to query. All locations must belong to
+ the same merchant.
+
+ Max: 10 location IDs.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ query : typing.Optional[SearchOrdersQueryParams]
+ Query conditions used to filter or sort the results. Note that when
+ retrieving additional pages using a cursor, you must use the original query.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+
+ Default: `500`
+ Max: `1000`
+
+ return_entries : typing.Optional[bool]
+ A Boolean that controls the format of the search results. If `true`,
+ `SearchOrders` returns [OrderEntry](entity:OrderEntry) objects. If `false`, `SearchOrders`
+ returns complete order objects.
+
+ Default: `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchOrdersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/orders/search",
+ method="POST",
+ json={
+ "location_ids": location_ids,
+ "cursor": cursor,
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchOrdersQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "return_entries": return_entries,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchOrdersResponse,
+ construct_type(
+ type_=SearchOrdersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetOrderResponse]:
+ """
+ Retrieves an [Order](entity:Order) by ID.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetOrderResponse,
+ construct_type(
+ type_=GetOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ order_id: str,
+ *,
+ order: typing.Optional[OrderParams] = OMIT,
+ fields_to_clear: typing.Optional[typing.Sequence[str]] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateOrderResponse]:
+ """
+ Updates an open [order](entity:Order) by adding, replacing, or deleting
+ fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated.
+
+ An `UpdateOrder` request requires the following:
+
+ - The `order_id` in the endpoint path, identifying the order to update.
+ - The latest `version` of the order to update.
+ - The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects)
+ containing only the fields to update and the version to which the update is
+ being applied.
+ - If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete)
+ identifying the fields to clear.
+
+ To pay for an order, see
+ [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to update.
+
+ order : typing.Optional[OrderParams]
+ The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects)
+ containing only the fields to update and the version to which the update is
+ being applied.
+
+ fields_to_clear : typing.Optional[typing.Sequence[str]]
+ The [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete)
+ fields to clear. For example, `line_items[uid].note`.
+ For more information, see [Deleting fields](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#deleting-fields).
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this update request.
+
+ If you are unsure whether a particular update was applied to an order successfully,
+ you can reattempt it with the same idempotency key without
+ worrying about creating duplicate updates to the order.
+ The latest order version is returned.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}",
+ method="PUT",
+ json={
+ "order": convert_and_respect_annotation_metadata(
+ object_=order, annotation=OrderParams, direction="write"
+ ),
+ "fields_to_clear": fields_to_clear,
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateOrderResponse,
+ construct_type(
+ type_=UpdateOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def pay(
+ self,
+ order_id: str,
+ *,
+ idempotency_key: str,
+ order_version: typing.Optional[int] = OMIT,
+ payment_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[PayOrderResponse]:
+ """
+ Pay for an [order](entity:Order) using one or more approved [payments](entity:Payment)
+ or settle an order with a total of `0`.
+
+ The total of the `payment_ids` listed in the request must be equal to the order
+ total. Orders with a total amount of `0` can be marked as paid by specifying an empty
+ array of `payment_ids` in the request.
+
+ To be used with `PayOrder`, a payment must:
+
+ - Reference the order by specifying the `order_id` when [creating the payment](api-endpoint:Payments-CreatePayment).
+ Any approved payments that reference the same `order_id` not specified in the
+ `payment_ids` is canceled.
+ - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture).
+ Using a delayed capture payment with `PayOrder` completes the approved payment.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order being paid.
+
+ idempotency_key : str
+ A value you specify that uniquely identifies this request among requests you have sent. If
+ you are unsure whether a particular payment request was completed successfully, you can reattempt
+ it with the same idempotency key without worrying about duplicate payments.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ order_version : typing.Optional[int]
+ The version of the order being paid. If not supplied, the latest version will be paid.
+
+ payment_ids : typing.Optional[typing.Sequence[str]]
+ The IDs of the [payments](entity:Payment) to collect.
+ The payment total must match the order total.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[PayOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}/pay",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "order_version": order_version,
+ "payment_ids": payment_ids,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ PayOrderResponse,
+ construct_type(
+ type_=PayOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawOrdersClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ order: typing.Optional[OrderParams] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateOrderResponse]:
+ """
+ Creates a new [order](entity:Order) that can include information about products for
+ purchase and settings to apply to the purchase.
+
+ To pay for a created order, see
+ [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
+
+ You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint.
+
+ Parameters
+ ----------
+ order : typing.Optional[OrderParams]
+ The order to create. If this field is set, the only other top-level field that can be
+ set is the `idempotency_key`.
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this
+ order among orders you have created.
+
+ If you are unsure whether a particular order was created successfully,
+ you can try it again with the same idempotency key without
+ worrying about creating duplicate orders.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/orders",
+ method="POST",
+ json={
+ "order": convert_and_respect_annotation_metadata(
+ object_=order, annotation=OrderParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateOrderResponse,
+ construct_type(
+ type_=CreateOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_get(
+ self,
+ *,
+ order_ids: typing.Sequence[str],
+ location_id: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BatchGetOrdersResponse]:
+ """
+ Retrieves a set of [orders](entity:Order) by their IDs.
+
+ If a given order ID does not exist, the ID is ignored instead of generating an error.
+
+ Parameters
+ ----------
+ order_ids : typing.Sequence[str]
+ The IDs of the orders to retrieve. A maximum of 100 orders can be retrieved per request.
+
+ location_id : typing.Optional[str]
+ The ID of the location for these orders. This field is optional: omit it to retrieve
+ orders within the scope of the current authorization's merchant ID.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchGetOrdersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/orders/batch-retrieve",
+ method="POST",
+ json={
+ "location_id": location_id,
+ "order_ids": order_ids,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchGetOrdersResponse,
+ construct_type(
+ type_=BatchGetOrdersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def calculate(
+ self,
+ *,
+ order: OrderParams,
+ proposed_rewards: typing.Optional[typing.Sequence[OrderRewardParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CalculateOrderResponse]:
+ """
+ Enables applications to preview order pricing without creating an order.
+
+ Parameters
+ ----------
+ order : OrderParams
+ The order to be calculated. Expects the entire order, not a sparse update.
+
+ proposed_rewards : typing.Optional[typing.Sequence[OrderRewardParams]]
+ Identifies one or more loyalty reward tiers to apply during the order calculation.
+ The discounts defined by the reward tiers are added to the order only to preview the
+ effect of applying the specified rewards. The rewards do not correspond to actual
+ redemptions; that is, no `reward`s are created. Therefore, the reward `id`s are
+ random strings used only to reference the reward tier.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CalculateOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/orders/calculate",
+ method="POST",
+ json={
+ "order": convert_and_respect_annotation_metadata(
+ object_=order, annotation=OrderParams, direction="write"
+ ),
+ "proposed_rewards": convert_and_respect_annotation_metadata(
+ object_=proposed_rewards,
+ annotation=typing.Optional[typing.Sequence[OrderRewardParams]],
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CalculateOrderResponse,
+ construct_type(
+ type_=CalculateOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def clone(
+ self,
+ *,
+ order_id: str,
+ version: typing.Optional[int] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CloneOrderResponse]:
+ """
+ Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order has
+ only the core fields (such as line items, taxes, and discounts) copied from the original order.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to clone.
+
+ version : typing.Optional[int]
+ An optional order version for concurrency protection.
+
+ If a version is provided, it must match the latest stored version of the order to clone.
+ If a version is not provided, the API clones the latest version.
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this clone request.
+
+ If you are unsure whether a particular order was cloned successfully,
+ you can reattempt the call with the same idempotency key without
+ worrying about creating duplicate cloned orders.
+ The originally cloned order is returned.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CloneOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/orders/clone",
+ method="POST",
+ json={
+ "order_id": order_id,
+ "version": version,
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CloneOrderResponse,
+ construct_type(
+ type_=CloneOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ query: typing.Optional[SearchOrdersQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ return_entries: typing.Optional[bool] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchOrdersResponse]:
+ """
+ Search all orders for one or more locations. Orders include all sales,
+ returns, and exchanges regardless of how or when they entered the Square
+ ecosystem (such as Point of Sale, Invoices, and Connect APIs).
+
+ `SearchOrders` requests need to specify which locations to search and define a
+ [SearchOrdersQuery](entity:SearchOrdersQuery) object that controls
+ how to sort or filter the results. Your `SearchOrdersQuery` can:
+
+ Set filter criteria.
+ Set the sort order.
+ Determine whether to return results as complete `Order` objects or as
+ [OrderEntry](entity:OrderEntry) objects.
+
+ Note that details for orders processed with Square Point of Sale while in
+ offline mode might not be transmitted to Square for up to 72 hours. Offline
+ orders have a `created_at` value that reflects the time the order was created,
+ not the time it was subsequently transmitted to Square.
+
+ Parameters
+ ----------
+ location_ids : typing.Optional[typing.Sequence[str]]
+ The location IDs for the orders to query. All locations must belong to
+ the same merchant.
+
+ Max: 10 location IDs.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for your original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ query : typing.Optional[SearchOrdersQueryParams]
+ Query conditions used to filter or sort the results. Note that when
+ retrieving additional pages using a cursor, you must use the original query.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+
+ Default: `500`
+ Max: `1000`
+
+ return_entries : typing.Optional[bool]
+ A Boolean that controls the format of the search results. If `true`,
+ `SearchOrders` returns [OrderEntry](entity:OrderEntry) objects. If `false`, `SearchOrders`
+ returns complete order objects.
+
+ Default: `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchOrdersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/orders/search",
+ method="POST",
+ json={
+ "location_ids": location_ids,
+ "cursor": cursor,
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchOrdersQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "return_entries": return_entries,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchOrdersResponse,
+ construct_type(
+ type_=SearchOrdersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetOrderResponse]:
+ """
+ Retrieves an [Order](entity:Order) by ID.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetOrderResponse,
+ construct_type(
+ type_=GetOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ order_id: str,
+ *,
+ order: typing.Optional[OrderParams] = OMIT,
+ fields_to_clear: typing.Optional[typing.Sequence[str]] = OMIT,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateOrderResponse]:
+ """
+ Updates an open [order](entity:Order) by adding, replacing, or deleting
+ fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated.
+
+ An `UpdateOrder` request requires the following:
+
+ - The `order_id` in the endpoint path, identifying the order to update.
+ - The latest `version` of the order to update.
+ - The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects)
+ containing only the fields to update and the version to which the update is
+ being applied.
+ - If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete)
+ identifying the fields to clear.
+
+ To pay for an order, see
+ [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order to update.
+
+ order : typing.Optional[OrderParams]
+ The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects)
+ containing only the fields to update and the version to which the update is
+ being applied.
+
+ fields_to_clear : typing.Optional[typing.Sequence[str]]
+ The [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete)
+ fields to clear. For example, `line_items[uid].note`.
+ For more information, see [Deleting fields](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#deleting-fields).
+
+ idempotency_key : typing.Optional[str]
+ A value you specify that uniquely identifies this update request.
+
+ If you are unsure whether a particular update was applied to an order successfully,
+ you can reattempt it with the same idempotency key without
+ worrying about creating duplicate updates to the order.
+ The latest order version is returned.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}",
+ method="PUT",
+ json={
+ "order": convert_and_respect_annotation_metadata(
+ object_=order, annotation=OrderParams, direction="write"
+ ),
+ "fields_to_clear": fields_to_clear,
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateOrderResponse,
+ construct_type(
+ type_=UpdateOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def pay(
+ self,
+ order_id: str,
+ *,
+ idempotency_key: str,
+ order_version: typing.Optional[int] = OMIT,
+ payment_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[PayOrderResponse]:
+ """
+ Pay for an [order](entity:Order) using one or more approved [payments](entity:Payment)
+ or settle an order with a total of `0`.
+
+ The total of the `payment_ids` listed in the request must be equal to the order
+ total. Orders with a total amount of `0` can be marked as paid by specifying an empty
+ array of `payment_ids` in the request.
+
+ To be used with `PayOrder`, a payment must:
+
+ - Reference the order by specifying the `order_id` when [creating the payment](api-endpoint:Payments-CreatePayment).
+ Any approved payments that reference the same `order_id` not specified in the
+ `payment_ids` is canceled.
+ - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture).
+ Using a delayed capture payment with `PayOrder` completes the approved payment.
+
+ Parameters
+ ----------
+ order_id : str
+ The ID of the order being paid.
+
+ idempotency_key : str
+ A value you specify that uniquely identifies this request among requests you have sent. If
+ you are unsure whether a particular payment request was completed successfully, you can reattempt
+ it with the same idempotency key without worrying about duplicate payments.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ order_version : typing.Optional[int]
+ The version of the order being paid. If not supplied, the latest version will be paid.
+
+ payment_ids : typing.Optional[typing.Sequence[str]]
+ The IDs of the [payments](entity:Payment) to collect.
+ The payment total must match the order total.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[PayOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/orders/{jsonable_encoder(order_id)}/pay",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "order_version": order_version,
+ "payment_ids": payment_ids,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ PayOrderResponse,
+ construct_type(
+ type_=PayOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/payments/__init__.py b/src/square/payments/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/payments/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/payments/client.py b/src/square/payments/client.py
new file mode 100644
index 00000000..89962a77
--- /dev/null
+++ b/src/square/payments/client.py
@@ -0,0 +1,1426 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..requests.address import AddressParams
+from ..requests.cash_payment_details import CashPaymentDetailsParams
+from ..requests.customer_details import CustomerDetailsParams
+from ..requests.external_payment_details import ExternalPaymentDetailsParams
+from ..requests.money import MoneyParams
+from ..requests.offline_payment_details import OfflinePaymentDetailsParams
+from ..requests.payment import PaymentParams
+from ..types.cancel_payment_by_idempotency_key_response import CancelPaymentByIdempotencyKeyResponse
+from ..types.cancel_payment_response import CancelPaymentResponse
+from ..types.complete_payment_response import CompletePaymentResponse
+from ..types.create_payment_response import CreatePaymentResponse
+from ..types.get_payment_response import GetPaymentResponse
+from ..types.list_payments_request_sort_field import ListPaymentsRequestSortField
+from ..types.list_payments_response import ListPaymentsResponse
+from ..types.payment import Payment
+from ..types.update_payment_response import UpdatePaymentResponse
+from .raw_client import AsyncRawPaymentsClient, RawPaymentsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class PaymentsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawPaymentsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawPaymentsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawPaymentsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ total: typing.Optional[int] = None,
+ last4: typing.Optional[str] = None,
+ card_brand: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ is_offline_payment: typing.Optional[bool] = None,
+ offline_begin_time: typing.Optional[str] = None,
+ offline_end_time: typing.Optional[str] = None,
+ updated_at_begin_time: typing.Optional[str] = None,
+ updated_at_end_time: typing.Optional[str] = None,
+ sort_field: typing.Optional[ListPaymentsRequestSortField] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Payment, ListPaymentsResponse]:
+ """
+ Retrieves a list of payments taken by the account making the request.
+
+ Results are eventually consistent, and new payments or changes to payments might take several
+ seconds to appear.
+
+ The maximum results per page is 100.
+
+ Parameters
+ ----------
+ begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve payments for, in RFC 3339 format.
+ The range is determined using the `created_at` field for each Payment.
+ Inclusive. Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `created_at` field for each Payment.
+
+ Default: The current time.
+
+ sort_order : typing.Optional[str]
+ The order in which results are listed by `ListPaymentsRequest.sort_field`:
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ location_id : typing.Optional[str]
+ Limit results to the location supplied. By default, results are returned
+ for the default (main) location associated with the seller.
+
+ total : typing.Optional[int]
+ The exact amount in the `total_money` for a payment.
+
+ last4 : typing.Optional[str]
+ The last four digits of a payment card.
+
+ card_brand : typing.Optional[str]
+ The brand of the payment card (for example, VISA).
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+
+ Default: `100`
+
+ is_offline_payment : typing.Optional[bool]
+ Whether the payment was taken offline or not.
+
+ offline_begin_time : typing.Optional[str]
+ Indicates the start of the time range for which to retrieve offline payments, in RFC 3339
+ format for timestamps. The range is determined using the
+ `offline_payment_details.client_created_at` field for each Payment. If set, payments without a
+ value set in `offline_payment_details.client_created_at` will not be returned.
+
+ Default: The current time.
+
+ offline_end_time : typing.Optional[str]
+ Indicates the end of the time range for which to retrieve offline payments, in RFC 3339
+ format for timestamps. The range is determined using the
+ `offline_payment_details.client_created_at` field for each Payment. If set, payments without a
+ value set in `offline_payment_details.client_created_at` will not be returned.
+
+ Default: The current time.
+
+ updated_at_begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `updated_at` field for each Payment.
+
+ updated_at_end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `updated_at` field for each Payment.
+
+ sort_field : typing.Optional[ListPaymentsRequestSortField]
+ The field used to sort results by. The default is `CREATED_AT`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Payment, ListPaymentsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.payments.list(
+ begin_time="begin_time",
+ end_time="end_time",
+ sort_order="sort_order",
+ cursor="cursor",
+ location_id="location_id",
+ total=1000000,
+ last4="last_4",
+ card_brand="card_brand",
+ limit=1,
+ is_offline_payment=True,
+ offline_begin_time="offline_begin_time",
+ offline_end_time="offline_end_time",
+ updated_at_begin_time="updated_at_begin_time",
+ updated_at_end_time="updated_at_end_time",
+ sort_field="CREATED_AT",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=cursor,
+ location_id=location_id,
+ total=total,
+ last4=last4,
+ card_brand=card_brand,
+ limit=limit,
+ is_offline_payment=is_offline_payment,
+ offline_begin_time=offline_begin_time,
+ offline_end_time=offline_end_time,
+ updated_at_begin_time=updated_at_begin_time,
+ updated_at_end_time=updated_at_end_time,
+ sort_field=sort_field,
+ request_options=request_options,
+ )
+
+ def create(
+ self,
+ *,
+ source_id: str,
+ idempotency_key: str,
+ amount_money: typing.Optional[MoneyParams] = OMIT,
+ tip_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_allocations: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
+ delay_duration: typing.Optional[str] = OMIT,
+ delay_action: typing.Optional[str] = OMIT,
+ autocomplete: typing.Optional[bool] = OMIT,
+ order_id: typing.Optional[str] = OMIT,
+ customer_id: typing.Optional[str] = OMIT,
+ location_id: typing.Optional[str] = OMIT,
+ team_member_id: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ verification_token: typing.Optional[str] = OMIT,
+ accept_partial_authorization: typing.Optional[bool] = OMIT,
+ buyer_email_address: typing.Optional[str] = OMIT,
+ buyer_phone_number: typing.Optional[str] = OMIT,
+ billing_address: typing.Optional[AddressParams] = OMIT,
+ shipping_address: typing.Optional[AddressParams] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ statement_description_identifier: typing.Optional[str] = OMIT,
+ cash_details: typing.Optional[CashPaymentDetailsParams] = OMIT,
+ external_details: typing.Optional[ExternalPaymentDetailsParams] = OMIT,
+ customer_details: typing.Optional[CustomerDetailsParams] = OMIT,
+ offline_payment_details: typing.Optional[OfflinePaymentDetailsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreatePaymentResponse:
+ """
+ Creates a payment using the provided source. You can use this endpoint
+ to charge a card (credit/debit card or
+ Square gift card) or record a payment that the seller received outside of Square
+ (cash payment from a buyer or a payment that an external entity
+ processed on behalf of the seller).
+
+ The endpoint creates a
+ `Payment` object and returns it in the response.
+
+ Parameters
+ ----------
+ source_id : str
+ The ID for the source of funds for this payment.
+ This could be a payment token generated by the Web Payments SDK for any of its
+ [supported methods](https://developer.squareup.com/docs/web-payments/overview#explore-payment-methods),
+ including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment
+ that the seller received outside of Square, specify either "CASH" or "EXTERNAL".
+ For more information, see
+ [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
+
+ idempotency_key : str
+ A unique string that identifies this `CreatePayment` request. Keys can be any valid string
+ but must be unique for every `CreatePayment` request.
+
+ Note: The number of allowed characters might be less than the stated maximum, if multi-byte
+ characters are used.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ amount_money : typing.Optional[MoneyParams]
+ The amount of money to accept for this payment, not including `tip_money`.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The currency code must match the currency associated with the business
+ that is accepting the payment.
+
+ tip_money : typing.Optional[MoneyParams]
+ The amount designated as a tip, in addition to `amount_money`.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.
+
+ The currency code must match the currency associated with the business
+ that is accepting the payment.
+
+ app_fee_money : typing.Optional[MoneyParams]
+ The amount of money that the developer is taking as a fee
+ for facilitating the payment on behalf of the seller.
+
+ The amount cannot be more than 90% of the total amount of the payment.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The fee currency code must match the currency associated with the seller
+ that is accepting the payment. The application must be from a developer
+ account in the same country and using the same currency code as the seller.
+
+ For more information about the application fee scenario, see
+ [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
+ For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+
+ app_fee_allocations : typing.Optional[typing.Sequence[typing.Any]]
+ Details pertaining to recipients of the application fee. The sum of the amounts in the
+ app_fee_allocations must equal the app_fee_money amount, if present. If populated, an
+ allocation must be present for every party that expects to receive a portion of the application
+ fee, including the application developer.
+
+ delay_duration : typing.Optional[str]
+ The duration of time after the payment's creation when Square automatically
+ either completes or cancels the payment depending on the `delay_action` field value.
+ For more information, see
+ [Time threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ This parameter should be specified as a time duration, in RFC 3339 format.
+
+ Note: This feature is only supported for card payments. This parameter can only be set for a delayed
+ capture payment (`autocomplete=false`).
+
+ Default:
+
+ - Card-present payments: "PT36H" (36 hours) from the creation time.
+ - Card-not-present payments: "P7D" (7 days) from the creation time.
+
+ delay_action : typing.Optional[str]
+ The action to be applied to the payment when the `delay_duration` has elapsed. The action must be
+ CANCEL or COMPLETE. For more information, see
+ [Time Threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ Default: CANCEL
+
+ autocomplete : typing.Optional[bool]
+ If set to `true`, this payment will be completed when possible. If
+ set to `false`, this payment is held in an approved state until either
+ explicitly completed (captured) or canceled (voided). For more information, see
+ [Delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment).
+
+ Default: true
+
+ order_id : typing.Optional[str]
+ Associates a previously created order with this payment.
+
+ customer_id : typing.Optional[str]
+ The [Customer](entity:Customer) ID of the customer associated with the payment.
+
+ This is required if the `source_id` refers to a card on file created using the Cards API.
+
+ location_id : typing.Optional[str]
+ The location ID to associate with the payment. If not specified, the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location) is
+ used.
+
+ team_member_id : typing.Optional[str]
+ An optional [TeamMember](entity:TeamMember) ID to associate with
+ this payment.
+
+ reference_id : typing.Optional[str]
+ A user-defined ID to associate with the payment.
+
+ You can use this field to associate the payment to an entity in an external system
+ (for example, you might specify an order ID that is generated by a third-party shopping cart).
+
+ verification_token : typing.Optional[str]
+ An identifying token generated by [payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
+ Verification tokens encapsulate customer device information and 3-D Secure
+ challenge results to indicate that Square has verified the buyer identity.
+
+ For more information, see [SCA Overview](https://developer.squareup.com/docs/sca-overview).
+
+ accept_partial_authorization : typing.Optional[bool]
+ If set to `true` and charging a Square Gift Card, a payment might be returned with
+ `amount_money` equal to less than what was requested. For example, a request for $20 when charging
+ a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose
+ to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card
+ payment. This field cannot be `true` when `autocomplete = true`.
+
+ For more information, see
+ [Partial amount with Square Gift Cards](https://developer.squareup.com/docs/payments-api/take-payments#partial-payment-gift-card).
+
+ Default: false
+
+ buyer_email_address : typing.Optional[str]
+ The buyer's email address.
+
+ buyer_phone_number : typing.Optional[str]
+ The buyer's phone number.
+ Must follow the following format:
+ 1. A leading + symbol (followed by a country code)
+ 2. The phone number can contain spaces and the special characters `(` , `)` , `-` , and `.`.
+ Alphabetical characters aren't allowed.
+ 3. The phone number must contain between 9 and 16 digits.
+
+ billing_address : typing.Optional[AddressParams]
+ The buyer's billing address.
+
+ shipping_address : typing.Optional[AddressParams]
+ The buyer's shipping address.
+
+ note : typing.Optional[str]
+ An optional note to be entered by the developer when creating a payment.
+
+ statement_description_identifier : typing.Optional[str]
+ Optional additional payment information to include on the customer's card statement
+ as part of the statement description. This can be, for example, an invoice number, ticket number,
+ or short description that uniquely identifies the purchase.
+
+ Note that the `statement_description_identifier` might get truncated on the statement description
+ to fit the required information including the Square identifier (SQ *) and name of the
+ seller taking the payment.
+
+ cash_details : typing.Optional[CashPaymentDetailsParams]
+ Additional details required when recording a cash payment (`source_id` is CASH).
+
+ external_details : typing.Optional[ExternalPaymentDetailsParams]
+ Additional details required when recording an external payment (`source_id` is EXTERNAL).
+
+ customer_details : typing.Optional[CustomerDetailsParams]
+ Details about the customer making the payment.
+
+ offline_payment_details : typing.Optional[OfflinePaymentDetailsParams]
+ An optional field for specifying the offline payment details. This is intended for
+ internal 1st-party callers only.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreatePaymentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.payments.create(
+ source_id="ccof:GaJGNaZa8x4OgDJn4GB",
+ idempotency_key="7b0f3ec5-086a-4871-8f13-3c81b3875218",
+ amount_money={"amount": 1000, "currency": "USD"},
+ app_fee_money={"amount": 10, "currency": "USD"},
+ autocomplete=True,
+ customer_id="W92WH6P11H4Z77CTET0RNTGFW8",
+ location_id="L88917AVBK2S5",
+ reference_id="123456",
+ note="Brief description",
+ )
+ """
+ _response = self._raw_client.create(
+ source_id=source_id,
+ idempotency_key=idempotency_key,
+ amount_money=amount_money,
+ tip_money=tip_money,
+ app_fee_money=app_fee_money,
+ app_fee_allocations=app_fee_allocations,
+ delay_duration=delay_duration,
+ delay_action=delay_action,
+ autocomplete=autocomplete,
+ order_id=order_id,
+ customer_id=customer_id,
+ location_id=location_id,
+ team_member_id=team_member_id,
+ reference_id=reference_id,
+ verification_token=verification_token,
+ accept_partial_authorization=accept_partial_authorization,
+ buyer_email_address=buyer_email_address,
+ buyer_phone_number=buyer_phone_number,
+ billing_address=billing_address,
+ shipping_address=shipping_address,
+ note=note,
+ statement_description_identifier=statement_description_identifier,
+ cash_details=cash_details,
+ external_details=external_details,
+ customer_details=customer_details,
+ offline_payment_details=offline_payment_details,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def cancel_by_idempotency_key(
+ self, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelPaymentByIdempotencyKeyResponse:
+ """
+ Cancels (voids) a payment identified by the idempotency key that is specified in the
+ request.
+
+ Use this method when the status of a `CreatePayment` request is unknown (for example, after you send a
+ `CreatePayment` request, a network error occurs and you do not get a response). In this case, you can
+ direct Square to cancel the payment using this endpoint. In the request, you provide the same
+ idempotency key that you provided in your `CreatePayment` request that you want to cancel. After
+ canceling the payment, you can submit your `CreatePayment` request again.
+
+ Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint
+ returns successfully.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ The `idempotency_key` identifying the payment to be canceled.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelPaymentByIdempotencyKeyResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.payments.cancel_by_idempotency_key(
+ idempotency_key="a7e36d40-d24b-11e8-b568-0800200c9a66",
+ )
+ """
+ _response = self._raw_client.cancel_by_idempotency_key(
+ idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def get(self, payment_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetPaymentResponse:
+ """
+ Retrieves details for a specific payment.
+
+ Parameters
+ ----------
+ payment_id : str
+ A unique ID for the desired payment.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetPaymentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.payments.get(
+ payment_id="payment_id",
+ )
+ """
+ _response = self._raw_client.get(payment_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ payment_id: str,
+ *,
+ idempotency_key: str,
+ payment: typing.Optional[PaymentParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdatePaymentResponse:
+ """
+ Updates a payment with the APPROVED status.
+ You can update the `amount_money` and `tip_money` using this endpoint.
+
+ Parameters
+ ----------
+ payment_id : str
+ The ID of the payment to update.
+
+ idempotency_key : str
+ A unique string that identifies this `UpdatePayment` request. Keys can be any valid string
+ but must be unique for every `UpdatePayment` request.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ payment : typing.Optional[PaymentParams]
+ The updated `Payment` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdatePaymentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.payments.update(
+ payment_id="payment_id",
+ payment={
+ "amount_money": {"amount": 1000, "currency": "USD"},
+ "tip_money": {"amount": 100, "currency": "USD"},
+ "version_token": "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o",
+ },
+ idempotency_key="956f8b13-e4ec-45d6-85e8-d1d95ef0c5de",
+ )
+ """
+ _response = self._raw_client.update(
+ payment_id, idempotency_key=idempotency_key, payment=payment, request_options=request_options
+ )
+ return _response.data
+
+ def cancel(
+ self, payment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelPaymentResponse:
+ """
+ Cancels (voids) a payment. You can use this endpoint to cancel a payment with
+ the APPROVED `status`.
+
+ Parameters
+ ----------
+ payment_id : str
+ The ID of the payment to cancel.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelPaymentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.payments.cancel(
+ payment_id="payment_id",
+ )
+ """
+ _response = self._raw_client.cancel(payment_id, request_options=request_options)
+ return _response.data
+
+ def complete(
+ self,
+ payment_id: str,
+ *,
+ version_token: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CompletePaymentResponse:
+ """
+ Completes (captures) a payment.
+ By default, payments are set to complete immediately after they are created.
+
+ You can use this endpoint to complete a payment with the APPROVED `status`.
+
+ Parameters
+ ----------
+ payment_id : str
+ The unique ID identifying the payment to be completed.
+
+ version_token : typing.Optional[str]
+ Used for optimistic concurrency. This opaque token identifies the current `Payment`
+ version that the caller expects. If the server has a different version of the Payment,
+ the update fails and a response with a VERSION_MISMATCH error is returned.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CompletePaymentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.payments.complete(
+ payment_id="payment_id",
+ )
+ """
+ _response = self._raw_client.complete(payment_id, version_token=version_token, request_options=request_options)
+ return _response.data
+
+
+class AsyncPaymentsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawPaymentsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawPaymentsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawPaymentsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ total: typing.Optional[int] = None,
+ last4: typing.Optional[str] = None,
+ card_brand: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ is_offline_payment: typing.Optional[bool] = None,
+ offline_begin_time: typing.Optional[str] = None,
+ offline_end_time: typing.Optional[str] = None,
+ updated_at_begin_time: typing.Optional[str] = None,
+ updated_at_end_time: typing.Optional[str] = None,
+ sort_field: typing.Optional[ListPaymentsRequestSortField] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Payment, ListPaymentsResponse]:
+ """
+ Retrieves a list of payments taken by the account making the request.
+
+ Results are eventually consistent, and new payments or changes to payments might take several
+ seconds to appear.
+
+ The maximum results per page is 100.
+
+ Parameters
+ ----------
+ begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve payments for, in RFC 3339 format.
+ The range is determined using the `created_at` field for each Payment.
+ Inclusive. Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `created_at` field for each Payment.
+
+ Default: The current time.
+
+ sort_order : typing.Optional[str]
+ The order in which results are listed by `ListPaymentsRequest.sort_field`:
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ location_id : typing.Optional[str]
+ Limit results to the location supplied. By default, results are returned
+ for the default (main) location associated with the seller.
+
+ total : typing.Optional[int]
+ The exact amount in the `total_money` for a payment.
+
+ last4 : typing.Optional[str]
+ The last four digits of a payment card.
+
+ card_brand : typing.Optional[str]
+ The brand of the payment card (for example, VISA).
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+
+ Default: `100`
+
+ is_offline_payment : typing.Optional[bool]
+ Whether the payment was taken offline or not.
+
+ offline_begin_time : typing.Optional[str]
+ Indicates the start of the time range for which to retrieve offline payments, in RFC 3339
+ format for timestamps. The range is determined using the
+ `offline_payment_details.client_created_at` field for each Payment. If set, payments without a
+ value set in `offline_payment_details.client_created_at` will not be returned.
+
+ Default: The current time.
+
+ offline_end_time : typing.Optional[str]
+ Indicates the end of the time range for which to retrieve offline payments, in RFC 3339
+ format for timestamps. The range is determined using the
+ `offline_payment_details.client_created_at` field for each Payment. If set, payments without a
+ value set in `offline_payment_details.client_created_at` will not be returned.
+
+ Default: The current time.
+
+ updated_at_begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `updated_at` field for each Payment.
+
+ updated_at_end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `updated_at` field for each Payment.
+
+ sort_field : typing.Optional[ListPaymentsRequestSortField]
+ The field used to sort results by. The default is `CREATED_AT`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Payment, ListPaymentsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.payments.list(
+ begin_time="begin_time",
+ end_time="end_time",
+ sort_order="sort_order",
+ cursor="cursor",
+ location_id="location_id",
+ total=1000000,
+ last4="last_4",
+ card_brand="card_brand",
+ limit=1,
+ is_offline_payment=True,
+ offline_begin_time="offline_begin_time",
+ offline_end_time="offline_end_time",
+ updated_at_begin_time="updated_at_begin_time",
+ updated_at_end_time="updated_at_end_time",
+ sort_field="CREATED_AT",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=cursor,
+ location_id=location_id,
+ total=total,
+ last4=last4,
+ card_brand=card_brand,
+ limit=limit,
+ is_offline_payment=is_offline_payment,
+ offline_begin_time=offline_begin_time,
+ offline_end_time=offline_end_time,
+ updated_at_begin_time=updated_at_begin_time,
+ updated_at_end_time=updated_at_end_time,
+ sort_field=sort_field,
+ request_options=request_options,
+ )
+
+ async def create(
+ self,
+ *,
+ source_id: str,
+ idempotency_key: str,
+ amount_money: typing.Optional[MoneyParams] = OMIT,
+ tip_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_allocations: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
+ delay_duration: typing.Optional[str] = OMIT,
+ delay_action: typing.Optional[str] = OMIT,
+ autocomplete: typing.Optional[bool] = OMIT,
+ order_id: typing.Optional[str] = OMIT,
+ customer_id: typing.Optional[str] = OMIT,
+ location_id: typing.Optional[str] = OMIT,
+ team_member_id: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ verification_token: typing.Optional[str] = OMIT,
+ accept_partial_authorization: typing.Optional[bool] = OMIT,
+ buyer_email_address: typing.Optional[str] = OMIT,
+ buyer_phone_number: typing.Optional[str] = OMIT,
+ billing_address: typing.Optional[AddressParams] = OMIT,
+ shipping_address: typing.Optional[AddressParams] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ statement_description_identifier: typing.Optional[str] = OMIT,
+ cash_details: typing.Optional[CashPaymentDetailsParams] = OMIT,
+ external_details: typing.Optional[ExternalPaymentDetailsParams] = OMIT,
+ customer_details: typing.Optional[CustomerDetailsParams] = OMIT,
+ offline_payment_details: typing.Optional[OfflinePaymentDetailsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreatePaymentResponse:
+ """
+ Creates a payment using the provided source. You can use this endpoint
+ to charge a card (credit/debit card or
+ Square gift card) or record a payment that the seller received outside of Square
+ (cash payment from a buyer or a payment that an external entity
+ processed on behalf of the seller).
+
+ The endpoint creates a
+ `Payment` object and returns it in the response.
+
+ Parameters
+ ----------
+ source_id : str
+ The ID for the source of funds for this payment.
+ This could be a payment token generated by the Web Payments SDK for any of its
+ [supported methods](https://developer.squareup.com/docs/web-payments/overview#explore-payment-methods),
+ including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment
+ that the seller received outside of Square, specify either "CASH" or "EXTERNAL".
+ For more information, see
+ [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
+
+ idempotency_key : str
+ A unique string that identifies this `CreatePayment` request. Keys can be any valid string
+ but must be unique for every `CreatePayment` request.
+
+ Note: The number of allowed characters might be less than the stated maximum, if multi-byte
+ characters are used.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ amount_money : typing.Optional[MoneyParams]
+ The amount of money to accept for this payment, not including `tip_money`.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The currency code must match the currency associated with the business
+ that is accepting the payment.
+
+ tip_money : typing.Optional[MoneyParams]
+ The amount designated as a tip, in addition to `amount_money`.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.
+
+ The currency code must match the currency associated with the business
+ that is accepting the payment.
+
+ app_fee_money : typing.Optional[MoneyParams]
+ The amount of money that the developer is taking as a fee
+ for facilitating the payment on behalf of the seller.
+
+ The amount cannot be more than 90% of the total amount of the payment.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The fee currency code must match the currency associated with the seller
+ that is accepting the payment. The application must be from a developer
+ account in the same country and using the same currency code as the seller.
+
+ For more information about the application fee scenario, see
+ [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
+ For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+
+ app_fee_allocations : typing.Optional[typing.Sequence[typing.Any]]
+ Details pertaining to recipients of the application fee. The sum of the amounts in the
+ app_fee_allocations must equal the app_fee_money amount, if present. If populated, an
+ allocation must be present for every party that expects to receive a portion of the application
+ fee, including the application developer.
+
+ delay_duration : typing.Optional[str]
+ The duration of time after the payment's creation when Square automatically
+ either completes or cancels the payment depending on the `delay_action` field value.
+ For more information, see
+ [Time threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ This parameter should be specified as a time duration, in RFC 3339 format.
+
+ Note: This feature is only supported for card payments. This parameter can only be set for a delayed
+ capture payment (`autocomplete=false`).
+
+ Default:
+
+ - Card-present payments: "PT36H" (36 hours) from the creation time.
+ - Card-not-present payments: "P7D" (7 days) from the creation time.
+
+ delay_action : typing.Optional[str]
+ The action to be applied to the payment when the `delay_duration` has elapsed. The action must be
+ CANCEL or COMPLETE. For more information, see
+ [Time Threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ Default: CANCEL
+
+ autocomplete : typing.Optional[bool]
+ If set to `true`, this payment will be completed when possible. If
+ set to `false`, this payment is held in an approved state until either
+ explicitly completed (captured) or canceled (voided). For more information, see
+ [Delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment).
+
+ Default: true
+
+ order_id : typing.Optional[str]
+ Associates a previously created order with this payment.
+
+ customer_id : typing.Optional[str]
+ The [Customer](entity:Customer) ID of the customer associated with the payment.
+
+ This is required if the `source_id` refers to a card on file created using the Cards API.
+
+ location_id : typing.Optional[str]
+ The location ID to associate with the payment. If not specified, the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location) is
+ used.
+
+ team_member_id : typing.Optional[str]
+ An optional [TeamMember](entity:TeamMember) ID to associate with
+ this payment.
+
+ reference_id : typing.Optional[str]
+ A user-defined ID to associate with the payment.
+
+ You can use this field to associate the payment to an entity in an external system
+ (for example, you might specify an order ID that is generated by a third-party shopping cart).
+
+ verification_token : typing.Optional[str]
+ An identifying token generated by [payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
+ Verification tokens encapsulate customer device information and 3-D Secure
+ challenge results to indicate that Square has verified the buyer identity.
+
+ For more information, see [SCA Overview](https://developer.squareup.com/docs/sca-overview).
+
+ accept_partial_authorization : typing.Optional[bool]
+ If set to `true` and charging a Square Gift Card, a payment might be returned with
+ `amount_money` equal to less than what was requested. For example, a request for $20 when charging
+ a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose
+ to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card
+ payment. This field cannot be `true` when `autocomplete = true`.
+
+ For more information, see
+ [Partial amount with Square Gift Cards](https://developer.squareup.com/docs/payments-api/take-payments#partial-payment-gift-card).
+
+ Default: false
+
+ buyer_email_address : typing.Optional[str]
+ The buyer's email address.
+
+ buyer_phone_number : typing.Optional[str]
+ The buyer's phone number.
+ Must follow the following format:
+ 1. A leading + symbol (followed by a country code)
+ 2. The phone number can contain spaces and the special characters `(` , `)` , `-` , and `.`.
+ Alphabetical characters aren't allowed.
+ 3. The phone number must contain between 9 and 16 digits.
+
+ billing_address : typing.Optional[AddressParams]
+ The buyer's billing address.
+
+ shipping_address : typing.Optional[AddressParams]
+ The buyer's shipping address.
+
+ note : typing.Optional[str]
+ An optional note to be entered by the developer when creating a payment.
+
+ statement_description_identifier : typing.Optional[str]
+ Optional additional payment information to include on the customer's card statement
+ as part of the statement description. This can be, for example, an invoice number, ticket number,
+ or short description that uniquely identifies the purchase.
+
+ Note that the `statement_description_identifier` might get truncated on the statement description
+ to fit the required information including the Square identifier (SQ *) and name of the
+ seller taking the payment.
+
+ cash_details : typing.Optional[CashPaymentDetailsParams]
+ Additional details required when recording a cash payment (`source_id` is CASH).
+
+ external_details : typing.Optional[ExternalPaymentDetailsParams]
+ Additional details required when recording an external payment (`source_id` is EXTERNAL).
+
+ customer_details : typing.Optional[CustomerDetailsParams]
+ Details about the customer making the payment.
+
+ offline_payment_details : typing.Optional[OfflinePaymentDetailsParams]
+ An optional field for specifying the offline payment details. This is intended for
+ internal 1st-party callers only.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreatePaymentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.payments.create(
+ source_id="ccof:GaJGNaZa8x4OgDJn4GB",
+ idempotency_key="7b0f3ec5-086a-4871-8f13-3c81b3875218",
+ amount_money={"amount": 1000, "currency": "USD"},
+ app_fee_money={"amount": 10, "currency": "USD"},
+ autocomplete=True,
+ customer_id="W92WH6P11H4Z77CTET0RNTGFW8",
+ location_id="L88917AVBK2S5",
+ reference_id="123456",
+ note="Brief description",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ source_id=source_id,
+ idempotency_key=idempotency_key,
+ amount_money=amount_money,
+ tip_money=tip_money,
+ app_fee_money=app_fee_money,
+ app_fee_allocations=app_fee_allocations,
+ delay_duration=delay_duration,
+ delay_action=delay_action,
+ autocomplete=autocomplete,
+ order_id=order_id,
+ customer_id=customer_id,
+ location_id=location_id,
+ team_member_id=team_member_id,
+ reference_id=reference_id,
+ verification_token=verification_token,
+ accept_partial_authorization=accept_partial_authorization,
+ buyer_email_address=buyer_email_address,
+ buyer_phone_number=buyer_phone_number,
+ billing_address=billing_address,
+ shipping_address=shipping_address,
+ note=note,
+ statement_description_identifier=statement_description_identifier,
+ cash_details=cash_details,
+ external_details=external_details,
+ customer_details=customer_details,
+ offline_payment_details=offline_payment_details,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def cancel_by_idempotency_key(
+ self, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelPaymentByIdempotencyKeyResponse:
+ """
+ Cancels (voids) a payment identified by the idempotency key that is specified in the
+ request.
+
+ Use this method when the status of a `CreatePayment` request is unknown (for example, after you send a
+ `CreatePayment` request, a network error occurs and you do not get a response). In this case, you can
+ direct Square to cancel the payment using this endpoint. In the request, you provide the same
+ idempotency key that you provided in your `CreatePayment` request that you want to cancel. After
+ canceling the payment, you can submit your `CreatePayment` request again.
+
+ Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint
+ returns successfully.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ The `idempotency_key` identifying the payment to be canceled.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelPaymentByIdempotencyKeyResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.payments.cancel_by_idempotency_key(
+ idempotency_key="a7e36d40-d24b-11e8-b568-0800200c9a66",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.cancel_by_idempotency_key(
+ idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, payment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetPaymentResponse:
+ """
+ Retrieves details for a specific payment.
+
+ Parameters
+ ----------
+ payment_id : str
+ A unique ID for the desired payment.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetPaymentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.payments.get(
+ payment_id="payment_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(payment_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ payment_id: str,
+ *,
+ idempotency_key: str,
+ payment: typing.Optional[PaymentParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdatePaymentResponse:
+ """
+ Updates a payment with the APPROVED status.
+ You can update the `amount_money` and `tip_money` using this endpoint.
+
+ Parameters
+ ----------
+ payment_id : str
+ The ID of the payment to update.
+
+ idempotency_key : str
+ A unique string that identifies this `UpdatePayment` request. Keys can be any valid string
+ but must be unique for every `UpdatePayment` request.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ payment : typing.Optional[PaymentParams]
+ The updated `Payment` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdatePaymentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.payments.update(
+ payment_id="payment_id",
+ payment={
+ "amount_money": {"amount": 1000, "currency": "USD"},
+ "tip_money": {"amount": 100, "currency": "USD"},
+ "version_token": "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o",
+ },
+ idempotency_key="956f8b13-e4ec-45d6-85e8-d1d95ef0c5de",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ payment_id, idempotency_key=idempotency_key, payment=payment, request_options=request_options
+ )
+ return _response.data
+
+ async def cancel(
+ self, payment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelPaymentResponse:
+ """
+ Cancels (voids) a payment. You can use this endpoint to cancel a payment with
+ the APPROVED `status`.
+
+ Parameters
+ ----------
+ payment_id : str
+ The ID of the payment to cancel.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelPaymentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.payments.cancel(
+ payment_id="payment_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.cancel(payment_id, request_options=request_options)
+ return _response.data
+
+ async def complete(
+ self,
+ payment_id: str,
+ *,
+ version_token: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CompletePaymentResponse:
+ """
+ Completes (captures) a payment.
+ By default, payments are set to complete immediately after they are created.
+
+ You can use this endpoint to complete a payment with the APPROVED `status`.
+
+ Parameters
+ ----------
+ payment_id : str
+ The unique ID identifying the payment to be completed.
+
+ version_token : typing.Optional[str]
+ Used for optimistic concurrency. This opaque token identifies the current `Payment`
+ version that the caller expects. If the server has a different version of the Payment,
+ the update fails and a response with a VERSION_MISMATCH error is returned.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CompletePaymentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.payments.complete(
+ payment_id="payment_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.complete(
+ payment_id, version_token=version_token, request_options=request_options
+ )
+ return _response.data
diff --git a/src/square/payments/raw_client.py b/src/square/payments/raw_client.py
new file mode 100644
index 00000000..ef7add6d
--- /dev/null
+++ b/src/square/payments/raw_client.py
@@ -0,0 +1,1501 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.address import AddressParams
+from ..requests.cash_payment_details import CashPaymentDetailsParams
+from ..requests.customer_details import CustomerDetailsParams
+from ..requests.external_payment_details import ExternalPaymentDetailsParams
+from ..requests.money import MoneyParams
+from ..requests.offline_payment_details import OfflinePaymentDetailsParams
+from ..requests.payment import PaymentParams
+from ..types.cancel_payment_by_idempotency_key_response import CancelPaymentByIdempotencyKeyResponse
+from ..types.cancel_payment_response import CancelPaymentResponse
+from ..types.complete_payment_response import CompletePaymentResponse
+from ..types.create_payment_response import CreatePaymentResponse
+from ..types.get_payment_response import GetPaymentResponse
+from ..types.list_payments_request_sort_field import ListPaymentsRequestSortField
+from ..types.list_payments_response import ListPaymentsResponse
+from ..types.payment import Payment
+from ..types.update_payment_response import UpdatePaymentResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawPaymentsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ total: typing.Optional[int] = None,
+ last4: typing.Optional[str] = None,
+ card_brand: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ is_offline_payment: typing.Optional[bool] = None,
+ offline_begin_time: typing.Optional[str] = None,
+ offline_end_time: typing.Optional[str] = None,
+ updated_at_begin_time: typing.Optional[str] = None,
+ updated_at_end_time: typing.Optional[str] = None,
+ sort_field: typing.Optional[ListPaymentsRequestSortField] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Payment, ListPaymentsResponse]:
+ """
+ Retrieves a list of payments taken by the account making the request.
+
+ Results are eventually consistent, and new payments or changes to payments might take several
+ seconds to appear.
+
+ The maximum results per page is 100.
+
+ Parameters
+ ----------
+ begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve payments for, in RFC 3339 format.
+ The range is determined using the `created_at` field for each Payment.
+ Inclusive. Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `created_at` field for each Payment.
+
+ Default: The current time.
+
+ sort_order : typing.Optional[str]
+ The order in which results are listed by `ListPaymentsRequest.sort_field`:
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ location_id : typing.Optional[str]
+ Limit results to the location supplied. By default, results are returned
+ for the default (main) location associated with the seller.
+
+ total : typing.Optional[int]
+ The exact amount in the `total_money` for a payment.
+
+ last4 : typing.Optional[str]
+ The last four digits of a payment card.
+
+ card_brand : typing.Optional[str]
+ The brand of the payment card (for example, VISA).
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+
+ Default: `100`
+
+ is_offline_payment : typing.Optional[bool]
+ Whether the payment was taken offline or not.
+
+ offline_begin_time : typing.Optional[str]
+ Indicates the start of the time range for which to retrieve offline payments, in RFC 3339
+ format for timestamps. The range is determined using the
+ `offline_payment_details.client_created_at` field for each Payment. If set, payments without a
+ value set in `offline_payment_details.client_created_at` will not be returned.
+
+ Default: The current time.
+
+ offline_end_time : typing.Optional[str]
+ Indicates the end of the time range for which to retrieve offline payments, in RFC 3339
+ format for timestamps. The range is determined using the
+ `offline_payment_details.client_created_at` field for each Payment. If set, payments without a
+ value set in `offline_payment_details.client_created_at` will not be returned.
+
+ Default: The current time.
+
+ updated_at_begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `updated_at` field for each Payment.
+
+ updated_at_end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `updated_at` field for each Payment.
+
+ sort_field : typing.Optional[ListPaymentsRequestSortField]
+ The field used to sort results by. The default is `CREATED_AT`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Payment, ListPaymentsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/payments",
+ method="GET",
+ params={
+ "begin_time": begin_time,
+ "end_time": end_time,
+ "sort_order": sort_order,
+ "cursor": cursor,
+ "location_id": location_id,
+ "total": total,
+ "last_4": last4,
+ "card_brand": card_brand,
+ "limit": limit,
+ "is_offline_payment": is_offline_payment,
+ "offline_begin_time": offline_begin_time,
+ "offline_end_time": offline_end_time,
+ "updated_at_begin_time": updated_at_begin_time,
+ "updated_at_end_time": updated_at_end_time,
+ "sort_field": sort_field,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListPaymentsResponse,
+ construct_type(
+ type_=ListPaymentsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.payments
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=_parsed_next,
+ location_id=location_id,
+ total=total,
+ last4=last4,
+ card_brand=card_brand,
+ limit=limit,
+ is_offline_payment=is_offline_payment,
+ offline_begin_time=offline_begin_time,
+ offline_end_time=offline_end_time,
+ updated_at_begin_time=updated_at_begin_time,
+ updated_at_end_time=updated_at_end_time,
+ sort_field=sort_field,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ source_id: str,
+ idempotency_key: str,
+ amount_money: typing.Optional[MoneyParams] = OMIT,
+ tip_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_allocations: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
+ delay_duration: typing.Optional[str] = OMIT,
+ delay_action: typing.Optional[str] = OMIT,
+ autocomplete: typing.Optional[bool] = OMIT,
+ order_id: typing.Optional[str] = OMIT,
+ customer_id: typing.Optional[str] = OMIT,
+ location_id: typing.Optional[str] = OMIT,
+ team_member_id: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ verification_token: typing.Optional[str] = OMIT,
+ accept_partial_authorization: typing.Optional[bool] = OMIT,
+ buyer_email_address: typing.Optional[str] = OMIT,
+ buyer_phone_number: typing.Optional[str] = OMIT,
+ billing_address: typing.Optional[AddressParams] = OMIT,
+ shipping_address: typing.Optional[AddressParams] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ statement_description_identifier: typing.Optional[str] = OMIT,
+ cash_details: typing.Optional[CashPaymentDetailsParams] = OMIT,
+ external_details: typing.Optional[ExternalPaymentDetailsParams] = OMIT,
+ customer_details: typing.Optional[CustomerDetailsParams] = OMIT,
+ offline_payment_details: typing.Optional[OfflinePaymentDetailsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreatePaymentResponse]:
+ """
+ Creates a payment using the provided source. You can use this endpoint
+ to charge a card (credit/debit card or
+ Square gift card) or record a payment that the seller received outside of Square
+ (cash payment from a buyer or a payment that an external entity
+ processed on behalf of the seller).
+
+ The endpoint creates a
+ `Payment` object and returns it in the response.
+
+ Parameters
+ ----------
+ source_id : str
+ The ID for the source of funds for this payment.
+ This could be a payment token generated by the Web Payments SDK for any of its
+ [supported methods](https://developer.squareup.com/docs/web-payments/overview#explore-payment-methods),
+ including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment
+ that the seller received outside of Square, specify either "CASH" or "EXTERNAL".
+ For more information, see
+ [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
+
+ idempotency_key : str
+ A unique string that identifies this `CreatePayment` request. Keys can be any valid string
+ but must be unique for every `CreatePayment` request.
+
+ Note: The number of allowed characters might be less than the stated maximum, if multi-byte
+ characters are used.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ amount_money : typing.Optional[MoneyParams]
+ The amount of money to accept for this payment, not including `tip_money`.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The currency code must match the currency associated with the business
+ that is accepting the payment.
+
+ tip_money : typing.Optional[MoneyParams]
+ The amount designated as a tip, in addition to `amount_money`.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.
+
+ The currency code must match the currency associated with the business
+ that is accepting the payment.
+
+ app_fee_money : typing.Optional[MoneyParams]
+ The amount of money that the developer is taking as a fee
+ for facilitating the payment on behalf of the seller.
+
+ The amount cannot be more than 90% of the total amount of the payment.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The fee currency code must match the currency associated with the seller
+ that is accepting the payment. The application must be from a developer
+ account in the same country and using the same currency code as the seller.
+
+ For more information about the application fee scenario, see
+ [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
+ For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+
+ app_fee_allocations : typing.Optional[typing.Sequence[typing.Any]]
+ Details pertaining to recipients of the application fee. The sum of the amounts in the
+ app_fee_allocations must equal the app_fee_money amount, if present. If populated, an
+ allocation must be present for every party that expects to receive a portion of the application
+ fee, including the application developer.
+
+ delay_duration : typing.Optional[str]
+ The duration of time after the payment's creation when Square automatically
+ either completes or cancels the payment depending on the `delay_action` field value.
+ For more information, see
+ [Time threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ This parameter should be specified as a time duration, in RFC 3339 format.
+
+ Note: This feature is only supported for card payments. This parameter can only be set for a delayed
+ capture payment (`autocomplete=false`).
+
+ Default:
+
+ - Card-present payments: "PT36H" (36 hours) from the creation time.
+ - Card-not-present payments: "P7D" (7 days) from the creation time.
+
+ delay_action : typing.Optional[str]
+ The action to be applied to the payment when the `delay_duration` has elapsed. The action must be
+ CANCEL or COMPLETE. For more information, see
+ [Time Threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ Default: CANCEL
+
+ autocomplete : typing.Optional[bool]
+ If set to `true`, this payment will be completed when possible. If
+ set to `false`, this payment is held in an approved state until either
+ explicitly completed (captured) or canceled (voided). For more information, see
+ [Delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment).
+
+ Default: true
+
+ order_id : typing.Optional[str]
+ Associates a previously created order with this payment.
+
+ customer_id : typing.Optional[str]
+ The [Customer](entity:Customer) ID of the customer associated with the payment.
+
+ This is required if the `source_id` refers to a card on file created using the Cards API.
+
+ location_id : typing.Optional[str]
+ The location ID to associate with the payment. If not specified, the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location) is
+ used.
+
+ team_member_id : typing.Optional[str]
+ An optional [TeamMember](entity:TeamMember) ID to associate with
+ this payment.
+
+ reference_id : typing.Optional[str]
+ A user-defined ID to associate with the payment.
+
+ You can use this field to associate the payment to an entity in an external system
+ (for example, you might specify an order ID that is generated by a third-party shopping cart).
+
+ verification_token : typing.Optional[str]
+ An identifying token generated by [payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
+ Verification tokens encapsulate customer device information and 3-D Secure
+ challenge results to indicate that Square has verified the buyer identity.
+
+ For more information, see [SCA Overview](https://developer.squareup.com/docs/sca-overview).
+
+ accept_partial_authorization : typing.Optional[bool]
+ If set to `true` and charging a Square Gift Card, a payment might be returned with
+ `amount_money` equal to less than what was requested. For example, a request for $20 when charging
+ a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose
+ to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card
+ payment. This field cannot be `true` when `autocomplete = true`.
+
+ For more information, see
+ [Partial amount with Square Gift Cards](https://developer.squareup.com/docs/payments-api/take-payments#partial-payment-gift-card).
+
+ Default: false
+
+ buyer_email_address : typing.Optional[str]
+ The buyer's email address.
+
+ buyer_phone_number : typing.Optional[str]
+ The buyer's phone number.
+ Must follow the following format:
+ 1. A leading + symbol (followed by a country code)
+ 2. The phone number can contain spaces and the special characters `(` , `)` , `-` , and `.`.
+ Alphabetical characters aren't allowed.
+ 3. The phone number must contain between 9 and 16 digits.
+
+ billing_address : typing.Optional[AddressParams]
+ The buyer's billing address.
+
+ shipping_address : typing.Optional[AddressParams]
+ The buyer's shipping address.
+
+ note : typing.Optional[str]
+ An optional note to be entered by the developer when creating a payment.
+
+ statement_description_identifier : typing.Optional[str]
+ Optional additional payment information to include on the customer's card statement
+ as part of the statement description. This can be, for example, an invoice number, ticket number,
+ or short description that uniquely identifies the purchase.
+
+ Note that the `statement_description_identifier` might get truncated on the statement description
+ to fit the required information including the Square identifier (SQ *) and name of the
+ seller taking the payment.
+
+ cash_details : typing.Optional[CashPaymentDetailsParams]
+ Additional details required when recording a cash payment (`source_id` is CASH).
+
+ external_details : typing.Optional[ExternalPaymentDetailsParams]
+ Additional details required when recording an external payment (`source_id` is EXTERNAL).
+
+ customer_details : typing.Optional[CustomerDetailsParams]
+ Details about the customer making the payment.
+
+ offline_payment_details : typing.Optional[OfflinePaymentDetailsParams]
+ An optional field for specifying the offline payment details. This is intended for
+ internal 1st-party callers only.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreatePaymentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/payments",
+ method="POST",
+ json={
+ "source_id": source_id,
+ "idempotency_key": idempotency_key,
+ "amount_money": convert_and_respect_annotation_metadata(
+ object_=amount_money, annotation=MoneyParams, direction="write"
+ ),
+ "tip_money": convert_and_respect_annotation_metadata(
+ object_=tip_money, annotation=MoneyParams, direction="write"
+ ),
+ "app_fee_money": convert_and_respect_annotation_metadata(
+ object_=app_fee_money, annotation=MoneyParams, direction="write"
+ ),
+ "app_fee_allocations": app_fee_allocations,
+ "delay_duration": delay_duration,
+ "delay_action": delay_action,
+ "autocomplete": autocomplete,
+ "order_id": order_id,
+ "customer_id": customer_id,
+ "location_id": location_id,
+ "team_member_id": team_member_id,
+ "reference_id": reference_id,
+ "verification_token": verification_token,
+ "accept_partial_authorization": accept_partial_authorization,
+ "buyer_email_address": buyer_email_address,
+ "buyer_phone_number": buyer_phone_number,
+ "billing_address": convert_and_respect_annotation_metadata(
+ object_=billing_address, annotation=AddressParams, direction="write"
+ ),
+ "shipping_address": convert_and_respect_annotation_metadata(
+ object_=shipping_address, annotation=AddressParams, direction="write"
+ ),
+ "note": note,
+ "statement_description_identifier": statement_description_identifier,
+ "cash_details": convert_and_respect_annotation_metadata(
+ object_=cash_details, annotation=CashPaymentDetailsParams, direction="write"
+ ),
+ "external_details": convert_and_respect_annotation_metadata(
+ object_=external_details, annotation=ExternalPaymentDetailsParams, direction="write"
+ ),
+ "customer_details": convert_and_respect_annotation_metadata(
+ object_=customer_details, annotation=CustomerDetailsParams, direction="write"
+ ),
+ "offline_payment_details": convert_and_respect_annotation_metadata(
+ object_=offline_payment_details, annotation=OfflinePaymentDetailsParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreatePaymentResponse,
+ construct_type(
+ type_=CreatePaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def cancel_by_idempotency_key(
+ self, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[CancelPaymentByIdempotencyKeyResponse]:
+ """
+ Cancels (voids) a payment identified by the idempotency key that is specified in the
+ request.
+
+ Use this method when the status of a `CreatePayment` request is unknown (for example, after you send a
+ `CreatePayment` request, a network error occurs and you do not get a response). In this case, you can
+ direct Square to cancel the payment using this endpoint. In the request, you provide the same
+ idempotency key that you provided in your `CreatePayment` request that you want to cancel. After
+ canceling the payment, you can submit your `CreatePayment` request again.
+
+ Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint
+ returns successfully.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ The `idempotency_key` identifying the payment to be canceled.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CancelPaymentByIdempotencyKeyResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/payments/cancel",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelPaymentByIdempotencyKeyResponse,
+ construct_type(
+ type_=CancelPaymentByIdempotencyKeyResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, payment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetPaymentResponse]:
+ """
+ Retrieves details for a specific payment.
+
+ Parameters
+ ----------
+ payment_id : str
+ A unique ID for the desired payment.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetPaymentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/payments/{jsonable_encoder(payment_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetPaymentResponse,
+ construct_type(
+ type_=GetPaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ payment_id: str,
+ *,
+ idempotency_key: str,
+ payment: typing.Optional[PaymentParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdatePaymentResponse]:
+ """
+ Updates a payment with the APPROVED status.
+ You can update the `amount_money` and `tip_money` using this endpoint.
+
+ Parameters
+ ----------
+ payment_id : str
+ The ID of the payment to update.
+
+ idempotency_key : str
+ A unique string that identifies this `UpdatePayment` request. Keys can be any valid string
+ but must be unique for every `UpdatePayment` request.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ payment : typing.Optional[PaymentParams]
+ The updated `Payment` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdatePaymentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/payments/{jsonable_encoder(payment_id)}",
+ method="PUT",
+ json={
+ "payment": convert_and_respect_annotation_metadata(
+ object_=payment, annotation=PaymentParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdatePaymentResponse,
+ construct_type(
+ type_=UpdatePaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def cancel(
+ self, payment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[CancelPaymentResponse]:
+ """
+ Cancels (voids) a payment. You can use this endpoint to cancel a payment with
+ the APPROVED `status`.
+
+ Parameters
+ ----------
+ payment_id : str
+ The ID of the payment to cancel.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CancelPaymentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/payments/{jsonable_encoder(payment_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelPaymentResponse,
+ construct_type(
+ type_=CancelPaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def complete(
+ self,
+ payment_id: str,
+ *,
+ version_token: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CompletePaymentResponse]:
+ """
+ Completes (captures) a payment.
+ By default, payments are set to complete immediately after they are created.
+
+ You can use this endpoint to complete a payment with the APPROVED `status`.
+
+ Parameters
+ ----------
+ payment_id : str
+ The unique ID identifying the payment to be completed.
+
+ version_token : typing.Optional[str]
+ Used for optimistic concurrency. This opaque token identifies the current `Payment`
+ version that the caller expects. If the server has a different version of the Payment,
+ the update fails and a response with a VERSION_MISMATCH error is returned.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CompletePaymentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/payments/{jsonable_encoder(payment_id)}/complete",
+ method="POST",
+ json={
+ "version_token": version_token,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CompletePaymentResponse,
+ construct_type(
+ type_=CompletePaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawPaymentsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ total: typing.Optional[int] = None,
+ last4: typing.Optional[str] = None,
+ card_brand: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ is_offline_payment: typing.Optional[bool] = None,
+ offline_begin_time: typing.Optional[str] = None,
+ offline_end_time: typing.Optional[str] = None,
+ updated_at_begin_time: typing.Optional[str] = None,
+ updated_at_end_time: typing.Optional[str] = None,
+ sort_field: typing.Optional[ListPaymentsRequestSortField] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Payment, ListPaymentsResponse]:
+ """
+ Retrieves a list of payments taken by the account making the request.
+
+ Results are eventually consistent, and new payments or changes to payments might take several
+ seconds to appear.
+
+ The maximum results per page is 100.
+
+ Parameters
+ ----------
+ begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve payments for, in RFC 3339 format.
+ The range is determined using the `created_at` field for each Payment.
+ Inclusive. Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `created_at` field for each Payment.
+
+ Default: The current time.
+
+ sort_order : typing.Optional[str]
+ The order in which results are listed by `ListPaymentsRequest.sort_field`:
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ location_id : typing.Optional[str]
+ Limit results to the location supplied. By default, results are returned
+ for the default (main) location associated with the seller.
+
+ total : typing.Optional[int]
+ The exact amount in the `total_money` for a payment.
+
+ last4 : typing.Optional[str]
+ The last four digits of a payment card.
+
+ card_brand : typing.Optional[str]
+ The brand of the payment card (for example, VISA).
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+
+ Default: `100`
+
+ is_offline_payment : typing.Optional[bool]
+ Whether the payment was taken offline or not.
+
+ offline_begin_time : typing.Optional[str]
+ Indicates the start of the time range for which to retrieve offline payments, in RFC 3339
+ format for timestamps. The range is determined using the
+ `offline_payment_details.client_created_at` field for each Payment. If set, payments without a
+ value set in `offline_payment_details.client_created_at` will not be returned.
+
+ Default: The current time.
+
+ offline_end_time : typing.Optional[str]
+ Indicates the end of the time range for which to retrieve offline payments, in RFC 3339
+ format for timestamps. The range is determined using the
+ `offline_payment_details.client_created_at` field for each Payment. If set, payments without a
+ value set in `offline_payment_details.client_created_at` will not be returned.
+
+ Default: The current time.
+
+ updated_at_begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `updated_at` field for each Payment.
+
+ updated_at_end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
+ range is determined using the `updated_at` field for each Payment.
+
+ sort_field : typing.Optional[ListPaymentsRequestSortField]
+ The field used to sort results by. The default is `CREATED_AT`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Payment, ListPaymentsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/payments",
+ method="GET",
+ params={
+ "begin_time": begin_time,
+ "end_time": end_time,
+ "sort_order": sort_order,
+ "cursor": cursor,
+ "location_id": location_id,
+ "total": total,
+ "last_4": last4,
+ "card_brand": card_brand,
+ "limit": limit,
+ "is_offline_payment": is_offline_payment,
+ "offline_begin_time": offline_begin_time,
+ "offline_end_time": offline_end_time,
+ "updated_at_begin_time": updated_at_begin_time,
+ "updated_at_end_time": updated_at_end_time,
+ "sort_field": sort_field,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListPaymentsResponse,
+ construct_type(
+ type_=ListPaymentsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.payments
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=_parsed_next,
+ location_id=location_id,
+ total=total,
+ last4=last4,
+ card_brand=card_brand,
+ limit=limit,
+ is_offline_payment=is_offline_payment,
+ offline_begin_time=offline_begin_time,
+ offline_end_time=offline_end_time,
+ updated_at_begin_time=updated_at_begin_time,
+ updated_at_end_time=updated_at_end_time,
+ sort_field=sort_field,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ source_id: str,
+ idempotency_key: str,
+ amount_money: typing.Optional[MoneyParams] = OMIT,
+ tip_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_allocations: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
+ delay_duration: typing.Optional[str] = OMIT,
+ delay_action: typing.Optional[str] = OMIT,
+ autocomplete: typing.Optional[bool] = OMIT,
+ order_id: typing.Optional[str] = OMIT,
+ customer_id: typing.Optional[str] = OMIT,
+ location_id: typing.Optional[str] = OMIT,
+ team_member_id: typing.Optional[str] = OMIT,
+ reference_id: typing.Optional[str] = OMIT,
+ verification_token: typing.Optional[str] = OMIT,
+ accept_partial_authorization: typing.Optional[bool] = OMIT,
+ buyer_email_address: typing.Optional[str] = OMIT,
+ buyer_phone_number: typing.Optional[str] = OMIT,
+ billing_address: typing.Optional[AddressParams] = OMIT,
+ shipping_address: typing.Optional[AddressParams] = OMIT,
+ note: typing.Optional[str] = OMIT,
+ statement_description_identifier: typing.Optional[str] = OMIT,
+ cash_details: typing.Optional[CashPaymentDetailsParams] = OMIT,
+ external_details: typing.Optional[ExternalPaymentDetailsParams] = OMIT,
+ customer_details: typing.Optional[CustomerDetailsParams] = OMIT,
+ offline_payment_details: typing.Optional[OfflinePaymentDetailsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreatePaymentResponse]:
+ """
+ Creates a payment using the provided source. You can use this endpoint
+ to charge a card (credit/debit card or
+ Square gift card) or record a payment that the seller received outside of Square
+ (cash payment from a buyer or a payment that an external entity
+ processed on behalf of the seller).
+
+ The endpoint creates a
+ `Payment` object and returns it in the response.
+
+ Parameters
+ ----------
+ source_id : str
+ The ID for the source of funds for this payment.
+ This could be a payment token generated by the Web Payments SDK for any of its
+ [supported methods](https://developer.squareup.com/docs/web-payments/overview#explore-payment-methods),
+ including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment
+ that the seller received outside of Square, specify either "CASH" or "EXTERNAL".
+ For more information, see
+ [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
+
+ idempotency_key : str
+ A unique string that identifies this `CreatePayment` request. Keys can be any valid string
+ but must be unique for every `CreatePayment` request.
+
+ Note: The number of allowed characters might be less than the stated maximum, if multi-byte
+ characters are used.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ amount_money : typing.Optional[MoneyParams]
+ The amount of money to accept for this payment, not including `tip_money`.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The currency code must match the currency associated with the business
+ that is accepting the payment.
+
+ tip_money : typing.Optional[MoneyParams]
+ The amount designated as a tip, in addition to `amount_money`.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.
+
+ The currency code must match the currency associated with the business
+ that is accepting the payment.
+
+ app_fee_money : typing.Optional[MoneyParams]
+ The amount of money that the developer is taking as a fee
+ for facilitating the payment on behalf of the seller.
+
+ The amount cannot be more than 90% of the total amount of the payment.
+
+ The amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The fee currency code must match the currency associated with the seller
+ that is accepting the payment. The application must be from a developer
+ account in the same country and using the same currency code as the seller.
+
+ For more information about the application fee scenario, see
+ [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
+ For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+
+ app_fee_allocations : typing.Optional[typing.Sequence[typing.Any]]
+ Details pertaining to recipients of the application fee. The sum of the amounts in the
+ app_fee_allocations must equal the app_fee_money amount, if present. If populated, an
+ allocation must be present for every party that expects to receive a portion of the application
+ fee, including the application developer.
+
+ delay_duration : typing.Optional[str]
+ The duration of time after the payment's creation when Square automatically
+ either completes or cancels the payment depending on the `delay_action` field value.
+ For more information, see
+ [Time threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ This parameter should be specified as a time duration, in RFC 3339 format.
+
+ Note: This feature is only supported for card payments. This parameter can only be set for a delayed
+ capture payment (`autocomplete=false`).
+
+ Default:
+
+ - Card-present payments: "PT36H" (36 hours) from the creation time.
+ - Card-not-present payments: "P7D" (7 days) from the creation time.
+
+ delay_action : typing.Optional[str]
+ The action to be applied to the payment when the `delay_duration` has elapsed. The action must be
+ CANCEL or COMPLETE. For more information, see
+ [Time Threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ Default: CANCEL
+
+ autocomplete : typing.Optional[bool]
+ If set to `true`, this payment will be completed when possible. If
+ set to `false`, this payment is held in an approved state until either
+ explicitly completed (captured) or canceled (voided). For more information, see
+ [Delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment).
+
+ Default: true
+
+ order_id : typing.Optional[str]
+ Associates a previously created order with this payment.
+
+ customer_id : typing.Optional[str]
+ The [Customer](entity:Customer) ID of the customer associated with the payment.
+
+ This is required if the `source_id` refers to a card on file created using the Cards API.
+
+ location_id : typing.Optional[str]
+ The location ID to associate with the payment. If not specified, the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location) is
+ used.
+
+ team_member_id : typing.Optional[str]
+ An optional [TeamMember](entity:TeamMember) ID to associate with
+ this payment.
+
+ reference_id : typing.Optional[str]
+ A user-defined ID to associate with the payment.
+
+ You can use this field to associate the payment to an entity in an external system
+ (for example, you might specify an order ID that is generated by a third-party shopping cart).
+
+ verification_token : typing.Optional[str]
+ An identifying token generated by [payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
+ Verification tokens encapsulate customer device information and 3-D Secure
+ challenge results to indicate that Square has verified the buyer identity.
+
+ For more information, see [SCA Overview](https://developer.squareup.com/docs/sca-overview).
+
+ accept_partial_authorization : typing.Optional[bool]
+ If set to `true` and charging a Square Gift Card, a payment might be returned with
+ `amount_money` equal to less than what was requested. For example, a request for $20 when charging
+ a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose
+ to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card
+ payment. This field cannot be `true` when `autocomplete = true`.
+
+ For more information, see
+ [Partial amount with Square Gift Cards](https://developer.squareup.com/docs/payments-api/take-payments#partial-payment-gift-card).
+
+ Default: false
+
+ buyer_email_address : typing.Optional[str]
+ The buyer's email address.
+
+ buyer_phone_number : typing.Optional[str]
+ The buyer's phone number.
+ Must follow the following format:
+ 1. A leading + symbol (followed by a country code)
+ 2. The phone number can contain spaces and the special characters `(` , `)` , `-` , and `.`.
+ Alphabetical characters aren't allowed.
+ 3. The phone number must contain between 9 and 16 digits.
+
+ billing_address : typing.Optional[AddressParams]
+ The buyer's billing address.
+
+ shipping_address : typing.Optional[AddressParams]
+ The buyer's shipping address.
+
+ note : typing.Optional[str]
+ An optional note to be entered by the developer when creating a payment.
+
+ statement_description_identifier : typing.Optional[str]
+ Optional additional payment information to include on the customer's card statement
+ as part of the statement description. This can be, for example, an invoice number, ticket number,
+ or short description that uniquely identifies the purchase.
+
+ Note that the `statement_description_identifier` might get truncated on the statement description
+ to fit the required information including the Square identifier (SQ *) and name of the
+ seller taking the payment.
+
+ cash_details : typing.Optional[CashPaymentDetailsParams]
+ Additional details required when recording a cash payment (`source_id` is CASH).
+
+ external_details : typing.Optional[ExternalPaymentDetailsParams]
+ Additional details required when recording an external payment (`source_id` is EXTERNAL).
+
+ customer_details : typing.Optional[CustomerDetailsParams]
+ Details about the customer making the payment.
+
+ offline_payment_details : typing.Optional[OfflinePaymentDetailsParams]
+ An optional field for specifying the offline payment details. This is intended for
+ internal 1st-party callers only.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreatePaymentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/payments",
+ method="POST",
+ json={
+ "source_id": source_id,
+ "idempotency_key": idempotency_key,
+ "amount_money": convert_and_respect_annotation_metadata(
+ object_=amount_money, annotation=MoneyParams, direction="write"
+ ),
+ "tip_money": convert_and_respect_annotation_metadata(
+ object_=tip_money, annotation=MoneyParams, direction="write"
+ ),
+ "app_fee_money": convert_and_respect_annotation_metadata(
+ object_=app_fee_money, annotation=MoneyParams, direction="write"
+ ),
+ "app_fee_allocations": app_fee_allocations,
+ "delay_duration": delay_duration,
+ "delay_action": delay_action,
+ "autocomplete": autocomplete,
+ "order_id": order_id,
+ "customer_id": customer_id,
+ "location_id": location_id,
+ "team_member_id": team_member_id,
+ "reference_id": reference_id,
+ "verification_token": verification_token,
+ "accept_partial_authorization": accept_partial_authorization,
+ "buyer_email_address": buyer_email_address,
+ "buyer_phone_number": buyer_phone_number,
+ "billing_address": convert_and_respect_annotation_metadata(
+ object_=billing_address, annotation=AddressParams, direction="write"
+ ),
+ "shipping_address": convert_and_respect_annotation_metadata(
+ object_=shipping_address, annotation=AddressParams, direction="write"
+ ),
+ "note": note,
+ "statement_description_identifier": statement_description_identifier,
+ "cash_details": convert_and_respect_annotation_metadata(
+ object_=cash_details, annotation=CashPaymentDetailsParams, direction="write"
+ ),
+ "external_details": convert_and_respect_annotation_metadata(
+ object_=external_details, annotation=ExternalPaymentDetailsParams, direction="write"
+ ),
+ "customer_details": convert_and_respect_annotation_metadata(
+ object_=customer_details, annotation=CustomerDetailsParams, direction="write"
+ ),
+ "offline_payment_details": convert_and_respect_annotation_metadata(
+ object_=offline_payment_details, annotation=OfflinePaymentDetailsParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreatePaymentResponse,
+ construct_type(
+ type_=CreatePaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def cancel_by_idempotency_key(
+ self, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[CancelPaymentByIdempotencyKeyResponse]:
+ """
+ Cancels (voids) a payment identified by the idempotency key that is specified in the
+ request.
+
+ Use this method when the status of a `CreatePayment` request is unknown (for example, after you send a
+ `CreatePayment` request, a network error occurs and you do not get a response). In this case, you can
+ direct Square to cancel the payment using this endpoint. In the request, you provide the same
+ idempotency key that you provided in your `CreatePayment` request that you want to cancel. After
+ canceling the payment, you can submit your `CreatePayment` request again.
+
+ Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint
+ returns successfully.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ The `idempotency_key` identifying the payment to be canceled.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CancelPaymentByIdempotencyKeyResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/payments/cancel",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelPaymentByIdempotencyKeyResponse,
+ construct_type(
+ type_=CancelPaymentByIdempotencyKeyResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, payment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetPaymentResponse]:
+ """
+ Retrieves details for a specific payment.
+
+ Parameters
+ ----------
+ payment_id : str
+ A unique ID for the desired payment.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetPaymentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/payments/{jsonable_encoder(payment_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetPaymentResponse,
+ construct_type(
+ type_=GetPaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ payment_id: str,
+ *,
+ idempotency_key: str,
+ payment: typing.Optional[PaymentParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdatePaymentResponse]:
+ """
+ Updates a payment with the APPROVED status.
+ You can update the `amount_money` and `tip_money` using this endpoint.
+
+ Parameters
+ ----------
+ payment_id : str
+ The ID of the payment to update.
+
+ idempotency_key : str
+ A unique string that identifies this `UpdatePayment` request. Keys can be any valid string
+ but must be unique for every `UpdatePayment` request.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ payment : typing.Optional[PaymentParams]
+ The updated `Payment` object.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdatePaymentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/payments/{jsonable_encoder(payment_id)}",
+ method="PUT",
+ json={
+ "payment": convert_and_respect_annotation_metadata(
+ object_=payment, annotation=PaymentParams, direction="write"
+ ),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdatePaymentResponse,
+ construct_type(
+ type_=UpdatePaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def cancel(
+ self, payment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[CancelPaymentResponse]:
+ """
+ Cancels (voids) a payment. You can use this endpoint to cancel a payment with
+ the APPROVED `status`.
+
+ Parameters
+ ----------
+ payment_id : str
+ The ID of the payment to cancel.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CancelPaymentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/payments/{jsonable_encoder(payment_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelPaymentResponse,
+ construct_type(
+ type_=CancelPaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def complete(
+ self,
+ payment_id: str,
+ *,
+ version_token: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CompletePaymentResponse]:
+ """
+ Completes (captures) a payment.
+ By default, payments are set to complete immediately after they are created.
+
+ You can use this endpoint to complete a payment with the APPROVED `status`.
+
+ Parameters
+ ----------
+ payment_id : str
+ The unique ID identifying the payment to be completed.
+
+ version_token : typing.Optional[str]
+ Used for optimistic concurrency. This opaque token identifies the current `Payment`
+ version that the caller expects. If the server has a different version of the Payment,
+ the update fails and a response with a VERSION_MISMATCH error is returned.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CompletePaymentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/payments/{jsonable_encoder(payment_id)}/complete",
+ method="POST",
+ json={
+ "version_token": version_token,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CompletePaymentResponse,
+ construct_type(
+ type_=CompletePaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/payouts/__init__.py b/src/square/payouts/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/payouts/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/payouts/client.py b/src/square/payouts/client.py
new file mode 100644
index 00000000..1c34a918
--- /dev/null
+++ b/src/square/payouts/client.py
@@ -0,0 +1,451 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..types.get_payout_response import GetPayoutResponse
+from ..types.list_payout_entries_response import ListPayoutEntriesResponse
+from ..types.list_payouts_response import ListPayoutsResponse
+from ..types.payout import Payout
+from ..types.payout_entry import PayoutEntry
+from ..types.payout_status import PayoutStatus
+from ..types.sort_order import SortOrder
+from .raw_client import AsyncRawPayoutsClient, RawPayoutsClient
+
+
+class PayoutsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawPayoutsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawPayoutsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawPayoutsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[PayoutStatus] = None,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Payout, ListPayoutsResponse]:
+ """
+ Retrieves a list of all payouts for the default location.
+ You can filter payouts by location ID, status, time range, and order them in ascending or descending order.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+ The ID of the location for which to list the payouts.
+ By default, payouts are returned for the default (main) location associated with the seller.
+
+ status : typing.Optional[PayoutStatus]
+ If provided, only payouts with the given status are returned.
+
+ begin_time : typing.Optional[str]
+ The timestamp for the beginning of the payout creation time, in RFC 3339 format.
+ Inclusive. Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ The timestamp for the end of the payout creation time, in RFC 3339 format.
+ Default: The current time.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which payouts are listed.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ If request parameters change between requests, subsequent results may contain duplicates or missing records.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+ Default: `100`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Payout, ListPayoutsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.payouts.list(
+ location_id="location_id",
+ status="SENT",
+ begin_time="begin_time",
+ end_time="end_time",
+ sort_order="DESC",
+ cursor="cursor",
+ limit=1,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ location_id=location_id,
+ status=status,
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=cursor,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ def get(self, payout_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetPayoutResponse:
+ """
+ Retrieves details of a specific payout identified by a payout ID.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ payout_id : str
+ The ID of the payout to retrieve the information for.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetPayoutResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.payouts.get(
+ payout_id="payout_id",
+ )
+ """
+ _response = self._raw_client.get(payout_id, request_options=request_options)
+ return _response.data
+
+ def list_entries(
+ self,
+ payout_id: str,
+ *,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[PayoutEntry, ListPayoutEntriesResponse]:
+ """
+ Retrieves a list of all payout entries for a specific payout.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ payout_id : str
+ The ID of the payout to retrieve the information for.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which payout entries are listed.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ If request parameters change between requests, subsequent results may contain duplicates or missing records.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+ Default: `100`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[PayoutEntry, ListPayoutEntriesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.payouts.list_entries(
+ payout_id="payout_id",
+ sort_order="DESC",
+ cursor="cursor",
+ limit=1,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list_entries(
+ payout_id, sort_order=sort_order, cursor=cursor, limit=limit, request_options=request_options
+ )
+
+
+class AsyncPayoutsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawPayoutsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawPayoutsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawPayoutsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[PayoutStatus] = None,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Payout, ListPayoutsResponse]:
+ """
+ Retrieves a list of all payouts for the default location.
+ You can filter payouts by location ID, status, time range, and order them in ascending or descending order.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+ The ID of the location for which to list the payouts.
+ By default, payouts are returned for the default (main) location associated with the seller.
+
+ status : typing.Optional[PayoutStatus]
+ If provided, only payouts with the given status are returned.
+
+ begin_time : typing.Optional[str]
+ The timestamp for the beginning of the payout creation time, in RFC 3339 format.
+ Inclusive. Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ The timestamp for the end of the payout creation time, in RFC 3339 format.
+ Default: The current time.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which payouts are listed.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ If request parameters change between requests, subsequent results may contain duplicates or missing records.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+ Default: `100`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Payout, ListPayoutsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.payouts.list(
+ location_id="location_id",
+ status="SENT",
+ begin_time="begin_time",
+ end_time="end_time",
+ sort_order="DESC",
+ cursor="cursor",
+ limit=1,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ location_id=location_id,
+ status=status,
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=cursor,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ async def get(
+ self, payout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetPayoutResponse:
+ """
+ Retrieves details of a specific payout identified by a payout ID.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ payout_id : str
+ The ID of the payout to retrieve the information for.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetPayoutResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.payouts.get(
+ payout_id="payout_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(payout_id, request_options=request_options)
+ return _response.data
+
+ async def list_entries(
+ self,
+ payout_id: str,
+ *,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[PayoutEntry, ListPayoutEntriesResponse]:
+ """
+ Retrieves a list of all payout entries for a specific payout.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ payout_id : str
+ The ID of the payout to retrieve the information for.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which payout entries are listed.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ If request parameters change between requests, subsequent results may contain duplicates or missing records.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+ Default: `100`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[PayoutEntry, ListPayoutEntriesResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.payouts.list_entries(
+ payout_id="payout_id",
+ sort_order="DESC",
+ cursor="cursor",
+ limit=1,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list_entries(
+ payout_id, sort_order=sort_order, cursor=cursor, limit=limit, request_options=request_options
+ )
diff --git a/src/square/payouts/raw_client.py b/src/square/payouts/raw_client.py
new file mode 100644
index 00000000..87bfcff9
--- /dev/null
+++ b/src/square/payouts/raw_client.py
@@ -0,0 +1,469 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.unchecked_base_model import construct_type
+from ..types.get_payout_response import GetPayoutResponse
+from ..types.list_payout_entries_response import ListPayoutEntriesResponse
+from ..types.list_payouts_response import ListPayoutsResponse
+from ..types.payout import Payout
+from ..types.payout_entry import PayoutEntry
+from ..types.payout_status import PayoutStatus
+from ..types.sort_order import SortOrder
+
+
+class RawPayoutsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[PayoutStatus] = None,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[Payout, ListPayoutsResponse]:
+ """
+ Retrieves a list of all payouts for the default location.
+ You can filter payouts by location ID, status, time range, and order them in ascending or descending order.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+ The ID of the location for which to list the payouts.
+ By default, payouts are returned for the default (main) location associated with the seller.
+
+ status : typing.Optional[PayoutStatus]
+ If provided, only payouts with the given status are returned.
+
+ begin_time : typing.Optional[str]
+ The timestamp for the beginning of the payout creation time, in RFC 3339 format.
+ Inclusive. Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ The timestamp for the end of the payout creation time, in RFC 3339 format.
+ Default: The current time.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which payouts are listed.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ If request parameters change between requests, subsequent results may contain duplicates or missing records.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+ Default: `100`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[Payout, ListPayoutsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/payouts",
+ method="GET",
+ params={
+ "location_id": location_id,
+ "status": status,
+ "begin_time": begin_time,
+ "end_time": end_time,
+ "sort_order": sort_order,
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListPayoutsResponse,
+ construct_type(
+ type_=ListPayoutsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.payouts
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ location_id=location_id,
+ status=status,
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, payout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetPayoutResponse]:
+ """
+ Retrieves details of a specific payout identified by a payout ID.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ payout_id : str
+ The ID of the payout to retrieve the information for.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetPayoutResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/payouts/{jsonable_encoder(payout_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetPayoutResponse,
+ construct_type(
+ type_=GetPayoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def list_entries(
+ self,
+ payout_id: str,
+ *,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[PayoutEntry, ListPayoutEntriesResponse]:
+ """
+ Retrieves a list of all payout entries for a specific payout.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ payout_id : str
+ The ID of the payout to retrieve the information for.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which payout entries are listed.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ If request parameters change between requests, subsequent results may contain duplicates or missing records.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+ Default: `100`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[PayoutEntry, ListPayoutEntriesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/payouts/{jsonable_encoder(payout_id)}/payout-entries",
+ method="GET",
+ params={
+ "sort_order": sort_order,
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListPayoutEntriesResponse,
+ construct_type(
+ type_=ListPayoutEntriesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.payout_entries
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list_entries(
+ payout_id,
+ sort_order=sort_order,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawPayoutsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[PayoutStatus] = None,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[Payout, ListPayoutsResponse]:
+ """
+ Retrieves a list of all payouts for the default location.
+ You can filter payouts by location ID, status, time range, and order them in ascending or descending order.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ location_id : typing.Optional[str]
+ The ID of the location for which to list the payouts.
+ By default, payouts are returned for the default (main) location associated with the seller.
+
+ status : typing.Optional[PayoutStatus]
+ If provided, only payouts with the given status are returned.
+
+ begin_time : typing.Optional[str]
+ The timestamp for the beginning of the payout creation time, in RFC 3339 format.
+ Inclusive. Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ The timestamp for the end of the payout creation time, in RFC 3339 format.
+ Default: The current time.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which payouts are listed.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ If request parameters change between requests, subsequent results may contain duplicates or missing records.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+ Default: `100`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[Payout, ListPayoutsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/payouts",
+ method="GET",
+ params={
+ "location_id": location_id,
+ "status": status,
+ "begin_time": begin_time,
+ "end_time": end_time,
+ "sort_order": sort_order,
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListPayoutsResponse,
+ construct_type(
+ type_=ListPayoutsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.payouts
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ location_id=location_id,
+ status=status,
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, payout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetPayoutResponse]:
+ """
+ Retrieves details of a specific payout identified by a payout ID.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ payout_id : str
+ The ID of the payout to retrieve the information for.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetPayoutResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/payouts/{jsonable_encoder(payout_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetPayoutResponse,
+ construct_type(
+ type_=GetPayoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def list_entries(
+ self,
+ payout_id: str,
+ *,
+ sort_order: typing.Optional[SortOrder] = None,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[PayoutEntry, ListPayoutEntriesResponse]:
+ """
+ Retrieves a list of all payout entries for a specific payout.
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
+
+ Parameters
+ ----------
+ payout_id : str
+ The ID of the payout to retrieve the information for.
+
+ sort_order : typing.Optional[SortOrder]
+ The order in which payout entries are listed.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ If request parameters change between requests, subsequent results may contain duplicates or missing records.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value. If the provided value is
+ greater than 100, it is ignored and the default value is used instead.
+ Default: `100`
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[PayoutEntry, ListPayoutEntriesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/payouts/{jsonable_encoder(payout_id)}/payout-entries",
+ method="GET",
+ params={
+ "sort_order": sort_order,
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListPayoutEntriesResponse,
+ construct_type(
+ type_=ListPayoutEntriesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.payout_entries
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list_entries(
+ payout_id,
+ sort_order=sort_order,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/py.typed b/src/square/py.typed
new file mode 100644
index 00000000..e69de29b
diff --git a/src/square/refunds/__init__.py b/src/square/refunds/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/refunds/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/refunds/client.py b/src/square/refunds/client.py
new file mode 100644
index 00000000..d7081a3f
--- /dev/null
+++ b/src/square/refunds/client.py
@@ -0,0 +1,738 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..requests.destination_details_cash_refund_details import DestinationDetailsCashRefundDetailsParams
+from ..requests.destination_details_external_refund_details import DestinationDetailsExternalRefundDetailsParams
+from ..requests.money import MoneyParams
+from ..types.get_payment_refund_response import GetPaymentRefundResponse
+from ..types.list_payment_refunds_request_sort_field import ListPaymentRefundsRequestSortField
+from ..types.list_payment_refunds_response import ListPaymentRefundsResponse
+from ..types.payment_refund import PaymentRefund
+from ..types.refund_payment_response import RefundPaymentResponse
+from .raw_client import AsyncRawRefundsClient, RawRefundsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RefundsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawRefundsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawRefundsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawRefundsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[str] = None,
+ source_type: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ updated_at_begin_time: typing.Optional[str] = None,
+ updated_at_end_time: typing.Optional[str] = None,
+ sort_field: typing.Optional[ListPaymentRefundsRequestSortField] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[PaymentRefund, ListPaymentRefundsResponse]:
+ """
+ Retrieves a list of refunds for the account making the request.
+
+ Results are eventually consistent, and new refunds or changes to refunds might take several
+ seconds to appear.
+
+ The maximum results per page is 100.
+
+ Parameters
+ ----------
+ begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `created_at` field for each `PaymentRefund`.
+
+ Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `created_at` field for each `PaymentRefund`.
+
+ Default: The current time.
+
+ sort_order : typing.Optional[str]
+ The order in which results are listed by `PaymentRefund.created_at`:
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ location_id : typing.Optional[str]
+ Limit results to the location supplied. By default, results are returned
+ for all locations associated with the seller.
+
+ status : typing.Optional[str]
+ If provided, only refunds with the given status are returned.
+ For a list of refund status values, see [PaymentRefund](entity:PaymentRefund).
+
+ Default: If omitted, refunds are returned regardless of their status.
+
+ source_type : typing.Optional[str]
+ If provided, only returns refunds whose payments have the indicated source type.
+ Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.
+ For information about these payment source types, see
+ [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
+
+ Default: If omitted, refunds are returned regardless of the source type.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+
+ It is possible to receive fewer results than the specified limit on a given page.
+
+ If the supplied value is greater than 100, no more than 100 results are returned.
+
+ Default: 100
+
+ updated_at_begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `updated_at` field for each `PaymentRefund`.
+
+ Default: If omitted, the time range starts at `begin_time`.
+
+ updated_at_end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `updated_at` field for each `PaymentRefund`.
+
+ Default: The current time.
+
+ sort_field : typing.Optional[ListPaymentRefundsRequestSortField]
+ The field used to sort results by. The default is `CREATED_AT`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[PaymentRefund, ListPaymentRefundsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.refunds.list(
+ begin_time="begin_time",
+ end_time="end_time",
+ sort_order="sort_order",
+ cursor="cursor",
+ location_id="location_id",
+ status="status",
+ source_type="source_type",
+ limit=1,
+ updated_at_begin_time="updated_at_begin_time",
+ updated_at_end_time="updated_at_end_time",
+ sort_field="CREATED_AT",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=cursor,
+ location_id=location_id,
+ status=status,
+ source_type=source_type,
+ limit=limit,
+ updated_at_begin_time=updated_at_begin_time,
+ updated_at_end_time=updated_at_end_time,
+ sort_field=sort_field,
+ request_options=request_options,
+ )
+
+ def refund_payment(
+ self,
+ *,
+ idempotency_key: str,
+ amount_money: MoneyParams,
+ app_fee_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_allocations: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
+ payment_id: typing.Optional[str] = OMIT,
+ destination_id: typing.Optional[str] = OMIT,
+ unlinked: typing.Optional[bool] = OMIT,
+ location_id: typing.Optional[str] = OMIT,
+ customer_id: typing.Optional[str] = OMIT,
+ reason: typing.Optional[str] = OMIT,
+ payment_version_token: typing.Optional[str] = OMIT,
+ team_member_id: typing.Optional[str] = OMIT,
+ cash_details: typing.Optional[DestinationDetailsCashRefundDetailsParams] = OMIT,
+ external_details: typing.Optional[DestinationDetailsExternalRefundDetailsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RefundPaymentResponse:
+ """
+ Refunds a payment. You can refund the entire payment amount or a
+ portion of it. You can use this endpoint to refund a card payment or record a
+ refund of a cash or external payment. For more information, see
+ [Refund Payment](https://developer.squareup.com/docs/payments-api/refund-payments).
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `RefundPayment` request. The key can be any valid string
+ but must be unique for every `RefundPayment` request.
+
+ Keys are limited to a max of 45 characters - however, the number of allowed characters might be
+ less than 45, if multi-byte characters are used.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ amount_money : MoneyParams
+ The amount of money to refund.
+
+ This amount cannot be more than the `total_money` value of the payment minus the total
+ amount of all previously completed refunds for this payment.
+
+ This amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The currency code must match the currency associated with the business
+ that is charging the card.
+
+ app_fee_money : typing.Optional[MoneyParams]
+ The amount of money the developer contributes to help cover the refunded amount.
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents).
+
+ The value cannot be more than the `amount_money`.
+
+ You can specify this parameter in a refund request only if the same parameter was also included
+ when taking the payment. This is part of the application fee scenario the API supports. For more
+ information, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
+ For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+
+ app_fee_allocations : typing.Optional[typing.Sequence[typing.Any]]
+ Details pertaining to contributors to the refund of the application fee.
+ The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if
+ present. If populated, an allocation must be present for every party that expects to contribute
+ a portion of the refunded application fee, including the application developer.
+
+ payment_id : typing.Optional[str]
+ The unique ID of the payment being refunded.
+ Required when unlinked=false, otherwise must not be set.
+
+ destination_id : typing.Optional[str]
+ The ID indicating where funds will be refunded to. Required for unlinked refunds. For more
+ information, see [Process an Unlinked Refund](https://developer.squareup.com/docs/refunds-api/unlinked-refunds).
+
+ For refunds linked to Square payments, `destination_id` is usually omitted; in this case, funds
+ will be returned to the original payment source. The field may be specified in order to request
+ a cross-method refund to a gift card. For more information,
+ see [Cross-method refunds to gift cards](https://developer.squareup.com/docs/payments-api/refund-payments#cross-method-refunds-to-gift-cards).
+
+ unlinked : typing.Optional[bool]
+ Indicates that the refund is not linked to a Square payment.
+ If set to true, `destination_id` and `location_id` must be supplied while `payment_id` must not
+ be provided.
+
+ location_id : typing.Optional[str]
+ The location ID associated with the unlinked refund.
+ Required for requests specifying `unlinked=true`.
+ Otherwise, if included when `unlinked=false`, will throw an error.
+
+ customer_id : typing.Optional[str]
+ The [Customer](entity:Customer) ID of the customer associated with the refund.
+ This is required if the `destination_id` refers to a card on file created using the Cards
+ API. Only allowed when `unlinked=true`.
+
+ reason : typing.Optional[str]
+ A description of the reason for the refund.
+
+ payment_version_token : typing.Optional[str]
+ Used for optimistic concurrency. This opaque token identifies the current `Payment`
+ version that the caller expects. If the server has a different version of the Payment,
+ the update fails and a response with a VERSION_MISMATCH error is returned.
+ If the versions match, or the field is not provided, the refund proceeds as normal.
+
+ team_member_id : typing.Optional[str]
+ An optional [TeamMember](entity:TeamMember) ID to associate with this refund.
+
+ cash_details : typing.Optional[DestinationDetailsCashRefundDetailsParams]
+ Additional details required when recording an unlinked cash refund (`destination_id` is CASH).
+
+ external_details : typing.Optional[DestinationDetailsExternalRefundDetailsParams]
+ Additional details required when recording an unlinked external refund
+ (`destination_id` is EXTERNAL).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RefundPaymentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.refunds.refund_payment(
+ idempotency_key="9b7f2dcf-49da-4411-b23e-a2d6af21333a",
+ amount_money={"amount": 1000, "currency": "USD"},
+ app_fee_money={"amount": 10, "currency": "USD"},
+ payment_id="R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY",
+ reason="Example",
+ )
+ """
+ _response = self._raw_client.refund_payment(
+ idempotency_key=idempotency_key,
+ amount_money=amount_money,
+ app_fee_money=app_fee_money,
+ app_fee_allocations=app_fee_allocations,
+ payment_id=payment_id,
+ destination_id=destination_id,
+ unlinked=unlinked,
+ location_id=location_id,
+ customer_id=customer_id,
+ reason=reason,
+ payment_version_token=payment_version_token,
+ team_member_id=team_member_id,
+ cash_details=cash_details,
+ external_details=external_details,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def get(
+ self, refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetPaymentRefundResponse:
+ """
+ Retrieves a specific refund using the `refund_id`.
+
+ Parameters
+ ----------
+ refund_id : str
+ The unique ID for the desired `PaymentRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetPaymentRefundResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.refunds.get(
+ refund_id="refund_id",
+ )
+ """
+ _response = self._raw_client.get(refund_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncRefundsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawRefundsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawRefundsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawRefundsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[str] = None,
+ source_type: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ updated_at_begin_time: typing.Optional[str] = None,
+ updated_at_end_time: typing.Optional[str] = None,
+ sort_field: typing.Optional[ListPaymentRefundsRequestSortField] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[PaymentRefund, ListPaymentRefundsResponse]:
+ """
+ Retrieves a list of refunds for the account making the request.
+
+ Results are eventually consistent, and new refunds or changes to refunds might take several
+ seconds to appear.
+
+ The maximum results per page is 100.
+
+ Parameters
+ ----------
+ begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `created_at` field for each `PaymentRefund`.
+
+ Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `created_at` field for each `PaymentRefund`.
+
+ Default: The current time.
+
+ sort_order : typing.Optional[str]
+ The order in which results are listed by `PaymentRefund.created_at`:
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ location_id : typing.Optional[str]
+ Limit results to the location supplied. By default, results are returned
+ for all locations associated with the seller.
+
+ status : typing.Optional[str]
+ If provided, only refunds with the given status are returned.
+ For a list of refund status values, see [PaymentRefund](entity:PaymentRefund).
+
+ Default: If omitted, refunds are returned regardless of their status.
+
+ source_type : typing.Optional[str]
+ If provided, only returns refunds whose payments have the indicated source type.
+ Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.
+ For information about these payment source types, see
+ [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
+
+ Default: If omitted, refunds are returned regardless of the source type.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+
+ It is possible to receive fewer results than the specified limit on a given page.
+
+ If the supplied value is greater than 100, no more than 100 results are returned.
+
+ Default: 100
+
+ updated_at_begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `updated_at` field for each `PaymentRefund`.
+
+ Default: If omitted, the time range starts at `begin_time`.
+
+ updated_at_end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `updated_at` field for each `PaymentRefund`.
+
+ Default: The current time.
+
+ sort_field : typing.Optional[ListPaymentRefundsRequestSortField]
+ The field used to sort results by. The default is `CREATED_AT`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[PaymentRefund, ListPaymentRefundsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.refunds.list(
+ begin_time="begin_time",
+ end_time="end_time",
+ sort_order="sort_order",
+ cursor="cursor",
+ location_id="location_id",
+ status="status",
+ source_type="source_type",
+ limit=1,
+ updated_at_begin_time="updated_at_begin_time",
+ updated_at_end_time="updated_at_end_time",
+ sort_field="CREATED_AT",
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=cursor,
+ location_id=location_id,
+ status=status,
+ source_type=source_type,
+ limit=limit,
+ updated_at_begin_time=updated_at_begin_time,
+ updated_at_end_time=updated_at_end_time,
+ sort_field=sort_field,
+ request_options=request_options,
+ )
+
+ async def refund_payment(
+ self,
+ *,
+ idempotency_key: str,
+ amount_money: MoneyParams,
+ app_fee_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_allocations: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
+ payment_id: typing.Optional[str] = OMIT,
+ destination_id: typing.Optional[str] = OMIT,
+ unlinked: typing.Optional[bool] = OMIT,
+ location_id: typing.Optional[str] = OMIT,
+ customer_id: typing.Optional[str] = OMIT,
+ reason: typing.Optional[str] = OMIT,
+ payment_version_token: typing.Optional[str] = OMIT,
+ team_member_id: typing.Optional[str] = OMIT,
+ cash_details: typing.Optional[DestinationDetailsCashRefundDetailsParams] = OMIT,
+ external_details: typing.Optional[DestinationDetailsExternalRefundDetailsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> RefundPaymentResponse:
+ """
+ Refunds a payment. You can refund the entire payment amount or a
+ portion of it. You can use this endpoint to refund a card payment or record a
+ refund of a cash or external payment. For more information, see
+ [Refund Payment](https://developer.squareup.com/docs/payments-api/refund-payments).
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `RefundPayment` request. The key can be any valid string
+ but must be unique for every `RefundPayment` request.
+
+ Keys are limited to a max of 45 characters - however, the number of allowed characters might be
+ less than 45, if multi-byte characters are used.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ amount_money : MoneyParams
+ The amount of money to refund.
+
+ This amount cannot be more than the `total_money` value of the payment minus the total
+ amount of all previously completed refunds for this payment.
+
+ This amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The currency code must match the currency associated with the business
+ that is charging the card.
+
+ app_fee_money : typing.Optional[MoneyParams]
+ The amount of money the developer contributes to help cover the refunded amount.
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents).
+
+ The value cannot be more than the `amount_money`.
+
+ You can specify this parameter in a refund request only if the same parameter was also included
+ when taking the payment. This is part of the application fee scenario the API supports. For more
+ information, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
+ For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+
+ app_fee_allocations : typing.Optional[typing.Sequence[typing.Any]]
+ Details pertaining to contributors to the refund of the application fee.
+ The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if
+ present. If populated, an allocation must be present for every party that expects to contribute
+ a portion of the refunded application fee, including the application developer.
+
+ payment_id : typing.Optional[str]
+ The unique ID of the payment being refunded.
+ Required when unlinked=false, otherwise must not be set.
+
+ destination_id : typing.Optional[str]
+ The ID indicating where funds will be refunded to. Required for unlinked refunds. For more
+ information, see [Process an Unlinked Refund](https://developer.squareup.com/docs/refunds-api/unlinked-refunds).
+
+ For refunds linked to Square payments, `destination_id` is usually omitted; in this case, funds
+ will be returned to the original payment source. The field may be specified in order to request
+ a cross-method refund to a gift card. For more information,
+ see [Cross-method refunds to gift cards](https://developer.squareup.com/docs/payments-api/refund-payments#cross-method-refunds-to-gift-cards).
+
+ unlinked : typing.Optional[bool]
+ Indicates that the refund is not linked to a Square payment.
+ If set to true, `destination_id` and `location_id` must be supplied while `payment_id` must not
+ be provided.
+
+ location_id : typing.Optional[str]
+ The location ID associated with the unlinked refund.
+ Required for requests specifying `unlinked=true`.
+ Otherwise, if included when `unlinked=false`, will throw an error.
+
+ customer_id : typing.Optional[str]
+ The [Customer](entity:Customer) ID of the customer associated with the refund.
+ This is required if the `destination_id` refers to a card on file created using the Cards
+ API. Only allowed when `unlinked=true`.
+
+ reason : typing.Optional[str]
+ A description of the reason for the refund.
+
+ payment_version_token : typing.Optional[str]
+ Used for optimistic concurrency. This opaque token identifies the current `Payment`
+ version that the caller expects. If the server has a different version of the Payment,
+ the update fails and a response with a VERSION_MISMATCH error is returned.
+ If the versions match, or the field is not provided, the refund proceeds as normal.
+
+ team_member_id : typing.Optional[str]
+ An optional [TeamMember](entity:TeamMember) ID to associate with this refund.
+
+ cash_details : typing.Optional[DestinationDetailsCashRefundDetailsParams]
+ Additional details required when recording an unlinked cash refund (`destination_id` is CASH).
+
+ external_details : typing.Optional[DestinationDetailsExternalRefundDetailsParams]
+ Additional details required when recording an unlinked external refund
+ (`destination_id` is EXTERNAL).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RefundPaymentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.refunds.refund_payment(
+ idempotency_key="9b7f2dcf-49da-4411-b23e-a2d6af21333a",
+ amount_money={"amount": 1000, "currency": "USD"},
+ app_fee_money={"amount": 10, "currency": "USD"},
+ payment_id="R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY",
+ reason="Example",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.refund_payment(
+ idempotency_key=idempotency_key,
+ amount_money=amount_money,
+ app_fee_money=app_fee_money,
+ app_fee_allocations=app_fee_allocations,
+ payment_id=payment_id,
+ destination_id=destination_id,
+ unlinked=unlinked,
+ location_id=location_id,
+ customer_id=customer_id,
+ reason=reason,
+ payment_version_token=payment_version_token,
+ team_member_id=team_member_id,
+ cash_details=cash_details,
+ external_details=external_details,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def get(
+ self, refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetPaymentRefundResponse:
+ """
+ Retrieves a specific refund using the `refund_id`.
+
+ Parameters
+ ----------
+ refund_id : str
+ The unique ID for the desired `PaymentRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetPaymentRefundResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.refunds.get(
+ refund_id="refund_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(refund_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/refunds/raw_client.py b/src/square/refunds/raw_client.py
new file mode 100644
index 00000000..ea7bd59c
--- /dev/null
+++ b/src/square/refunds/raw_client.py
@@ -0,0 +1,761 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.destination_details_cash_refund_details import DestinationDetailsCashRefundDetailsParams
+from ..requests.destination_details_external_refund_details import DestinationDetailsExternalRefundDetailsParams
+from ..requests.money import MoneyParams
+from ..types.get_payment_refund_response import GetPaymentRefundResponse
+from ..types.list_payment_refunds_request_sort_field import ListPaymentRefundsRequestSortField
+from ..types.list_payment_refunds_response import ListPaymentRefundsResponse
+from ..types.payment_refund import PaymentRefund
+from ..types.refund_payment_response import RefundPaymentResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawRefundsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[str] = None,
+ source_type: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ updated_at_begin_time: typing.Optional[str] = None,
+ updated_at_end_time: typing.Optional[str] = None,
+ sort_field: typing.Optional[ListPaymentRefundsRequestSortField] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[PaymentRefund, ListPaymentRefundsResponse]:
+ """
+ Retrieves a list of refunds for the account making the request.
+
+ Results are eventually consistent, and new refunds or changes to refunds might take several
+ seconds to appear.
+
+ The maximum results per page is 100.
+
+ Parameters
+ ----------
+ begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `created_at` field for each `PaymentRefund`.
+
+ Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `created_at` field for each `PaymentRefund`.
+
+ Default: The current time.
+
+ sort_order : typing.Optional[str]
+ The order in which results are listed by `PaymentRefund.created_at`:
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ location_id : typing.Optional[str]
+ Limit results to the location supplied. By default, results are returned
+ for all locations associated with the seller.
+
+ status : typing.Optional[str]
+ If provided, only refunds with the given status are returned.
+ For a list of refund status values, see [PaymentRefund](entity:PaymentRefund).
+
+ Default: If omitted, refunds are returned regardless of their status.
+
+ source_type : typing.Optional[str]
+ If provided, only returns refunds whose payments have the indicated source type.
+ Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.
+ For information about these payment source types, see
+ [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
+
+ Default: If omitted, refunds are returned regardless of the source type.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+
+ It is possible to receive fewer results than the specified limit on a given page.
+
+ If the supplied value is greater than 100, no more than 100 results are returned.
+
+ Default: 100
+
+ updated_at_begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `updated_at` field for each `PaymentRefund`.
+
+ Default: If omitted, the time range starts at `begin_time`.
+
+ updated_at_end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `updated_at` field for each `PaymentRefund`.
+
+ Default: The current time.
+
+ sort_field : typing.Optional[ListPaymentRefundsRequestSortField]
+ The field used to sort results by. The default is `CREATED_AT`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[PaymentRefund, ListPaymentRefundsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/refunds",
+ method="GET",
+ params={
+ "begin_time": begin_time,
+ "end_time": end_time,
+ "sort_order": sort_order,
+ "cursor": cursor,
+ "location_id": location_id,
+ "status": status,
+ "source_type": source_type,
+ "limit": limit,
+ "updated_at_begin_time": updated_at_begin_time,
+ "updated_at_end_time": updated_at_end_time,
+ "sort_field": sort_field,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListPaymentRefundsResponse,
+ construct_type(
+ type_=ListPaymentRefundsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.refunds
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=_parsed_next,
+ location_id=location_id,
+ status=status,
+ source_type=source_type,
+ limit=limit,
+ updated_at_begin_time=updated_at_begin_time,
+ updated_at_end_time=updated_at_end_time,
+ sort_field=sort_field,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def refund_payment(
+ self,
+ *,
+ idempotency_key: str,
+ amount_money: MoneyParams,
+ app_fee_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_allocations: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
+ payment_id: typing.Optional[str] = OMIT,
+ destination_id: typing.Optional[str] = OMIT,
+ unlinked: typing.Optional[bool] = OMIT,
+ location_id: typing.Optional[str] = OMIT,
+ customer_id: typing.Optional[str] = OMIT,
+ reason: typing.Optional[str] = OMIT,
+ payment_version_token: typing.Optional[str] = OMIT,
+ team_member_id: typing.Optional[str] = OMIT,
+ cash_details: typing.Optional[DestinationDetailsCashRefundDetailsParams] = OMIT,
+ external_details: typing.Optional[DestinationDetailsExternalRefundDetailsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[RefundPaymentResponse]:
+ """
+ Refunds a payment. You can refund the entire payment amount or a
+ portion of it. You can use this endpoint to refund a card payment or record a
+ refund of a cash or external payment. For more information, see
+ [Refund Payment](https://developer.squareup.com/docs/payments-api/refund-payments).
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `RefundPayment` request. The key can be any valid string
+ but must be unique for every `RefundPayment` request.
+
+ Keys are limited to a max of 45 characters - however, the number of allowed characters might be
+ less than 45, if multi-byte characters are used.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ amount_money : MoneyParams
+ The amount of money to refund.
+
+ This amount cannot be more than the `total_money` value of the payment minus the total
+ amount of all previously completed refunds for this payment.
+
+ This amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The currency code must match the currency associated with the business
+ that is charging the card.
+
+ app_fee_money : typing.Optional[MoneyParams]
+ The amount of money the developer contributes to help cover the refunded amount.
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents).
+
+ The value cannot be more than the `amount_money`.
+
+ You can specify this parameter in a refund request only if the same parameter was also included
+ when taking the payment. This is part of the application fee scenario the API supports. For more
+ information, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
+ For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+
+ app_fee_allocations : typing.Optional[typing.Sequence[typing.Any]]
+ Details pertaining to contributors to the refund of the application fee.
+ The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if
+ present. If populated, an allocation must be present for every party that expects to contribute
+ a portion of the refunded application fee, including the application developer.
+
+ payment_id : typing.Optional[str]
+ The unique ID of the payment being refunded.
+ Required when unlinked=false, otherwise must not be set.
+
+ destination_id : typing.Optional[str]
+ The ID indicating where funds will be refunded to. Required for unlinked refunds. For more
+ information, see [Process an Unlinked Refund](https://developer.squareup.com/docs/refunds-api/unlinked-refunds).
+
+ For refunds linked to Square payments, `destination_id` is usually omitted; in this case, funds
+ will be returned to the original payment source. The field may be specified in order to request
+ a cross-method refund to a gift card. For more information,
+ see [Cross-method refunds to gift cards](https://developer.squareup.com/docs/payments-api/refund-payments#cross-method-refunds-to-gift-cards).
+
+ unlinked : typing.Optional[bool]
+ Indicates that the refund is not linked to a Square payment.
+ If set to true, `destination_id` and `location_id` must be supplied while `payment_id` must not
+ be provided.
+
+ location_id : typing.Optional[str]
+ The location ID associated with the unlinked refund.
+ Required for requests specifying `unlinked=true`.
+ Otherwise, if included when `unlinked=false`, will throw an error.
+
+ customer_id : typing.Optional[str]
+ The [Customer](entity:Customer) ID of the customer associated with the refund.
+ This is required if the `destination_id` refers to a card on file created using the Cards
+ API. Only allowed when `unlinked=true`.
+
+ reason : typing.Optional[str]
+ A description of the reason for the refund.
+
+ payment_version_token : typing.Optional[str]
+ Used for optimistic concurrency. This opaque token identifies the current `Payment`
+ version that the caller expects. If the server has a different version of the Payment,
+ the update fails and a response with a VERSION_MISMATCH error is returned.
+ If the versions match, or the field is not provided, the refund proceeds as normal.
+
+ team_member_id : typing.Optional[str]
+ An optional [TeamMember](entity:TeamMember) ID to associate with this refund.
+
+ cash_details : typing.Optional[DestinationDetailsCashRefundDetailsParams]
+ Additional details required when recording an unlinked cash refund (`destination_id` is CASH).
+
+ external_details : typing.Optional[DestinationDetailsExternalRefundDetailsParams]
+ Additional details required when recording an unlinked external refund
+ (`destination_id` is EXTERNAL).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RefundPaymentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/refunds",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "amount_money": convert_and_respect_annotation_metadata(
+ object_=amount_money, annotation=MoneyParams, direction="write"
+ ),
+ "app_fee_money": convert_and_respect_annotation_metadata(
+ object_=app_fee_money, annotation=MoneyParams, direction="write"
+ ),
+ "app_fee_allocations": app_fee_allocations,
+ "payment_id": payment_id,
+ "destination_id": destination_id,
+ "unlinked": unlinked,
+ "location_id": location_id,
+ "customer_id": customer_id,
+ "reason": reason,
+ "payment_version_token": payment_version_token,
+ "team_member_id": team_member_id,
+ "cash_details": convert_and_respect_annotation_metadata(
+ object_=cash_details, annotation=DestinationDetailsCashRefundDetailsParams, direction="write"
+ ),
+ "external_details": convert_and_respect_annotation_metadata(
+ object_=external_details,
+ annotation=DestinationDetailsExternalRefundDetailsParams,
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RefundPaymentResponse,
+ construct_type(
+ type_=RefundPaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetPaymentRefundResponse]:
+ """
+ Retrieves a specific refund using the `refund_id`.
+
+ Parameters
+ ----------
+ refund_id : str
+ The unique ID for the desired `PaymentRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetPaymentRefundResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/refunds/{jsonable_encoder(refund_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetPaymentRefundResponse,
+ construct_type(
+ type_=GetPaymentRefundResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawRefundsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ begin_time: typing.Optional[str] = None,
+ end_time: typing.Optional[str] = None,
+ sort_order: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ location_id: typing.Optional[str] = None,
+ status: typing.Optional[str] = None,
+ source_type: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ updated_at_begin_time: typing.Optional[str] = None,
+ updated_at_end_time: typing.Optional[str] = None,
+ sort_field: typing.Optional[ListPaymentRefundsRequestSortField] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[PaymentRefund, ListPaymentRefundsResponse]:
+ """
+ Retrieves a list of refunds for the account making the request.
+
+ Results are eventually consistent, and new refunds or changes to refunds might take several
+ seconds to appear.
+
+ The maximum results per page is 100.
+
+ Parameters
+ ----------
+ begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `created_at` field for each `PaymentRefund`.
+
+ Default: The current time minus one year.
+
+ end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `created_at` field for each `PaymentRefund`.
+
+ Default: The current time.
+
+ sort_order : typing.Optional[str]
+ The order in which results are listed by `PaymentRefund.created_at`:
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ location_id : typing.Optional[str]
+ Limit results to the location supplied. By default, results are returned
+ for all locations associated with the seller.
+
+ status : typing.Optional[str]
+ If provided, only refunds with the given status are returned.
+ For a list of refund status values, see [PaymentRefund](entity:PaymentRefund).
+
+ Default: If omitted, refunds are returned regardless of their status.
+
+ source_type : typing.Optional[str]
+ If provided, only returns refunds whose payments have the indicated source type.
+ Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.
+ For information about these payment source types, see
+ [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
+
+ Default: If omitted, refunds are returned regardless of the source type.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+
+ It is possible to receive fewer results than the specified limit on a given page.
+
+ If the supplied value is greater than 100, no more than 100 results are returned.
+
+ Default: 100
+
+ updated_at_begin_time : typing.Optional[str]
+ Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `updated_at` field for each `PaymentRefund`.
+
+ Default: If omitted, the time range starts at `begin_time`.
+
+ updated_at_end_time : typing.Optional[str]
+ Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
+ format. The range is determined using the `updated_at` field for each `PaymentRefund`.
+
+ Default: The current time.
+
+ sort_field : typing.Optional[ListPaymentRefundsRequestSortField]
+ The field used to sort results by. The default is `CREATED_AT`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[PaymentRefund, ListPaymentRefundsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/refunds",
+ method="GET",
+ params={
+ "begin_time": begin_time,
+ "end_time": end_time,
+ "sort_order": sort_order,
+ "cursor": cursor,
+ "location_id": location_id,
+ "status": status,
+ "source_type": source_type,
+ "limit": limit,
+ "updated_at_begin_time": updated_at_begin_time,
+ "updated_at_end_time": updated_at_end_time,
+ "sort_field": sort_field,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListPaymentRefundsResponse,
+ construct_type(
+ type_=ListPaymentRefundsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.refunds
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ begin_time=begin_time,
+ end_time=end_time,
+ sort_order=sort_order,
+ cursor=_parsed_next,
+ location_id=location_id,
+ status=status,
+ source_type=source_type,
+ limit=limit,
+ updated_at_begin_time=updated_at_begin_time,
+ updated_at_end_time=updated_at_end_time,
+ sort_field=sort_field,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def refund_payment(
+ self,
+ *,
+ idempotency_key: str,
+ amount_money: MoneyParams,
+ app_fee_money: typing.Optional[MoneyParams] = OMIT,
+ app_fee_allocations: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
+ payment_id: typing.Optional[str] = OMIT,
+ destination_id: typing.Optional[str] = OMIT,
+ unlinked: typing.Optional[bool] = OMIT,
+ location_id: typing.Optional[str] = OMIT,
+ customer_id: typing.Optional[str] = OMIT,
+ reason: typing.Optional[str] = OMIT,
+ payment_version_token: typing.Optional[str] = OMIT,
+ team_member_id: typing.Optional[str] = OMIT,
+ cash_details: typing.Optional[DestinationDetailsCashRefundDetailsParams] = OMIT,
+ external_details: typing.Optional[DestinationDetailsExternalRefundDetailsParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[RefundPaymentResponse]:
+ """
+ Refunds a payment. You can refund the entire payment amount or a
+ portion of it. You can use this endpoint to refund a card payment or record a
+ refund of a cash or external payment. For more information, see
+ [Refund Payment](https://developer.squareup.com/docs/payments-api/refund-payments).
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `RefundPayment` request. The key can be any valid string
+ but must be unique for every `RefundPayment` request.
+
+ Keys are limited to a max of 45 characters - however, the number of allowed characters might be
+ less than 45, if multi-byte characters are used.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+
+ amount_money : MoneyParams
+ The amount of money to refund.
+
+ This amount cannot be more than the `total_money` value of the payment minus the total
+ amount of all previously completed refunds for this payment.
+
+ This amount must be specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The currency code must match the currency associated with the business
+ that is charging the card.
+
+ app_fee_money : typing.Optional[MoneyParams]
+ The amount of money the developer contributes to help cover the refunded amount.
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents).
+
+ The value cannot be more than the `amount_money`.
+
+ You can specify this parameter in a refund request only if the same parameter was also included
+ when taking the payment. This is part of the application fee scenario the API supports. For more
+ information, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
+ For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+
+ app_fee_allocations : typing.Optional[typing.Sequence[typing.Any]]
+ Details pertaining to contributors to the refund of the application fee.
+ The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if
+ present. If populated, an allocation must be present for every party that expects to contribute
+ a portion of the refunded application fee, including the application developer.
+
+ payment_id : typing.Optional[str]
+ The unique ID of the payment being refunded.
+ Required when unlinked=false, otherwise must not be set.
+
+ destination_id : typing.Optional[str]
+ The ID indicating where funds will be refunded to. Required for unlinked refunds. For more
+ information, see [Process an Unlinked Refund](https://developer.squareup.com/docs/refunds-api/unlinked-refunds).
+
+ For refunds linked to Square payments, `destination_id` is usually omitted; in this case, funds
+ will be returned to the original payment source. The field may be specified in order to request
+ a cross-method refund to a gift card. For more information,
+ see [Cross-method refunds to gift cards](https://developer.squareup.com/docs/payments-api/refund-payments#cross-method-refunds-to-gift-cards).
+
+ unlinked : typing.Optional[bool]
+ Indicates that the refund is not linked to a Square payment.
+ If set to true, `destination_id` and `location_id` must be supplied while `payment_id` must not
+ be provided.
+
+ location_id : typing.Optional[str]
+ The location ID associated with the unlinked refund.
+ Required for requests specifying `unlinked=true`.
+ Otherwise, if included when `unlinked=false`, will throw an error.
+
+ customer_id : typing.Optional[str]
+ The [Customer](entity:Customer) ID of the customer associated with the refund.
+ This is required if the `destination_id` refers to a card on file created using the Cards
+ API. Only allowed when `unlinked=true`.
+
+ reason : typing.Optional[str]
+ A description of the reason for the refund.
+
+ payment_version_token : typing.Optional[str]
+ Used for optimistic concurrency. This opaque token identifies the current `Payment`
+ version that the caller expects. If the server has a different version of the Payment,
+ the update fails and a response with a VERSION_MISMATCH error is returned.
+ If the versions match, or the field is not provided, the refund proceeds as normal.
+
+ team_member_id : typing.Optional[str]
+ An optional [TeamMember](entity:TeamMember) ID to associate with this refund.
+
+ cash_details : typing.Optional[DestinationDetailsCashRefundDetailsParams]
+ Additional details required when recording an unlinked cash refund (`destination_id` is CASH).
+
+ external_details : typing.Optional[DestinationDetailsExternalRefundDetailsParams]
+ Additional details required when recording an unlinked external refund
+ (`destination_id` is EXTERNAL).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RefundPaymentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/refunds",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "amount_money": convert_and_respect_annotation_metadata(
+ object_=amount_money, annotation=MoneyParams, direction="write"
+ ),
+ "app_fee_money": convert_and_respect_annotation_metadata(
+ object_=app_fee_money, annotation=MoneyParams, direction="write"
+ ),
+ "app_fee_allocations": app_fee_allocations,
+ "payment_id": payment_id,
+ "destination_id": destination_id,
+ "unlinked": unlinked,
+ "location_id": location_id,
+ "customer_id": customer_id,
+ "reason": reason,
+ "payment_version_token": payment_version_token,
+ "team_member_id": team_member_id,
+ "cash_details": convert_and_respect_annotation_metadata(
+ object_=cash_details, annotation=DestinationDetailsCashRefundDetailsParams, direction="write"
+ ),
+ "external_details": convert_and_respect_annotation_metadata(
+ object_=external_details,
+ annotation=DestinationDetailsExternalRefundDetailsParams,
+ direction="write",
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RefundPaymentResponse,
+ construct_type(
+ type_=RefundPaymentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetPaymentRefundResponse]:
+ """
+ Retrieves a specific refund using the `refund_id`.
+
+ Parameters
+ ----------
+ refund_id : str
+ The unique ID for the desired `PaymentRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetPaymentRefundResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/refunds/{jsonable_encoder(refund_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetPaymentRefundResponse,
+ construct_type(
+ type_=GetPaymentRefundResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/reporting/__init__.py b/src/square/reporting/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/reporting/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/reporting/client.py b/src/square/reporting/client.py
new file mode 100644
index 00000000..65567e6b
--- /dev/null
+++ b/src/square/reporting/client.py
@@ -0,0 +1,196 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..requests.query import QueryParams
+from ..types.cache_mode import CacheMode
+from ..types.load_response import LoadResponse
+from ..types.metadata_response import MetadataResponse
+from .raw_client import AsyncRawReportingClient, RawReportingClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class ReportingClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawReportingClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawReportingClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawReportingClient
+ """
+ return self._raw_client
+
+ def get_metadata(self, *, request_options: typing.Optional[RequestOptions] = None) -> MetadataResponse:
+ """
+ Describes the data available to query: the cubes, views, measures, dimensions, and segments you can reference in a reporting query. Call this first to discover the schema, then pass the members you need to `load`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ MetadataResponse
+ successful operation
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.reporting.get_metadata()
+ """
+ _response = self._raw_client.get_metadata(request_options=request_options)
+ return _response.data
+
+ def load(
+ self,
+ *,
+ query_type: typing.Optional[str] = OMIT,
+ cache: typing.Optional[CacheMode] = OMIT,
+ query: typing.Optional[QueryParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> LoadResponse:
+ """
+ Runs a reporting query against the discovered schema and returns the aggregated results. Long-running queries may return a "Continue wait" response while processing — retry the same request until results are ready.
+
+ Parameters
+ ----------
+ query_type : typing.Optional[str]
+
+ cache : typing.Optional[CacheMode]
+
+ query : typing.Optional[QueryParams]
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ LoadResponse
+ successful operation
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.reporting.load()
+ """
+ _response = self._raw_client.load(
+ query_type=query_type, cache=cache, query=query, request_options=request_options
+ )
+ return _response.data
+
+
+class AsyncReportingClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawReportingClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawReportingClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawReportingClient
+ """
+ return self._raw_client
+
+ async def get_metadata(self, *, request_options: typing.Optional[RequestOptions] = None) -> MetadataResponse:
+ """
+ Describes the data available to query: the cubes, views, measures, dimensions, and segments you can reference in a reporting query. Call this first to discover the schema, then pass the members you need to `load`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ MetadataResponse
+ successful operation
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.reporting.get_metadata()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get_metadata(request_options=request_options)
+ return _response.data
+
+ async def load(
+ self,
+ *,
+ query_type: typing.Optional[str] = OMIT,
+ cache: typing.Optional[CacheMode] = OMIT,
+ query: typing.Optional[QueryParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> LoadResponse:
+ """
+ Runs a reporting query against the discovered schema and returns the aggregated results. Long-running queries may return a "Continue wait" response while processing — retry the same request until results are ready.
+
+ Parameters
+ ----------
+ query_type : typing.Optional[str]
+
+ cache : typing.Optional[CacheMode]
+
+ query : typing.Optional[QueryParams]
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ LoadResponse
+ successful operation
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.reporting.load()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.load(
+ query_type=query_type, cache=cache, query=query, request_options=request_options
+ )
+ return _response.data
diff --git a/src/square/reporting/raw_client.py b/src/square/reporting/raw_client.py
new file mode 100644
index 00000000..d1b7d3b5
--- /dev/null
+++ b/src/square/reporting/raw_client.py
@@ -0,0 +1,216 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.query import QueryParams
+from ..types.cache_mode import CacheMode
+from ..types.load_response import LoadResponse
+from ..types.metadata_response import MetadataResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawReportingClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def get_metadata(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[MetadataResponse]:
+ """
+ Describes the data available to query: the cubes, views, measures, dimensions, and segments you can reference in a reporting query. Call this first to discover the schema, then pass the members you need to `load`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[MetadataResponse]
+ successful operation
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "reporting/v1/meta",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ MetadataResponse,
+ construct_type(
+ type_=MetadataResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def load(
+ self,
+ *,
+ query_type: typing.Optional[str] = OMIT,
+ cache: typing.Optional[CacheMode] = OMIT,
+ query: typing.Optional[QueryParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[LoadResponse]:
+ """
+ Runs a reporting query against the discovered schema and returns the aggregated results. Long-running queries may return a "Continue wait" response while processing — retry the same request until results are ready.
+
+ Parameters
+ ----------
+ query_type : typing.Optional[str]
+
+ cache : typing.Optional[CacheMode]
+
+ query : typing.Optional[QueryParams]
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[LoadResponse]
+ successful operation
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "reporting/v1/load",
+ method="POST",
+ json={
+ "queryType": query_type,
+ "cache": cache,
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=QueryParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ LoadResponse,
+ construct_type(
+ type_=LoadResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawReportingClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def get_metadata(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[MetadataResponse]:
+ """
+ Describes the data available to query: the cubes, views, measures, dimensions, and segments you can reference in a reporting query. Call this first to discover the schema, then pass the members you need to `load`.
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[MetadataResponse]
+ successful operation
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "reporting/v1/meta",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ MetadataResponse,
+ construct_type(
+ type_=MetadataResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def load(
+ self,
+ *,
+ query_type: typing.Optional[str] = OMIT,
+ cache: typing.Optional[CacheMode] = OMIT,
+ query: typing.Optional[QueryParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[LoadResponse]:
+ """
+ Runs a reporting query against the discovered schema and returns the aggregated results. Long-running queries may return a "Continue wait" response while processing — retry the same request until results are ready.
+
+ Parameters
+ ----------
+ query_type : typing.Optional[str]
+
+ cache : typing.Optional[CacheMode]
+
+ query : typing.Optional[QueryParams]
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[LoadResponse]
+ successful operation
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "reporting/v1/load",
+ method="POST",
+ json={
+ "queryType": query_type,
+ "cache": cache,
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=QueryParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ LoadResponse,
+ construct_type(
+ type_=LoadResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/requests/__init__.py b/src/square/requests/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/requests/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/requests/accept_dispute_response.py b/src/square/requests/accept_dispute_response.py
new file mode 100644
index 00000000..358b86f6
--- /dev/null
+++ b/src/square/requests/accept_dispute_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute import DisputeParams
+from .error import ErrorParams
+
+
+class AcceptDisputeResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields in an `AcceptDispute` response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ dispute: typing_extensions.NotRequired[DisputeParams]
+ """
+ Details about the accepted dispute.
+ """
diff --git a/src/square/requests/accepted_payment_methods.py b/src/square/requests/accepted_payment_methods.py
new file mode 100644
index 00000000..0abbacb2
--- /dev/null
+++ b/src/square/requests/accepted_payment_methods.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class AcceptedPaymentMethodsParams(typing_extensions.TypedDict):
+ apple_pay: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether Apple Pay is accepted at checkout.
+ """
+
+ google_pay: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether Google Pay is accepted at checkout.
+ """
+
+ cash_app_pay: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether Cash App Pay is accepted at checkout.
+ """
+
+ afterpay_clearpay: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether Afterpay/Clearpay is accepted at checkout.
+ """
diff --git a/src/square/requests/accumulate_loyalty_points_response.py b/src/square/requests/accumulate_loyalty_points_response.py
new file mode 100644
index 00000000..8d621493
--- /dev/null
+++ b/src/square/requests/accumulate_loyalty_points_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_event import LoyaltyEventParams
+
+
+class AccumulateLoyaltyPointsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ event: typing_extensions.NotRequired[LoyaltyEventParams]
+ """
+ The resulting loyalty event. Starting in Square version 2022-08-17, this field is no longer returned.
+ """
+
+ events: typing_extensions.NotRequired[typing.Sequence[LoyaltyEventParams]]
+ """
+ The resulting loyalty events. If the purchase qualifies for points, the `ACCUMULATE_POINTS` event
+ is always included. When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included
+ if the purchase also qualifies for a loyalty promotion.
+ """
diff --git a/src/square/requests/ach_details.py b/src/square/requests/ach_details.py
new file mode 100644
index 00000000..dc75d5f0
--- /dev/null
+++ b/src/square/requests/ach_details.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class AchDetailsParams(typing_extensions.TypedDict):
+ """
+ ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type` of `ACH`.
+ """
+
+ routing_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The routing number for the bank account.
+ """
+
+ account_number_suffix: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The last few digits of the bank account number.
+ """
+
+ account_type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the bank account performing the transfer. The account type can be `CHECKING`,
+ `SAVINGS`, or `UNKNOWN`.
+ """
diff --git a/src/square/requests/add_group_to_customer_response.py b/src/square/requests/add_group_to_customer_response.py
new file mode 100644
index 00000000..ecf1452b
--- /dev/null
+++ b/src/square/requests/add_group_to_customer_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class AddGroupToCustomerResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [AddGroupToCustomer](api-endpoint:Customers-AddGroupToCustomer) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/additional_recipient.py b/src/square/requests/additional_recipient.py
new file mode 100644
index 00000000..c86d0777
--- /dev/null
+++ b/src/square/requests/additional_recipient.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class AdditionalRecipientParams(typing_extensions.TypedDict):
+ """
+ Represents an additional recipient (other than the merchant) receiving a portion of this tender.
+ """
+
+ location_id: str
+ """
+ The location ID for a recipient (other than the merchant) receiving a portion of this tender.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The description of the additional recipient.
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount of money distributed to the recipient.
+ """
+
+ receivable_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the RETIRED `AdditionalRecipientReceivable` object. This field should be empty for any `AdditionalRecipient` objects created after the retirement.
+ """
diff --git a/src/square/requests/address.py b/src/square/requests/address.py
new file mode 100644
index 00000000..bd1e5308
--- /dev/null
+++ b/src/square/requests/address.py
@@ -0,0 +1,109 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from ..types.country import Country
+
+
+class AddressParams(typing_extensions.TypedDict):
+ """
+ Represents a postal address in a country.
+ For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
+ """
+
+ address_line1: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="address_line_1")]
+ ]
+ """
+ The first line of the address.
+
+ Fields that start with `address_line` provide the address's most specific
+ details, like street number, street name, and building name. They do *not*
+ provide less specific details like city, state/province, or country (these
+ details are provided in other fields).
+ """
+
+ address_line2: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="address_line_2")]
+ ]
+ """
+ The second line of the address, if any.
+ """
+
+ address_line3: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="address_line_3")]
+ ]
+ """
+ The third line of the address, if any.
+ """
+
+ locality: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The city or town of the address. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
+ """
+
+ sublocality: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A civil region within the address's `locality`, if any.
+ """
+
+ sublocality2: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="sublocality_2")]
+ ]
+ """
+ A civil region within the address's `sublocality`, if any.
+ """
+
+ sublocality3: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="sublocality_3")]
+ ]
+ """
+ A civil region within the address's `sublocality_2`, if any.
+ """
+
+ administrative_district_level1: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="administrative_district_level_1")]
+ ]
+ """
+ A civil entity within the address's country. In the US, this
+ is the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
+ """
+
+ administrative_district_level2: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="administrative_district_level_2")]
+ ]
+ """
+ A civil entity within the address's `administrative_district_level_1`.
+ In the US, this is the county.
+ """
+
+ administrative_district_level3: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="administrative_district_level_3")]
+ ]
+ """
+ A civil entity within the address's `administrative_district_level_2`,
+ if any.
+ """
+
+ postal_code: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The address's postal code. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
+ """
+
+ country: typing_extensions.NotRequired[Country]
+ """
+ The address's country, in the two-letter format of ISO 3166. For example, `US` or `FR`.
+ See [Country](#type-country) for possible values
+ """
+
+ first_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Optional first name when it's representing recipient.
+ """
+
+ last_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Optional last name when it's representing recipient.
+ """
diff --git a/src/square/requests/adjust_loyalty_points_response.py b/src/square/requests/adjust_loyalty_points_response.py
new file mode 100644
index 00000000..9fd2e62a
--- /dev/null
+++ b/src/square/requests/adjust_loyalty_points_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_event import LoyaltyEventParams
+
+
+class AdjustLoyaltyPointsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [AdjustLoyaltyPoints](api-endpoint:Loyalty-AdjustLoyaltyPoints) request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ event: typing_extensions.NotRequired[LoyaltyEventParams]
+ """
+ The resulting event data for the adjustment.
+ """
diff --git a/src/square/requests/afterpay_details.py b/src/square/requests/afterpay_details.py
new file mode 100644
index 00000000..98caa190
--- /dev/null
+++ b/src/square/requests/afterpay_details.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class AfterpayDetailsParams(typing_extensions.TypedDict):
+ """
+ Additional details about Afterpay payments.
+ """
+
+ email_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Email address on the buyer's Afterpay account.
+ """
diff --git a/src/square/requests/application_details.py b/src/square/requests/application_details.py
new file mode 100644
index 00000000..bab29397
--- /dev/null
+++ b/src/square/requests/application_details.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.application_details_external_square_product import ApplicationDetailsExternalSquareProduct
+
+
+class ApplicationDetailsParams(typing_extensions.TypedDict):
+ """
+ Details about the application that took the payment.
+ """
+
+ square_product: typing_extensions.NotRequired[ApplicationDetailsExternalSquareProduct]
+ """
+ The Square product, such as Square Point of Sale (POS),
+ Square Invoices, or Square Virtual Terminal.
+ See [ExternalSquareProduct](#type-externalsquareproduct) for possible values
+ """
+
+ application_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square ID assigned to the application used to take the payment.
+ Application developers can use this information to identify payments that
+ their application processed.
+ For example, if a developer uses a custom application to process payments,
+ this field contains the application ID from the Developer Dashboard.
+ If a seller uses a [Square App Marketplace](https://developer.squareup.com/docs/app-marketplace)
+ application to process payments, the field contains the corresponding application ID.
+ """
diff --git a/src/square/requests/appointment_segment.py b/src/square/requests/appointment_segment.py
new file mode 100644
index 00000000..45dc63a1
--- /dev/null
+++ b/src/square/requests/appointment_segment.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class AppointmentSegmentParams(typing_extensions.TypedDict):
+ """
+ Defines an appointment segment of a booking.
+ """
+
+ duration_minutes: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The time span in minutes of an appointment segment.
+ """
+
+ service_variation_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment.
+ """
+
+ team_member_id: str
+ """
+ The ID of the [TeamMember](entity:TeamMember) object representing the team member booked in this segment.
+ """
+
+ service_variation_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The current version of the item variation representing the service booked in this segment.
+ """
+
+ intermission_minutes: typing_extensions.NotRequired[int]
+ """
+ Time between the end of this segment and the beginning of the subsequent segment.
+ """
+
+ any_team_member: typing_extensions.NotRequired[bool]
+ """
+ Whether the customer accepts any team member, instead of a specific one, to serve this segment.
+ """
+
+ resource_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ The IDs of the seller-accessible resources used for this appointment segment.
+ """
diff --git a/src/square/requests/availability.py b/src/square/requests/availability.py
new file mode 100644
index 00000000..4d7446c3
--- /dev/null
+++ b/src/square/requests/availability.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .appointment_segment import AppointmentSegmentParams
+
+
+class AvailabilityParams(typing_extensions.TypedDict):
+ """
+ Defines an appointment slot that encapsulates the appointment segments, location and starting time available for booking.
+ """
+
+ start_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The RFC 3339 timestamp specifying the beginning time of the slot available for booking.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the location available for booking.
+ """
+
+ appointment_segments: typing_extensions.NotRequired[typing.Optional[typing.Sequence[AppointmentSegmentParams]]]
+ """
+ The list of appointment segments available for booking
+ """
diff --git a/src/square/requests/bank_account.py b/src/square/requests/bank_account.py
new file mode 100644
index 00000000..e23c72e4
--- /dev/null
+++ b/src/square/requests/bank_account.py
@@ -0,0 +1,122 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.bank_account_status import BankAccountStatus
+from ..types.bank_account_type import BankAccountType
+from ..types.country import Country
+from ..types.currency import Currency
+
+
+class BankAccountParams(typing_extensions.TypedDict):
+ """
+ Represents a bank account. For more information about
+ linking a bank account to a Square account, see
+ [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).
+ """
+
+ id: str
+ """
+ The unique, Square-issued identifier for the bank account.
+ """
+
+ account_number_suffix: str
+ """
+ The last few digits of the account number.
+ """
+
+ country: Country
+ """
+ The ISO 3166 Alpha-2 country code where the bank account is based.
+ See [Country](#type-country) for possible values
+ """
+
+ currency: Currency
+ """
+ The 3-character ISO 4217 currency code indicating the operating
+ currency of the bank account. For example, the currency code for US dollars
+ is `USD`.
+ See [Currency](#type-currency) for possible values
+ """
+
+ account_type: BankAccountType
+ """
+ The financial purpose of the associated bank account.
+ See [BankAccountType](#type-bankaccounttype) for possible values
+ """
+
+ holder_name: str
+ """
+ Name of the account holder. This name must match the name
+ on the targeted bank account record.
+ """
+
+ primary_bank_identification_number: str
+ """
+ Primary identifier for the bank. For more information, see
+ [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).
+ """
+
+ secondary_bank_identification_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Secondary identifier for the bank. For more information, see
+ [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).
+ """
+
+ debit_mandate_reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Reference identifier that will be displayed to UK bank account owners
+ when collecting direct debit authorization. Only required for UK bank accounts.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Client-provided identifier for linking the banking account to an entity
+ in a third-party system (for example, a bank account number or a user identifier).
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The location to which the bank account belongs.
+ """
+
+ status: BankAccountStatus
+ """
+ Read-only. The current verification status of this BankAccount object.
+ See [BankAccountStatus](#type-bankaccountstatus) for possible values
+ """
+
+ creditable: bool
+ """
+ Indicates whether it is possible for Square to send money to this bank account.
+ """
+
+ debitable: bool
+ """
+ Indicates whether it is possible for Square to take money from this
+ bank account.
+ """
+
+ fingerprint: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A Square-assigned, unique identifier for the bank account based on the
+ account information. The account fingerprint can be used to compare account
+ entries and determine if the they represent the same real-world bank account.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The current version of the `BankAccount`.
+ """
+
+ bank_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Read only. Name of actual financial institution.
+ For example "Bank of America".
+ """
+
+ customer_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the customer who owns the bank account
+ """
diff --git a/src/square/requests/bank_account_created_event.py b/src/square/requests/bank_account_created_event.py
new file mode 100644
index 00000000..ef1a02f6
--- /dev/null
+++ b/src/square/requests/bank_account_created_event.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account_created_event_data import BankAccountCreatedEventDataParams
+
+
+class BankAccountCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when you link an external bank account to a Square
+ account in the Seller Dashboard. Square sets the initial status to
+ `VERIFICATION_IN_PROGRESS` and publishes the event.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"bank_account.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[BankAccountCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/bank_account_created_event_data.py b/src/square/requests/bank_account_created_event_data.py
new file mode 100644
index 00000000..b8091ab0
--- /dev/null
+++ b/src/square/requests/bank_account_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account_created_event_object import BankAccountCreatedEventObjectParams
+
+
+class BankAccountCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"bank_account"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected bank account.
+ """
+
+ object: typing_extensions.NotRequired[BankAccountCreatedEventObjectParams]
+ """
+ An object containing the created bank account.
+ """
diff --git a/src/square/requests/bank_account_created_event_object.py b/src/square/requests/bank_account_created_event_object.py
new file mode 100644
index 00000000..5b5144a0
--- /dev/null
+++ b/src/square/requests/bank_account_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .bank_account import BankAccountParams
+
+
+class BankAccountCreatedEventObjectParams(typing_extensions.TypedDict):
+ bank_account: typing_extensions.NotRequired[BankAccountParams]
+ """
+ The created bank account.
+ """
diff --git a/src/square/requests/bank_account_disabled_event.py b/src/square/requests/bank_account_disabled_event.py
new file mode 100644
index 00000000..1695ebc5
--- /dev/null
+++ b/src/square/requests/bank_account_disabled_event.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account_disabled_event_data import BankAccountDisabledEventDataParams
+
+
+class BankAccountDisabledEventParams(typing_extensions.TypedDict):
+ """
+ Published when Square sets the status of a
+ [BankAccount](entity:BankAccount) to `DISABLED`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"bank_account.disabled"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was disabled, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[BankAccountDisabledEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/bank_account_disabled_event_data.py b/src/square/requests/bank_account_disabled_event_data.py
new file mode 100644
index 00000000..432f3ef0
--- /dev/null
+++ b/src/square/requests/bank_account_disabled_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account_disabled_event_object import BankAccountDisabledEventObjectParams
+
+
+class BankAccountDisabledEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"bank_account"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected bank account.
+ """
+
+ object: typing_extensions.NotRequired[BankAccountDisabledEventObjectParams]
+ """
+ An object containing the disabled bank account.
+ """
diff --git a/src/square/requests/bank_account_disabled_event_object.py b/src/square/requests/bank_account_disabled_event_object.py
new file mode 100644
index 00000000..733e544a
--- /dev/null
+++ b/src/square/requests/bank_account_disabled_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .bank_account import BankAccountParams
+
+
+class BankAccountDisabledEventObjectParams(typing_extensions.TypedDict):
+ bank_account: typing_extensions.NotRequired[BankAccountParams]
+ """
+ The disabled bank account.
+ """
diff --git a/src/square/requests/bank_account_payment_details.py b/src/square/requests/bank_account_payment_details.py
new file mode 100644
index 00000000..f50e0b3d
--- /dev/null
+++ b/src/square/requests/bank_account_payment_details.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .ach_details import AchDetailsParams
+from .error import ErrorParams
+
+
+class BankAccountPaymentDetailsParams(typing_extensions.TypedDict):
+ """
+ Additional details about BANK_ACCOUNT type payments.
+ """
+
+ bank_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the bank associated with the bank account.
+ """
+
+ transfer_type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the bank transfer. The type can be `ACH` or `UNKNOWN`.
+ """
+
+ account_ownership_type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ownership type of the bank account performing the transfer.
+ The type can be `INDIVIDUAL`, `COMPANY`, or `ACCOUNT_TYPE_UNKNOWN`.
+ """
+
+ fingerprint: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Uniquely identifies the bank account for this seller and can be used
+ to determine if payments are from the same bank account.
+ """
+
+ country: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The two-letter ISO code representing the country the bank account is located in.
+ """
+
+ statement_description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The statement description as sent to the bank.
+ """
+
+ ach_details: typing_extensions.NotRequired[AchDetailsParams]
+ """
+ ACH-specific information about the transfer. The information is only populated
+ if the `transfer_type` is `ACH`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Optional[typing.Sequence[ErrorParams]]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/bank_account_verified_event.py b/src/square/requests/bank_account_verified_event.py
new file mode 100644
index 00000000..a0a26d87
--- /dev/null
+++ b/src/square/requests/bank_account_verified_event.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account_verified_event_data import BankAccountVerifiedEventDataParams
+
+
+class BankAccountVerifiedEventParams(typing_extensions.TypedDict):
+ """
+ Published when Square sets the status of a
+ [BankAccount](entity:BankAccount) to `VERIFIED`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"bank_account.verified"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was verified, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[BankAccountVerifiedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/bank_account_verified_event_data.py b/src/square/requests/bank_account_verified_event_data.py
new file mode 100644
index 00000000..bd1d7af5
--- /dev/null
+++ b/src/square/requests/bank_account_verified_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account_verified_event_object import BankAccountVerifiedEventObjectParams
+
+
+class BankAccountVerifiedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"bank_account"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected bank account.
+ """
+
+ object: typing_extensions.NotRequired[BankAccountVerifiedEventObjectParams]
+ """
+ An object containing the verified bank account.
+ """
diff --git a/src/square/requests/bank_account_verified_event_object.py b/src/square/requests/bank_account_verified_event_object.py
new file mode 100644
index 00000000..960daec5
--- /dev/null
+++ b/src/square/requests/bank_account_verified_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .bank_account import BankAccountParams
+
+
+class BankAccountVerifiedEventObjectParams(typing_extensions.TypedDict):
+ bank_account: typing_extensions.NotRequired[BankAccountParams]
+ """
+ The verified bank account.
+ """
diff --git a/src/square/requests/batch_change_inventory_request.py b/src/square/requests/batch_change_inventory_request.py
new file mode 100644
index 00000000..f0431b4b
--- /dev/null
+++ b/src/square/requests/batch_change_inventory_request.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .inventory_change import InventoryChangeParams
+
+
+class BatchChangeInventoryRequestParams(typing_extensions.TypedDict):
+ idempotency_key: str
+ """
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+ """
+
+ changes: typing_extensions.NotRequired[typing.Optional[typing.Sequence[InventoryChangeParams]]]
+ """
+ The set of physical counts and inventory adjustments to be made.
+ Changes are applied based on the client-supplied timestamp and may be sent
+ out of order.
+ """
+
+ ignore_unchanged_counts: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the current physical count should be ignored if
+ the quantity is unchanged since the last physical count. Default: `true`.
+ """
diff --git a/src/square/requests/batch_change_inventory_response.py b/src/square/requests/batch_change_inventory_response.py
new file mode 100644
index 00000000..3082632c
--- /dev/null
+++ b/src/square/requests/batch_change_inventory_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_change import InventoryChangeParams
+from .inventory_count import InventoryCountParams
+
+
+class BatchChangeInventoryResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ counts: typing_extensions.NotRequired[typing.Sequence[InventoryCountParams]]
+ """
+ The current counts for all objects referenced in the request.
+ """
+
+ changes: typing_extensions.NotRequired[typing.Sequence[InventoryChangeParams]]
+ """
+ Changes created for the request.
+ """
diff --git a/src/square/requests/batch_create_team_members_response.py b/src/square/requests/batch_create_team_members_response.py
new file mode 100644
index 00000000..21274d20
--- /dev/null
+++ b/src/square/requests/batch_create_team_members_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .create_team_member_response import CreateTeamMemberResponseParams
+from .error import ErrorParams
+
+
+class BatchCreateTeamMembersResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from a bulk create request containing the created `TeamMember` objects or error messages.
+ """
+
+ team_members: typing_extensions.NotRequired[typing.Dict[str, CreateTeamMemberResponseParams]]
+ """
+ The successfully created `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/batch_create_vendors_response.py b/src/square/requests/batch_create_vendors_response.py
new file mode 100644
index 00000000..459aee16
--- /dev/null
+++ b/src/square/requests/batch_create_vendors_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .create_vendor_response import CreateVendorResponseParams
+from .error import ErrorParams
+
+
+class BatchCreateVendorsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [BulkCreateVendors](api-endpoint:Vendors-BulkCreateVendors).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ responses: typing_extensions.NotRequired[typing.Dict[str, CreateVendorResponseParams]]
+ """
+ A set of [CreateVendorResponse](entity:CreateVendorResponse) objects encapsulating successfully created [Vendor](entity:Vendor)
+ objects or error responses for failed attempts. The set is represented by
+ a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The idempotency keys correspond to those specified
+ in the input.
+ """
diff --git a/src/square/requests/batch_delete_catalog_objects_response.py b/src/square/requests/batch_delete_catalog_objects_response.py
new file mode 100644
index 00000000..e62f72b4
--- /dev/null
+++ b/src/square/requests/batch_delete_catalog_objects_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class BatchDeleteCatalogObjectsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ deleted_object_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ The IDs of all CatalogObjects deleted by this request.
+ """
+
+ deleted_at: typing_extensions.NotRequired[str]
+ """
+ The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this deletion in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".
+ """
diff --git a/src/square/requests/batch_get_catalog_objects_response.py b/src/square/requests/batch_get_catalog_objects_response.py
new file mode 100644
index 00000000..3365036e
--- /dev/null
+++ b/src/square/requests/batch_get_catalog_objects_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_object import CatalogObjectParams
+from .error import ErrorParams
+
+
+class BatchGetCatalogObjectsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ objects: typing_extensions.NotRequired[typing.Sequence[CatalogObjectParams]]
+ """
+ A list of [CatalogObject](entity:CatalogObject)s returned.
+ """
+
+ related_objects: typing_extensions.NotRequired[typing.Sequence[CatalogObjectParams]]
+ """
+ A list of [CatalogObject](entity:CatalogObject)s referenced by the object in the `objects` field.
+ """
diff --git a/src/square/requests/batch_get_inventory_changes_response.py b/src/square/requests/batch_get_inventory_changes_response.py
new file mode 100644
index 00000000..02572308
--- /dev/null
+++ b/src/square/requests/batch_get_inventory_changes_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_change import InventoryChangeParams
+
+
+class BatchGetInventoryChangesResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ changes: typing_extensions.NotRequired[typing.Sequence[InventoryChangeParams]]
+ """
+ The current calculated inventory changes for the requested objects
+ and locations.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
diff --git a/src/square/requests/batch_get_inventory_counts_request.py b/src/square/requests/batch_get_inventory_counts_request.py
new file mode 100644
index 00000000..bc4d2231
--- /dev/null
+++ b/src/square/requests/batch_get_inventory_counts_request.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.inventory_state import InventoryState
+
+
+class BatchGetInventoryCountsRequestParams(typing_extensions.TypedDict):
+ catalog_object_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The filter to return results by `CatalogObject` ID.
+ The filter is applicable only when set. The default is null.
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The filter to return results by `Location` ID.
+ This filter is applicable only when set. The default is null.
+ """
+
+ updated_after: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+ """
+
+ cursor: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
+
+ states: typing_extensions.NotRequired[typing.Optional[typing.Sequence[InventoryState]]]
+ """
+ The filter to return results by `InventoryState`. The filter is only applicable when set.
+ Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
+ The default is null.
+ """
+
+ limit: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The number of [records](entity:InventoryCount) to return.
+ """
diff --git a/src/square/requests/batch_get_inventory_counts_response.py b/src/square/requests/batch_get_inventory_counts_response.py
new file mode 100644
index 00000000..3ad8c952
--- /dev/null
+++ b/src/square/requests/batch_get_inventory_counts_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_count import InventoryCountParams
+
+
+class BatchGetInventoryCountsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ counts: typing_extensions.NotRequired[typing.Sequence[InventoryCountParams]]
+ """
+ The current calculated inventory counts for the requested objects
+ and locations.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
diff --git a/src/square/requests/batch_get_orders_response.py b/src/square/requests/batch_get_orders_response.py
new file mode 100644
index 00000000..0acdaa86
--- /dev/null
+++ b/src/square/requests/batch_get_orders_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .order import OrderParams
+
+
+class BatchGetOrdersResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `BatchRetrieveOrders` endpoint.
+ """
+
+ orders: typing_extensions.NotRequired[typing.Sequence[OrderParams]]
+ """
+ The requested orders. This will omit any requested orders that do not exist.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/batch_get_vendors_response.py b/src/square/requests/batch_get_vendors_response.py
new file mode 100644
index 00000000..d4cf11a7
--- /dev/null
+++ b/src/square/requests/batch_get_vendors_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .get_vendor_response import GetVendorResponseParams
+
+
+class BatchGetVendorsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [BulkRetrieveVendors](api-endpoint:Vendors-BulkRetrieveVendors).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ responses: typing_extensions.NotRequired[typing.Dict[str, GetVendorResponseParams]]
+ """
+ The set of [RetrieveVendorResponse](entity:RetrieveVendorResponse) objects encapsulating successfully retrieved [Vendor](entity:Vendor)
+ objects or error responses for failed attempts. The set is represented by
+ a collection of `Vendor`-ID/`Vendor`-object or `Vendor`-ID/error-object pairs.
+ """
diff --git a/src/square/requests/batch_retrieve_inventory_changes_request.py b/src/square/requests/batch_retrieve_inventory_changes_request.py
new file mode 100644
index 00000000..e119fe22
--- /dev/null
+++ b/src/square/requests/batch_retrieve_inventory_changes_request.py
@@ -0,0 +1,78 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.inventory_change_type import InventoryChangeType
+from ..types.inventory_state import InventoryState
+from .batch_retrieve_inventory_changes_sort import BatchRetrieveInventoryChangesSortParams
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonIdParams
+
+
+class BatchRetrieveInventoryChangesRequestParams(typing_extensions.TypedDict):
+ catalog_object_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The filter to return results by `CatalogObject` ID.
+ The filter is only applicable when set. The default value is null.
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The filter to return results by `Location` ID.
+ The filter is only applicable when set. The default value is null.
+ """
+
+ types: typing_extensions.NotRequired[typing.Optional[typing.Sequence[InventoryChangeType]]]
+ """
+ The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
+ The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
+ """
+
+ states: typing_extensions.NotRequired[typing.Optional[typing.Sequence[InventoryState]]]
+ """
+ The filter to return `ADJUSTMENT` query results by
+ `InventoryState`. This filter is only applied when set.
+ The default value is null.
+ """
+
+ updated_after: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+ """
+
+ updated_before: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The filter to return results with their `created_at` or `calculated_at` value
+ strictly before the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+ """
+
+ cursor: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
+
+ limit: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The number of [records](entity:InventoryChange) to return.
+ """
+
+ sort: typing_extensions.NotRequired[BatchRetrieveInventoryChangesSortParams]
+ """
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+ """
+
+ reason_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]]
+ """
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+ """
diff --git a/src/square/requests/batch_retrieve_inventory_changes_sort.py b/src/square/requests/batch_retrieve_inventory_changes_sort.py
new file mode 100644
index 00000000..6258f4a6
--- /dev/null
+++ b/src/square/requests/batch_retrieve_inventory_changes_sort.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.batch_retrieve_inventory_changes_sort_field import BatchRetrieveInventoryChangesSortField
+from ..types.sort_order import SortOrder
+
+
+class BatchRetrieveInventoryChangesSortParams(typing_extensions.TypedDict):
+ field: typing_extensions.NotRequired[BatchRetrieveInventoryChangesSortField]
+ """
+ The field to sort inventory changes by.
+ See [Field](#type-field) for possible values
+ """
+
+ order: typing_extensions.NotRequired[SortOrder]
+ """
+ The order to sort inventory changes by.
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/batch_update_team_members_response.py b/src/square/requests/batch_update_team_members_response.py
new file mode 100644
index 00000000..bba659d7
--- /dev/null
+++ b/src/square/requests/batch_update_team_members_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .update_team_member_response import UpdateTeamMemberResponseParams
+
+
+class BatchUpdateTeamMembersResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from a bulk update request containing the updated `TeamMember` objects or error messages.
+ """
+
+ team_members: typing_extensions.NotRequired[typing.Dict[str, UpdateTeamMemberResponseParams]]
+ """
+ The successfully updated `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/batch_update_vendors_response.py b/src/square/requests/batch_update_vendors_response.py
new file mode 100644
index 00000000..fd327cc1
--- /dev/null
+++ b/src/square/requests/batch_update_vendors_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .update_vendor_response import UpdateVendorResponseParams
+
+
+class BatchUpdateVendorsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [BulkUpdateVendors](api-endpoint:Vendors-BulkUpdateVendors).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ responses: typing_extensions.NotRequired[typing.Dict[str, UpdateVendorResponseParams]]
+ """
+ A set of [UpdateVendorResponse](entity:UpdateVendorResponse) objects encapsulating successfully created [Vendor](entity:Vendor)
+ objects or error responses for failed attempts. The set is represented by a collection of `Vendor`-ID/`UpdateVendorResponse`-object or
+ `Vendor`-ID/error-object pairs.
+ """
diff --git a/src/square/requests/batch_upsert_catalog_objects_response.py b/src/square/requests/batch_upsert_catalog_objects_response.py
new file mode 100644
index 00000000..4d7c8106
--- /dev/null
+++ b/src/square/requests/batch_upsert_catalog_objects_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_id_mapping import CatalogIdMappingParams
+from .catalog_object import CatalogObjectParams
+from .error import ErrorParams
+
+
+class BatchUpsertCatalogObjectsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ objects: typing_extensions.NotRequired[typing.Sequence[CatalogObjectParams]]
+ """
+ The created successfully created CatalogObjects.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".
+ """
+
+ id_mappings: typing_extensions.NotRequired[typing.Sequence[CatalogIdMappingParams]]
+ """
+ The mapping between client and server IDs for this upsert.
+ """
diff --git a/src/square/requests/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.py b/src/square/requests/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.py
new file mode 100644
index 00000000..91807d6f
--- /dev/null
+++ b/src/square/requests/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+
+
+class BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestParams(typing_extensions.TypedDict):
+ """
+ Represents an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes)
+ request. An individual request contains a customer ID, the custom attribute to create or update,
+ and an optional idempotency key.
+ """
+
+ customer_id: str
+ """
+ The ID of the target [customer profile](entity:Customer).
+ """
+
+ custom_attribute: CustomAttributeParams
+ """
+ The custom attribute to create or update, with following fields:
+
+ - `key`. This key must match the `key` of a custom attribute definition in the Square seller
+ account. If the requesting application is not the definition owner, you must provide the qualified key.
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for update operations, include this optional field in the request and set the
+ value to the current version of the custom attribute.
+ """
+
+ idempotency_key: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique identifier for this individual upsert request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
diff --git a/src/square/requests/batch_upsert_customer_custom_attributes_response.py b/src/square/requests/batch_upsert_customer_custom_attributes_response.py
new file mode 100644
index 00000000..31b0bb5e
--- /dev/null
+++ b/src/square/requests/batch_upsert_customer_custom_attributes_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response import (
+ BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponseParams,
+)
+from .error import ErrorParams
+
+
+class BatchUpsertCustomerCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual upsert request.
+ """
+
+ values: typing_extensions.NotRequired[
+ typing.Dict[str, BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponseParams]
+ ]
+ """
+ A map of responses that correspond to individual upsert requests. Each response has the
+ same ID as the corresponding request and contains either a `customer_id` and `custom_attribute` or an `errors` field.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.py b/src/square/requests/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.py
new file mode 100644
index 00000000..ee54f4d5
--- /dev/null
+++ b/src/square/requests/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponseParams(
+ typing_extensions.TypedDict
+):
+ """
+ Represents a response for an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) operation.
+ """
+
+ customer_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the customer profile associated with the custom attribute.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred while processing the individual request.
+ """
diff --git a/src/square/requests/booking.py b/src/square/requests/booking.py
new file mode 100644
index 00000000..238b18f7
--- /dev/null
+++ b/src/square/requests/booking.py
@@ -0,0 +1,109 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.booking_booking_source import BookingBookingSource
+from ..types.booking_status import BookingStatus
+from ..types.business_appointment_settings_booking_location_type import BusinessAppointmentSettingsBookingLocationType
+from .address import AddressParams
+from .appointment_segment import AppointmentSegmentParams
+from .booking_creator_details import BookingCreatorDetailsParams
+
+
+class BookingParams(typing_extensions.TypedDict):
+ """
+ Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
+ at a given location to a requesting customer in one or more appointment segments.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique ID of this object representing a booking.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The revision number for the booking used for optimistic concurrency.
+ """
+
+ status: typing_extensions.NotRequired[BookingStatus]
+ """
+ The status of the booking, describing where the booking stands with respect to the booking state machine.
+ See [BookingStatus](#type-bookingstatus) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The RFC 3339 timestamp specifying the creation time of this booking.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The RFC 3339 timestamp specifying the most recent update time of this booking.
+ """
+
+ start_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The RFC 3339 timestamp specifying the starting time of this booking.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [Location](entity:Location) object representing the location where the booked service is provided. Once set when the booking is created, its value cannot be changed.
+ """
+
+ customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [Customer](entity:Customer) object representing the customer receiving the booked service.
+ """
+
+ customer_note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The free-text field for the customer to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a relevant [CatalogObject](entity:CatalogObject) instance.
+ """
+
+ seller_note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The free-text field for the seller to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a specific [CatalogObject](entity:CatalogObject) instance.
+ This field should not be visible to customers.
+ """
+
+ appointment_segments: typing_extensions.NotRequired[typing.Optional[typing.Sequence[AppointmentSegmentParams]]]
+ """
+ A list of appointment segments for this booking.
+ """
+
+ transition_time_minutes: typing_extensions.NotRequired[int]
+ """
+ Additional time at the end of a booking.
+ Applications should not make this field visible to customers of a seller.
+ """
+
+ all_day: typing_extensions.NotRequired[bool]
+ """
+ Whether the booking is of a full business day.
+ """
+
+ location_type: typing_extensions.NotRequired[BusinessAppointmentSettingsBookingLocationType]
+ """
+ The type of location where the booking is held.
+ See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values
+ """
+
+ creator_details: typing_extensions.NotRequired[BookingCreatorDetailsParams]
+ """
+ Information about the booking creator.
+ """
+
+ source: typing_extensions.NotRequired[BookingBookingSource]
+ """
+ The source of the booking.
+ Access to this field requires seller-level permissions.
+ See [BookingBookingSource](#type-bookingbookingsource) for possible values
+ """
+
+ address: typing_extensions.NotRequired[AddressParams]
+ """
+ Stores a customer address if the location type is `CUSTOMER_LOCATION`.
+ """
diff --git a/src/square/requests/booking_created_event.py b/src/square/requests/booking_created_event.py
new file mode 100644
index 00000000..d7899af1
--- /dev/null
+++ b/src/square/requests/booking_created_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking_created_event_data import BookingCreatedEventDataParams
+
+
+class BookingCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking is created.
+
+ To receive this event with buyer-level permissions, you must have `APPOINTMENTS_READ` set for the OAuth scope.
+ To receive this event with seller-level permissions, you must have `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` set for the OAuth scope.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[BookingCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/booking_created_event_data.py b/src/square/requests/booking_created_event_data.py
new file mode 100644
index 00000000..c7b82907
--- /dev/null
+++ b/src/square/requests/booking_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking_created_event_object import BookingCreatedEventObjectParams
+
+
+class BookingCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `"booking"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[BookingCreatedEventObjectParams]
+ """
+ An object containing the created booking.
+ """
diff --git a/src/square/requests/booking_created_event_object.py b/src/square/requests/booking_created_event_object.py
new file mode 100644
index 00000000..7455923d
--- /dev/null
+++ b/src/square/requests/booking_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .booking import BookingParams
+
+
+class BookingCreatedEventObjectParams(typing_extensions.TypedDict):
+ booking: typing_extensions.NotRequired[BookingParams]
+ """
+ The created booking.
+ """
diff --git a/src/square/requests/booking_creator_details.py b/src/square/requests/booking_creator_details.py
new file mode 100644
index 00000000..fa8f39ec
--- /dev/null
+++ b/src/square/requests/booking_creator_details.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.booking_creator_details_creator_type import BookingCreatorDetailsCreatorType
+
+
+class BookingCreatorDetailsParams(typing_extensions.TypedDict):
+ """
+ Information about a booking creator.
+ """
+
+ creator_type: typing_extensions.NotRequired[BookingCreatorDetailsCreatorType]
+ """
+ The seller-accessible type of the creator of the booking.
+ See [BookingCreatorDetailsCreatorType](#type-bookingcreatordetailscreatortype) for possible values
+ """
+
+ team_member_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the team member who created the booking, when the booking creator is of the `TEAM_MEMBER` type.
+ Access to this field requires seller-level permissions.
+ """
+
+ customer_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the customer who created the booking, when the booking creator is of the `CUSTOMER` type.
+ Access to this field requires seller-level permissions.
+ """
diff --git a/src/square/requests/booking_custom_attribute_definition_owned_created_event.py b/src/square/requests/booking_custom_attribute_definition_owned_created_event.py
new file mode 100644
index 00000000..76423654
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_definition_owned_created_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class BookingCustomAttributeDefinitionOwnedCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ is created by the subscribing application. Subscribe to this event to be notified
+ when your application creates a booking custom attribute definition.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.owned.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/booking_custom_attribute_definition_owned_deleted_event.py b/src/square/requests/booking_custom_attribute_definition_owned_deleted_event.py
new file mode 100644
index 00000000..f3544ec1
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_definition_owned_deleted_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class BookingCustomAttributeDefinitionOwnedDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ is deleted by the subscribing application. Subscribe to this event to be notified
+ when your application deletes a booking custom attribute definition.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.owned.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/booking_custom_attribute_definition_owned_updated_event.py b/src/square/requests/booking_custom_attribute_definition_owned_updated_event.py
new file mode 100644
index 00000000..18687fc1
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_definition_owned_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class BookingCustomAttributeDefinitionOwnedUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ is updated by the subscribing application. Subscribe to this event to be notified
+ when your application updates a booking custom attribute definition.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.owned.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/booking_custom_attribute_definition_visible_created_event.py b/src/square/requests/booking_custom_attribute_definition_visible_created_event.py
new file mode 100644
index 00000000..a7640ae6
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_definition_visible_created_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class BookingCustomAttributeDefinitionVisibleCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is created.
+ An application that subscribes to this event is notified when a booking custom attribute definition is created
+ by any application for which the subscribing application has read access to the booking custom attribute definition.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.visible.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/booking_custom_attribute_definition_visible_deleted_event.py b/src/square/requests/booking_custom_attribute_definition_visible_deleted_event.py
new file mode 100644
index 00000000..5450aa76
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_definition_visible_deleted_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class BookingCustomAttributeDefinitionVisibleDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted.
+ An application that subscribes to this event is notified when a booking custom attribute definition is deleted
+ by any application for which the subscribing application has read access to the booking custom attribute definition.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.visible.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/booking_custom_attribute_definition_visible_updated_event.py b/src/square/requests/booking_custom_attribute_definition_visible_updated_event.py
new file mode 100644
index 00000000..bfb8f94a
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_definition_visible_updated_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class BookingCustomAttributeDefinitionVisibleUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated.
+ An application that subscribes to this event is notified when a booking custom attribute definition is updated
+ by any application for which the subscribing application has read access to the booking custom attribute definition.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.visible.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/booking_custom_attribute_delete_request.py b/src/square/requests/booking_custom_attribute_delete_request.py
new file mode 100644
index 00000000..1ae622f2
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_delete_request.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class BookingCustomAttributeDeleteRequestParams(typing_extensions.TypedDict):
+ """
+ Represents an individual delete request in a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes)
+ request. An individual request contains a booking ID, the custom attribute to delete, and an optional idempotency key.
+ """
+
+ booking_id: str
+ """
+ The ID of the target [booking](entity:Booking).
+ """
+
+ key: str
+ """
+ The key of the custom attribute to delete. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+ """
diff --git a/src/square/requests/booking_custom_attribute_delete_response.py b/src/square/requests/booking_custom_attribute_delete_response.py
new file mode 100644
index 00000000..50c1b51f
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_delete_response.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class BookingCustomAttributeDeleteResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response for an individual upsert request in a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) operation.
+ """
+
+ booking_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [booking](entity:Booking) associated with the custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred while processing the individual request.
+ """
diff --git a/src/square/requests/booking_custom_attribute_owned_deleted_event.py b/src/square/requests/booking_custom_attribute_owned_deleted_event.py
new file mode 100644
index 00000000..a68f6667
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_owned_deleted_event.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class BookingCustomAttributeOwnedDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking [custom attribute](entity:CustomAttribute)
+ associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is
+ owned by the subscribing application is deleted.
+ Subscribe to this event to be notified
+ when your application deletes a booking custom attribute.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.custom_attribute.owned.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/booking_custom_attribute_owned_updated_event.py b/src/square/requests/booking_custom_attribute_owned_updated_event.py
new file mode 100644
index 00000000..ccc53db9
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_owned_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class BookingCustomAttributeOwnedUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking [custom attribute](entity:CustomAttribute)
+ is updated by the subscribing application. Subscribe to this event to be notified
+ when your application updates a booking custom attribute.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.custom_attribute.owned.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/booking_custom_attribute_upsert_request.py b/src/square/requests/booking_custom_attribute_upsert_request.py
new file mode 100644
index 00000000..7296205f
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_upsert_request.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+
+
+class BookingCustomAttributeUpsertRequestParams(typing_extensions.TypedDict):
+ """
+ Represents an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes)
+ request. An individual request contains a booking ID, the custom attribute to create or update,
+ and an optional idempotency key.
+ """
+
+ booking_id: str
+ """
+ The ID of the target [booking](entity:Booking).
+ """
+
+ custom_attribute: CustomAttributeParams
+ """
+ The custom attribute to create or update, with following fields:
+
+ - `key`. This key must match the `key` of a custom attribute definition in the Square seller
+ account. If the requesting application is not the definition owner, you must provide the qualified key.
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/booking-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for update operations, include this optional field in the request and set the
+ value to the current version of the custom attribute.
+ """
+
+ idempotency_key: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique identifier for this individual upsert request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
diff --git a/src/square/requests/booking_custom_attribute_upsert_response.py b/src/square/requests/booking_custom_attribute_upsert_response.py
new file mode 100644
index 00000000..af3d32c6
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_upsert_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class BookingCustomAttributeUpsertResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response for an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) operation.
+ """
+
+ booking_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [booking](entity:Booking) associated with the custom attribute.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred while processing the individual request.
+ """
diff --git a/src/square/requests/booking_custom_attribute_visible_deleted_event.py b/src/square/requests/booking_custom_attribute_visible_deleted_event.py
new file mode 100644
index 00000000..5f1ad6f9
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_visible_deleted_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class BookingCustomAttributeVisibleDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking [custom attribute](entity:CustomAttribute) with
+ the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted.
+ An application that subscribes to this event is notified when a booking custom attribute is deleted
+ by any application for which the subscribing application has read access to the booking custom attribute.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.custom_attribute.visible.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/booking_custom_attribute_visible_updated_event.py b/src/square/requests/booking_custom_attribute_visible_updated_event.py
new file mode 100644
index 00000000..636e5425
--- /dev/null
+++ b/src/square/requests/booking_custom_attribute_visible_updated_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class BookingCustomAttributeVisibleUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking [custom attribute](entity:CustomAttribute)
+ with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated.
+ An application that subscribes to this event is notified when a booking custom attribute is updated
+ by any application for which the subscribing application has read access to the booking custom attribute.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.custom_attribute.visible.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/booking_updated_event.py b/src/square/requests/booking_updated_event.py
new file mode 100644
index 00000000..0a677d28
--- /dev/null
+++ b/src/square/requests/booking_updated_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking_updated_event_data import BookingUpdatedEventDataParams
+
+
+class BookingUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a booking is updated or cancelled.
+
+ To receive this event with buyer-level permissions, you must have `APPOINTMENTS_READ` set for the OAuth scope.
+ To receive this event with seller-level permissions, you must have `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` set for the OAuth scope.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"booking.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[BookingUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/booking_updated_event_data.py b/src/square/requests/booking_updated_event_data.py
new file mode 100644
index 00000000..5cae0fff
--- /dev/null
+++ b/src/square/requests/booking_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking_updated_event_object import BookingUpdatedEventObjectParams
+
+
+class BookingUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `"booking"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[BookingUpdatedEventObjectParams]
+ """
+ An object containing the updated booking.
+ """
diff --git a/src/square/requests/booking_updated_event_object.py b/src/square/requests/booking_updated_event_object.py
new file mode 100644
index 00000000..e2465541
--- /dev/null
+++ b/src/square/requests/booking_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .booking import BookingParams
+
+
+class BookingUpdatedEventObjectParams(typing_extensions.TypedDict):
+ booking: typing_extensions.NotRequired[BookingParams]
+ """
+ The updated booking.
+ """
diff --git a/src/square/requests/break_.py b/src/square/requests/break_.py
new file mode 100644
index 00000000..3d92ee8b
--- /dev/null
+++ b/src/square/requests/break_.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class BreakParams(typing_extensions.TypedDict):
+ """
+ A record of a team member's break on a [timecard](entity:Timecard).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The UUID for this object.
+ """
+
+ start_at: str
+ """
+ RFC 3339; follows the same timezone information as the [timecard](entity:Timecard). Precision up to
+ the minute is respected; seconds are truncated.
+ """
+
+ end_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ RFC 3339; follows the same timezone information as the [timecard](entity:Timecard). Precision up to
+ the minute is respected; seconds are truncated.
+ """
+
+ break_type_id: str
+ """
+ The [BreakType](entity:BreakType) that this break was templated on.
+ """
+
+ name: str
+ """
+ A human-readable name.
+ """
+
+ expected_duration: str
+ """
+ Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of
+ the break.
+
+ Example for break expected duration of 15 minutes: PT15M
+ """
+
+ is_paid: bool
+ """
+ Whether this break counts towards time worked for compensation
+ purposes.
+ """
diff --git a/src/square/requests/break_type.py b/src/square/requests/break_type.py
new file mode 100644
index 00000000..cc158217
--- /dev/null
+++ b/src/square/requests/break_type.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class BreakTypeParams(typing_extensions.TypedDict):
+ """
+ A template for a type of [break](entity:Break) that can be added to a
+ [timecard](entity:Timecard), including the expected duration and paid status.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The UUID for this object.
+ """
+
+ location_id: str
+ """
+ The ID of the business location this type of break applies to.
+ """
+
+ break_name: str
+ """
+ A human-readable name for this type of break. The name is displayed to
+ team members in Square products.
+ """
+
+ expected_duration: str
+ """
+ Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of
+ this break. Precision less than minutes is truncated.
+
+ Example for break expected duration of 15 minutes: PT15M
+ """
+
+ is_paid: bool
+ """
+ Whether this break counts towards time worked for compensation
+ purposes.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ Used for resolving concurrency issues. The request fails if the version
+ provided does not match the server version at the time of the request. If a value is not
+ provided, Square's servers execute a "blind" write; potentially
+ overwriting another writer's data.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ A read-only timestamp in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ A read-only timestamp in RFC 3339 format.
+ """
diff --git a/src/square/requests/bulk_create_customer_data.py b/src/square/requests/bulk_create_customer_data.py
new file mode 100644
index 00000000..a31225d7
--- /dev/null
+++ b/src/square/requests/bulk_create_customer_data.py
@@ -0,0 +1,79 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .address import AddressParams
+from .customer_tax_ids import CustomerTaxIdsParams
+
+
+class BulkCreateCustomerDataParams(typing_extensions.TypedDict):
+ """
+ Defines the customer data provided in individual create requests for a
+ [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) operation.
+ """
+
+ given_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The given name (that is, the first name) associated with the customer profile.
+ """
+
+ family_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The family name (that is, the last name) associated with the customer profile.
+ """
+
+ company_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A business name associated with the customer profile.
+ """
+
+ nickname: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A nickname for the customer profile.
+ """
+
+ email_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The email address associated with the customer profile.
+ """
+
+ address: typing_extensions.NotRequired[AddressParams]
+ """
+ The physical address associated with the customer profile. For maximum length constraints,
+ see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+ """
+
+ phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The phone number associated with the customer profile. The phone number must be valid
+ and can contain 9–16 digits, with an optional `+` prefix and country code. For more information,
+ see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A custom note associated with the customer profile.
+ """
+
+ birthday: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format.
+ For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21.
+ Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or
+ `0000` if a birth year is not specified.
+ """
+
+ tax_ids: typing_extensions.NotRequired[CustomerTaxIdsParams]
+ """
+ The tax ID associated with the customer profile. This field is available only for
+ customers of sellers in EU countries or the United Kingdom. For more information, see
+ [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+ """
diff --git a/src/square/requests/bulk_create_customers_response.py b/src/square/requests/bulk_create_customers_response.py
new file mode 100644
index 00000000..8133955f
--- /dev/null
+++ b/src/square/requests/bulk_create_customers_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .create_customer_response import CreateCustomerResponseParams
+from .error import ErrorParams
+
+
+class BulkCreateCustomersResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields included in the response body from the
+ [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint.
+ """
+
+ responses: typing_extensions.NotRequired[typing.Dict[str, CreateCustomerResponseParams]]
+ """
+ A map of responses that correspond to individual create requests, represented by
+ key-value pairs.
+
+ Each key is the idempotency key that was provided for a create request and each value
+ is the corresponding response.
+ If the request succeeds, the value is the new customer profile.
+ If the request fails, the value contains any errors that occurred during the request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any top-level errors that prevented the bulk operation from running.
+ """
diff --git a/src/square/requests/bulk_delete_booking_custom_attributes_response.py b/src/square/requests/bulk_delete_booking_custom_attributes_response.py
new file mode 100644
index 00000000..dc814542
--- /dev/null
+++ b/src/square/requests/bulk_delete_booking_custom_attributes_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking_custom_attribute_delete_response import BookingCustomAttributeDeleteResponseParams
+from .error import ErrorParams
+
+
+class BulkDeleteBookingCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual delete request.
+ """
+
+ values: typing_extensions.NotRequired[typing.Dict[str, BookingCustomAttributeDeleteResponseParams]]
+ """
+ A map of responses that correspond to individual delete requests. Each response has the
+ same ID as the corresponding request and contains `booking_id` and `errors` field.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/bulk_delete_customers_response.py b/src/square/requests/bulk_delete_customers_response.py
new file mode 100644
index 00000000..47011ae2
--- /dev/null
+++ b/src/square/requests/bulk_delete_customers_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .delete_customer_response import DeleteCustomerResponseParams
+from .error import ErrorParams
+
+
+class BulkDeleteCustomersResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields included in the response body from the
+ [BulkDeleteCustomers](api-endpoint:Customers-BulkDeleteCustomers) endpoint.
+ """
+
+ responses: typing_extensions.NotRequired[typing.Dict[str, DeleteCustomerResponseParams]]
+ """
+ A map of responses that correspond to individual delete requests, represented by
+ key-value pairs.
+
+ Each key is the customer ID that was specified for a delete request and each value
+ is the corresponding response.
+ If the request succeeds, the value is an empty object (`{ }`).
+ If the request fails, the value contains any errors that occurred during the request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any top-level errors that prevented the bulk operation from running.
+ """
diff --git a/src/square/requests/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.py b/src/square/requests/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.py
new file mode 100644
index 00000000..414415e1
--- /dev/null
+++ b/src/square/requests/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestParams(typing_extensions.TypedDict):
+ """
+ Represents an individual delete request in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes)
+ request. An individual request contains an optional ID of the associated custom attribute definition
+ and optional key of the associated custom attribute definition.
+ """
+
+ key: typing_extensions.NotRequired[str]
+ """
+ The key of the associated custom attribute definition.
+ Represented as a qualified key if the requesting app is not the definition owner.
+ """
diff --git a/src/square/requests/bulk_delete_location_custom_attributes_response.py b/src/square/requests/bulk_delete_location_custom_attributes_response.py
new file mode 100644
index 00000000..ce23db58
--- /dev/null
+++ b/src/square/requests/bulk_delete_location_custom_attributes_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response import (
+ BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponseParams,
+)
+from .error import ErrorParams
+
+
+class BulkDeleteLocationCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual delete request.
+ """
+
+ values: typing.Dict[str, BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponseParams]
+ """
+ A map of responses that correspond to individual delete requests. Each response has the
+ same key as the corresponding request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.py b/src/square/requests/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.py
new file mode 100644
index 00000000..9a45fe72
--- /dev/null
+++ b/src/square/requests/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponseParams(
+ typing_extensions.TypedDict
+):
+ """
+ Represents an individual delete response in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes)
+ request.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the location associated with the custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred while processing the individual LocationCustomAttributeDeleteRequest request
+ """
diff --git a/src/square/requests/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.py b/src/square/requests/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.py
new file mode 100644
index 00000000..f2f9dbe1
--- /dev/null
+++ b/src/square/requests/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestParams(typing_extensions.TypedDict):
+ """
+ Represents an individual delete request in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes)
+ request. An individual request contains an optional ID of the associated custom attribute definition
+ and optional key of the associated custom attribute definition.
+ """
+
+ key: typing_extensions.NotRequired[str]
+ """
+ The key of the associated custom attribute definition.
+ Represented as a qualified key if the requesting app is not the definition owner.
+ """
diff --git a/src/square/requests/bulk_delete_merchant_custom_attributes_response.py b/src/square/requests/bulk_delete_merchant_custom_attributes_response.py
new file mode 100644
index 00000000..8291eaf9
--- /dev/null
+++ b/src/square/requests/bulk_delete_merchant_custom_attributes_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response import (
+ BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponseParams,
+)
+from .error import ErrorParams
+
+
+class BulkDeleteMerchantCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual delete request.
+ """
+
+ values: typing.Dict[str, BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponseParams]
+ """
+ A map of responses that correspond to individual delete requests. Each response has the
+ same key as the corresponding request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.py b/src/square/requests/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.py
new file mode 100644
index 00000000..809426e6
--- /dev/null
+++ b/src/square/requests/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponseParams(
+ typing_extensions.TypedDict
+):
+ """
+ Represents an individual delete response in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes)
+ request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred while processing the individual MerchantCustomAttributeDeleteRequest request
+ """
diff --git a/src/square/requests/bulk_delete_order_custom_attributes_request_delete_custom_attribute.py b/src/square/requests/bulk_delete_order_custom_attributes_request_delete_custom_attribute.py
new file mode 100644
index 00000000..f72c4a90
--- /dev/null
+++ b/src/square/requests/bulk_delete_order_custom_attributes_request_delete_custom_attribute.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class BulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeParams(typing_extensions.TypedDict):
+ """
+ Represents one delete within the bulk operation.
+ """
+
+ key: typing_extensions.NotRequired[str]
+ """
+ The key of the custom attribute to delete. This key must match the key
+ of an existing custom attribute definition.
+ """
+
+ order_id: str
+ """
+ The ID of the target [order](entity:Order).
+ """
diff --git a/src/square/requests/bulk_delete_order_custom_attributes_response.py b/src/square/requests/bulk_delete_order_custom_attributes_response.py
new file mode 100644
index 00000000..353176d5
--- /dev/null
+++ b/src/square/requests/bulk_delete_order_custom_attributes_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .delete_order_custom_attribute_response import DeleteOrderCustomAttributeResponseParams
+from .error import ErrorParams
+
+
+class BulkDeleteOrderCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from deleting one or more order custom attributes.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ values: typing.Dict[str, DeleteOrderCustomAttributeResponseParams]
+ """
+ A map of responses that correspond to individual delete requests. Each response has the same ID
+ as the corresponding request and contains either a `custom_attribute` or an `errors` field.
+ """
diff --git a/src/square/requests/bulk_publish_scheduled_shifts_data.py b/src/square/requests/bulk_publish_scheduled_shifts_data.py
new file mode 100644
index 00000000..17039f6a
--- /dev/null
+++ b/src/square/requests/bulk_publish_scheduled_shifts_data.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class BulkPublishScheduledShiftsDataParams(typing_extensions.TypedDict):
+ """
+ Represents options for an individual publish request in a
+ [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts)
+ operation, provided as the value in a key-value pair.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The current version of the scheduled shift, used to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control. If the provided version doesn't match the server version, the request fails.
+ If omitted, Square executes a blind write, potentially overwriting data from another publish request.
+ """
diff --git a/src/square/requests/bulk_publish_scheduled_shifts_response.py b/src/square/requests/bulk_publish_scheduled_shifts_response.py
new file mode 100644
index 00000000..864a1e4e
--- /dev/null
+++ b/src/square/requests/bulk_publish_scheduled_shifts_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .publish_scheduled_shift_response import PublishScheduledShiftResponseParams
+
+
+class BulkPublishScheduledShiftsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts) response.
+ Either `scheduled_shifts` or `errors` is present in the response.
+ """
+
+ responses: typing_extensions.NotRequired[typing.Dict[str, PublishScheduledShiftResponseParams]]
+ """
+ A map of key-value pairs that represent responses for individual publish requests.
+ The order of responses might differ from the order in which the requests were provided.
+
+ - Each key is the scheduled shift ID that was specified for a publish request.
+ - Each value is the corresponding response. If the request succeeds, the value is the
+ published scheduled shift. If the request fails, the value is an `errors` array containing
+ any errors that occurred while processing the request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any top-level errors that prevented the bulk operation from succeeding.
+ """
diff --git a/src/square/requests/bulk_retrieve_bookings_response.py b/src/square/requests/bulk_retrieve_bookings_response.py
new file mode 100644
index 00000000..709739f1
--- /dev/null
+++ b/src/square/requests/bulk_retrieve_bookings_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .get_booking_response import GetBookingResponseParams
+
+
+class BulkRetrieveBookingsResponseParams(typing_extensions.TypedDict):
+ """
+ Response payload for bulk retrieval of bookings.
+ """
+
+ bookings: typing_extensions.NotRequired[typing.Dict[str, GetBookingResponseParams]]
+ """
+ Requested bookings returned as a map containing `booking_id` as the key and `RetrieveBookingResponse` as the value.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/bulk_retrieve_channels_response.py b/src/square/requests/bulk_retrieve_channels_response.py
new file mode 100644
index 00000000..de21568b
--- /dev/null
+++ b/src/square/requests/bulk_retrieve_channels_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .retrieve_channel_response import RetrieveChannelResponseParams
+
+
+class BulkRetrieveChannelsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the request body for the
+ [BulkRetrieveChannels](api-endpoint:Channels-BulkRetrieveChannels) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ responses: typing_extensions.NotRequired[typing.Dict[str, RetrieveChannelResponseParams]]
+ """
+ A map of channel IDs to channel responses which tell whether
+ retrieval for a specific channel is success or not.
+ Channel response of a success retrieval would contain channel info
+ whereas channel response of a failed retrieval would have error info.
+ """
diff --git a/src/square/requests/bulk_retrieve_customers_response.py b/src/square/requests/bulk_retrieve_customers_response.py
new file mode 100644
index 00000000..098a36ab
--- /dev/null
+++ b/src/square/requests/bulk_retrieve_customers_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .get_customer_response import GetCustomerResponseParams
+
+
+class BulkRetrieveCustomersResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields included in the response body from the
+ [BulkRetrieveCustomers](api-endpoint:Customers-BulkRetrieveCustomers) endpoint.
+ """
+
+ responses: typing_extensions.NotRequired[typing.Dict[str, GetCustomerResponseParams]]
+ """
+ A map of responses that correspond to individual retrieve requests, represented by
+ key-value pairs.
+
+ Each key is the customer ID that was specified for a retrieve request and each value
+ is the corresponding response.
+ If the request succeeds, the value is the requested customer profile.
+ If the request fails, the value contains any errors that occurred during the request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any top-level errors that prevented the bulk operation from running.
+ """
diff --git a/src/square/requests/bulk_retrieve_team_member_booking_profiles_response.py b/src/square/requests/bulk_retrieve_team_member_booking_profiles_response.py
new file mode 100644
index 00000000..844ff498
--- /dev/null
+++ b/src/square/requests/bulk_retrieve_team_member_booking_profiles_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .get_team_member_booking_profile_response import GetTeamMemberBookingProfileResponseParams
+
+
+class BulkRetrieveTeamMemberBookingProfilesResponseParams(typing_extensions.TypedDict):
+ """
+ Response payload for the [BulkRetrieveTeamMemberBookingProfiles](api-endpoint:Bookings-BulkRetrieveTeamMemberBookingProfiles) endpoint.
+ """
+
+ team_member_booking_profiles: typing_extensions.NotRequired[
+ typing.Dict[str, GetTeamMemberBookingProfileResponseParams]
+ ]
+ """
+ The returned team members' booking profiles, as a map with `team_member_id` as the key and [TeamMemberBookingProfile](entity:TeamMemberBookingProfile) the value.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/bulk_swap_plan_response.py b/src/square/requests/bulk_swap_plan_response.py
new file mode 100644
index 00000000..0fc63bd6
--- /dev/null
+++ b/src/square/requests/bulk_swap_plan_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class BulkSwapPlanResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response of the
+ [BulkSwapPlan](api-endpoint:Subscriptions-BulkSwapPlan) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ affected_subscriptions: typing_extensions.NotRequired[int]
+ """
+ The number of affected subscriptions.
+ """
diff --git a/src/square/requests/bulk_update_customer_data.py b/src/square/requests/bulk_update_customer_data.py
new file mode 100644
index 00000000..33e3dfbf
--- /dev/null
+++ b/src/square/requests/bulk_update_customer_data.py
@@ -0,0 +1,88 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .address import AddressParams
+from .customer_tax_ids import CustomerTaxIdsParams
+
+
+class BulkUpdateCustomerDataParams(typing_extensions.TypedDict):
+ """
+ Defines the customer data provided in individual update requests for a
+ [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) operation.
+ """
+
+ given_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The given name (that is, the first name) associated with the customer profile.
+ """
+
+ family_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The family name (that is, the last name) associated with the customer profile.
+ """
+
+ company_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A business name associated with the customer profile.
+ """
+
+ nickname: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A nickname for the customer profile.
+ """
+
+ email_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The email address associated with the customer profile.
+ """
+
+ address: typing_extensions.NotRequired[AddressParams]
+ """
+ The physical address associated with the customer profile. For maximum length constraints,
+ see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+ """
+
+ phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The phone number associated with the customer profile. The phone number must be valid
+ and can contain 9–16 digits, with an optional `+` prefix and country code. For more information,
+ see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An custom note associates with the customer profile.
+ """
+
+ birthday: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format.
+ For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21.
+ Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or
+ `0000` if a birth year is not specified.
+ """
+
+ tax_ids: typing_extensions.NotRequired[CustomerTaxIdsParams]
+ """
+ The tax ID associated with the customer profile. This field is available only for
+ customers of sellers in EU countries or the United Kingdom. For more information, see
+ [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The current version of the customer profile.
+
+ As a best practice, you should include this field to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control.
+ """
diff --git a/src/square/requests/bulk_update_customers_response.py b/src/square/requests/bulk_update_customers_response.py
new file mode 100644
index 00000000..4fc5b3fc
--- /dev/null
+++ b/src/square/requests/bulk_update_customers_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .update_customer_response import UpdateCustomerResponseParams
+
+
+class BulkUpdateCustomersResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields included in the response body from the
+ [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) endpoint.
+ """
+
+ responses: typing_extensions.NotRequired[typing.Dict[str, UpdateCustomerResponseParams]]
+ """
+ A map of responses that correspond to individual update requests, represented by
+ key-value pairs.
+
+ Each key is the customer ID that was specified for an update request and each value
+ is the corresponding response.
+ If the request succeeds, the value is the updated customer profile.
+ If the request fails, the value contains any errors that occurred during the request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any top-level errors that prevented the bulk operation from running.
+ """
diff --git a/src/square/requests/bulk_upsert_booking_custom_attributes_response.py b/src/square/requests/bulk_upsert_booking_custom_attributes_response.py
new file mode 100644
index 00000000..225d7aff
--- /dev/null
+++ b/src/square/requests/bulk_upsert_booking_custom_attributes_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking_custom_attribute_upsert_response import BookingCustomAttributeUpsertResponseParams
+from .error import ErrorParams
+
+
+class BulkUpsertBookingCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual upsert request.
+ """
+
+ values: typing_extensions.NotRequired[typing.Dict[str, BookingCustomAttributeUpsertResponseParams]]
+ """
+ A map of responses that correspond to individual upsert requests. Each response has the
+ same ID as the corresponding request and contains either a `booking_id` and `custom_attribute` or an `errors` field.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.py b/src/square/requests/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.py
new file mode 100644
index 00000000..f77d7329
--- /dev/null
+++ b/src/square/requests/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+
+
+class BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestParams(typing_extensions.TypedDict):
+ """
+ Represents an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes)
+ request. An individual request contains a location ID, the custom attribute to create or update,
+ and an optional idempotency key.
+ """
+
+ location_id: str
+ """
+ The ID of the target [location](entity:Location).
+ """
+
+ custom_attribute: CustomAttributeParams
+ """
+ The custom attribute to create or update, with following fields:
+ - `key`. This key must match the `key` of a custom attribute definition in the Square seller
+ account. If the requesting application is not the definition owner, you must provide the qualified key.
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types)..
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, specify the current version of the custom attribute.
+ If this is not important for your application, `version` can be set to -1.
+ """
+
+ idempotency_key: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique identifier for this individual upsert request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
diff --git a/src/square/requests/bulk_upsert_location_custom_attributes_response.py b/src/square/requests/bulk_upsert_location_custom_attributes_response.py
new file mode 100644
index 00000000..e751d28e
--- /dev/null
+++ b/src/square/requests/bulk_upsert_location_custom_attributes_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response import (
+ BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponseParams,
+)
+from .error import ErrorParams
+
+
+class BulkUpsertLocationCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual upsert request.
+ """
+
+ values: typing_extensions.NotRequired[
+ typing.Dict[str, BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponseParams]
+ ]
+ """
+ A map of responses that correspond to individual upsert requests. Each response has the
+ same ID as the corresponding request and contains either a `location_id` and `custom_attribute` or an `errors` field.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.py b/src/square/requests/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.py
new file mode 100644
index 00000000..2059bbb3
--- /dev/null
+++ b/src/square/requests/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponseParams(
+ typing_extensions.TypedDict
+):
+ """
+ Represents a response for an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) operation.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the location associated with the custom attribute.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred while processing the individual request.
+ """
diff --git a/src/square/requests/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.py b/src/square/requests/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.py
new file mode 100644
index 00000000..704e933d
--- /dev/null
+++ b/src/square/requests/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+
+
+class BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestParams(typing_extensions.TypedDict):
+ """
+ Represents an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes)
+ request. An individual request contains a merchant ID, the custom attribute to create or update,
+ and an optional idempotency key.
+ """
+
+ merchant_id: str
+ """
+ The ID of the target [merchant](entity:Merchant).
+ """
+
+ custom_attribute: CustomAttributeParams
+ """
+ The custom attribute to create or update, with following fields:
+ - `key`. This key must match the `key` of a custom attribute definition in the Square seller
+ account. If the requesting application is not the definition owner, you must provide the qualified key.
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - The version field must match the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
+ """
+
+ idempotency_key: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique identifier for this individual upsert request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
diff --git a/src/square/requests/bulk_upsert_merchant_custom_attributes_response.py b/src/square/requests/bulk_upsert_merchant_custom_attributes_response.py
new file mode 100644
index 00000000..b65d58a3
--- /dev/null
+++ b/src/square/requests/bulk_upsert_merchant_custom_attributes_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response import (
+ BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponseParams,
+)
+from .error import ErrorParams
+
+
+class BulkUpsertMerchantCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual upsert request.
+ """
+
+ values: typing_extensions.NotRequired[
+ typing.Dict[str, BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponseParams]
+ ]
+ """
+ A map of responses that correspond to individual upsert requests. Each response has the
+ same ID as the corresponding request and contains either a `merchant_id` and `custom_attribute` or an `errors` field.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.py b/src/square/requests/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.py
new file mode 100644
index 00000000..a99bec8f
--- /dev/null
+++ b/src/square/requests/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponseParams(
+ typing_extensions.TypedDict
+):
+ """
+ Represents a response for an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) operation.
+ """
+
+ merchant_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the merchant associated with the custom attribute.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred while processing the individual request.
+ """
diff --git a/src/square/requests/bulk_upsert_order_custom_attributes_request_upsert_custom_attribute.py b/src/square/requests/bulk_upsert_order_custom_attributes_request_upsert_custom_attribute.py
new file mode 100644
index 00000000..6ce71b0d
--- /dev/null
+++ b/src/square/requests/bulk_upsert_order_custom_attributes_request_upsert_custom_attribute.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+
+
+class BulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeParams(typing_extensions.TypedDict):
+ """
+ Represents one upsert within the bulk operation.
+ """
+
+ custom_attribute: CustomAttributeParams
+ """
+ The custom attribute to create or update, with the following fields:
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+ """
+
+ idempotency_key: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
+
+ order_id: str
+ """
+ The ID of the target [order](entity:Order).
+ """
diff --git a/src/square/requests/bulk_upsert_order_custom_attributes_response.py b/src/square/requests/bulk_upsert_order_custom_attributes_response.py
new file mode 100644
index 00000000..b23f8555
--- /dev/null
+++ b/src/square/requests/bulk_upsert_order_custom_attributes_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .upsert_order_custom_attribute_response import UpsertOrderCustomAttributeResponseParams
+
+
+class BulkUpsertOrderCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from a bulk upsert of order custom attributes.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ values: typing.Dict[str, UpsertOrderCustomAttributeResponseParams]
+ """
+ A map of responses that correspond to individual upsert operations for custom attributes.
+ """
diff --git a/src/square/requests/business_appointment_settings.py b/src/square/requests/business_appointment_settings.py
new file mode 100644
index 00000000..4a7c0ee8
--- /dev/null
+++ b/src/square/requests/business_appointment_settings.py
@@ -0,0 +1,93 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.business_appointment_settings_alignment_time import BusinessAppointmentSettingsAlignmentTime
+from ..types.business_appointment_settings_booking_location_type import BusinessAppointmentSettingsBookingLocationType
+from ..types.business_appointment_settings_cancellation_policy import BusinessAppointmentSettingsCancellationPolicy
+from ..types.business_appointment_settings_max_appointments_per_day_limit_type import (
+ BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType,
+)
+from .money import MoneyParams
+
+
+class BusinessAppointmentSettingsParams(typing_extensions.TypedDict):
+ """
+ The service appointment settings, including where and how the service is provided.
+ """
+
+ location_types: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[BusinessAppointmentSettingsBookingLocationType]]
+ ]
+ """
+ Types of the location allowed for bookings.
+ See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values
+ """
+
+ alignment_time: typing_extensions.NotRequired[BusinessAppointmentSettingsAlignmentTime]
+ """
+ The time unit of the service duration for bookings.
+ See [BusinessAppointmentSettingsAlignmentTime](#type-businessappointmentsettingsalignmenttime) for possible values
+ """
+
+ min_booking_lead_time_seconds: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The minimum lead time in seconds before a service can be booked. A booking must be created at least this amount of time before its starting time.
+ """
+
+ max_booking_lead_time_seconds: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum lead time in seconds before a service can be booked. A booking must be created at most this amount of time before its starting time.
+ """
+
+ any_team_member_booking_enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether a customer can choose from all available time slots and have a staff member assigned
+ automatically (`true`) or not (`false`).
+ """
+
+ multiple_service_booking_enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether a customer can book multiple services in a single online booking.
+ """
+
+ max_appointments_per_day_limit_type: typing_extensions.NotRequired[
+ BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType
+ ]
+ """
+ Indicates whether the daily appointment limit applies to team members or to
+ business locations.
+ See [BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType](#type-businessappointmentsettingsmaxappointmentsperdaylimittype) for possible values
+ """
+
+ max_appointments_per_day_limit: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of daily appointments per team member or per location.
+ """
+
+ cancellation_window_seconds: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The cut-off time in seconds for allowing clients to cancel or reschedule an appointment.
+ """
+
+ cancellation_fee_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The flat-fee amount charged for a no-show booking.
+ """
+
+ cancellation_policy: typing_extensions.NotRequired[BusinessAppointmentSettingsCancellationPolicy]
+ """
+ The cancellation policy adopted by the seller.
+ See [BusinessAppointmentSettingsCancellationPolicy](#type-businessappointmentsettingscancellationpolicy) for possible values
+ """
+
+ cancellation_policy_text: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The free-form text of the seller's cancellation policy.
+ """
+
+ skip_booking_flow_staff_selection: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether customers has an assigned staff member (`true`) or can select s staff member of their choice (`false`).
+ """
diff --git a/src/square/requests/business_booking_profile.py b/src/square/requests/business_booking_profile.py
new file mode 100644
index 00000000..bb0f7daa
--- /dev/null
+++ b/src/square/requests/business_booking_profile.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.business_booking_profile_booking_policy import BusinessBookingProfileBookingPolicy
+from ..types.business_booking_profile_customer_timezone_choice import BusinessBookingProfileCustomerTimezoneChoice
+from .business_appointment_settings import BusinessAppointmentSettingsParams
+
+
+class BusinessBookingProfileParams(typing_extensions.TypedDict):
+ """
+ A seller's business booking profile, including booking policy, appointment settings, etc.
+ """
+
+ seller_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller, obtainable using the Merchants API.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The RFC 3339 timestamp specifying the booking's creation time.
+ """
+
+ booking_enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the seller is open for booking.
+ """
+
+ customer_timezone_choice: typing_extensions.NotRequired[BusinessBookingProfileCustomerTimezoneChoice]
+ """
+ The choice of customer's time zone information of a booking.
+ The Square online booking site and all notifications to customers uses either the seller location’s time zone
+ or the time zone the customer chooses at booking.
+ See [BusinessBookingProfileCustomerTimezoneChoice](#type-businessbookingprofilecustomertimezonechoice) for possible values
+ """
+
+ booking_policy: typing_extensions.NotRequired[BusinessBookingProfileBookingPolicy]
+ """
+ The policy for the seller to automatically accept booking requests (`ACCEPT_ALL`) or not (`REQUIRES_ACCEPTANCE`).
+ See [BusinessBookingProfileBookingPolicy](#type-businessbookingprofilebookingpolicy) for possible values
+ """
+
+ allow_user_cancel: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether customers can cancel or reschedule their own bookings (`true`) or not (`false`).
+ """
+
+ business_appointment_settings: typing_extensions.NotRequired[BusinessAppointmentSettingsParams]
+ """
+ Settings for appointment-type bookings.
+ """
+
+ support_seller_level_writes: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the seller's subscription to Square Appointments supports creating, updating or canceling an appointment through the API (`true`) or not (`false`) using seller permission.
+ """
diff --git a/src/square/requests/business_hours.py b/src/square/requests/business_hours.py
new file mode 100644
index 00000000..81ebf97e
--- /dev/null
+++ b/src/square/requests/business_hours.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .business_hours_period import BusinessHoursPeriodParams
+
+
+class BusinessHoursParams(typing_extensions.TypedDict):
+ """
+ The hours of operation for a location.
+ """
+
+ periods: typing_extensions.NotRequired[typing.Optional[typing.Sequence[BusinessHoursPeriodParams]]]
+ """
+ The list of time periods during which the business is open. There can be at most 10 periods per day.
+ """
diff --git a/src/square/requests/business_hours_period.py b/src/square/requests/business_hours_period.py
new file mode 100644
index 00000000..054973ad
--- /dev/null
+++ b/src/square/requests/business_hours_period.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.day_of_week import DayOfWeek
+
+
+class BusinessHoursPeriodParams(typing_extensions.TypedDict):
+ """
+ Represents a period of time during which a business location is open.
+ """
+
+ day_of_week: typing_extensions.NotRequired[DayOfWeek]
+ """
+ The day of the week for this time period.
+ See [DayOfWeek](#type-dayofweek) for possible values
+ """
+
+ start_local_time: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The start time of a business hours period, specified in local time using partial-time
+ RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning.
+ Note that the seconds value is always :00, but it is appended for conformance to the RFC.
+ """
+
+ end_local_time: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The end time of a business hours period, specified in local time using partial-time
+ RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening.
+ Note that the seconds value is always :00, but it is appended for conformance to the RFC.
+ """
diff --git a/src/square/requests/buy_now_pay_later_details.py b/src/square/requests/buy_now_pay_later_details.py
new file mode 100644
index 00000000..2e550bc4
--- /dev/null
+++ b/src/square/requests/buy_now_pay_later_details.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .afterpay_details import AfterpayDetailsParams
+from .clearpay_details import ClearpayDetailsParams
+from .error import ErrorParams
+
+
+class BuyNowPayLaterDetailsParams(typing_extensions.TypedDict):
+ """
+ Additional details about a Buy Now Pay Later payment type.
+ """
+
+ brand: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The brand used for the Buy Now Pay Later payment.
+ The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`.
+ """
+
+ afterpay_details: typing_extensions.NotRequired[AfterpayDetailsParams]
+ """
+ Details about an Afterpay payment. These details are only populated if the `brand` is
+ `AFTERPAY`.
+ """
+
+ clearpay_details: typing_extensions.NotRequired[ClearpayDetailsParams]
+ """
+ Details about a Clearpay payment. These details are only populated if the `brand` is
+ `CLEARPAY`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the payment.
+ """
diff --git a/src/square/requests/calculate_loyalty_points_response.py b/src/square/requests/calculate_loyalty_points_response.py
new file mode 100644
index 00000000..51e51f9c
--- /dev/null
+++ b/src/square/requests/calculate_loyalty_points_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class CalculateLoyaltyPointsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints) response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ points: typing_extensions.NotRequired[int]
+ """
+ The number of points that the buyer can earn from the base loyalty program.
+ """
+
+ promotion_points: typing_extensions.NotRequired[int]
+ """
+ The number of points that the buyer can earn from a loyalty promotion. To be eligible
+ to earn promotion points, the purchase must first qualify for program points. When `order_id`
+ is not provided in the request, this value is always 0.
+ """
diff --git a/src/square/requests/calculate_order_response.py b/src/square/requests/calculate_order_response.py
new file mode 100644
index 00000000..cf4495d0
--- /dev/null
+++ b/src/square/requests/calculate_order_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .order import OrderParams
+
+
+class CalculateOrderResponseParams(typing_extensions.TypedDict):
+ order: typing_extensions.NotRequired[OrderParams]
+ """
+ The calculated version of the order provided in the request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/cancel_booking_response.py b/src/square/requests/cancel_booking_response.py
new file mode 100644
index 00000000..76174beb
--- /dev/null
+++ b/src/square/requests/cancel_booking_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking import BookingParams
+from .error import ErrorParams
+
+
+class CancelBookingResponseParams(typing_extensions.TypedDict):
+ booking: typing_extensions.NotRequired[BookingParams]
+ """
+ The booking that was cancelled.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/cancel_invoice_response.py b/src/square/requests/cancel_invoice_response.py
new file mode 100644
index 00000000..2501bc75
--- /dev/null
+++ b/src/square/requests/cancel_invoice_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .invoice import InvoiceParams
+
+
+class CancelInvoiceResponseParams(typing_extensions.TypedDict):
+ """
+ The response returned by the `CancelInvoice` request.
+ """
+
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The canceled invoice.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/cancel_loyalty_promotion_response.py b/src/square/requests/cancel_loyalty_promotion_response.py
new file mode 100644
index 00000000..ce216b4d
--- /dev/null
+++ b/src/square/requests/cancel_loyalty_promotion_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_promotion import LoyaltyPromotionParams
+
+
+class CancelLoyaltyPromotionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [CancelLoyaltyPromotion](api-endpoint:Loyalty-CancelLoyaltyPromotion) response.
+ Either `loyalty_promotion` or `errors` is present in the response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_promotion: typing_extensions.NotRequired[LoyaltyPromotionParams]
+ """
+ The canceled loyalty promotion.
+ """
diff --git a/src/square/requests/cancel_payment_by_idempotency_key_response.py b/src/square/requests/cancel_payment_by_idempotency_key_response.py
new file mode 100644
index 00000000..ce763ea2
--- /dev/null
+++ b/src/square/requests/cancel_payment_by_idempotency_key_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class CancelPaymentByIdempotencyKeyResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response returned by
+ [CancelPaymentByIdempotencyKey](api-endpoint:Payments-CancelPaymentByIdempotencyKey).
+ On success, `errors` is empty.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/cancel_payment_response.py b/src/square/requests/cancel_payment_response.py
new file mode 100644
index 00000000..332dfce7
--- /dev/null
+++ b/src/square/requests/cancel_payment_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment import PaymentParams
+
+
+class CancelPaymentResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response returned by [CancelPayment](api-endpoint:Payments-CancelPayment).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ payment: typing_extensions.NotRequired[PaymentParams]
+ """
+ The successfully canceled `Payment` object.
+ """
diff --git a/src/square/requests/cancel_subscription_response.py b/src/square/requests/cancel_subscription_response.py
new file mode 100644
index 00000000..5fcd0f98
--- /dev/null
+++ b/src/square/requests/cancel_subscription_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription import SubscriptionParams
+from .subscription_action import SubscriptionActionParams
+
+
+class CancelSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response from the
+ [CancelSubscription](api-endpoint:Subscriptions-CancelSubscription) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The specified subscription scheduled for cancellation according to the action created by the request.
+ """
+
+ actions: typing_extensions.NotRequired[typing.Sequence[SubscriptionActionParams]]
+ """
+ A list of a single `CANCEL` action scheduled for the subscription.
+ """
diff --git a/src/square/requests/cancel_terminal_action_response.py b/src/square/requests/cancel_terminal_action_response.py
new file mode 100644
index 00000000..f52ffeea
--- /dev/null
+++ b/src/square/requests/cancel_terminal_action_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_action import TerminalActionParams
+
+
+class CancelTerminalActionResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ action: typing_extensions.NotRequired[TerminalActionParams]
+ """
+ The canceled `TerminalAction`
+ """
diff --git a/src/square/requests/cancel_terminal_checkout_response.py b/src/square/requests/cancel_terminal_checkout_response.py
new file mode 100644
index 00000000..29fc794b
--- /dev/null
+++ b/src/square/requests/cancel_terminal_checkout_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_checkout import TerminalCheckoutParams
+
+
+class CancelTerminalCheckoutResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ checkout: typing_extensions.NotRequired[TerminalCheckoutParams]
+ """
+ The canceled `TerminalCheckout`.
+ """
diff --git a/src/square/requests/cancel_terminal_refund_response.py b/src/square/requests/cancel_terminal_refund_response.py
new file mode 100644
index 00000000..72fee36c
--- /dev/null
+++ b/src/square/requests/cancel_terminal_refund_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_refund import TerminalRefundParams
+
+
+class CancelTerminalRefundResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ refund: typing_extensions.NotRequired[TerminalRefundParams]
+ """
+ The updated `TerminalRefund`.
+ """
diff --git a/src/square/requests/cancel_transfer_order_response.py b/src/square/requests/cancel_transfer_order_response.py
new file mode 100644
index 00000000..ec1da7b5
--- /dev/null
+++ b/src/square/requests/cancel_transfer_order_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .transfer_order import TransferOrderParams
+
+
+class CancelTransferOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Response for canceling a transfer order
+ """
+
+ transfer_order: typing_extensions.NotRequired[TransferOrderParams]
+ """
+ The updated transfer order with status changed to CANCELED
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request
+ """
diff --git a/src/square/requests/capture_transaction_response.py b/src/square/requests/capture_transaction_response.py
new file mode 100644
index 00000000..841db9d4
--- /dev/null
+++ b/src/square/requests/capture_transaction_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class CaptureTransactionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CaptureTransaction](api-endpoint:Transactions-CaptureTransaction) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/card.py b/src/square/requests/card.py
new file mode 100644
index 00000000..7649ca24
--- /dev/null
+++ b/src/square/requests/card.py
@@ -0,0 +1,153 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from ..types.card_brand import CardBrand
+from ..types.card_co_brand import CardCoBrand
+from ..types.card_issuer_alert import CardIssuerAlert
+from ..types.card_prepaid_type import CardPrepaidType
+from ..types.card_type import CardType
+from .address import AddressParams
+
+
+class CardParams(typing_extensions.TypedDict):
+ """
+ Represents the payment details of a card to be used for payments. These
+ details are determined by the payment token generated by Web Payments SDK.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ Unique ID for this card. Generated by Square.
+ """
+
+ card_brand: typing_extensions.NotRequired[CardBrand]
+ """
+ The card's brand.
+ See [CardBrand](#type-cardbrand) for possible values
+ """
+
+ last4: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="last_4")]]
+ """
+ The last 4 digits of the card number.
+ """
+
+ exp_month: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The expiration month of the associated card as an integer between 1 and 12.
+ """
+
+ exp_year: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The four-digit year of the card's expiration date.
+ """
+
+ cardholder_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the cardholder.
+ """
+
+ billing_address: typing_extensions.NotRequired[AddressParams]
+ """
+ The billing address for this card. `US` postal codes can be provided as a 5-digit zip code
+ or 9-digit ZIP+4 (example: `12345-6789`). For a full list of field meanings by country, see
+ [Working with Addresses](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-addresses).
+ """
+
+ fingerprint: typing_extensions.NotRequired[str]
+ """
+ Intended as a Square-assigned identifier, based
+ on the card number, to identify the card across multiple locations within a
+ single application.
+ """
+
+ customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ **Required** The ID of a [customer](entity:Customer) to be associated with the card.
+ """
+
+ merchant_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the merchant associated with the card.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional user-defined reference ID that associates this card with
+ another entity in an external system. For example, a customer ID from an
+ external customer management system.
+ """
+
+ enabled: typing_extensions.NotRequired[bool]
+ """
+ Indicates whether or not a card can be used for payments.
+ """
+
+ card_type: typing_extensions.NotRequired[CardType]
+ """
+ The type of the card.
+ The Card object includes this field only in response to Payments API calls.
+ See [CardType](#type-cardtype) for possible values
+ """
+
+ prepaid_type: typing_extensions.NotRequired[CardPrepaidType]
+ """
+ Indicates whether the card is prepaid or not.
+ See [CardPrepaidType](#type-cardprepaidtype) for possible values
+ """
+
+ bin: typing_extensions.NotRequired[str]
+ """
+ The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API
+ returns this field.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp for when the card object was created on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".
+ """
+
+ disabled_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp for when the card object was disabled on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ Current version number of the card. Increments with each card update. Requests to update an
+ existing Card object will be rejected unless the version in the request matches the current
+ version for the Card.
+ """
+
+ card_co_brand: typing_extensions.NotRequired[CardCoBrand]
+ """
+ The card's co-brand if available. For example, an Afterpay virtual card would have a
+ co-brand of AFTERPAY.
+ See [CardCoBrand](#type-cardcobrand) for possible values
+ """
+
+ issuer_alert: typing_extensions.NotRequired[CardIssuerAlert]
+ """
+ An alert from the issuing bank about the card status. Alerts can indicate whether
+ future charges to the card are likely to fail. For more information, see
+ [Manage Card on File Declines](https://developer.squareup.com/docs/cards-api/manage-card-on-file-declines).
+
+ This field is present only if there's an active issuer alert.
+ See [IssuerAlert](#type-issueralert) for possible values
+ """
+
+ issuer_alert_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the current issuer alert was received and processed, in
+ RFC 3339 format.
+
+ This field is present only if there's an active issuer alert.
+ """
+
+ hsa_fsa: typing_extensions.NotRequired[bool]
+ """
+ Indicates whether the card is linked to a Health Savings Account (HSA) or Flexible
+ Spending Account (FSA), based on the card BIN.
+ """
diff --git a/src/square/requests/card_automatically_updated_event.py b/src/square/requests/card_automatically_updated_event.py
new file mode 100644
index 00000000..09ca07df
--- /dev/null
+++ b/src/square/requests/card_automatically_updated_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card_automatically_updated_event_data import CardAutomaticallyUpdatedEventDataParams
+
+
+class CardAutomaticallyUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when Square automatically updates the expiration date or
+ primary account number (PAN) of a [card](entity:Card) or adds or removes an issuer alert.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"card.automatically_updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CardAutomaticallyUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/card_automatically_updated_event_data.py b/src/square/requests/card_automatically_updated_event_data.py
new file mode 100644
index 00000000..1788bc8e
--- /dev/null
+++ b/src/square/requests/card_automatically_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card_automatically_updated_event_object import CardAutomaticallyUpdatedEventObjectParams
+
+
+class CardAutomaticallyUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `"card"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[CardAutomaticallyUpdatedEventObjectParams]
+ """
+ An object containing the automatically updated card.
+ """
diff --git a/src/square/requests/card_automatically_updated_event_object.py b/src/square/requests/card_automatically_updated_event_object.py
new file mode 100644
index 00000000..ca33c822
--- /dev/null
+++ b/src/square/requests/card_automatically_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .card import CardParams
+
+
+class CardAutomaticallyUpdatedEventObjectParams(typing_extensions.TypedDict):
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The automatically updated card.
+ """
diff --git a/src/square/requests/card_created_event.py b/src/square/requests/card_created_event.py
new file mode 100644
index 00000000..9b308dd5
--- /dev/null
+++ b/src/square/requests/card_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card_created_event_data import CardCreatedEventDataParams
+
+
+class CardCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [card](entity:Card) is created or imported.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"card.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CardCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/card_created_event_data.py b/src/square/requests/card_created_event_data.py
new file mode 100644
index 00000000..e888fc7c
--- /dev/null
+++ b/src/square/requests/card_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card_created_event_object import CardCreatedEventObjectParams
+
+
+class CardCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `"card"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[CardCreatedEventObjectParams]
+ """
+ An object containing the created card.
+ """
diff --git a/src/square/requests/card_created_event_object.py b/src/square/requests/card_created_event_object.py
new file mode 100644
index 00000000..aa3f43c7
--- /dev/null
+++ b/src/square/requests/card_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .card import CardParams
+
+
+class CardCreatedEventObjectParams(typing_extensions.TypedDict):
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The created card.
+ """
diff --git a/src/square/requests/card_disabled_event.py b/src/square/requests/card_disabled_event.py
new file mode 100644
index 00000000..64547c75
--- /dev/null
+++ b/src/square/requests/card_disabled_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card_disabled_event_data import CardDisabledEventDataParams
+
+
+class CardDisabledEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [card](entity:Card) is disabled.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"card.disabled"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CardDisabledEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/card_disabled_event_data.py b/src/square/requests/card_disabled_event_data.py
new file mode 100644
index 00000000..61f2f606
--- /dev/null
+++ b/src/square/requests/card_disabled_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card_disabled_event_object import CardDisabledEventObjectParams
+
+
+class CardDisabledEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `"card"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[CardDisabledEventObjectParams]
+ """
+ An object containing the disabled card.
+ """
diff --git a/src/square/requests/card_disabled_event_object.py b/src/square/requests/card_disabled_event_object.py
new file mode 100644
index 00000000..a19ac583
--- /dev/null
+++ b/src/square/requests/card_disabled_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .card import CardParams
+
+
+class CardDisabledEventObjectParams(typing_extensions.TypedDict):
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The disabled card.
+ """
diff --git a/src/square/requests/card_forgotten_event.py b/src/square/requests/card_forgotten_event.py
new file mode 100644
index 00000000..1d694cd7
--- /dev/null
+++ b/src/square/requests/card_forgotten_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card_forgotten_event_data import CardForgottenEventDataParams
+
+
+class CardForgottenEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [card](entity:Card) is GDPR forgotten or vaulted.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"card.forgotten"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CardForgottenEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/card_forgotten_event_card.py b/src/square/requests/card_forgotten_event_card.py
new file mode 100644
index 00000000..abb68064
--- /dev/null
+++ b/src/square/requests/card_forgotten_event_card.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CardForgottenEventCardParams(typing_extensions.TypedDict):
+ id: typing_extensions.NotRequired[str]
+ """
+ Unique ID for this card. Generated by Square.
+ """
+
+ customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of a customer created using the Customers API associated with the card.
+ """
+
+ enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether or not a card can be used for payments.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional user-defined reference ID that associates this card with
+ another entity in an external system. For example, a customer ID from an
+ external customer management system.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ Current version number of the card. Increments with each card update. Requests to update an
+ existing Card object will be rejected unless the version in the request matches the current
+ version for the Card.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the merchant associated with the card.
+ """
diff --git a/src/square/requests/card_forgotten_event_data.py b/src/square/requests/card_forgotten_event_data.py
new file mode 100644
index 00000000..d58d1242
--- /dev/null
+++ b/src/square/requests/card_forgotten_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card_forgotten_event_object import CardForgottenEventObjectParams
+
+
+class CardForgottenEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `"card"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[CardForgottenEventObjectParams]
+ """
+ An object containing the forgotten card.
+ """
diff --git a/src/square/requests/card_forgotten_event_object.py b/src/square/requests/card_forgotten_event_object.py
new file mode 100644
index 00000000..83df79d3
--- /dev/null
+++ b/src/square/requests/card_forgotten_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .card_forgotten_event_card import CardForgottenEventCardParams
+
+
+class CardForgottenEventObjectParams(typing_extensions.TypedDict):
+ card: typing_extensions.NotRequired[CardForgottenEventCardParams]
+ """
+ The forgotten card.
+ """
diff --git a/src/square/requests/card_payment_details.py b/src/square/requests/card_payment_details.py
new file mode 100644
index 00000000..5bf773ed
--- /dev/null
+++ b/src/square/requests/card_payment_details.py
@@ -0,0 +1,125 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card import CardParams
+from .card_payment_timeline import CardPaymentTimelineParams
+from .card_surcharge_details import CardSurchargeDetailsParams
+from .device_details import DeviceDetailsParams
+from .error import ErrorParams
+
+
+class CardPaymentDetailsParams(typing_extensions.TypedDict):
+ """
+ Reflects the current status of a card payment. Contains only non-confidential information.
+ """
+
+ status: typing_extensions.NotRequired[str]
+ """
+ The card payment's current state. The state can be AUTHORIZED, CAPTURED, VOIDED, or
+ FAILED.
+ """
+
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The credit card's non-confidential details.
+ """
+
+ entry_method: typing_extensions.NotRequired[str]
+ """
+ The method used to enter the card's details for the payment. The method can be
+ `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
+ """
+
+ cvv_status: typing_extensions.NotRequired[str]
+ """
+ The status code returned from the Card Verification Value (CVV) check. The code can be
+ `CVV_ACCEPTED`, `CVV_REJECTED`, or `CVV_NOT_CHECKED`.
+ """
+
+ avs_status: typing_extensions.NotRequired[str]
+ """
+ The status code returned from the Address Verification System (AVS) check. The code can be
+ `AVS_ACCEPTED`, `AVS_REJECTED`, or `AVS_NOT_CHECKED`.
+ """
+
+ auth_result_code: typing_extensions.NotRequired[str]
+ """
+ The status code returned by the card issuer that describes the payment's
+ authorization status.
+ """
+
+ application_identifier: typing_extensions.NotRequired[str]
+ """
+ For EMV payments, the application ID identifies the EMV application used for the payment.
+ """
+
+ application_name: typing_extensions.NotRequired[str]
+ """
+ For EMV payments, the human-readable name of the EMV application used for the payment.
+ """
+
+ application_cryptogram: typing_extensions.NotRequired[str]
+ """
+ For EMV payments, the cryptogram generated for the payment.
+ """
+
+ verification_method: typing_extensions.NotRequired[str]
+ """
+ For EMV payments, the method used to verify the cardholder's identity. The method can be
+ `PIN`, `SIGNATURE`, `PIN_AND_SIGNATURE`, `ON_DEVICE`, or `NONE`.
+ """
+
+ verification_results: typing_extensions.NotRequired[str]
+ """
+ For EMV payments, the results of the cardholder verification. The result can be
+ `SUCCESS`, `FAILURE`, or `UNKNOWN`.
+ """
+
+ statement_description: typing_extensions.NotRequired[str]
+ """
+ The statement description sent to the card networks.
+
+ Note: The actual statement description varies and is likely to be truncated and appended with
+ additional information on a per issuer basis.
+ """
+
+ device_details: typing_extensions.NotRequired[DeviceDetailsParams]
+ """
+ __Deprecated__: Use `Payment.device_details` instead.
+
+ Details about the device that took the payment.
+ """
+
+ card_payment_timeline: typing_extensions.NotRequired[CardPaymentTimelineParams]
+ """
+ The timeline for card payments.
+ """
+
+ refund_requires_card_presence: typing_extensions.NotRequired[bool]
+ """
+ Whether the card must be physically present for the payment to
+ be refunded. If set to `true`, the card must be present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ applied_card_surcharge_details: typing_extensions.NotRequired[CardSurchargeDetailsParams]
+ """
+ Additional information about a card_surcharge on the payment.
+ """
+
+ wallet_type: typing_extensions.NotRequired[str]
+ """
+ The type of digital wallet used for this card payment, if applicable.
+ Currently only populated for in-person Apple Pay payments. Detection has no false
+ positives but may have false negatives (some Apple Pay payments may not be detected).
+
+ For payments with `source_type` of `WALLET`, see `DigitalWalletDetails` instead.
+
+ Values: `APPLE_PAY`
+ """
diff --git a/src/square/requests/card_payment_timeline.py b/src/square/requests/card_payment_timeline.py
new file mode 100644
index 00000000..b9ac800e
--- /dev/null
+++ b/src/square/requests/card_payment_timeline.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CardPaymentTimelineParams(typing_extensions.TypedDict):
+ """
+ The timeline for card payments.
+ """
+
+ authorized_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timestamp when the payment was authorized, in RFC 3339 format.
+ """
+
+ captured_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timestamp when the payment was captured, in RFC 3339 format.
+ """
+
+ voided_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timestamp when the payment was voided, in RFC 3339 format.
+ """
diff --git a/src/square/requests/card_surcharge_details.py b/src/square/requests/card_surcharge_details.py
new file mode 100644
index 00000000..dafded64
--- /dev/null
+++ b/src/square/requests/card_surcharge_details.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class CardSurchargeDetailsParams(typing_extensions.TypedDict):
+ """
+ Details related to an attempt to apply a card surcharge to this payment. When surcharge
+ eligibility is not known in advance, such as when the card type (debit or credit) is required
+ to make the eligibility determination, proposed_card_surcharge_money and
+ proposed_additional_amount_money will match the values in the request, while card_surcharge_money
+ and additional_amount_money are present only when the payment has a surcharge applied.
+ """
+
+ card_surcharge_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ A specific surcharge levied by the merchant, if a card payment is used, instead of cash or
+ some other payment type. Should only include the base surcharge amount. Any additional fees related
+ to the surcharge (e.g. taxes on the surcharge) should only be included in the additional_amount_money.
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+ The currency code must match the currency associated with the business that is accepting the
+ payment.
+ """
diff --git a/src/square/requests/card_updated_event.py b/src/square/requests/card_updated_event.py
new file mode 100644
index 00000000..d3885e3e
--- /dev/null
+++ b/src/square/requests/card_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card_updated_event_data import CardUpdatedEventDataParams
+
+
+class CardUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [card](entity:Card) is updated by the seller in the Square Dashboard.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"card.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CardUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/card_updated_event_data.py b/src/square/requests/card_updated_event_data.py
new file mode 100644
index 00000000..c85fc732
--- /dev/null
+++ b/src/square/requests/card_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card_updated_event_object import CardUpdatedEventObjectParams
+
+
+class CardUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `"card"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[CardUpdatedEventObjectParams]
+ """
+ An object containing the updated card.
+ """
diff --git a/src/square/requests/card_updated_event_object.py b/src/square/requests/card_updated_event_object.py
new file mode 100644
index 00000000..b13c86b6
--- /dev/null
+++ b/src/square/requests/card_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .card import CardParams
+
+
+class CardUpdatedEventObjectParams(typing_extensions.TypedDict):
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The updated card.
+ """
diff --git a/src/square/requests/cash_app_details.py b/src/square/requests/cash_app_details.py
new file mode 100644
index 00000000..6dd98467
--- /dev/null
+++ b/src/square/requests/cash_app_details.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CashAppDetailsParams(typing_extensions.TypedDict):
+ """
+ Additional details about `WALLET` type payments with the `brand` of `CASH_APP`.
+ """
+
+ buyer_full_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the Cash App account holder.
+ """
+
+ buyer_country_code: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The country of the Cash App account holder, in ISO 3166-1-alpha-2 format.
+
+ For possible values, see [Country](entity:Country).
+ """
+
+ buyer_cashtag: typing_extensions.NotRequired[str]
+ """
+ $Cashtag of the Cash App account holder.
+ """
diff --git a/src/square/requests/cash_drawer_device.py b/src/square/requests/cash_drawer_device.py
new file mode 100644
index 00000000..9e8e4736
--- /dev/null
+++ b/src/square/requests/cash_drawer_device.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CashDrawerDeviceParams(typing_extensions.TypedDict):
+ id: typing_extensions.NotRequired[str]
+ """
+ The device Square-issued ID
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The device merchant-specified name.
+ """
diff --git a/src/square/requests/cash_drawer_shift.py b/src/square/requests/cash_drawer_shift.py
new file mode 100644
index 00000000..706715db
--- /dev/null
+++ b/src/square/requests/cash_drawer_shift.py
@@ -0,0 +1,142 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.cash_drawer_shift_state import CashDrawerShiftState
+from .cash_drawer_device import CashDrawerDeviceParams
+from .money import MoneyParams
+
+
+class CashDrawerShiftParams(typing_extensions.TypedDict):
+ """
+ This model gives the details of a cash drawer shift.
+ The cash_payment_money, cash_refund_money, cash_paid_in_money,
+ and cash_paid_out_money fields are all computed by summing their respective
+ event types.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The shift unique ID.
+ """
+
+ state: typing_extensions.NotRequired[CashDrawerShiftState]
+ """
+ The shift current state.
+ See [CashDrawerShiftState](#type-cashdrawershiftstate) for possible values
+ """
+
+ opened_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The time when the shift began, in ISO 8601 format.
+ """
+
+ ended_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The time when the shift ended, in ISO 8601 format.
+ """
+
+ closed_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The time when the shift was closed, in ISO 8601 format.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The free-form text description of a cash drawer by an employee.
+ """
+
+ opened_cash_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money in the cash drawer at the start of the shift.
+ The amount must be greater than or equal to zero.
+ """
+
+ cash_payment_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money added to the cash drawer from cash payments.
+ This is computed by summing all events with the types CASH_TENDER_PAYMENT and
+ CASH_TENDER_CANCELED_PAYMENT. The amount is always greater than or equal to
+ zero.
+ """
+
+ cash_refunds_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money removed from the cash drawer from cash refunds.
+ It is computed by summing the events of type CASH_TENDER_REFUND. The amount
+ is always greater than or equal to zero.
+ """
+
+ cash_paid_in_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money added to the cash drawer for reasons other than cash
+ payments. It is computed by summing the events of type PAID_IN. The amount is
+ always greater than or equal to zero.
+ """
+
+ cash_paid_out_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money removed from the cash drawer for reasons other than
+ cash refunds. It is computed by summing the events of type PAID_OUT. The amount
+ is always greater than or equal to zero.
+ """
+
+ expected_cash_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money that should be in the cash drawer at the end of the
+ shift, based on the shift's other money amounts.
+ This can be negative if employees have not correctly recorded all the events
+ on the cash drawer.
+ cash_paid_out_money is a summation of amounts from cash_payment_money (zero
+ or positive), cash_refunds_money (zero or negative), cash_paid_in_money (zero
+ or positive), and cash_paid_out_money (zero or negative) event types.
+ """
+
+ closed_cash_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money found in the cash drawer at the end of the shift
+ by an auditing employee. The amount should be positive.
+ """
+
+ device: typing_extensions.NotRequired[CashDrawerDeviceParams]
+ """
+ The device running Square Point of Sale that was connected to the cash drawer.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The shift start time in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The shift updated at time in RFC 3339 format.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the location the cash drawer shift belongs to.
+ """
+
+ team_member_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ The IDs of all team members that were logged into Square Point of Sale at any
+ point while the cash drawer shift was open.
+ """
+
+ opening_team_member_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the team member that started the cash drawer shift.
+ """
+
+ ending_team_member_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the team member that ended the cash drawer shift.
+ """
+
+ closing_team_member_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the team member that closed the cash drawer shift by auditing
+ the cash drawer contents.
+ """
diff --git a/src/square/requests/cash_drawer_shift_event.py b/src/square/requests/cash_drawer_shift_event.py
new file mode 100644
index 00000000..30fa53bc
--- /dev/null
+++ b/src/square/requests/cash_drawer_shift_event.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.cash_drawer_event_type import CashDrawerEventType
+from .money import MoneyParams
+
+
+class CashDrawerShiftEventParams(typing_extensions.TypedDict):
+ id: typing_extensions.NotRequired[str]
+ """
+ The unique ID of the event.
+ """
+
+ event_type: typing_extensions.NotRequired[CashDrawerEventType]
+ """
+ The type of cash drawer shift event.
+ See [CashDrawerEventType](#type-cashdrawereventtype) for possible values
+ """
+
+ event_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money that was added to or removed from the cash drawer
+ in the event. The amount can be positive (for added money)
+ or zero (for other tender type payments). The addition or removal of money can be determined by
+ by the event type.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The event time in RFC 3339 format.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional description of the event, entered by the employee that
+ created the event.
+ """
+
+ team_member_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the team member that created the event.
+ """
diff --git a/src/square/requests/cash_drawer_shift_summary.py b/src/square/requests/cash_drawer_shift_summary.py
new file mode 100644
index 00000000..c8cb0c80
--- /dev/null
+++ b/src/square/requests/cash_drawer_shift_summary.py
@@ -0,0 +1,83 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.cash_drawer_shift_state import CashDrawerShiftState
+from .money import MoneyParams
+
+
+class CashDrawerShiftSummaryParams(typing_extensions.TypedDict):
+ """
+ The summary of a closed cash drawer shift.
+ This model contains only the money counted to start a cash drawer shift, counted
+ at the end of the shift, and the amount that should be in the drawer at shift
+ end based on summing all cash drawer shift events.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The shift unique ID.
+ """
+
+ state: typing_extensions.NotRequired[CashDrawerShiftState]
+ """
+ The shift current state.
+ See [CashDrawerShiftState](#type-cashdrawershiftstate) for possible values
+ """
+
+ opened_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The shift start time in ISO 8601 format.
+ """
+
+ ended_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The shift end time in ISO 8601 format.
+ """
+
+ closed_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The shift close time in ISO 8601 format.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An employee free-text description of a cash drawer shift.
+ """
+
+ opened_cash_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money in the cash drawer at the start of the shift. This
+ must be a positive amount.
+ """
+
+ expected_cash_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money that should be in the cash drawer at the end of the
+ shift, based on the cash drawer events on the shift.
+ The amount is correct if all shift employees accurately recorded their
+ cash drawer shift events. Unrecorded events and events with the wrong amount
+ result in an incorrect expected_cash_money amount that can be negative.
+ """
+
+ closed_cash_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money found in the cash drawer at the end of the shift by
+ an auditing employee. The amount must be greater than or equal to zero.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The shift start time in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The shift updated at time in RFC 3339 format.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the location the cash drawer shift belongs to.
+ """
diff --git a/src/square/requests/cash_payment_details.py b/src/square/requests/cash_payment_details.py
new file mode 100644
index 00000000..e34a3df9
--- /dev/null
+++ b/src/square/requests/cash_payment_details.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class CashPaymentDetailsParams(typing_extensions.TypedDict):
+ """
+ Stores details about a cash payment. Contains only non-confidential information. For more information, see
+ [Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments).
+ """
+
+ buyer_supplied_money: MoneyParams
+ """
+ The amount and currency of the money supplied by the buyer.
+ """
+
+ change_back_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of change due back to the buyer.
+ This read-only field is calculated
+ from the `amount_money` and `buyer_supplied_money` fields.
+ """
diff --git a/src/square/requests/catalog_availability_period.py b/src/square/requests/catalog_availability_period.py
new file mode 100644
index 00000000..1aa5bd2a
--- /dev/null
+++ b/src/square/requests/catalog_availability_period.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.day_of_week import DayOfWeek
+
+
+class CatalogAvailabilityPeriodParams(typing_extensions.TypedDict):
+ """
+ Represents a time period of availability.
+ """
+
+ start_local_time: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The start time of an availability period, specified in local time using partial-time
+ RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning.
+ Note that the seconds value is always :00, but it is appended for conformance to the RFC.
+ """
+
+ end_local_time: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The end time of an availability period, specified in local time using partial-time
+ RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening.
+ Note that the seconds value is always :00, but it is appended for conformance to the RFC.
+ """
+
+ day_of_week: typing_extensions.NotRequired[DayOfWeek]
+ """
+ The day of the week for this availability period.
+ See [DayOfWeek](#type-dayofweek) for possible values
+ """
diff --git a/src/square/requests/catalog_category.py b/src/square/requests/catalog_category.py
new file mode 100644
index 00000000..847aa64e
--- /dev/null
+++ b/src/square/requests/catalog_category.py
@@ -0,0 +1,78 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from ..types.catalog_category_type import CatalogCategoryType
+from .catalog_ecom_seo_data import CatalogEcomSeoDataParams
+from .category_path_to_root_node import CategoryPathToRootNodeParams
+
+if typing.TYPE_CHECKING:
+ from .catalog_object_category import CatalogObjectCategoryParams
+
+
+class CatalogCategoryParams(typing_extensions.TypedDict):
+ """
+ A category to which a `CatalogItem` instance belongs.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The category name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
+ """
+
+ image_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of images associated with this `CatalogCategory` instance.
+ Currently these images are not displayed by Square, but are free to be displayed in 3rd party applications.
+ """
+
+ category_type: typing_extensions.NotRequired[CatalogCategoryType]
+ """
+ The type of the category.
+ See [CatalogCategoryType](#type-catalogcategorytype) for possible values
+ """
+
+ parent_category: typing_extensions.NotRequired["CatalogObjectCategoryParams"]
+ """
+ The parent category of this category instance. This includes the parent category ID and an ordinal
+ value that determines the category's relative position among sibling categories with the same parent.
+ """
+
+ is_top_level: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether a category is a top level category, which does not have any parent_category.
+ """
+
+ channels: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A list of IDs representing channels, such as a Square Online site, where the category can be made visible.
+ """
+
+ availability_period_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of the `CatalogAvailabilityPeriod` objects associated with the category.
+ """
+
+ online_visibility: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the category is visible (`true`) or hidden (`false`) on all of the seller's Square Online sites.
+ """
+
+ root_category: typing_extensions.NotRequired[str]
+ """
+ The top-level category in a category hierarchy.
+ """
+
+ ecom_seo_data: typing_extensions.NotRequired[CatalogEcomSeoDataParams]
+ """
+ The SEO data for a seller's Square Online store.
+ """
+
+ path_to_root: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CategoryPathToRootNodeParams]]]
+ """
+ The path from the category to its root category. The first node of the path is the parent of the category
+ and the last is the root category. The path is empty if the category is a root category.
+ """
diff --git a/src/square/requests/catalog_custom_attribute_definition.py b/src/square/requests/catalog_custom_attribute_definition.py
new file mode 100644
index 00000000..1e978830
--- /dev/null
+++ b/src/square/requests/catalog_custom_attribute_definition.py
@@ -0,0 +1,103 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_custom_attribute_definition_app_visibility import CatalogCustomAttributeDefinitionAppVisibility
+from ..types.catalog_custom_attribute_definition_seller_visibility import (
+ CatalogCustomAttributeDefinitionSellerVisibility,
+)
+from ..types.catalog_custom_attribute_definition_type import CatalogCustomAttributeDefinitionType
+from ..types.catalog_object_type import CatalogObjectType
+from .catalog_custom_attribute_definition_number_config import CatalogCustomAttributeDefinitionNumberConfigParams
+from .catalog_custom_attribute_definition_selection_config import CatalogCustomAttributeDefinitionSelectionConfigParams
+from .catalog_custom_attribute_definition_string_config import CatalogCustomAttributeDefinitionStringConfigParams
+from .source_application import SourceApplicationParams
+
+
+class CatalogCustomAttributeDefinitionParams(typing_extensions.TypedDict):
+ """
+ Contains information defining a custom attribute. Custom attributes are
+ intended to store additional information about a catalog object or to associate a
+ catalog object with an entity in another system. Do not use custom attributes
+ to store any sensitive information (personally identifiable information, card details, etc.).
+ [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes)
+ """
+
+ type: CatalogCustomAttributeDefinitionType
+ """
+ The type of this custom attribute. Cannot be modified after creation.
+ Required.
+ See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values
+ """
+
+ name: str
+ """
+ The name of this definition for API and seller-facing UI purposes.
+ The name must be unique within the (merchant, application) pair. Required.
+ May not be empty and may not exceed 255 characters. Can be modified after creation.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Seller-oriented description of the meaning of this Custom Attribute,
+ any constraints that the seller should observe, etc. May be displayed as a tooltip in Square UIs.
+ """
+
+ source_application: typing_extensions.NotRequired[SourceApplicationParams]
+ """
+ __Read only.__ Contains information about the application that
+ created this custom attribute definition.
+ """
+
+ allowed_object_types: typing.Sequence[CatalogObjectType]
+ """
+ The set of `CatalogObject` types that this custom atttribute may be applied to.
+ Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. At least one type must be included.
+ See [CatalogObjectType](#type-catalogobjecttype) for possible values
+ """
+
+ seller_visibility: typing_extensions.NotRequired[CatalogCustomAttributeDefinitionSellerVisibility]
+ """
+ The visibility of a custom attribute in seller-facing UIs (including Square Point
+ of Sale applications and Square Dashboard). May be modified.
+ See [CatalogCustomAttributeDefinitionSellerVisibility](#type-catalogcustomattributedefinitionsellervisibility) for possible values
+ """
+
+ app_visibility: typing_extensions.NotRequired[CatalogCustomAttributeDefinitionAppVisibility]
+ """
+ The visibility of a custom attribute to applications other than the application
+ that created the attribute.
+ See [CatalogCustomAttributeDefinitionAppVisibility](#type-catalogcustomattributedefinitionappvisibility) for possible values
+ """
+
+ string_config: typing_extensions.NotRequired[CatalogCustomAttributeDefinitionStringConfigParams]
+ """
+ Optionally, populated when `type` = `STRING`, unset otherwise.
+ """
+
+ number_config: typing_extensions.NotRequired[CatalogCustomAttributeDefinitionNumberConfigParams]
+ """
+ Optionally, populated when `type` = `NUMBER`, unset otherwise.
+ """
+
+ selection_config: typing_extensions.NotRequired[CatalogCustomAttributeDefinitionSelectionConfigParams]
+ """
+ Populated when `type` is set to `SELECTION`, unset otherwise.
+ """
+
+ custom_attribute_usage_count: typing_extensions.NotRequired[int]
+ """
+ The number of custom attributes that reference this
+ custom attribute definition. Set by the server in response to a ListCatalog
+ request with `include_counts` set to `true`. If the actual count is greater
+ than 100, `custom_attribute_usage_count` will be set to `100`.
+ """
+
+ key: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the desired custom attribute key that can be used to access
+ the custom attribute value on catalog objects. Cannot be modified after the
+ custom attribute definition has been created.
+ Must be between 1 and 60 characters, and may only contain the characters `[a-zA-Z0-9_-]`.
+ """
diff --git a/src/square/requests/catalog_custom_attribute_definition_number_config.py b/src/square/requests/catalog_custom_attribute_definition_number_config.py
new file mode 100644
index 00000000..7710bf10
--- /dev/null
+++ b/src/square/requests/catalog_custom_attribute_definition_number_config.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogCustomAttributeDefinitionNumberConfigParams(typing_extensions.TypedDict):
+ precision: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ An integer between 0 and 5 that represents the maximum number of
+ positions allowed after the decimal in number custom attribute values
+ For example:
+
+ - if the precision is 0, the quantity can be 1, 2, 3, etc.
+ - if the precision is 1, the quantity can be 0.1, 0.2, etc.
+ - if the precision is 2, the quantity can be 0.01, 0.12, etc.
+
+ Default: 5
+ """
diff --git a/src/square/requests/catalog_custom_attribute_definition_selection_config.py b/src/square/requests/catalog_custom_attribute_definition_selection_config.py
new file mode 100644
index 00000000..ad5b4e65
--- /dev/null
+++ b/src/square/requests/catalog_custom_attribute_definition_selection_config.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_custom_attribute_definition_selection_config_custom_attribute_selection import (
+ CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelectionParams,
+)
+
+
+class CatalogCustomAttributeDefinitionSelectionConfigParams(typing_extensions.TypedDict):
+ """
+ Configuration associated with `SELECTION`-type custom attribute definitions.
+ """
+
+ max_allowed_selections: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of selections that can be set. The maximum value for this
+ attribute is 100. The default value is 1. The value can be modified, but changing the value will not
+ affect existing custom attribute values on objects. Clients need to
+ handle custom attributes with more selected values than allowed by this limit.
+ """
+
+ allowed_selections: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelectionParams]]
+ ]
+ """
+ The set of valid `CatalogCustomAttributeSelections`. Up to a maximum of 100
+ selections can be defined. Can be modified.
+ """
diff --git a/src/square/requests/catalog_custom_attribute_definition_selection_config_custom_attribute_selection.py b/src/square/requests/catalog_custom_attribute_definition_selection_config_custom_attribute_selection.py
new file mode 100644
index 00000000..abfe6ea9
--- /dev/null
+++ b/src/square/requests/catalog_custom_attribute_definition_selection_config_custom_attribute_selection.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelectionParams(typing_extensions.TypedDict):
+ """
+ A named selection for this `SELECTION`-type custom attribute definition.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Unique ID set by Square.
+ """
+
+ name: str
+ """
+ Selection name, unique within `allowed_selections`.
+ """
diff --git a/src/square/requests/catalog_custom_attribute_definition_string_config.py b/src/square/requests/catalog_custom_attribute_definition_string_config.py
new file mode 100644
index 00000000..fb7e6aac
--- /dev/null
+++ b/src/square/requests/catalog_custom_attribute_definition_string_config.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogCustomAttributeDefinitionStringConfigParams(typing_extensions.TypedDict):
+ """
+ Configuration associated with Custom Attribute Definitions of type `STRING`.
+ """
+
+ enforce_uniqueness: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If true, each Custom Attribute instance associated with this Custom Attribute
+ Definition must have a unique value within the seller's catalog. For
+ example, this may be used for a value like a SKU that should not be
+ duplicated within a seller's catalog. May not be modified after the
+ definition has been created.
+ """
diff --git a/src/square/requests/catalog_custom_attribute_value.py b/src/square/requests/catalog_custom_attribute_value.py
new file mode 100644
index 00000000..83c7ea61
--- /dev/null
+++ b/src/square/requests/catalog_custom_attribute_value.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_custom_attribute_definition_type import CatalogCustomAttributeDefinitionType
+
+
+class CatalogCustomAttributeValueParams(typing_extensions.TypedDict):
+ """
+ An instance of a custom attribute. Custom attributes can be defined and
+ added to `ITEM` and `ITEM_VARIATION` type catalog objects.
+ [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes).
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the custom attribute.
+ """
+
+ string_value: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The string value of the custom attribute. Populated if `type` = `STRING`.
+ """
+
+ custom_attribute_definition_id: typing_extensions.NotRequired[str]
+ """
+ The id of the [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) this value belongs to.
+ """
+
+ type: typing_extensions.NotRequired[CatalogCustomAttributeDefinitionType]
+ """
+ A copy of type from the associated `CatalogCustomAttributeDefinition`.
+ See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values
+ """
+
+ number_value: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Populated if `type` = `NUMBER`. Contains a string
+ representation of a decimal number, using a `.` as the decimal separator.
+ """
+
+ boolean_value: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ A `true` or `false` value. Populated if `type` = `BOOLEAN`.
+ """
+
+ selection_uid_values: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ One or more choices from `allowed_selections`. Populated if `type` = `SELECTION`.
+ """
+
+ key: typing_extensions.NotRequired[str]
+ """
+ If the associated `CatalogCustomAttributeDefinition` object is defined by another application, this key is prefixed by the defining application ID.
+ For example, if the CatalogCustomAttributeDefinition has a key attribute of "cocoa_brand" and the defining application ID is "abcd1234", this key is "abcd1234:cocoa_brand"
+ when the application making the request is different from the application defining the custom attribute definition. Otherwise, the key is simply "cocoa_brand".
+ """
diff --git a/src/square/requests/catalog_discount.py b/src/square/requests/catalog_discount.py
new file mode 100644
index 00000000..36666e66
--- /dev/null
+++ b/src/square/requests/catalog_discount.py
@@ -0,0 +1,74 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_discount_modify_tax_basis import CatalogDiscountModifyTaxBasis
+from ..types.catalog_discount_type import CatalogDiscountType
+from .money import MoneyParams
+
+
+class CatalogDiscountParams(typing_extensions.TypedDict):
+ """
+ A discount applicable to items.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The discount name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
+ """
+
+ discount_type: typing_extensions.NotRequired[CatalogDiscountType]
+ """
+ Indicates whether the discount is a fixed amount or percentage, or entered at the time of sale.
+ See [CatalogDiscountType](#type-catalogdiscounttype) for possible values
+ """
+
+ percentage: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The percentage of the discount as a string representation of a decimal number, using a `.` as the decimal
+ separator and without a `%` sign. A value of `7.5` corresponds to `7.5%`. Specify a percentage of `0` if `discount_type`
+ is `VARIABLE_PERCENTAGE`.
+
+ Do not use this field for amount-based or variable discounts.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of the discount. Specify an amount of `0` if `discount_type` is `VARIABLE_AMOUNT`.
+
+ Do not use this field for percentage-based or variable discounts.
+ """
+
+ pin_required: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether a mobile staff member needs to enter their PIN to apply the
+ discount to a payment in the Square Point of Sale app.
+ """
+
+ label_color: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The color of the discount display label in the Square Point of Sale app. This must be a valid hex color code.
+ """
+
+ modify_tax_basis: typing_extensions.NotRequired[CatalogDiscountModifyTaxBasis]
+ """
+ Indicates whether this discount should reduce the price used to calculate tax.
+
+ Most discounts should use `MODIFY_TAX_BASIS`. However, in some circumstances taxes must
+ be calculated based on an item's price, ignoring a particular discount. For example,
+ in many US jurisdictions, a manufacturer coupon or instant rebate reduces the price a
+ customer pays but does not reduce the sale price used to calculate how much sales tax is
+ due. In this case, the discount representing that manufacturer coupon should have
+ `DO_NOT_MODIFY_TAX_BASIS` for this field.
+
+ If you are unsure whether you need to use this field, consult your tax professional.
+ See [CatalogDiscountModifyTaxBasis](#type-catalogdiscountmodifytaxbasis) for possible values
+ """
+
+ maximum_amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ For a percentage discount, the maximum absolute value of the discount. For example, if a
+ 50% discount has a `maximum_amount_money` of $20, a $100 purchase will yield a $20 discount,
+ not a $50 discount.
+ """
diff --git a/src/square/requests/catalog_ecom_seo_data.py b/src/square/requests/catalog_ecom_seo_data.py
new file mode 100644
index 00000000..62395f76
--- /dev/null
+++ b/src/square/requests/catalog_ecom_seo_data.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogEcomSeoDataParams(typing_extensions.TypedDict):
+ """
+ SEO data for for a seller's Square Online store.
+ """
+
+ page_title: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The SEO title used for the Square Online store.
+ """
+
+ page_description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The SEO description used for the Square Online store.
+ """
+
+ permalink: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The SEO permalink used for the Square Online store.
+ """
diff --git a/src/square/requests/catalog_id_mapping.py b/src/square/requests/catalog_id_mapping.py
new file mode 100644
index 00000000..8cf5abd2
--- /dev/null
+++ b/src/square/requests/catalog_id_mapping.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogIdMappingParams(typing_extensions.TypedDict):
+ """
+ A mapping between a temporary client-supplied ID and a permanent server-generated ID.
+
+ When calling [UpsertCatalogObject](api-endpoint:Catalog-UpsertCatalogObject) or
+ [BatchUpsertCatalogObjects](api-endpoint:Catalog-BatchUpsertCatalogObjects) to
+ create a [CatalogObject](entity:CatalogObject) instance, you can supply
+ a temporary ID for the to-be-created object, especially when the object is to be referenced
+ elsewhere in the same request body. This temporary ID can be any string unique within
+ the call, but must be prefixed by "#".
+
+ After the request is submitted and the object created, a permanent server-generated ID is assigned
+ to the new object. The permanent ID is unique across the Square catalog.
+ """
+
+ client_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The client-supplied temporary `#`-prefixed ID for a new `CatalogObject`.
+ """
+
+ object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The permanent ID for the CatalogObject created by the server.
+ """
diff --git a/src/square/requests/catalog_image.py b/src/square/requests/catalog_image.py
new file mode 100644
index 00000000..2cdeb97d
--- /dev/null
+++ b/src/square/requests/catalog_image.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogImageParams(typing_extensions.TypedDict):
+ """
+ An image file to use in Square catalogs. It can be associated with
+ `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, and `CatalogModifierList` objects.
+ Only the images on items and item variations are exposed in Dashboard.
+ Only the first image on an item is displayed in Square Point of Sale (SPOS).
+ Images on items and variations are displayed through Square Online Store.
+ Images on other object types are for use by 3rd party application developers.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The internal name to identify this image in calls to the Square API.
+ This is a searchable attribute for use in applicable query filters
+ using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
+ It is not unique and should not be shown in a buyer facing context.
+ """
+
+ url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The URL of this image, generated by Square after an image is uploaded
+ using the [CreateCatalogImage](api-endpoint:Catalog-CreateCatalogImage) endpoint.
+ To modify the image, use the UpdateCatalogImage endpoint. Do not change the URL field.
+ """
+
+ caption: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A caption that describes what is shown in the image. Displayed in the
+ Square Online Store. This is a searchable attribute for use in applicable query filters
+ using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
+ """
+
+ photo_studio_order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The immutable order ID for this image object created by the Photo Studio service in Square Online Store.
+ """
diff --git a/src/square/requests/catalog_info_response.py b/src/square/requests/catalog_info_response.py
new file mode 100644
index 00000000..6a71bd5d
--- /dev/null
+++ b/src/square/requests/catalog_info_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_info_response_limits import CatalogInfoResponseLimitsParams
+from .error import ErrorParams
+from .standard_unit_description_group import StandardUnitDescriptionGroupParams
+
+
+class CatalogInfoResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ limits: typing_extensions.NotRequired[CatalogInfoResponseLimitsParams]
+ """
+ Limits that apply to this API.
+ """
+
+ standard_unit_description_group: typing_extensions.NotRequired[StandardUnitDescriptionGroupParams]
+ """
+ Names and abbreviations for standard units.
+ """
diff --git a/src/square/requests/catalog_info_response_limits.py b/src/square/requests/catalog_info_response_limits.py
new file mode 100644
index 00000000..af1cfca3
--- /dev/null
+++ b/src/square/requests/catalog_info_response_limits.py
@@ -0,0 +1,73 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogInfoResponseLimitsParams(typing_extensions.TypedDict):
+ batch_upsert_max_objects_per_batch: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of objects that may appear within a single batch in a
+ `/v2/catalog/batch-upsert` request.
+ """
+
+ batch_upsert_max_total_objects: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of objects that may appear across all batches in a
+ `/v2/catalog/batch-upsert` request.
+ """
+
+ batch_retrieve_max_object_ids: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of object IDs that may appear in a `/v2/catalog/batch-retrieve`
+ request.
+ """
+
+ search_max_page_limit: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of results that may be returned in a page of a
+ `/v2/catalog/search` response.
+ """
+
+ batch_delete_max_object_ids: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of object IDs that may be included in a single
+ `/v2/catalog/batch-delete` request.
+ """
+
+ update_item_taxes_max_item_ids: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of item IDs that may be included in a single
+ `/v2/catalog/update-item-taxes` request.
+ """
+
+ update_item_taxes_max_taxes_to_enable: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of tax IDs to be enabled that may be included in a single
+ `/v2/catalog/update-item-taxes` request.
+ """
+
+ update_item_taxes_max_taxes_to_disable: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of tax IDs to be disabled that may be included in a single
+ `/v2/catalog/update-item-taxes` request.
+ """
+
+ update_item_modifier_lists_max_item_ids: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of item IDs that may be included in a single
+ `/v2/catalog/update-item-modifier-lists` request.
+ """
+
+ update_item_modifier_lists_max_modifier_lists_to_enable: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of modifier list IDs to be enabled that may be included in
+ a single `/v2/catalog/update-item-modifier-lists` request.
+ """
+
+ update_item_modifier_lists_max_modifier_lists_to_disable: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of modifier list IDs to be disabled that may be included in
+ a single `/v2/catalog/update-item-modifier-lists` request.
+ """
diff --git a/src/square/requests/catalog_item.py b/src/square/requests/catalog_item.py
new file mode 100644
index 00000000..743cc2a4
--- /dev/null
+++ b/src/square/requests/catalog_item.py
@@ -0,0 +1,219 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from ..types.catalog_item_product_type import CatalogItemProductType
+from .catalog_ecom_seo_data import CatalogEcomSeoDataParams
+from .catalog_item_food_and_beverage_details import CatalogItemFoodAndBeverageDetailsParams
+from .catalog_item_modifier_list_info import CatalogItemModifierListInfoParams
+from .catalog_item_option_for_item import CatalogItemOptionForItemParams
+from .catalog_object_category import CatalogObjectCategoryParams
+
+if typing.TYPE_CHECKING:
+ from .catalog_object import CatalogObjectParams
+
+
+class CatalogItemParams(typing_extensions.TypedDict):
+ """
+ A [CatalogObject](entity:CatalogObject) instance of the `ITEM` type, also referred to as an item, in the catalog.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The item's name. This is a searchable attribute for use in applicable query filters, its value must not be empty, and the length is of Unicode code points.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The item's description. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
+
+ Deprecated at 2022-07-20, this field is planned to retire in 6 months. You should migrate to use `description_html` to set the description
+ of the [CatalogItem](entity:CatalogItem) instance. The `description` and `description_html` field values are kept in sync. If you try to
+ set the both fields, the `description_html` text value overwrites the `description` value. Updates in one field are also reflected in the other,
+ except for when you use an early version before Square API 2022-07-20 and `description_html` is set to blank, setting the `description` value to null
+ does not nullify `description_html`.
+ """
+
+ abbreviation: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used.
+ This attribute is searchable, and its value length is of Unicode code points.
+ """
+
+ label_color: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code.
+ """
+
+ is_taxable: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`.
+ """
+
+ category_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the item's category, if any. Deprecated since 2023-12-13. Use `CatalogItem.categories`, instead.
+ """
+
+ buyer_facing_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The override to a product name to display to users
+ """
+
+ tax_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A set of IDs indicating the taxes enabled for
+ this item. When updating an item, any taxes listed here will be added to the item.
+ Taxes may also be added to or deleted from an item using `UpdateItemTaxes`.
+ """
+
+ modifier_list_info: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[CatalogItemModifierListInfoParams]]
+ ]
+ """
+ A set of `CatalogItemModifierListInfo` objects
+ representing the modifier lists that apply to this item, along with the overrides and min
+ and max limits that are specific to this item. Modifier lists
+ may also be added to or deleted from an item using `UpdateItemModifierLists`.
+ """
+
+ variations: typing_extensions.NotRequired[typing.Optional[typing.Sequence["CatalogObjectParams"]]]
+ """
+ A list of [CatalogItemVariation](entity:CatalogItemVariation) objects for this item. An item must have
+ at least one variation.
+ """
+
+ product_type: typing_extensions.NotRequired[CatalogItemProductType]
+ """
+ The product type of the item. Once set, the `product_type` value cannot be modified.
+
+ Items of the `LEGACY_SQUARE_ONLINE_SERVICE` and `LEGACY_SQUARE_ONLINE_MEMBERSHIP` product types can be updated
+ but cannot be created using the API.
+ See [CatalogItemProductType](#type-catalogitemproducttype) for possible values
+ """
+
+ skip_modifier_screen: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If `false`, the Square Point of Sale app will present the `CatalogItem`'s
+ details screen immediately, allowing the merchant to choose `CatalogModifier`s
+ before adding the item to the cart. This is the default behavior.
+
+ If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected
+ modifiers, and merchants can edit modifiers by drilling down onto the item's details.
+
+ Third-party clients are encouraged to implement similar behaviors.
+ """
+
+ item_options: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CatalogItemOptionForItemParams]]]
+ """
+ List of item options IDs for this item. Used to manage and group item
+ variations in a specified order.
+
+ Maximum: 6 item options.
+ """
+
+ ecom_uri: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Deprecated. A URI pointing to a published e-commerce product page for the Item.
+ """
+
+ ecom_image_uris: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Deprecated. A comma-separated list of encoded URIs pointing to a set of published e-commerce images for the Item.
+ """
+
+ image_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of images associated with this `CatalogItem` instance.
+ These images will be shown to customers in Square Online Store.
+ The first image will show up as the icon for this item in POS.
+ """
+
+ sort_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A name to sort the item by. If this name is unspecified, namely, the `sort_name` field is absent, the regular `name` field is used for sorting.
+ Its value must not be empty.
+
+ It is currently supported for sellers of the Japanese locale only.
+ """
+
+ categories: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CatalogObjectCategoryParams]]]
+ """
+ The list of categories to which this item belongs. Each entry includes the category ID and an ordinal
+ value that determines the item's relative position within that category.
+ """
+
+ description_html: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The item's description as expressed in valid HTML elements. The length of this field value, including those of HTML tags,
+ is of Unicode points. With application query filters, the text values of the HTML elements and attributes are searchable. Invalid or
+ unsupported HTML elements or attributes are ignored.
+
+ Supported HTML elements include:
+ - `a`: Link. Supports linking to website URLs, email address, and telephone numbers.
+ - `b`, `strong`: Bold text
+ - `br`: Line break
+ - `code`: Computer code
+ - `div`: Section
+ - `h1-h6`: Headings
+ - `i`, `em`: Italics
+ - `li`: List element
+ - `ol`: Numbered list
+ - `p`: Paragraph
+ - `ul`: Bullet list
+ - `u`: Underline
+
+
+ Supported HTML attributes include:
+ - `align`: Alignment of the text content
+ - `href`: Link destination
+ - `rel`: Relationship between link's target and source
+ - `target`: Place to open the linked document
+ """
+
+ description_plaintext: typing_extensions.NotRequired[str]
+ """
+ A server-generated plaintext version of the `description_html` field, without formatting tags.
+ """
+
+ kitchen_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ (Optional) Name that the restaurant wants to display to their kitchen workers
+ instead of the customer-facing name.
+ e.g., customer name might be "Big John's Mega Burger" and the
+ kitchen name is "12oz beef burger"
+ """
+
+ channels: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available.
+ This field is read only and cannot be edited.
+ """
+
+ is_archived: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether this item is archived (`true`) or not (`false`).
+ """
+
+ ecom_seo_data: typing_extensions.NotRequired[CatalogEcomSeoDataParams]
+ """
+ The SEO data for a seller's Square Online store.
+ """
+
+ food_and_beverage_details: typing_extensions.NotRequired[CatalogItemFoodAndBeverageDetailsParams]
+ """
+ The food and beverage-specific details for the `FOOD_AND_BEV` item.
+ """
+
+ reporting_category: typing_extensions.NotRequired[CatalogObjectCategoryParams]
+ """
+ The item's reporting category.
+ """
+
+ is_alcoholic: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether this item is alcoholic (`true`) or not (`false`).
+ """
diff --git a/src/square/requests/catalog_item_food_and_beverage_details.py b/src/square/requests/catalog_item_food_and_beverage_details.py
new file mode 100644
index 00000000..37b74152
--- /dev/null
+++ b/src/square/requests/catalog_item_food_and_beverage_details.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_item_food_and_beverage_details_dietary_preference import (
+ CatalogItemFoodAndBeverageDetailsDietaryPreferenceParams,
+)
+from .catalog_item_food_and_beverage_details_ingredient import CatalogItemFoodAndBeverageDetailsIngredientParams
+
+
+class CatalogItemFoodAndBeverageDetailsParams(typing_extensions.TypedDict):
+ """
+ The food and beverage-specific details of a `FOOD_AND_BEV` item.
+ """
+
+ calorie_count: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The calorie count (in the unit of kcal) for the `FOOD_AND_BEV` type of items.
+ """
+
+ dietary_preferences: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[CatalogItemFoodAndBeverageDetailsDietaryPreferenceParams]]
+ ]
+ """
+ The dietary preferences for the `FOOD_AND_BEV` item.
+ """
+
+ ingredients: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[CatalogItemFoodAndBeverageDetailsIngredientParams]]
+ ]
+ """
+ The ingredients for the `FOOD_AND_BEV` type item.
+ """
diff --git a/src/square/requests/catalog_item_food_and_beverage_details_dietary_preference.py b/src/square/requests/catalog_item_food_and_beverage_details_dietary_preference.py
new file mode 100644
index 00000000..375db540
--- /dev/null
+++ b/src/square/requests/catalog_item_food_and_beverage_details_dietary_preference.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_item_food_and_beverage_details_dietary_preference_standard_dietary_preference import (
+ CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference,
+)
+from ..types.catalog_item_food_and_beverage_details_dietary_preference_type import (
+ CatalogItemFoodAndBeverageDetailsDietaryPreferenceType,
+)
+
+
+class CatalogItemFoodAndBeverageDetailsDietaryPreferenceParams(typing_extensions.TypedDict):
+ """
+ Dietary preferences that can be assigned to an `FOOD_AND_BEV` item and its ingredients.
+ """
+
+ type: typing_extensions.NotRequired[CatalogItemFoodAndBeverageDetailsDietaryPreferenceType]
+ """
+ The dietary preference type. Supported values include `STANDARD` and `CUSTOM` as specified in `FoodAndBeverageDetails.DietaryPreferenceType`.
+ See [DietaryPreferenceType](#type-dietarypreferencetype) for possible values
+ """
+
+ standard_name: typing_extensions.NotRequired[
+ CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference
+ ]
+ """
+ The name of the dietary preference from a standard pre-defined list. This should be null if it's a custom dietary preference.
+ See [StandardDietaryPreference](#type-standarddietarypreference) for possible values
+ """
+
+ custom_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of a user-defined custom dietary preference. This should be null if it's a standard dietary preference.
+ """
diff --git a/src/square/requests/catalog_item_food_and_beverage_details_ingredient.py b/src/square/requests/catalog_item_food_and_beverage_details_ingredient.py
new file mode 100644
index 00000000..e8e46d02
--- /dev/null
+++ b/src/square/requests/catalog_item_food_and_beverage_details_ingredient.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_item_food_and_beverage_details_dietary_preference_type import (
+ CatalogItemFoodAndBeverageDetailsDietaryPreferenceType,
+)
+from ..types.catalog_item_food_and_beverage_details_ingredient_standard_ingredient import (
+ CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient,
+)
+
+
+class CatalogItemFoodAndBeverageDetailsIngredientParams(typing_extensions.TypedDict):
+ """
+ Describes the ingredient used in a `FOOD_AND_BEV` item.
+ """
+
+ type: typing_extensions.NotRequired[CatalogItemFoodAndBeverageDetailsDietaryPreferenceType]
+ """
+ The dietary preference type of the ingredient. Supported values include `STANDARD` and `CUSTOM` as specified in `FoodAndBeverageDetails.DietaryPreferenceType`.
+ See [DietaryPreferenceType](#type-dietarypreferencetype) for possible values
+ """
+
+ standard_name: typing_extensions.NotRequired[CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient]
+ """
+ The name of the ingredient from a standard pre-defined list. This should be null if it's a custom dietary preference.
+ See [StandardIngredient](#type-standardingredient) for possible values
+ """
+
+ custom_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of a custom user-defined ingredient. This should be null if it's a standard dietary preference.
+ """
diff --git a/src/square/requests/catalog_item_modifier_list_info.py b/src/square/requests/catalog_item_modifier_list_info.py
new file mode 100644
index 00000000..b20cf8d9
--- /dev/null
+++ b/src/square/requests/catalog_item_modifier_list_info.py
@@ -0,0 +1,89 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_modifier_toggle_override_type import CatalogModifierToggleOverrideType
+from .catalog_modifier_override import CatalogModifierOverrideParams
+
+
+class CatalogItemModifierListInfoParams(typing_extensions.TypedDict):
+ """
+ Controls how a modifier list is applied to a specific item. This object allows for item-specific customization of modifier list behavior
+ and provides the ability to override global modifier list settings.
+ """
+
+ modifier_list_id: str
+ """
+ The ID of the `CatalogModifierList` controlled by this `CatalogModifierListInfo`.
+ """
+
+ modifier_overrides: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CatalogModifierOverrideParams]]]
+ """
+ A set of `CatalogModifierOverride` objects that override default modifier settings for this item.
+ """
+
+ min_selected_modifiers: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The minimum number of modifiers that must be selected from this modifier list.
+ Values:
+
+ - 0: No selection is required.
+ - -1: Default value, the attribute was not set by the client. When `max_selected_modifiers` is
+ also -1, use the minimum and maximum selection values set on the `CatalogItemModifierList`.
+ - >0: The required minimum modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.
+ - < -1: Invalid. Treated as no selection required.
+ """
+
+ max_selected_modifiers: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of modifiers that can be selected.
+ Values:
+
+ - 0: No maximum limit.
+ - -1: Default value, the attribute was not set by the client. When `min_selected_modifiers` is
+ also -1, use the minimum and maximum selection values set on the `CatalogItemModifierList`.
+ - >0: The maximum total modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.
+ - < -1: Invalid. Treated as no maximum limit.
+ """
+
+ enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If `true`, enable this `CatalogModifierList`. The default value is `true`.
+ """
+
+ ordinal: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied
+ to a `CatalogItem` instance.
+ """
+
+ allow_quantities: typing_extensions.NotRequired[CatalogModifierToggleOverrideType]
+ """
+ Controls whether multiple quantities of the same modifier can be selected for this item.
+ - `YES` means that every modifier in the `CatalogModifierList` can have multiple quantities
+ selected for this item.
+ - `NO` means that each modifier in the `CatalogModifierList` can be selected only once for this item.
+ - `NOT_SET` means that the `allow_quantities` setting on the `CatalogModifierList` is obeyed.
+ See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values
+ """
+
+ is_conversational: typing_extensions.NotRequired[CatalogModifierToggleOverrideType]
+ """
+ Controls whether conversational mode is enabled for modifiers on this item.
+
+ - `YES` means conversational mode is enabled for every modifier in the `CatalogModifierList`.
+ - `NO` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`.
+ - `NOT_SET` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`.
+ See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values
+ """
+
+ hidden_from_customer_override: typing_extensions.NotRequired[CatalogModifierToggleOverrideType]
+ """
+ Controls whether all modifiers for this item are hidden from customer receipts.
+ - `YES` means that all modifiers in the `CatalogModifierList` are hidden from customer
+ receipts for this item.
+ - `NO` means that all modifiers in the `CatalogModifierList` are visible on customer receipts for this item.
+ - `NOT_SET` means that the `hidden_from_customer` setting on the `CatalogModifierList` is obeyed.
+ See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values
+ """
diff --git a/src/square/requests/catalog_item_option.py b/src/square/requests/catalog_item_option.py
new file mode 100644
index 00000000..63a3ac9c
--- /dev/null
+++ b/src/square/requests/catalog_item_option.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+
+if typing.TYPE_CHECKING:
+ from .catalog_object import CatalogObjectParams
+
+
+class CatalogItemOptionParams(typing_extensions.TypedDict):
+ """
+ A group of variations for a `CatalogItem`.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The item option's display name for the seller. Must be unique across
+ all item options. This is a searchable attribute for use in applicable query filters.
+ """
+
+ display_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The item option's display name for the customer. This is a searchable attribute for use in applicable query filters.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The item option's human-readable description. Displayed in the Square
+ Point of Sale app for the seller and in the Online Store or on receipts for
+ the buyer. This is a searchable attribute for use in applicable query filters.
+ """
+
+ show_colors: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If true, display colors for entries in `values` when present.
+ """
+
+ values: typing_extensions.NotRequired[typing.Optional[typing.Sequence["CatalogObjectParams"]]]
+ """
+ A list of CatalogObjects containing the
+ `CatalogItemOptionValue`s for this item.
+ """
diff --git a/src/square/requests/catalog_item_option_for_item.py b/src/square/requests/catalog_item_option_for_item.py
new file mode 100644
index 00000000..51c82186
--- /dev/null
+++ b/src/square/requests/catalog_item_option_for_item.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogItemOptionForItemParams(typing_extensions.TypedDict):
+ """
+ An option that can be assigned to an item.
+ For example, a t-shirt item may offer a color option or a size option.
+ """
+
+ item_option_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique id of the item option, used to form the dimensions of the item option matrix in a specified order.
+ """
diff --git a/src/square/requests/catalog_item_option_value.py b/src/square/requests/catalog_item_option_value.py
new file mode 100644
index 00000000..0c639274
--- /dev/null
+++ b/src/square/requests/catalog_item_option_value.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogItemOptionValueParams(typing_extensions.TypedDict):
+ """
+ An enumerated value that can link a
+ `CatalogItemVariation` to an item option as one of
+ its item option values.
+ """
+
+ item_option_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Unique ID of the associated item option.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of this item option value. This is a searchable attribute for use in applicable query filters.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A human-readable description for the option value. This is a searchable attribute for use in applicable query filters.
+ """
+
+ color: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The HTML-supported hex color for the item option (e.g., "#ff8d4e85").
+ Only displayed if `show_colors` is enabled on the parent `ItemOption`. When
+ left unset, `color` defaults to white ("#ffffff") when `show_colors` is
+ enabled on the parent `ItemOption`.
+ """
+
+ ordinal: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ Determines where this option value appears in a list of option values.
+ """
diff --git a/src/square/requests/catalog_item_option_value_for_item_variation.py b/src/square/requests/catalog_item_option_value_for_item_variation.py
new file mode 100644
index 00000000..62ddd96f
--- /dev/null
+++ b/src/square/requests/catalog_item_option_value_for_item_variation.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogItemOptionValueForItemVariationParams(typing_extensions.TypedDict):
+ """
+ A `CatalogItemOptionValue` links an item variation to an item option as
+ an item option value. For example, a t-shirt item may offer a color option and
+ a size option. An item option value would represent each variation of t-shirt:
+ For example, "Color:Red, Size:Small" or "Color:Blue, Size:Medium".
+ """
+
+ item_option_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique id of an item option.
+ """
+
+ item_option_value_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique id of the selected value for the item option.
+ """
diff --git a/src/square/requests/catalog_item_variation.py b/src/square/requests/catalog_item_variation.py
new file mode 100644
index 00000000..1a7a05b7
--- /dev/null
+++ b/src/square/requests/catalog_item_variation.py
@@ -0,0 +1,192 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_pricing_type import CatalogPricingType
+from ..types.inventory_alert_type import InventoryAlertType
+from .catalog_item_option_value_for_item_variation import CatalogItemOptionValueForItemVariationParams
+from .catalog_item_variation_vendor_information import CatalogItemVariationVendorInformationParams
+from .catalog_stock_conversion import CatalogStockConversionParams
+from .item_variation_location_overrides import ItemVariationLocationOverridesParams
+from .money import MoneyParams
+
+
+class CatalogItemVariationParams(typing_extensions.TypedDict):
+ """
+ An item variation, representing a product for sale, in the Catalog object model. Each [item](entity:CatalogItem) must have at least one
+ item variation and can have at most 250 item variations.
+
+ An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked
+ number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both
+ stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass
+ variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be
+ converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes
+ the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count
+ decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion.
+ """
+
+ item_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the `CatalogItem` associated with this item variation.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The item variation's name. This is a searchable attribute for use in applicable query filters.
+
+ Its value has a maximum length of 255 Unicode code points. However, when the parent [item](entity:CatalogItem)
+ uses [item options](entity:CatalogItemOption), this attribute is auto-generated, read-only, and can be
+ longer than 255 Unicode code points.
+ """
+
+ sku: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The item variation's SKU, if any. This is a searchable attribute for use in applicable query filters.
+ """
+
+ upc: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The universal product code (UPC) of the item variation, if any. This is a searchable attribute for use in applicable query filters.
+
+ The value of this attribute should be a number of 12-14 digits long. This restriction is enforced on the Square Seller Dashboard,
+ Square Point of Sale or Retail Point of Sale apps, where this attribute shows in the GTIN field. If a non-compliant UPC value is assigned
+ to this attribute using the API, the value is not editable on the Seller Dashboard, Square Point of Sale or Retail Point of Sale apps
+ unless it is updated to fit the expected format.
+ """
+
+ ordinal: typing_extensions.NotRequired[int]
+ """
+ The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal
+ for each item variation within a parent `CatalogItem` is set according to the item variations's
+ position. On reads, the value is not guaranteed to be sequential or unique.
+ """
+
+ pricing_type: typing_extensions.NotRequired[CatalogPricingType]
+ """
+ Indicates whether the item variation's price is fixed or determined at the time
+ of sale.
+ See [CatalogPricingType](#type-catalogpricingtype) for possible values
+ """
+
+ price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The item variation's price, if fixed pricing is used.
+ """
+
+ location_overrides: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[ItemVariationLocationOverridesParams]]
+ ]
+ """
+ Per-location price and inventory overrides.
+ """
+
+ track_inventory: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If `true`, inventory tracking is active for the variation at all locations by default.
+ This value can be overridden for specific locations using `ItemVariationLocationOverrides.track_inventory`.
+ If unset at both levels, inventory tracking is disabled.
+ """
+
+ inventory_alert_type: typing_extensions.NotRequired[InventoryAlertType]
+ """
+ Indicates whether the item variation displays an alert when its inventory quantity is less than or equal
+ to its `inventory_alert_threshold`.
+
+ Deprecated because this field has never been global.
+ See [InventoryAlertType](#type-inventoryalerttype) for possible values
+ """
+
+ inventory_alert_threshold: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type`
+ is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. This value is always an integer.
+
+ Deprecated because this field has never been global.
+ """
+
+ user_data: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Arbitrary user metadata to associate with the item variation. This attribute value length is of Unicode code points.
+ """
+
+ service_duration: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ If the `CatalogItem` that owns this item variation is of type
+ `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For
+ example, a 30 minute appointment would have the value `1800000`, which is equal to
+ 30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second).
+ """
+
+ available_for_booking: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If the `CatalogItem` that owns this item variation is of type
+ `APPOINTMENTS_SERVICE`, a bool representing whether this service is available for booking.
+ """
+
+ item_option_values: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[CatalogItemOptionValueForItemVariationParams]]
+ ]
+ """
+ List of item option values associated with this item variation. Listed
+ in the same order as the item options of the parent item.
+ """
+
+ measurement_unit_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity
+ sold of this item variation. If left unset, the item will be sold in
+ whole quantities.
+ """
+
+ sellable: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether this variation can be sold. The inventory count of a sellable variation indicates
+ the number of units available for sale. When a variation is both stockable and sellable,
+ its sellable inventory count can be smaller than or equal to its stockable count.
+ """
+
+ stockable: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE).
+ When a variation is both stockable and sellable, the inventory count of a stockable variation keeps track of the number of units of this variation in stock
+ and is not an indicator of the number of units of the variation that can be sold.
+ """
+
+ image_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of images associated with this `CatalogItemVariation` instance.
+ These images will be shown to customers in Square Online Store.
+ """
+
+ team_member_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Tokens of employees that can perform the service represented by this variation. Only valid for
+ variations of type `APPOINTMENTS_SERVICE`.
+ """
+
+ stockable_conversion: typing_extensions.NotRequired[CatalogStockConversionParams]
+ """
+ The unit conversion rule, as prescribed by the [CatalogStockConversion](entity:CatalogStockConversion) type,
+ that describes how this non-stockable (i.e., sellable/receivable) item variation is converted
+ to/from the stockable item variation sharing the same parent item. With the stock conversion,
+ you can accurately track inventory when an item variation is sold in one unit, but stocked in
+ another unit.
+ """
+
+ kitchen_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ (Optional) Name that the restaurant wants to display to their kitchen workers
+ instead of the customer-facing name.
+ e.g., customer name might be "Mega-Jumbo Triplesized" and the
+ kitchen name is "Large container"
+ """
+
+ vendor_information: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[CatalogItemVariationVendorInformationParams]]
+ ]
+ """
+ Details of the vendor this product is purchased from.
+ This field can be set only if the seller has an active subscription
+ to either Square for Retail Premium or Square for Restaurants Premium.
+ """
diff --git a/src/square/requests/catalog_item_variation_vendor_information.py b/src/square/requests/catalog_item_variation_vendor_information.py
new file mode 100644
index 00000000..c8764afb
--- /dev/null
+++ b/src/square/requests/catalog_item_variation_vendor_information.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class CatalogItemVariationVendorInformationParams(typing_extensions.TypedDict):
+ """
+ Information about the vendor of an item variation.
+ """
+
+ vendor_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ ID of the [Vendor](entity:Vendor) linked to a default cost of this product.
+ When the product is added to a purchase order, the default cost is pre-filled.
+ This field is not validated. Clients should gracefully handle cases where the vendor_id
+ does not match any existing vendor.
+ """
+
+ vendor_code: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Unique identifier of this product in the specified vendor's' inventory system.
+ When the product is added to a purchase order, the vendor code is pre-filled based
+ on the selected vendor.
+ """
+
+ unit_cost_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The unit cost of the linked product, when purchased from the linked vendor.
+ """
diff --git a/src/square/requests/catalog_measurement_unit.py b/src/square/requests/catalog_measurement_unit.py
new file mode 100644
index 00000000..21542934
--- /dev/null
+++ b/src/square/requests/catalog_measurement_unit.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .measurement_unit import MeasurementUnitParams
+
+
+class CatalogMeasurementUnitParams(typing_extensions.TypedDict):
+ """
+ Represents the unit used to measure a `CatalogItemVariation` and
+ specifies the precision for decimal quantities.
+ """
+
+ measurement_unit: typing_extensions.NotRequired[MeasurementUnitParams]
+ """
+ Indicates the unit used to measure the quantity of a catalog item variation.
+ """
+
+ precision: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ An integer between 0 and 5 that represents the maximum number of
+ positions allowed after the decimal in quantities measured with this unit.
+ For example:
+
+ - if the precision is 0, the quantity can be 1, 2, 3, etc.
+ - if the precision is 1, the quantity can be 0.1, 0.2, etc.
+ - if the precision is 2, the quantity can be 0.01, 0.12, etc.
+
+ Default: 3
+ """
diff --git a/src/square/requests/catalog_modifier.py b/src/square/requests/catalog_modifier.py
new file mode 100644
index 00000000..9b3a5318
--- /dev/null
+++ b/src/square/requests/catalog_modifier.py
@@ -0,0 +1,63 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .modifier_location_overrides import ModifierLocationOverridesParams
+from .money import MoneyParams
+
+
+class CatalogModifierParams(typing_extensions.TypedDict):
+ """
+ A modifier that can be applied to items at the time of sale. For example, a cheese modifier for a burger, or a flavor modifier for a serving of ice cream.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The modifier name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
+ """
+
+ price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The modifier price.
+ """
+
+ on_by_default: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ When `true`, this modifier is selected by default when displaying the modifier list.
+ This setting can be overridden at the item level using `CatalogModifierListInfo.modifier_overrides`.
+ """
+
+ ordinal: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ Determines where this `CatalogModifier` appears in the `CatalogModifierList`.
+ """
+
+ modifier_list_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the `CatalogModifierList` associated with this modifier.
+ """
+
+ location_overrides: typing_extensions.NotRequired[typing.Optional[typing.Sequence[ModifierLocationOverridesParams]]]
+ """
+ Location-specific price overrides.
+ """
+
+ kitchen_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ (Optional) Name that the restaurant wants to display to their kitchen workers
+ instead of the customer-facing name.
+ e.g., customer name might be "Double Baconize" and the
+ kitchen name is "Add 2x bacon"
+ """
+
+ image_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the image associated with this `CatalogModifier` instance.
+ Currently this image is not displayed by Square, but is free to be displayed in 3rd party applications.
+ """
+
+ hidden_online: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ When `true`, this modifier is hidden from online ordering channels. This setting can be overridden at the item level using `CatalogModifierListInfo.modifier_overrides`.
+ """
diff --git a/src/square/requests/catalog_modifier_list.py b/src/square/requests/catalog_modifier_list.py
new file mode 100644
index 00000000..c0da4825
--- /dev/null
+++ b/src/square/requests/catalog_modifier_list.py
@@ -0,0 +1,133 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from ..types.catalog_modifier_list_modifier_type import CatalogModifierListModifierType
+from ..types.catalog_modifier_list_selection_type import CatalogModifierListSelectionType
+
+if typing.TYPE_CHECKING:
+ from .catalog_object import CatalogObjectParams
+
+
+class CatalogModifierListParams(typing_extensions.TypedDict):
+ """
+ A container for a list of modifiers, or a text-based modifier.
+ For text-based modifiers, this represents text configuration for an item. (For example, custom text to print on a t-shirt).
+ For non text-based modifiers, this represents a list of modifiers that can be applied to items at the time of sale.
+ (For example, a list of condiments for a hot dog, or a list of ice cream flavors).
+ Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of
+ Unicode code points.
+ """
+
+ ordinal: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances.
+ """
+
+ selection_type: typing_extensions.NotRequired[CatalogModifierListSelectionType]
+ """
+ __Deprecated__: Indicates whether a single (`SINGLE`) modifier or multiple (`MULTIPLE`) modifiers can be selected. Use
+ `min_selected_modifiers` and `max_selected_modifiers` instead.
+ See [CatalogModifierListSelectionType](#type-catalogmodifierlistselectiontype) for possible values
+ """
+
+ modifiers: typing_extensions.NotRequired[typing.Optional[typing.Sequence["CatalogObjectParams"]]]
+ """
+ A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`,
+ for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list
+ is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes:
+ ```
+ {
+ "id": "{{catalog_modifier_id}}",
+ "type": "MODIFIER",
+ "modifier_data": {{a CatalogModifier instance>}}
+ }
+ ```
+ """
+
+ image_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of images associated with this `CatalogModifierList` instance.
+ Currently these images are not displayed on Square products, but may be displayed in 3rd-party applications.
+ """
+
+ allow_quantities: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ When `true`, allows multiple quantities of the same modifier to be selected.
+ """
+
+ is_conversational: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ True if modifiers belonging to this list can be used conversationally.
+ """
+
+ modifier_type: typing_extensions.NotRequired[CatalogModifierListModifierType]
+ """
+ The type of the modifier.
+
+ When this `modifier_type` value is `TEXT`, the `CatalogModifierList` represents a text-based modifier.
+ When this `modifier_type` value is `LIST`, the `CatalogModifierList` contains a list of `CatalogModifier` objects.
+ See [CatalogModifierListModifierType](#type-catalogmodifierlistmodifiertype) for possible values
+ """
+
+ max_length: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum length, in Unicode points, of the text string of the text-based modifier as represented by
+ this `CatalogModifierList` object with the `modifier_type` set to `TEXT`.
+ """
+
+ text_required: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based modifier
+ as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`.
+ """
+
+ internal_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note for internal use by the business.
+
+ For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!"
+ is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as
+ an instruction for the business to follow.
+
+ For non text-based modifiers, this `internal_name` attribute can be
+ used to include SKUs, internal codes, or supplemental descriptions for internal use.
+ """
+
+ min_selected_modifiers: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The minimum number of modifiers that must be selected from this list. The value can be overridden with `CatalogItemModifierListInfo`.
+
+ Values:
+
+ - 0: No selection is required.
+ - -1: Default value, the attribute was not set by the client. Treated as no selection required.
+ - >0: The required minimum modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.
+ - < -1: Invalid. Treated as no selection required.
+ """
+
+ max_selected_modifiers: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The maximum number of modifiers that must be selected from this list. The value can be overridden with `CatalogItemModifierListInfo`.
+
+ Values:
+
+ - 0: No maximum limit.
+ - -1: Default value, the attribute was not set by the client. Treated as no maximum limit.
+ - >0: The maximum total modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.
+ - < -1: Invalid. Treated as no maximum limit.
+ """
+
+ hidden_from_customer: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If `true`, modifiers from this list are hidden from customer receipts. The default value is `false`.
+ This setting can be overridden with `CatalogItemModifierListInfo.hidden_from_customer_override`.
+ """
diff --git a/src/square/requests/catalog_modifier_override.py b/src/square/requests/catalog_modifier_override.py
new file mode 100644
index 00000000..fb231113
--- /dev/null
+++ b/src/square/requests/catalog_modifier_override.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_modifier_toggle_override_type import CatalogModifierToggleOverrideType
+
+
+class CatalogModifierOverrideParams(typing_extensions.TypedDict):
+ """
+ Options to control how to override the default behavior of the specified modifier.
+ """
+
+ modifier_id: str
+ """
+ The ID of the `CatalogModifier` whose default behavior is being overridden.
+ """
+
+ on_by_default: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ __Deprecated__: Use `on_by_default_override` instead.
+ """
+
+ hidden_online_override: typing_extensions.NotRequired[CatalogModifierToggleOverrideType]
+ """
+ If `YES`, this setting overrides the `hidden_online` setting on the `CatalogModifier` object,
+ and the modifier is always hidden from online sales channels.
+ If `NO`, the modifier is not hidden. It is always visible in online sales channels for this catalog item.
+ `NOT_SET` means the `hidden_online` setting on the `CatalogModifier` object is obeyed.
+ See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values
+ """
+
+ on_by_default_override: typing_extensions.NotRequired[CatalogModifierToggleOverrideType]
+ """
+ If `YES`, this setting overrides the `on_by_default` setting on the `CatalogModifier` object,
+ and the modifier is always selected by default for the catalog item.
+
+ If `NO`, the modifier is not selected by default for this catalog item.
+ `NOT_SET` means the `on_by_default` setting on the `CatalogModifier` object is obeyed.
+ See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values
+ """
diff --git a/src/square/requests/catalog_object.py b/src/square/requests/catalog_object.py
new file mode 100644
index 00000000..c8291a4a
--- /dev/null
+++ b/src/square/requests/catalog_object.py
@@ -0,0 +1,378 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from .catalog_availability_period import CatalogAvailabilityPeriodParams
+from .catalog_custom_attribute_definition import CatalogCustomAttributeDefinitionParams
+from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams
+from .catalog_discount import CatalogDiscountParams
+from .catalog_image import CatalogImageParams
+from .catalog_item_option_value import CatalogItemOptionValueParams
+from .catalog_item_variation import CatalogItemVariationParams
+from .catalog_measurement_unit import CatalogMeasurementUnitParams
+from .catalog_modifier import CatalogModifierParams
+from .catalog_pricing_rule import CatalogPricingRuleParams
+from .catalog_product_set import CatalogProductSetParams
+from .catalog_quick_amounts_settings import CatalogQuickAmountsSettingsParams
+from .catalog_subscription_plan_variation import CatalogSubscriptionPlanVariationParams
+from .catalog_tax import CatalogTaxParams
+from .catalog_time_period import CatalogTimePeriodParams
+from .catalog_v1id import CatalogV1IdParams
+
+if typing.TYPE_CHECKING:
+ from .catalog_category import CatalogCategoryParams
+ from .catalog_item import CatalogItemParams
+ from .catalog_item_option import CatalogItemOptionParams
+ from .catalog_modifier_list import CatalogModifierListParams
+ from .catalog_subscription_plan import CatalogSubscriptionPlanParams
+
+
+class CatalogObject_ItemParams(typing_extensions.TypedDict):
+ type: typing.Literal["ITEM"]
+ item_data: typing_extensions.NotRequired["CatalogItemParams"]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_ImageParams(typing_extensions.TypedDict):
+ type: typing.Literal["IMAGE"]
+ image_data: typing_extensions.NotRequired[CatalogImageParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_CategoryParams(typing_extensions.TypedDict):
+ type: typing.Literal["CATEGORY"]
+ id: typing_extensions.NotRequired[str]
+ ordinal: typing_extensions.NotRequired[typing.Optional[int]]
+ category_data: typing_extensions.NotRequired["CatalogCategoryParams"]
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_ItemVariationParams(typing_extensions.TypedDict):
+ type: typing.Literal["ITEM_VARIATION"]
+ item_variation_data: typing_extensions.NotRequired[CatalogItemVariationParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_TaxParams(typing_extensions.TypedDict):
+ type: typing.Literal["TAX"]
+ tax_data: typing_extensions.NotRequired[CatalogTaxParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_DiscountParams(typing_extensions.TypedDict):
+ type: typing.Literal["DISCOUNT"]
+ discount_data: typing_extensions.NotRequired[CatalogDiscountParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_ModifierListParams(typing_extensions.TypedDict):
+ type: typing.Literal["MODIFIER_LIST"]
+ modifier_list_data: typing_extensions.NotRequired["CatalogModifierListParams"]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_ModifierParams(typing_extensions.TypedDict):
+ type: typing.Literal["MODIFIER"]
+ modifier_data: typing_extensions.NotRequired[CatalogModifierParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_PricingRuleParams(typing_extensions.TypedDict):
+ type: typing.Literal["PRICING_RULE"]
+ pricing_rule_data: typing_extensions.NotRequired[CatalogPricingRuleParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_ProductSetParams(typing_extensions.TypedDict):
+ type: typing.Literal["PRODUCT_SET"]
+ product_set_data: typing_extensions.NotRequired[CatalogProductSetParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_TimePeriodParams(typing_extensions.TypedDict):
+ type: typing.Literal["TIME_PERIOD"]
+ time_period_data: typing_extensions.NotRequired[CatalogTimePeriodParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_MeasurementUnitParams(typing_extensions.TypedDict):
+ type: typing.Literal["MEASUREMENT_UNIT"]
+ measurement_unit_data: typing_extensions.NotRequired[CatalogMeasurementUnitParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_SubscriptionPlanVariationParams(typing_extensions.TypedDict):
+ type: typing.Literal["SUBSCRIPTION_PLAN_VARIATION"]
+ subscription_plan_variation_data: typing_extensions.NotRequired[CatalogSubscriptionPlanVariationParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_ItemOptionParams(typing_extensions.TypedDict):
+ type: typing.Literal["ITEM_OPTION"]
+ item_option_data: typing_extensions.NotRequired["CatalogItemOptionParams"]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_ItemOptionValParams(typing_extensions.TypedDict):
+ type: typing.Literal["ITEM_OPTION_VAL"]
+ item_option_value_data: typing_extensions.NotRequired[CatalogItemOptionValueParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_CustomAttributeDefinitionParams(typing_extensions.TypedDict):
+ type: typing.Literal["CUSTOM_ATTRIBUTE_DEFINITION"]
+ custom_attribute_definition_data: typing_extensions.NotRequired[CatalogCustomAttributeDefinitionParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_QuickAmountsSettingsParams(typing_extensions.TypedDict):
+ type: typing.Literal["QUICK_AMOUNTS_SETTINGS"]
+ quick_amounts_settings_data: typing_extensions.NotRequired[CatalogQuickAmountsSettingsParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_SubscriptionPlanParams(typing_extensions.TypedDict):
+ type: typing.Literal["SUBSCRIPTION_PLAN"]
+ subscription_plan_data: typing_extensions.NotRequired["CatalogSubscriptionPlanParams"]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+class CatalogObject_AvailabilityPeriodParams(typing_extensions.TypedDict):
+ type: typing.Literal["AVAILABILITY_PERIOD"]
+ availability_period_data: typing_extensions.NotRequired[CatalogAvailabilityPeriodParams]
+ id: str
+ updated_at: typing_extensions.NotRequired[str]
+ version: typing_extensions.NotRequired[int]
+ is_deleted: typing_extensions.NotRequired[bool]
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ image_id: typing_extensions.NotRequired[str]
+
+
+CatalogObjectParams = typing.Union[
+ CatalogObject_ItemParams,
+ CatalogObject_ImageParams,
+ CatalogObject_CategoryParams,
+ CatalogObject_ItemVariationParams,
+ CatalogObject_TaxParams,
+ CatalogObject_DiscountParams,
+ CatalogObject_ModifierListParams,
+ CatalogObject_ModifierParams,
+ CatalogObject_PricingRuleParams,
+ CatalogObject_ProductSetParams,
+ CatalogObject_TimePeriodParams,
+ CatalogObject_MeasurementUnitParams,
+ CatalogObject_SubscriptionPlanVariationParams,
+ CatalogObject_ItemOptionParams,
+ CatalogObject_ItemOptionValParams,
+ CatalogObject_CustomAttributeDefinitionParams,
+ CatalogObject_QuickAmountsSettingsParams,
+ CatalogObject_SubscriptionPlanParams,
+ CatalogObject_AvailabilityPeriodParams,
+]
diff --git a/src/square/requests/catalog_object_availability_period.py b/src/square/requests/catalog_object_availability_period.py
new file mode 100644
index 00000000..78abf984
--- /dev/null
+++ b/src/square/requests/catalog_object_availability_period.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_availability_period import CatalogAvailabilityPeriodParams
+from .catalog_object_base import CatalogObjectBaseParams
+
+
+class CatalogObjectAvailabilityPeriodParams(CatalogObjectBaseParams):
+ availability_period_data: typing_extensions.NotRequired[CatalogAvailabilityPeriodParams]
+ """
+ Structured data for a `CatalogAvailabilityPeriod`, set for CatalogObjects of type `AVAILABILITY_PERIOD`.
+ """
diff --git a/src/square/requests/catalog_object_base.py b/src/square/requests/catalog_object_base.py
new file mode 100644
index 00000000..53239602
--- /dev/null
+++ b/src/square/requests/catalog_object_base.py
@@ -0,0 +1,92 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams
+from .catalog_v1id import CatalogV1IdParams
+
+
+class CatalogObjectBaseParams(typing_extensions.TypedDict):
+ id: str
+ """
+ An identifier to reference this object in the catalog. When a new `CatalogObject`
+ is inserted, the client should set the id to a temporary identifier starting with
+ a "`#`" character. Other objects being inserted or updated within the same request
+ may use this identifier to refer to the new object.
+
+ When the server receives the new object, it will supply a unique identifier that
+ replaces the temporary identifier for all future references.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"`
+ would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version of the object. When updating an object, the version supplied
+ must match the version in the database, otherwise the write will be rejected as conflicting.
+ """
+
+ is_deleted: typing_extensions.NotRequired[bool]
+ """
+ If `true`, the object has been deleted from the database. Must be `false` for new objects
+ being inserted. When deleted, the `updated_at` field will equal the deletion time.
+ """
+
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ """
+ A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair
+ is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute
+ value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition)
+ object defined by the application making the request.
+
+ If the `CatalogCustomAttributeDefinition` object is
+ defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by
+ the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of
+ `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"`
+ if the application making the request is different from the application defining the custom attribute definition.
+ Otherwise, the key used in the map is simply `"cocoa_brand"`.
+
+ Application-defined custom attributes are set at a global (location-independent) level.
+ Custom attribute values are intended to store additional information about a catalog object
+ or associations with an entity in another system. Do not use custom attributes
+ to store any sensitive information (personally identifiable information, card details, etc.).
+ """
+
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ """
+ The Connect v1 IDs for this object at each location where it is present, where they
+ differ from the object's Connect V2 ID. The field will only be present for objects that
+ have been created or modified by legacy APIs.
+ """
+
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ """
+ If `true`, this object is present at all locations (including future locations), except where specified in
+ the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations),
+ except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`.
+ """
+
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ A list of locations where the object is present, even if `present_at_all_locations` is `false`.
+ This can include locations that are deactivated.
+ """
+
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ A list of locations where the object is not present, even if `present_at_all_locations` is `true`.
+ This can include locations that are deactivated.
+ """
+
+ image_id: typing_extensions.NotRequired[str]
+ """
+ Identifies the `CatalogImage` attached to this `CatalogObject`.
+ """
diff --git a/src/square/requests/catalog_object_batch.py b/src/square/requests/catalog_object_batch.py
new file mode 100644
index 00000000..0a9c7f8f
--- /dev/null
+++ b/src/square/requests/catalog_object_batch.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_object import CatalogObjectParams
+
+
+class CatalogObjectBatchParams(typing_extensions.TypedDict):
+ """
+ A batch of catalog objects.
+ """
+
+ objects: typing.Sequence[CatalogObjectParams]
+ """
+ A list of CatalogObjects belonging to this batch.
+ """
diff --git a/src/square/requests/catalog_object_category.py b/src/square/requests/catalog_object_category.py
new file mode 100644
index 00000000..7c8113d6
--- /dev/null
+++ b/src/square/requests/catalog_object_category.py
@@ -0,0 +1,110 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams
+from .catalog_v1id import CatalogV1IdParams
+
+if typing.TYPE_CHECKING:
+ from .catalog_category import CatalogCategoryParams
+
+
+class CatalogObjectCategoryParams(typing_extensions.TypedDict):
+ """
+ A category that can be assigned to an item or a parent category that can be assigned
+ to another category. For example, a clothing category can be assigned to a t-shirt item or
+ be made as the parent category to the pants category.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the object's category.
+ """
+
+ ordinal: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The position of this object within the specified category. When an item is assigned to a category,
+ the ordinal determines the item's position relative to other items in the same category. When used for a
+ parent category reference, the ordinal determines the category's position among its sibling categories.
+ """
+
+ type: typing_extensions.NotRequired[typing.Literal["CATEGORY"]]
+ category_data: typing_extensions.NotRequired["CatalogCategoryParams"]
+ """
+ Structured data for a `CatalogCategory`, set for CatalogObjects of type `CATEGORY`.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"`
+ would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version of the object. When updating an object, the version supplied
+ must match the version in the database, otherwise the write will be rejected as conflicting.
+ """
+
+ is_deleted: typing_extensions.NotRequired[bool]
+ """
+ If `true`, the object has been deleted from the database. Must be `false` for new objects
+ being inserted. When deleted, the `updated_at` field will equal the deletion time.
+ """
+
+ custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]]
+ """
+ A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair
+ is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute
+ value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition)
+ object defined by the application making the request.
+
+ If the `CatalogCustomAttributeDefinition` object is
+ defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by
+ the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of
+ `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"`
+ if the application making the request is different from the application defining the custom attribute definition.
+ Otherwise, the key used in the map is simply `"cocoa_brand"`.
+
+ Application-defined custom attributes are set at a global (location-independent) level.
+ Custom attribute values are intended to store additional information about a catalog object
+ or associations with an entity in another system. Do not use custom attributes
+ to store any sensitive information (personally identifiable information, card details, etc.).
+ """
+
+ catalog_v1ids: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")]
+ ]
+ """
+ The Connect v1 IDs for this object at each location where it is present, where they
+ differ from the object's Connect V2 ID. The field will only be present for objects that
+ have been created or modified by legacy APIs.
+ """
+
+ present_at_all_locations: typing_extensions.NotRequired[bool]
+ """
+ If `true`, this object is present at all locations (including future locations), except where specified in
+ the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations),
+ except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`.
+ """
+
+ present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ A list of locations where the object is present, even if `present_at_all_locations` is `false`.
+ This can include locations that are deactivated.
+ """
+
+ absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ A list of locations where the object is not present, even if `present_at_all_locations` is `true`.
+ This can include locations that are deactivated.
+ """
+
+ image_id: typing_extensions.NotRequired[str]
+ """
+ Identifies the `CatalogImage` attached to this `CatalogObject`.
+ """
diff --git a/src/square/requests/catalog_object_custom_attribute_definition.py b/src/square/requests/catalog_object_custom_attribute_definition.py
new file mode 100644
index 00000000..b21b63b3
--- /dev/null
+++ b/src/square/requests/catalog_object_custom_attribute_definition.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_custom_attribute_definition import CatalogCustomAttributeDefinitionParams
+from .catalog_object_base import CatalogObjectBaseParams
+
+
+class CatalogObjectCustomAttributeDefinitionParams(CatalogObjectBaseParams):
+ custom_attribute_definition_data: typing_extensions.NotRequired[CatalogCustomAttributeDefinitionParams]
+ """
+ Structured data for a `CatalogCustomAttributeDefinition`, set for CatalogObjects of type `CUSTOM_ATTRIBUTE_DEFINITION`.
+ """
diff --git a/src/square/requests/catalog_object_discount.py b/src/square/requests/catalog_object_discount.py
new file mode 100644
index 00000000..f2ec28b7
--- /dev/null
+++ b/src/square/requests/catalog_object_discount.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_discount import CatalogDiscountParams
+from .catalog_object_base import CatalogObjectBaseParams
+
+
+class CatalogObjectDiscountParams(CatalogObjectBaseParams):
+ discount_data: typing_extensions.NotRequired[CatalogDiscountParams]
+ """
+ Structured data for a `CatalogDiscount`, set for CatalogObjects of type `DISCOUNT`.
+ """
diff --git a/src/square/requests/catalog_object_image.py b/src/square/requests/catalog_object_image.py
new file mode 100644
index 00000000..5c5b1805
--- /dev/null
+++ b/src/square/requests/catalog_object_image.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_image import CatalogImageParams
+from .catalog_object_base import CatalogObjectBaseParams
+
+
+class CatalogObjectImageParams(CatalogObjectBaseParams):
+ image_data: typing_extensions.NotRequired[CatalogImageParams]
+ """
+ Structured data for a `CatalogImage`, set for CatalogObjects of type `IMAGE`.
+ """
diff --git a/src/square/requests/catalog_object_item.py b/src/square/requests/catalog_object_item.py
new file mode 100644
index 00000000..5b4b22c1
--- /dev/null
+++ b/src/square/requests/catalog_object_item.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from .catalog_object_base import CatalogObjectBaseParams
+
+if typing.TYPE_CHECKING:
+ from .catalog_item import CatalogItemParams
+
+
+class CatalogObjectItemParams(CatalogObjectBaseParams):
+ item_data: typing_extensions.NotRequired["CatalogItemParams"]
+ """
+ Structured data for a `CatalogItem`, set for CatalogObjects of type `ITEM`.
+ """
diff --git a/src/square/requests/catalog_object_item_option.py b/src/square/requests/catalog_object_item_option.py
new file mode 100644
index 00000000..b4e5b83b
--- /dev/null
+++ b/src/square/requests/catalog_object_item_option.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from .catalog_object_base import CatalogObjectBaseParams
+
+if typing.TYPE_CHECKING:
+ from .catalog_item_option import CatalogItemOptionParams
+
+
+class CatalogObjectItemOptionParams(CatalogObjectBaseParams):
+ item_option_data: typing_extensions.NotRequired["CatalogItemOptionParams"]
+ """
+ Structured data for a `CatalogItemOption`, set for CatalogObjects of type `ITEM_OPTION`.
+ """
diff --git a/src/square/requests/catalog_object_item_option_value.py b/src/square/requests/catalog_object_item_option_value.py
new file mode 100644
index 00000000..7f34f91d
--- /dev/null
+++ b/src/square/requests/catalog_object_item_option_value.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_item_option_value import CatalogItemOptionValueParams
+from .catalog_object_base import CatalogObjectBaseParams
+
+
+class CatalogObjectItemOptionValueParams(CatalogObjectBaseParams):
+ item_option_value_data: typing_extensions.NotRequired[CatalogItemOptionValueParams]
+ """
+ Structured data for a `CatalogItemOptionValue`, set for CatalogObjects of type `ITEM_OPTION_VAL`.
+ """
diff --git a/src/square/requests/catalog_object_item_variation.py b/src/square/requests/catalog_object_item_variation.py
new file mode 100644
index 00000000..5830eda1
--- /dev/null
+++ b/src/square/requests/catalog_object_item_variation.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_item_variation import CatalogItemVariationParams
+from .catalog_object_base import CatalogObjectBaseParams
+
+
+class CatalogObjectItemVariationParams(CatalogObjectBaseParams):
+ item_variation_data: typing_extensions.NotRequired[CatalogItemVariationParams]
+ """
+ Structured data for a `CatalogItemVariation`, set for CatalogObjects of type `ITEM_VARIATION`.
+ """
diff --git a/src/square/requests/catalog_object_measurement_unit.py b/src/square/requests/catalog_object_measurement_unit.py
new file mode 100644
index 00000000..266cf22e
--- /dev/null
+++ b/src/square/requests/catalog_object_measurement_unit.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_measurement_unit import CatalogMeasurementUnitParams
+from .catalog_object_base import CatalogObjectBaseParams
+
+
+class CatalogObjectMeasurementUnitParams(CatalogObjectBaseParams):
+ measurement_unit_data: typing_extensions.NotRequired[CatalogMeasurementUnitParams]
+ """
+ Structured data for a `CatalogMeasurementUnit`, set for CatalogObjects of type `MEASUREMENT_UNIT`.
+ """
diff --git a/src/square/requests/catalog_object_modifier.py b/src/square/requests/catalog_object_modifier.py
new file mode 100644
index 00000000..aebdddc7
--- /dev/null
+++ b/src/square/requests/catalog_object_modifier.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_modifier import CatalogModifierParams
+from .catalog_object_base import CatalogObjectBaseParams
+
+
+class CatalogObjectModifierParams(CatalogObjectBaseParams):
+ modifier_data: typing_extensions.NotRequired[CatalogModifierParams]
+ """
+ Structured data for a `CatalogModifier`, set for CatalogObjects of type `MODIFIER`.
+ """
diff --git a/src/square/requests/catalog_object_modifier_list.py b/src/square/requests/catalog_object_modifier_list.py
new file mode 100644
index 00000000..1edc778a
--- /dev/null
+++ b/src/square/requests/catalog_object_modifier_list.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from .catalog_object_base import CatalogObjectBaseParams
+
+if typing.TYPE_CHECKING:
+ from .catalog_modifier_list import CatalogModifierListParams
+
+
+class CatalogObjectModifierListParams(CatalogObjectBaseParams):
+ modifier_list_data: typing_extensions.NotRequired["CatalogModifierListParams"]
+ """
+ Structured data for a `CatalogModifierList`, set for CatalogObjects of type `MODIFIER_LIST`.
+ """
diff --git a/src/square/requests/catalog_object_pricing_rule.py b/src/square/requests/catalog_object_pricing_rule.py
new file mode 100644
index 00000000..005e70c4
--- /dev/null
+++ b/src/square/requests/catalog_object_pricing_rule.py
@@ -0,0 +1,13 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_object_base import CatalogObjectBaseParams
+from .catalog_pricing_rule import CatalogPricingRuleParams
+
+
+class CatalogObjectPricingRuleParams(CatalogObjectBaseParams):
+ pricing_rule_data: typing_extensions.NotRequired[CatalogPricingRuleParams]
+ """
+ Structured data for a `CatalogPricingRule`, set for CatalogObjects of type `PRICING_RULE`.
+ A `CatalogPricingRule` object often works with a `CatalogProductSet` object or a `CatalogTimePeriod` object.
+ """
diff --git a/src/square/requests/catalog_object_product_set.py b/src/square/requests/catalog_object_product_set.py
new file mode 100644
index 00000000..986417fb
--- /dev/null
+++ b/src/square/requests/catalog_object_product_set.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_object_base import CatalogObjectBaseParams
+from .catalog_product_set import CatalogProductSetParams
+
+
+class CatalogObjectProductSetParams(CatalogObjectBaseParams):
+ product_set_data: typing_extensions.NotRequired[CatalogProductSetParams]
+ """
+ Structured data for a `CatalogProductSet`, set for CatalogObjects of type `PRODUCT_SET`.
+ """
diff --git a/src/square/requests/catalog_object_quick_amounts_settings.py b/src/square/requests/catalog_object_quick_amounts_settings.py
new file mode 100644
index 00000000..43d37fa7
--- /dev/null
+++ b/src/square/requests/catalog_object_quick_amounts_settings.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_object_base import CatalogObjectBaseParams
+from .catalog_quick_amounts_settings import CatalogQuickAmountsSettingsParams
+
+
+class CatalogObjectQuickAmountsSettingsParams(CatalogObjectBaseParams):
+ quick_amounts_settings_data: typing_extensions.NotRequired[CatalogQuickAmountsSettingsParams]
+ """
+ Structured data for a `CatalogQuickAmountsSettings`, set for CatalogObjects of type `QUICK_AMOUNTS_SETTINGS`.
+ """
diff --git a/src/square/requests/catalog_object_reference.py b/src/square/requests/catalog_object_reference.py
new file mode 100644
index 00000000..50b60111
--- /dev/null
+++ b/src/square/requests/catalog_object_reference.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogObjectReferenceParams(typing_extensions.TypedDict):
+ """
+ A reference to a Catalog object at a specific version. In general this is
+ used as an entry point into a graph of catalog objects, where the objects exist
+ at a specific version.
+ """
+
+ object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the referenced object.
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the object.
+ """
diff --git a/src/square/requests/catalog_object_subscription_plan.py b/src/square/requests/catalog_object_subscription_plan.py
new file mode 100644
index 00000000..cc533de0
--- /dev/null
+++ b/src/square/requests/catalog_object_subscription_plan.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from .catalog_object_base import CatalogObjectBaseParams
+
+if typing.TYPE_CHECKING:
+ from .catalog_subscription_plan import CatalogSubscriptionPlanParams
+
+
+class CatalogObjectSubscriptionPlanParams(CatalogObjectBaseParams):
+ subscription_plan_data: typing_extensions.NotRequired["CatalogSubscriptionPlanParams"]
+ """
+ Structured data for a `CatalogSubscriptionPlan`, set for CatalogObjects of type `SUBSCRIPTION_PLAN`.
+ """
diff --git a/src/square/requests/catalog_object_subscription_plan_variation.py b/src/square/requests/catalog_object_subscription_plan_variation.py
new file mode 100644
index 00000000..1abe46b1
--- /dev/null
+++ b/src/square/requests/catalog_object_subscription_plan_variation.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_object_base import CatalogObjectBaseParams
+from .catalog_subscription_plan_variation import CatalogSubscriptionPlanVariationParams
+
+
+class CatalogObjectSubscriptionPlanVariationParams(CatalogObjectBaseParams):
+ subscription_plan_variation_data: typing_extensions.NotRequired[CatalogSubscriptionPlanVariationParams]
+ """
+ Structured data for a `CatalogSubscriptionPlanVariation`, set for CatalogObjects of type `SUBSCRIPTION_PLAN_VARIATION`.
+ """
diff --git a/src/square/requests/catalog_object_tax.py b/src/square/requests/catalog_object_tax.py
new file mode 100644
index 00000000..6f44bafb
--- /dev/null
+++ b/src/square/requests/catalog_object_tax.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_object_base import CatalogObjectBaseParams
+from .catalog_tax import CatalogTaxParams
+
+
+class CatalogObjectTaxParams(CatalogObjectBaseParams):
+ tax_data: typing_extensions.NotRequired[CatalogTaxParams]
+ """
+ Structured data for a `CatalogTax`, set for CatalogObjects of type `TAX`.
+ """
diff --git a/src/square/requests/catalog_object_time_period.py b/src/square/requests/catalog_object_time_period.py
new file mode 100644
index 00000000..e6457092
--- /dev/null
+++ b/src/square/requests/catalog_object_time_period.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_object_base import CatalogObjectBaseParams
+from .catalog_time_period import CatalogTimePeriodParams
+
+
+class CatalogObjectTimePeriodParams(CatalogObjectBaseParams):
+ time_period_data: typing_extensions.NotRequired[CatalogTimePeriodParams]
+ """
+ Structured data for a `CatalogTimePeriod`, set for CatalogObjects of type `TIME_PERIOD`.
+ """
diff --git a/src/square/requests/catalog_pricing_rule.py b/src/square/requests/catalog_pricing_rule.py
new file mode 100644
index 00000000..ccaf45f5
--- /dev/null
+++ b/src/square/requests/catalog_pricing_rule.py
@@ -0,0 +1,107 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.exclude_strategy import ExcludeStrategy
+from .money import MoneyParams
+
+
+class CatalogPricingRuleParams(typing_extensions.TypedDict):
+ """
+ Defines how discounts are automatically applied to a set of items that match the pricing rule
+ during the active time period.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ User-defined name for the pricing rule. For example, "Buy one get one
+ free" or "10% off".
+ """
+
+ time_period_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A list of unique IDs for the catalog time periods when
+ this pricing rule is in effect. If left unset, the pricing rule is always
+ in effect.
+ """
+
+ discount_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Unique ID for the `CatalogDiscount` to take off
+ the price of all matched items.
+ """
+
+ match_products_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Unique ID for the `CatalogProductSet` that will be matched by this rule. A match rule
+ matches within the entire cart, and can match multiple times. This field will always be set.
+ """
+
+ apply_products_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ __Deprecated__: Please use the `exclude_products_id` field to apply
+ an exclude set instead. Exclude sets allow better control over quantity
+ ranges and offer more flexibility for which matched items receive a discount.
+
+ `CatalogProductSet` to apply the pricing to.
+ An apply rule matches within the subset of the cart that fits the match rules (the match set).
+ An apply rule can only match once in the match set.
+ If not supplied, the pricing will be applied to all products in the match set.
+ Other products retain their base price, or a price generated by other rules.
+ """
+
+ exclude_products_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ `CatalogProductSet` to exclude from the pricing rule.
+ An exclude rule matches within the subset of the cart that fits the match rules (the match set).
+ An exclude rule can only match once in the match set.
+ If not supplied, the pricing will be applied to all products in the match set.
+ Other products retain their base price, or a price generated by other rules.
+ """
+
+ valid_from_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Represents the date the Pricing Rule is valid from. Represented in RFC 3339 full-date format (YYYY-MM-DD).
+ """
+
+ valid_from_local_time: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Represents the local time the pricing rule should be valid from. Represented in RFC 3339 partial-time format
+ (HH:MM:SS). Partial seconds will be truncated.
+ """
+
+ valid_until_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Represents the date the Pricing Rule is valid until. Represented in RFC 3339 full-date format (YYYY-MM-DD).
+ """
+
+ valid_until_local_time: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Represents the local time the pricing rule should be valid until. Represented in RFC 3339 partial-time format
+ (HH:MM:SS). Partial seconds will be truncated.
+ """
+
+ exclude_strategy: typing_extensions.NotRequired[ExcludeStrategy]
+ """
+ If an `exclude_products_id` was given, controls which subset of matched
+ products is excluded from any discounts.
+
+ Default value: `LEAST_EXPENSIVE`
+ See [ExcludeStrategy](#type-excludestrategy) for possible values
+ """
+
+ minimum_order_subtotal_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The minimum order subtotal (before discounts or taxes are applied)
+ that must be met before this rule may be applied.
+ """
+
+ customer_group_ids_any: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A list of IDs of customer groups, the members of which are eligible for discounts specified in this pricing rule.
+ Notice that a group ID is generated by the Customers API.
+ If this field is not set, the specified discount applies to matched products sold to anyone whether the buyer
+ has a customer profile created or not. If this `customer_group_ids_any` field is set, the specified discount
+ applies only to matched products sold to customers belonging to the specified customer groups.
+ """
diff --git a/src/square/requests/catalog_product_set.py b/src/square/requests/catalog_product_set.py
new file mode 100644
index 00000000..9145f9ea
--- /dev/null
+++ b/src/square/requests/catalog_product_set.py
@@ -0,0 +1,72 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogProductSetParams(typing_extensions.TypedDict):
+ """
+ Represents a collection of catalog objects for the purpose of applying a
+ `PricingRule`. Including a catalog object will include all of its subtypes.
+ For example, including a category in a product set will include all of its
+ items and associated item variations in the product set. Including an item in
+ a product set will also include its item variations.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ User-defined name for the product set. For example, "Clearance Items"
+ or "Winter Sale Items".
+ """
+
+ product_ids_any: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Unique IDs for any `CatalogObject` included in this product set. Any
+ number of these catalog objects can be in an order for a pricing rule to apply.
+
+ This can be used with `product_ids_all` in a parent `CatalogProductSet` to
+ match groups of products for a bulk discount, such as a discount for an
+ entree and side combo.
+
+ Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set.
+
+ Max: 5000 catalog object IDs.
+ """
+
+ product_ids_all: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Unique IDs for any `CatalogObject` included in this product set.
+ All objects in this set must be included in an order for a pricing rule to apply.
+
+ Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set.
+
+ Max: 5000 catalog object IDs.
+ """
+
+ quantity_exact: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ If set, there must be exactly this many items from `products_any` or `products_all`
+ in the cart for the discount to apply.
+
+ Cannot be combined with either `quantity_min` or `quantity_max`.
+ """
+
+ quantity_min: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ If set, there must be at least this many items from `products_any` or `products_all`
+ in a cart for the discount to apply. See `quantity_exact`. Defaults to 0 if
+ `quantity_exact`, `quantity_min` and `quantity_max` are all unspecified.
+ """
+
+ quantity_max: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ If set, the pricing rule will apply to a maximum of this many items from
+ `products_any` or `products_all`.
+ """
+
+ all_products: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If set to `true`, the product set will include every item in the catalog.
+ Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set.
+ """
diff --git a/src/square/requests/catalog_query.py b/src/square/requests/catalog_query.py
new file mode 100644
index 00000000..feb7bd5b
--- /dev/null
+++ b/src/square/requests/catalog_query.py
@@ -0,0 +1,105 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_query_exact import CatalogQueryExactParams
+from .catalog_query_item_variations_for_item_option_values import CatalogQueryItemVariationsForItemOptionValuesParams
+from .catalog_query_items_for_item_options import CatalogQueryItemsForItemOptionsParams
+from .catalog_query_items_for_modifier_list import CatalogQueryItemsForModifierListParams
+from .catalog_query_items_for_tax import CatalogQueryItemsForTaxParams
+from .catalog_query_prefix import CatalogQueryPrefixParams
+from .catalog_query_range import CatalogQueryRangeParams
+from .catalog_query_set import CatalogQuerySetParams
+from .catalog_query_sorted_attribute import CatalogQuerySortedAttributeParams
+from .catalog_query_text import CatalogQueryTextParams
+
+
+class CatalogQueryParams(typing_extensions.TypedDict):
+ """
+ A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint.
+
+ Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
+ Any combination of the following types may be used together:
+ - [exact_query](entity:CatalogQueryExact)
+ - [prefix_query](entity:CatalogQueryPrefix)
+ - [range_query](entity:CatalogQueryRange)
+ - [sorted_attribute_query](entity:CatalogQuerySortedAttribute)
+ - [text_query](entity:CatalogQueryText)
+
+ All other query types cannot be combined with any others.
+
+ When a query filter is based on an attribute, the attribute must be searchable.
+ Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters.
+
+ Searchable attribute and objects queryable by searchable attributes:
+ - `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`, `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue`
+ - `description`: `CatalogItem`, `CatalogItemOptionValue`
+ - `abbreviation`: `CatalogItem`
+ - `upc`: `CatalogItemVariation`
+ - `sku`: `CatalogItemVariation`
+ - `caption`: `CatalogImage`
+ - `display_name`: `CatalogItemOption`
+
+ For example, to search for [CatalogItem](entity:CatalogItem) objects by searchable attributes, you can use
+ the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter.
+ """
+
+ sorted_attribute_query: typing_extensions.NotRequired[CatalogQuerySortedAttributeParams]
+ """
+ A query expression to sort returned query result by the given attribute.
+ """
+
+ exact_query: typing_extensions.NotRequired[CatalogQueryExactParams]
+ """
+ An exact query expression to return objects with attribute name and value
+ matching the specified attribute name and value exactly. Value matching is case insensitive.
+ """
+
+ set_query: typing_extensions.NotRequired[CatalogQuerySetParams]
+ """
+ A set query expression to return objects with attribute name and value
+ matching the specified attribute name and any of the specified attribute values exactly.
+ Value matching is case insensitive.
+ """
+
+ prefix_query: typing_extensions.NotRequired[CatalogQueryPrefixParams]
+ """
+ A prefix query expression to return objects with attribute values
+ that have a prefix matching the specified string value. Value matching is case insensitive.
+ """
+
+ range_query: typing_extensions.NotRequired[CatalogQueryRangeParams]
+ """
+ A range query expression to return objects with numeric values
+ that lie in the specified range.
+ """
+
+ text_query: typing_extensions.NotRequired[CatalogQueryTextParams]
+ """
+ A text query expression to return objects whose searchable attributes contain all of the given
+ keywords, irrespective of their order. For example, if a `CatalogItem` contains custom attribute values of
+ `{"name": "t-shirt"}` and `{"description": "Small, Purple"}`, the query filter of `{"keywords": ["shirt", "sma", "purp"]}`
+ returns this item.
+ """
+
+ items_for_tax_query: typing_extensions.NotRequired[CatalogQueryItemsForTaxParams]
+ """
+ A query expression to return items that have any of the specified taxes (as identified by the corresponding `CatalogTax` object IDs) enabled.
+ """
+
+ items_for_modifier_list_query: typing_extensions.NotRequired[CatalogQueryItemsForModifierListParams]
+ """
+ A query expression to return items that have any of the given modifier list (as identified by the corresponding `CatalogModifierList`s IDs) enabled.
+ """
+
+ items_for_item_options_query: typing_extensions.NotRequired[CatalogQueryItemsForItemOptionsParams]
+ """
+ A query expression to return items that contains the specified item options (as identified the corresponding `CatalogItemOption` IDs).
+ """
+
+ item_variations_for_item_option_values_query: typing_extensions.NotRequired[
+ CatalogQueryItemVariationsForItemOptionValuesParams
+ ]
+ """
+ A query expression to return item variations (of the [CatalogItemVariation](entity:CatalogItemVariation) type) that
+ contain all of the specified `CatalogItemOption` IDs.
+ """
diff --git a/src/square/requests/catalog_query_exact.py b/src/square/requests/catalog_query_exact.py
new file mode 100644
index 00000000..f3791cae
--- /dev/null
+++ b/src/square/requests/catalog_query_exact.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CatalogQueryExactParams(typing_extensions.TypedDict):
+ """
+ The query filter to return the search result by exact match of the specified attribute name and value.
+ """
+
+ attribute_name: str
+ """
+ The name of the attribute to be searched. Matching of the attribute name is exact.
+ """
+
+ attribute_value: str
+ """
+ The desired value of the search attribute. Matching of the attribute value is case insensitive and can be partial.
+ For example, if a specified value of "sma", objects with the named attribute value of "Small", "small" are both matched.
+ """
diff --git a/src/square/requests/catalog_query_item_variations_for_item_option_values.py b/src/square/requests/catalog_query_item_variations_for_item_option_values.py
new file mode 100644
index 00000000..f8b3bdda
--- /dev/null
+++ b/src/square/requests/catalog_query_item_variations_for_item_option_values.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogQueryItemVariationsForItemOptionValuesParams(typing_extensions.TypedDict):
+ """
+ The query filter to return the item variations containing the specified item option value IDs.
+ """
+
+ item_option_value_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A set of `CatalogItemOptionValue` IDs to be used to find associated
+ `CatalogItemVariation`s. All ItemVariations that contain all of the given
+ Item Option Values (in any order) will be returned.
+ """
diff --git a/src/square/requests/catalog_query_items_for_item_options.py b/src/square/requests/catalog_query_items_for_item_options.py
new file mode 100644
index 00000000..f9044c50
--- /dev/null
+++ b/src/square/requests/catalog_query_items_for_item_options.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogQueryItemsForItemOptionsParams(typing_extensions.TypedDict):
+ """
+ The query filter to return the items containing the specified item option IDs.
+ """
+
+ item_option_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A set of `CatalogItemOption` IDs to be used to find associated
+ `CatalogItem`s. All Items that contain all of the given Item Options (in any order)
+ will be returned.
+ """
diff --git a/src/square/requests/catalog_query_items_for_modifier_list.py b/src/square/requests/catalog_query_items_for_modifier_list.py
new file mode 100644
index 00000000..e687e450
--- /dev/null
+++ b/src/square/requests/catalog_query_items_for_modifier_list.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogQueryItemsForModifierListParams(typing_extensions.TypedDict):
+ """
+ The query filter to return the items containing the specified modifier list IDs.
+ """
+
+ modifier_list_ids: typing.Sequence[str]
+ """
+ A set of `CatalogModifierList` IDs to be used to find associated `CatalogItem`s.
+ """
diff --git a/src/square/requests/catalog_query_items_for_tax.py b/src/square/requests/catalog_query_items_for_tax.py
new file mode 100644
index 00000000..52b43657
--- /dev/null
+++ b/src/square/requests/catalog_query_items_for_tax.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogQueryItemsForTaxParams(typing_extensions.TypedDict):
+ """
+ The query filter to return the items containing the specified tax IDs.
+ """
+
+ tax_ids: typing.Sequence[str]
+ """
+ A set of `CatalogTax` IDs to be used to find associated `CatalogItem`s.
+ """
diff --git a/src/square/requests/catalog_query_prefix.py b/src/square/requests/catalog_query_prefix.py
new file mode 100644
index 00000000..05626ab3
--- /dev/null
+++ b/src/square/requests/catalog_query_prefix.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CatalogQueryPrefixParams(typing_extensions.TypedDict):
+ """
+ The query filter to return the search result whose named attribute values are prefixed by the specified attribute value.
+ """
+
+ attribute_name: str
+ """
+ The name of the attribute to be searched.
+ """
+
+ attribute_prefix: str
+ """
+ The desired prefix of the search attribute value.
+ """
diff --git a/src/square/requests/catalog_query_range.py b/src/square/requests/catalog_query_range.py
new file mode 100644
index 00000000..49c14e3a
--- /dev/null
+++ b/src/square/requests/catalog_query_range.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogQueryRangeParams(typing_extensions.TypedDict):
+ """
+ The query filter to return the search result whose named attribute values fall between the specified range.
+ """
+
+ attribute_name: str
+ """
+ The name of the attribute to be searched.
+ """
+
+ attribute_min_value: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The desired minimum value for the search attribute (inclusive).
+ """
+
+ attribute_max_value: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The desired maximum value for the search attribute (inclusive).
+ """
diff --git a/src/square/requests/catalog_query_set.py b/src/square/requests/catalog_query_set.py
new file mode 100644
index 00000000..f288e1ce
--- /dev/null
+++ b/src/square/requests/catalog_query_set.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogQuerySetParams(typing_extensions.TypedDict):
+ """
+ The query filter to return the search result(s) by exact match of the specified `attribute_name` and any of
+ the `attribute_values`.
+ """
+
+ attribute_name: str
+ """
+ The name of the attribute to be searched. Matching of the attribute name is exact.
+ """
+
+ attribute_values: typing.Sequence[str]
+ """
+ The desired values of the search attribute. Matching of the attribute values is exact and case insensitive.
+ A maximum of 250 values may be searched in a request.
+ """
diff --git a/src/square/requests/catalog_query_sorted_attribute.py b/src/square/requests/catalog_query_sorted_attribute.py
new file mode 100644
index 00000000..6d23fd43
--- /dev/null
+++ b/src/square/requests/catalog_query_sorted_attribute.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.sort_order import SortOrder
+
+
+class CatalogQuerySortedAttributeParams(typing_extensions.TypedDict):
+ """
+ The query expression to specify the key to sort search results.
+ """
+
+ attribute_name: str
+ """
+ The attribute whose value is used as the sort key.
+ """
+
+ initial_attribute_value: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The first attribute value to be returned by the query. Ascending sorts will return only
+ objects with this value or greater, while descending sorts will return only objects with this value
+ or less. If unset, start at the beginning (for ascending sorts) or end (for descending sorts).
+ """
+
+ sort_order: typing_extensions.NotRequired[SortOrder]
+ """
+ The desired sort order, `"ASC"` (ascending) or `"DESC"` (descending).
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/catalog_query_text.py b/src/square/requests/catalog_query_text.py
new file mode 100644
index 00000000..071dab0d
--- /dev/null
+++ b/src/square/requests/catalog_query_text.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogQueryTextParams(typing_extensions.TypedDict):
+ """
+ The query filter to return the search result whose searchable attribute values contain all of the specified keywords or tokens, independent of the token order or case.
+ """
+
+ keywords: typing.Sequence[str]
+ """
+ A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 alphanumeric characters are ignored.
+ """
diff --git a/src/square/requests/catalog_quick_amount.py b/src/square/requests/catalog_quick_amount.py
new file mode 100644
index 00000000..ad2a4c9e
--- /dev/null
+++ b/src/square/requests/catalog_quick_amount.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_quick_amount_type import CatalogQuickAmountType
+from .money import MoneyParams
+
+
+class CatalogQuickAmountParams(typing_extensions.TypedDict):
+ """
+ Represents a Quick Amount in the Catalog.
+ """
+
+ type: CatalogQuickAmountType
+ """
+ Represents the type of the Quick Amount.
+ See [CatalogQuickAmountType](#type-catalogquickamounttype) for possible values
+ """
+
+ amount: MoneyParams
+ """
+ Represents the actual amount of the Quick Amount with Money type.
+ """
+
+ score: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ Describes the ranking of the Quick Amount provided by machine learning model, in the range [0, 100].
+ MANUAL type amount will always have score = 100.
+ """
+
+ ordinal: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The order in which this Quick Amount should be displayed.
+ """
diff --git a/src/square/requests/catalog_quick_amounts_settings.py b/src/square/requests/catalog_quick_amounts_settings.py
new file mode 100644
index 00000000..f66735eb
--- /dev/null
+++ b/src/square/requests/catalog_quick_amounts_settings.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_quick_amounts_settings_option import CatalogQuickAmountsSettingsOption
+from .catalog_quick_amount import CatalogQuickAmountParams
+
+
+class CatalogQuickAmountsSettingsParams(typing_extensions.TypedDict):
+ """
+ A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts.
+ """
+
+ option: CatalogQuickAmountsSettingsOption
+ """
+ Represents the option seller currently uses on Quick Amounts.
+ See [CatalogQuickAmountsSettingsOption](#type-catalogquickamountssettingsoption) for possible values
+ """
+
+ eligible_for_auto_amounts: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Represents location's eligibility for auto amounts
+ The boolean should be consistent with whether there are AUTO amounts in the `amounts`.
+ """
+
+ amounts: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CatalogQuickAmountParams]]]
+ """
+ Represents a set of Quick Amounts at this location.
+ """
diff --git a/src/square/requests/catalog_stock_conversion.py b/src/square/requests/catalog_stock_conversion.py
new file mode 100644
index 00000000..6ff4a82c
--- /dev/null
+++ b/src/square/requests/catalog_stock_conversion.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CatalogStockConversionParams(typing_extensions.TypedDict):
+ """
+ Represents the rule of conversion between a stockable [CatalogItemVariation](entity:CatalogItemVariation)
+ and a non-stockable sell-by or receive-by `CatalogItemVariation` that
+ share the same underlying stock.
+ """
+
+ stockable_item_variation_id: str
+ """
+ References to the stockable [CatalogItemVariation](entity:CatalogItemVariation)
+ for this stock conversion. Selling, receiving or recounting the non-stockable `CatalogItemVariation`
+ defined with a stock conversion results in adjustments of this stockable `CatalogItemVariation`.
+ This immutable field must reference a stockable `CatalogItemVariation`
+ that shares the parent [CatalogItem](entity:CatalogItem) of the converted `CatalogItemVariation.`
+ """
+
+ stockable_quantity: str
+ """
+ The quantity of the stockable item variation (as identified by `stockable_item_variation_id`)
+ equivalent to the non-stockable item variation quantity (as specified in `nonstockable_quantity`)
+ as defined by this stock conversion. It accepts a decimal number in a string format that can take
+ up to 10 digits before the decimal point and up to 5 digits after the decimal point.
+ """
+
+ nonstockable_quantity: str
+ """
+ The converted equivalent quantity of the non-stockable [CatalogItemVariation](entity:CatalogItemVariation)
+ in its measurement unit. The `stockable_quantity` value and this `nonstockable_quantity` value together
+ define the conversion ratio between stockable item variation and the non-stockable item variation.
+ It accepts a decimal number in a string format that can take up to 10 digits before the decimal point
+ and up to 5 digits after the decimal point.
+ """
diff --git a/src/square/requests/catalog_subscription_plan.py b/src/square/requests/catalog_subscription_plan.py
new file mode 100644
index 00000000..090af2db
--- /dev/null
+++ b/src/square/requests/catalog_subscription_plan.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from .subscription_phase import SubscriptionPhaseParams
+
+if typing.TYPE_CHECKING:
+ from .catalog_object import CatalogObjectParams
+
+
+class CatalogSubscriptionPlanParams(typing_extensions.TypedDict):
+ """
+ Describes a subscription plan. A subscription plan represents what you want to sell in a subscription model, and includes references to each of the associated subscription plan variations.
+ For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations).
+ """
+
+ name: str
+ """
+ The name of the plan.
+ """
+
+ phases: typing_extensions.NotRequired[typing.Optional[typing.Sequence[SubscriptionPhaseParams]]]
+ """
+ A list of SubscriptionPhase containing the [SubscriptionPhase](entity:SubscriptionPhase) for this plan.
+ This field it required. Not including this field will throw a REQUIRED_FIELD_MISSING error
+ """
+
+ subscription_plan_variations: typing_extensions.NotRequired[typing.Optional[typing.Sequence["CatalogObjectParams"]]]
+ """
+ The list of subscription plan variations available for this product
+ """
+
+ eligible_item_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The list of IDs of `CatalogItems` that are eligible for subscription by this SubscriptionPlan's variations.
+ """
+
+ eligible_category_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The list of IDs of `CatalogCategory` that are eligible for subscription by this SubscriptionPlan's variations.
+ """
+
+ all_items: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If true, all items in the merchant's catalog are subscribable by this SubscriptionPlan.
+ """
diff --git a/src/square/requests/catalog_subscription_plan_variation.py b/src/square/requests/catalog_subscription_plan_variation.py
new file mode 100644
index 00000000..124cc9aa
--- /dev/null
+++ b/src/square/requests/catalog_subscription_plan_variation.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .subscription_phase import SubscriptionPhaseParams
+
+
+class CatalogSubscriptionPlanVariationParams(typing_extensions.TypedDict):
+ """
+ Describes a subscription plan variation. A subscription plan variation represents how the subscription for a product or service is sold.
+ For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations).
+ """
+
+ name: str
+ """
+ The name of the plan variation.
+ """
+
+ phases: typing.Sequence[SubscriptionPhaseParams]
+ """
+ A list containing each [SubscriptionPhase](entity:SubscriptionPhase) for this plan variation.
+ """
+
+ subscription_plan_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The id of the subscription plan, if there is one.
+ """
+
+ monthly_billing_anchor_date: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The day of the month the billing period starts.
+ """
+
+ can_prorate: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether bills for this plan variation can be split for proration.
+ """
+
+ successor_plan_variation_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of a "successor" plan variation to this one. If the field is set, and this object is disabled at all
+ locations, it indicates that this variation is deprecated and the object identified by the successor ID be used in
+ its stead.
+ """
diff --git a/src/square/requests/catalog_tax.py b/src/square/requests/catalog_tax.py
new file mode 100644
index 00000000..57bbdf81
--- /dev/null
+++ b/src/square/requests/catalog_tax.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.tax_calculation_phase import TaxCalculationPhase
+from ..types.tax_inclusion_type import TaxInclusionType
+
+
+class CatalogTaxParams(typing_extensions.TypedDict):
+ """
+ A tax applicable to an item.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The tax's name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
+ """
+
+ calculation_phase: typing_extensions.NotRequired[TaxCalculationPhase]
+ """
+ Whether the tax is calculated based on a payment's subtotal or total.
+ See [TaxCalculationPhase](#type-taxcalculationphase) for possible values
+ """
+
+ inclusion_type: typing_extensions.NotRequired[TaxInclusionType]
+ """
+ Whether the tax is `ADDITIVE` or `INCLUSIVE`.
+ See [TaxInclusionType](#type-taxinclusiontype) for possible values
+ """
+
+ percentage: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The percentage of the tax in decimal form, using a `'.'` as the decimal separator and without a `'%'` sign.
+ A value of `7.5` corresponds to 7.5%. For a location-specific tax rate, contact the tax authority of the location or a tax consultant.
+ """
+
+ applies_to_custom_amounts: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If `true`, the fee applies to custom amounts entered into the Square Point of Sale
+ app that are not associated with a particular `CatalogItem`.
+ """
+
+ enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ A Boolean flag to indicate whether the tax is displayed as enabled (`true`) in the Square Point of Sale app or not (`false`).
+ """
+
+ applies_to_product_set_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of a `CatalogProductSet` object. If set, the tax is applicable to all products in the product set.
+ """
diff --git a/src/square/requests/catalog_time_period.py b/src/square/requests/catalog_time_period.py
new file mode 100644
index 00000000..0898e791
--- /dev/null
+++ b/src/square/requests/catalog_time_period.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CatalogTimePeriodParams(typing_extensions.TypedDict):
+ """
+ Represents a time period - either a single period or a repeating period.
+ """
+
+ event: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An iCalendar (RFC 5545) [event](https://tools.ietf.org/html/rfc5545#section-3.6.1), which
+ specifies the name, timing, duration and recurrence of this time period.
+
+ Example:
+
+ ```
+ DTSTART:20190707T180000
+ DURATION:P2H
+ RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR
+ ```
+
+ Only `SUMMARY`, `DTSTART`, `DURATION` and `RRULE` fields are supported.
+ `DTSTART` must be in local (unzoned) time format. Note that while `BEGIN:VEVENT`
+ and `END:VEVENT` is not required in the request. The response will always
+ include them.
+ """
diff --git a/src/square/requests/catalog_v1id.py b/src/square/requests/catalog_v1id.py
new file mode 100644
index 00000000..3459f9ca
--- /dev/null
+++ b/src/square/requests/catalog_v1id.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+
+
+class CatalogV1IdParams(typing_extensions.TypedDict):
+ """
+ A Square API V1 identifier of an item, including the object ID and its associated location ID.
+ """
+
+ catalog_v1id: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="catalog_v1_id")]
+ ]
+ """
+ The ID for an object used in the Square API V1, if the object ID differs from the Square API V2 object ID.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the `Location` this Connect V1 ID is associated with.
+ """
diff --git a/src/square/requests/catalog_version_updated_event.py b/src/square/requests/catalog_version_updated_event.py
new file mode 100644
index 00000000..cec06226
--- /dev/null
+++ b/src/square/requests/catalog_version_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_version_updated_event_data import CatalogVersionUpdatedEventDataParams
+
+
+class CatalogVersionUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when the catalog is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CatalogVersionUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/catalog_version_updated_event_catalog_version.py b/src/square/requests/catalog_version_updated_event_catalog_version.py
new file mode 100644
index 00000000..aafd00f5
--- /dev/null
+++ b/src/square/requests/catalog_version_updated_event_catalog_version.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CatalogVersionUpdatedEventCatalogVersionParams(typing_extensions.TypedDict):
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ Last modification timestamp in RFC 3339 format.
+ """
diff --git a/src/square/requests/catalog_version_updated_event_data.py b/src/square/requests/catalog_version_updated_event_data.py
new file mode 100644
index 00000000..35f72bc2
--- /dev/null
+++ b/src/square/requests/catalog_version_updated_event_data.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_version_updated_event_object import CatalogVersionUpdatedEventObjectParams
+
+
+class CatalogVersionUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type.
+ """
+
+ object: typing_extensions.NotRequired[CatalogVersionUpdatedEventObjectParams]
+ """
+ An object containing fields and values relevant to the event. Is absent if affected object was deleted.
+ """
diff --git a/src/square/requests/catalog_version_updated_event_object.py b/src/square/requests/catalog_version_updated_event_object.py
new file mode 100644
index 00000000..66c3067e
--- /dev/null
+++ b/src/square/requests/catalog_version_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_version_updated_event_catalog_version import CatalogVersionUpdatedEventCatalogVersionParams
+
+
+class CatalogVersionUpdatedEventObjectParams(typing_extensions.TypedDict):
+ catalog_version: typing_extensions.NotRequired[CatalogVersionUpdatedEventCatalogVersionParams]
+ """
+ The version of the object.
+ """
diff --git a/src/square/requests/category_path_to_root_node.py b/src/square/requests/category_path_to_root_node.py
new file mode 100644
index 00000000..55d05a94
--- /dev/null
+++ b/src/square/requests/category_path_to_root_node.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CategoryPathToRootNodeParams(typing_extensions.TypedDict):
+ """
+ A node in the path from a retrieved category to its root node.
+ """
+
+ category_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The category's ID.
+ """
+
+ category_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The category's name.
+ """
diff --git a/src/square/requests/change_billing_anchor_date_response.py b/src/square/requests/change_billing_anchor_date_response.py
new file mode 100644
index 00000000..fcfc9c8e
--- /dev/null
+++ b/src/square/requests/change_billing_anchor_date_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription import SubscriptionParams
+from .subscription_action import SubscriptionActionParams
+
+
+class ChangeBillingAnchorDateResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a request to the
+ [ChangeBillingAnchorDate](api-endpoint:Subscriptions-ChangeBillingAnchorDate) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The specified subscription for updating billing anchor date.
+ """
+
+ actions: typing_extensions.NotRequired[typing.Sequence[SubscriptionActionParams]]
+ """
+ A list of a single billing anchor date change for the subscription.
+ """
diff --git a/src/square/requests/channel.py b/src/square/requests/channel.py
new file mode 100644
index 00000000..e636e2a2
--- /dev/null
+++ b/src/square/requests/channel.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.channel_status import ChannelStatus
+from .reference import ReferenceParams
+
+
+class ChannelParams(typing_extensions.TypedDict):
+ id: typing_extensions.NotRequired[str]
+ """
+ The channel's unique ID.
+ """
+
+ merchant_id: typing_extensions.NotRequired[str]
+ """
+ The unique ID of the merchant this channel belongs to.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the channel.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version number which is incremented each time an update is made to the channel.
+ """
+
+ reference: typing_extensions.NotRequired[ReferenceParams]
+ """
+ Represents an entity the channel is associated with.
+ """
+
+ status: typing_extensions.NotRequired[ChannelStatus]
+ """
+ Status of the channel.
+ See [Status](#type-status) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the channel was created, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the channel was last updated, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
+ """
diff --git a/src/square/requests/charge_request_additional_recipient.py b/src/square/requests/charge_request_additional_recipient.py
new file mode 100644
index 00000000..e440c004
--- /dev/null
+++ b/src/square/requests/charge_request_additional_recipient.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class ChargeRequestAdditionalRecipientParams(typing_extensions.TypedDict):
+ """
+ Represents an additional recipient (other than the merchant) entitled to a portion of the tender.
+ Support is currently limited to USD, CAD and GBP currencies
+ """
+
+ location_id: str
+ """
+ The location ID for a recipient (other than the merchant) receiving a portion of the tender.
+ """
+
+ description: str
+ """
+ The description of the additional recipient.
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount of money distributed to the recipient.
+ """
diff --git a/src/square/requests/checkout.py b/src/square/requests/checkout.py
new file mode 100644
index 00000000..3c18bf94
--- /dev/null
+++ b/src/square/requests/checkout.py
@@ -0,0 +1,94 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .additional_recipient import AdditionalRecipientParams
+from .address import AddressParams
+from .order import OrderParams
+
+
+class CheckoutParams(typing_extensions.TypedDict):
+ """
+ Square Checkout lets merchants accept online payments for supported
+ payment types using a checkout workflow hosted on squareup.com.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID generated by Square Checkout when a new checkout is requested.
+ """
+
+ checkout_page_url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The URL that the buyer's browser should be redirected to after the
+ checkout is completed.
+ """
+
+ ask_for_shipping_address: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If `true`, Square Checkout will collect shipping information on your
+ behalf and store that information with the transaction information in your
+ Square Dashboard.
+
+ Default: `false`.
+ """
+
+ merchant_support_email: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The email address to display on the Square Checkout confirmation page
+ and confirmation email that the buyer can use to contact the merchant.
+
+ If this value is not set, the confirmation page and email will display the
+ primary email address associated with the merchant's Square account.
+
+ Default: none; only exists if explicitly set.
+ """
+
+ pre_populate_buyer_email: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ If provided, the buyer's email is pre-populated on the checkout page
+ as an editable text field.
+
+ Default: none; only exists if explicitly set.
+ """
+
+ pre_populate_shipping_address: typing_extensions.NotRequired[AddressParams]
+ """
+ If provided, the buyer's shipping info is pre-populated on the
+ checkout page as editable text fields.
+
+ Default: none; only exists if explicitly set.
+ """
+
+ redirect_url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The URL to redirect to after checkout is completed with `checkoutId`,
+ Square's `orderId`, `transactionId`, and `referenceId` appended as URL
+ parameters. For example, if the provided redirect_url is
+ `http://www.example.com/order-complete`, a successful transaction redirects
+ the customer to:
+
+ http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx
+
+ If you do not provide a redirect URL, Square Checkout will display an order
+ confirmation page on your behalf; however Square strongly recommends that
+ you provide a redirect URL so you can verify the transaction results and
+ finalize the order through your existing/normal confirmation workflow.
+ """
+
+ order: typing_extensions.NotRequired[OrderParams]
+ """
+ Order to be checked out.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The time when the checkout was created, in RFC 3339 format.
+ """
+
+ additional_recipients: typing_extensions.NotRequired[typing.Optional[typing.Sequence[AdditionalRecipientParams]]]
+ """
+ Additional recipients (other than the merchant) receiving a portion of this checkout.
+ For example, fees assessed on the purchase by a third party integration.
+ """
diff --git a/src/square/requests/checkout_location_settings.py b/src/square/requests/checkout_location_settings.py
new file mode 100644
index 00000000..f109a3c7
--- /dev/null
+++ b/src/square/requests/checkout_location_settings.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .checkout_location_settings_branding import CheckoutLocationSettingsBrandingParams
+from .checkout_location_settings_coupons import CheckoutLocationSettingsCouponsParams
+from .checkout_location_settings_policy import CheckoutLocationSettingsPolicyParams
+from .checkout_location_settings_tipping import CheckoutLocationSettingsTippingParams
+
+
+class CheckoutLocationSettingsParams(typing_extensions.TypedDict):
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the location that these settings apply to.
+ """
+
+ customer_notes_enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether customers are allowed to leave notes at checkout.
+ """
+
+ policies: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CheckoutLocationSettingsPolicyParams]]]
+ """
+ Policy information is displayed at the bottom of the checkout pages.
+ You can set a maximum of two policies.
+ """
+
+ branding: typing_extensions.NotRequired[CheckoutLocationSettingsBrandingParams]
+ """
+ The branding settings for this location.
+ """
+
+ tipping: typing_extensions.NotRequired[CheckoutLocationSettingsTippingParams]
+ """
+ The tip settings for this location.
+ """
+
+ coupons: typing_extensions.NotRequired[CheckoutLocationSettingsCouponsParams]
+ """
+ The coupon settings for this location.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the settings were last updated, in RFC 3339 format.
+ Examples for January 25th, 2020 6:25:34pm Pacific Standard Time:
+ UTC: 2020-01-26T02:25:34Z
+ Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00
+ """
diff --git a/src/square/requests/checkout_location_settings_branding.py b/src/square/requests/checkout_location_settings_branding.py
new file mode 100644
index 00000000..ea977dde
--- /dev/null
+++ b/src/square/requests/checkout_location_settings_branding.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.checkout_location_settings_branding_button_shape import CheckoutLocationSettingsBrandingButtonShape
+from ..types.checkout_location_settings_branding_header_type import CheckoutLocationSettingsBrandingHeaderType
+
+
+class CheckoutLocationSettingsBrandingParams(typing_extensions.TypedDict):
+ header_type: typing_extensions.NotRequired[CheckoutLocationSettingsBrandingHeaderType]
+ """
+ Show the location logo on the checkout page.
+ See [HeaderType](#type-headertype) for possible values
+ """
+
+ button_color: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The HTML-supported hex color for the button on the checkout page (for example, "#FFFFFF").
+ """
+
+ button_shape: typing_extensions.NotRequired[CheckoutLocationSettingsBrandingButtonShape]
+ """
+ The shape of the button on the checkout page.
+ See [ButtonShape](#type-buttonshape) for possible values
+ """
diff --git a/src/square/requests/checkout_location_settings_coupons.py b/src/square/requests/checkout_location_settings_coupons.py
new file mode 100644
index 00000000..444fb3ed
--- /dev/null
+++ b/src/square/requests/checkout_location_settings_coupons.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CheckoutLocationSettingsCouponsParams(typing_extensions.TypedDict):
+ enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether coupons are enabled for this location.
+ """
diff --git a/src/square/requests/checkout_location_settings_policy.py b/src/square/requests/checkout_location_settings_policy.py
new file mode 100644
index 00000000..4e15cdfd
--- /dev/null
+++ b/src/square/requests/checkout_location_settings_policy.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CheckoutLocationSettingsPolicyParams(typing_extensions.TypedDict):
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID to identify the policy when making changes. You must set the UID for policy updates, but it’s optional when setting new policies.
+ """
+
+ title: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The title of the policy. This is required when setting the description, though you can update it in a different request.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The description of the policy.
+ """
diff --git a/src/square/requests/checkout_location_settings_tipping.py b/src/square/requests/checkout_location_settings_tipping.py
new file mode 100644
index 00000000..6edad740
--- /dev/null
+++ b/src/square/requests/checkout_location_settings_tipping.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class CheckoutLocationSettingsTippingParams(typing_extensions.TypedDict):
+ percentages: typing_extensions.NotRequired[typing.Optional[typing.Sequence[int]]]
+ """
+ Set three custom percentage amounts that buyers can select at checkout. If Smart Tip is enabled, this only applies to transactions totaling $10 or more.
+ """
+
+ smart_tipping_enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Enables Smart Tip Amounts. If Smart Tip Amounts is enabled, tipping works as follows:
+ If a transaction is less than $10, the available tipping options include No Tip, $1, $2, or $3.
+ If a transaction is $10 or more, the available tipping options include No Tip, 15%, 20%, or 25%.
+ You can set custom percentage amounts with the `percentages` field.
+ """
+
+ default_percent: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ Set the pre-selected percentage amounts that appear at checkout. If Smart Tip is enabled, this only applies to transactions totaling $10 or more.
+ """
+
+ smart_tips: typing_extensions.NotRequired[typing.Optional[typing.Sequence[MoneyParams]]]
+ """
+ Show the Smart Tip Amounts for this location.
+ """
+
+ default_smart_tip: typing_extensions.NotRequired[MoneyParams]
+ """
+ Set the pre-selected whole amount that appears at checkout when Smart Tip is enabled and the transaction amount is less than $10.
+ """
diff --git a/src/square/requests/checkout_merchant_settings.py b/src/square/requests/checkout_merchant_settings.py
new file mode 100644
index 00000000..ae593f18
--- /dev/null
+++ b/src/square/requests/checkout_merchant_settings.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .checkout_merchant_settings_payment_methods import CheckoutMerchantSettingsPaymentMethodsParams
+
+
+class CheckoutMerchantSettingsParams(typing_extensions.TypedDict):
+ payment_methods: typing_extensions.NotRequired[CheckoutMerchantSettingsPaymentMethodsParams]
+ """
+ The set of payment methods accepted for the merchant's account.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the settings were last updated, in RFC 3339 format.
+ Examples for January 25th, 2020 6:25:34pm Pacific Standard Time:
+ UTC: 2020-01-26T02:25:34Z
+ Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00
+ """
diff --git a/src/square/requests/checkout_merchant_settings_payment_methods.py b/src/square/requests/checkout_merchant_settings_payment_methods.py
new file mode 100644
index 00000000..020559c5
--- /dev/null
+++ b/src/square/requests/checkout_merchant_settings_payment_methods.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .checkout_merchant_settings_payment_methods_afterpay_clearpay import (
+ CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayParams,
+)
+from .checkout_merchant_settings_payment_methods_payment_method import (
+ CheckoutMerchantSettingsPaymentMethodsPaymentMethodParams,
+)
+
+
+class CheckoutMerchantSettingsPaymentMethodsParams(typing_extensions.TypedDict):
+ apple_pay: typing_extensions.NotRequired[CheckoutMerchantSettingsPaymentMethodsPaymentMethodParams]
+ google_pay: typing_extensions.NotRequired[CheckoutMerchantSettingsPaymentMethodsPaymentMethodParams]
+ cash_app: typing_extensions.NotRequired[CheckoutMerchantSettingsPaymentMethodsPaymentMethodParams]
+ afterpay_clearpay: typing_extensions.NotRequired[CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayParams]
diff --git a/src/square/requests/checkout_merchant_settings_payment_methods_afterpay_clearpay.py b/src/square/requests/checkout_merchant_settings_payment_methods_afterpay_clearpay.py
new file mode 100644
index 00000000..bba8c450
--- /dev/null
+++ b/src/square/requests/checkout_merchant_settings_payment_methods_afterpay_clearpay.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range import (
+ CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRangeParams,
+)
+
+
+class CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayParams(typing_extensions.TypedDict):
+ """
+ The settings allowed for AfterpayClearpay.
+ """
+
+ order_eligibility_range: typing_extensions.NotRequired[
+ CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRangeParams
+ ]
+ """
+ Afterpay is shown as an option for order totals falling within the configured range.
+ """
+
+ item_eligibility_range: typing_extensions.NotRequired[
+ CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRangeParams
+ ]
+ """
+ Afterpay is shown as an option for item totals falling within the configured range.
+ """
+
+ enabled: typing_extensions.NotRequired[bool]
+ """
+ Indicates whether the payment method is enabled for the account.
+ """
diff --git a/src/square/requests/checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range.py b/src/square/requests/checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range.py
new file mode 100644
index 00000000..9c9a11d0
--- /dev/null
+++ b/src/square/requests/checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range.py
@@ -0,0 +1,13 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRangeParams(typing_extensions.TypedDict):
+ """
+ A range of purchase price that qualifies.
+ """
+
+ min: MoneyParams
+ max: MoneyParams
diff --git a/src/square/requests/checkout_merchant_settings_payment_methods_payment_method.py b/src/square/requests/checkout_merchant_settings_payment_methods_payment_method.py
new file mode 100644
index 00000000..4d5452ad
--- /dev/null
+++ b/src/square/requests/checkout_merchant_settings_payment_methods_payment_method.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CheckoutMerchantSettingsPaymentMethodsPaymentMethodParams(typing_extensions.TypedDict):
+ """
+ The settings allowed for a payment method.
+ """
+
+ enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the payment method is enabled for the account.
+ """
diff --git a/src/square/requests/checkout_options.py b/src/square/requests/checkout_options.py
new file mode 100644
index 00000000..dfacdba6
--- /dev/null
+++ b/src/square/requests/checkout_options.py
@@ -0,0 +1,75 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .accepted_payment_methods import AcceptedPaymentMethodsParams
+from .custom_field import CustomFieldParams
+from .money import MoneyParams
+from .shipping_fee import ShippingFeeParams
+
+
+class CheckoutOptionsParams(typing_extensions.TypedDict):
+ allow_tipping: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the payment allows tipping.
+ """
+
+ custom_fields: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CustomFieldParams]]]
+ """
+ The custom fields requesting information from the buyer.
+ """
+
+ subscription_plan_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the subscription plan for the buyer to pay and subscribe.
+ For more information, see [Subscription Plan Checkout](https://developer.squareup.com/docs/checkout-api/subscription-plan-checkout).
+ """
+
+ redirect_url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The confirmation page URL to redirect the buyer to after Square processes the payment.
+ """
+
+ merchant_support_email: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The email address that buyers can use to contact the seller.
+ """
+
+ ask_for_shipping_address: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether to include the address fields in the payment form.
+ """
+
+ accepted_payment_methods: typing_extensions.NotRequired[AcceptedPaymentMethodsParams]
+ """
+ The methods allowed for buyers during checkout.
+ """
+
+ app_fee_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money that the developer is taking as a fee for facilitating the payment on behalf of the seller.
+
+ The amount cannot be more than 90% of the total amount of the payment.
+
+ The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-monetary-amounts).
+
+ The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller. For more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/collect-fees/additional-considerations#permissions).
+ """
+
+ shipping_fee: typing_extensions.NotRequired[ShippingFeeParams]
+ """
+ The fee associated with shipping to be applied to the `Order` as a service charge.
+ """
+
+ enable_coupon: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether to include the `Add coupon` section for the buyer to provide a Square marketing coupon in the payment form.
+ """
+
+ enable_loyalty: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether to include the `REWARDS` section for the buyer to opt in to loyalty, redeem rewards in the payment form, or both.
+ """
diff --git a/src/square/requests/clearpay_details.py b/src/square/requests/clearpay_details.py
new file mode 100644
index 00000000..5a3ce9cc
--- /dev/null
+++ b/src/square/requests/clearpay_details.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class ClearpayDetailsParams(typing_extensions.TypedDict):
+ """
+ Additional details about Clearpay payments.
+ """
+
+ email_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Email address on the buyer's Clearpay account.
+ """
diff --git a/src/square/requests/clone_order_response.py b/src/square/requests/clone_order_response.py
new file mode 100644
index 00000000..647b1a39
--- /dev/null
+++ b/src/square/requests/clone_order_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .order import OrderParams
+
+
+class CloneOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CloneOrder](api-endpoint:Orders-CloneOrder) endpoint.
+ """
+
+ order: typing_extensions.NotRequired[OrderParams]
+ """
+ The cloned order.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/collected_data.py b/src/square/requests/collected_data.py
new file mode 100644
index 00000000..f2c3e03c
--- /dev/null
+++ b/src/square/requests/collected_data.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CollectedDataParams(typing_extensions.TypedDict):
+ input_text: typing_extensions.NotRequired[str]
+ """
+ The buyer's input text.
+ """
diff --git a/src/square/requests/complete_payment_response.py b/src/square/requests/complete_payment_response.py
new file mode 100644
index 00000000..9da10b37
--- /dev/null
+++ b/src/square/requests/complete_payment_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment import PaymentParams
+
+
+class CompletePaymentResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response returned by[CompletePayment](api-endpoint:Payments-CompletePayment).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ payment: typing_extensions.NotRequired[PaymentParams]
+ """
+ The successfully completed payment.
+ """
diff --git a/src/square/requests/component.py b/src/square/requests/component.py
new file mode 100644
index 00000000..e302f940
--- /dev/null
+++ b/src/square/requests/component.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.component_component_type import ComponentComponentType
+from .device_component_details_application_details import DeviceComponentDetailsApplicationDetailsParams
+from .device_component_details_battery_details import DeviceComponentDetailsBatteryDetailsParams
+from .device_component_details_card_reader_details import DeviceComponentDetailsCardReaderDetailsParams
+from .device_component_details_ethernet_details import DeviceComponentDetailsEthernetDetailsParams
+from .device_component_details_wi_fi_details import DeviceComponentDetailsWiFiDetailsParams
+
+
+class ComponentParams(typing_extensions.TypedDict):
+ """
+ The wrapper object for the component entries of a given component type.
+ """
+
+ type: ComponentComponentType
+ """
+ The type of this component. Each component type has expected properties expressed
+ in a structured format within its corresponding `*_details` field.
+ See [ComponentType](#type-componenttype) for possible values
+ """
+
+ application_details: typing_extensions.NotRequired[DeviceComponentDetailsApplicationDetailsParams]
+ """
+ Structured data for an `Application`, set for Components of type `APPLICATION`.
+ """
+
+ card_reader_details: typing_extensions.NotRequired[DeviceComponentDetailsCardReaderDetailsParams]
+ """
+ Structured data for a `CardReader`, set for Components of type `CARD_READER`.
+ """
+
+ battery_details: typing_extensions.NotRequired[DeviceComponentDetailsBatteryDetailsParams]
+ """
+ Structured data for a `Battery`, set for Components of type `BATTERY`.
+ """
+
+ wifi_details: typing_extensions.NotRequired[DeviceComponentDetailsWiFiDetailsParams]
+ """
+ Structured data for a `WiFi` interface, set for Components of type `WIFI`.
+ """
+
+ ethernet_details: typing_extensions.NotRequired[DeviceComponentDetailsEthernetDetailsParams]
+ """
+ Structured data for an `Ethernet` interface, set for Components of type `ETHERNET`.
+ """
diff --git a/src/square/requests/confirmation_decision.py b/src/square/requests/confirmation_decision.py
new file mode 100644
index 00000000..4bce49dd
--- /dev/null
+++ b/src/square/requests/confirmation_decision.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class ConfirmationDecisionParams(typing_extensions.TypedDict):
+ has_agreed: typing_extensions.NotRequired[bool]
+ """
+ The buyer's decision to the displayed terms.
+ """
diff --git a/src/square/requests/confirmation_options.py b/src/square/requests/confirmation_options.py
new file mode 100644
index 00000000..df4d74f5
--- /dev/null
+++ b/src/square/requests/confirmation_options.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .confirmation_decision import ConfirmationDecisionParams
+
+
+class ConfirmationOptionsParams(typing_extensions.TypedDict):
+ title: str
+ """
+ The title text to display in the confirmation screen flow on the Terminal.
+ """
+
+ body: str
+ """
+ The agreement details to display in the confirmation flow on the Terminal.
+ """
+
+ agree_button_text: str
+ """
+ The button text to display indicating the customer agrees to the displayed terms.
+ """
+
+ disagree_button_text: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The button text to display indicating the customer does not agree to the displayed terms.
+ """
+
+ decision: typing_extensions.NotRequired[ConfirmationDecisionParams]
+ """
+ The result of the buyer’s actions when presented with the confirmation screen.
+ """
diff --git a/src/square/requests/coordinates.py b/src/square/requests/coordinates.py
new file mode 100644
index 00000000..fcd6468f
--- /dev/null
+++ b/src/square/requests/coordinates.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CoordinatesParams(typing_extensions.TypedDict):
+ """
+ Latitude and longitude coordinates.
+ """
+
+ latitude: typing_extensions.NotRequired[typing.Optional[float]]
+ """
+ The latitude of the coordinate expressed in degrees.
+ """
+
+ longitude: typing_extensions.NotRequired[typing.Optional[float]]
+ """
+ The longitude of the coordinate expressed in degrees.
+ """
diff --git a/src/square/requests/create_bank_account_response.py b/src/square/requests/create_bank_account_response.py
new file mode 100644
index 00000000..54bb9b34
--- /dev/null
+++ b/src/square/requests/create_bank_account_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account import BankAccountParams
+from .error import ErrorParams
+
+
+class CreateBankAccountResponseParams(typing_extensions.TypedDict):
+ """
+ Response object returned by CreateBankAccount.
+ """
+
+ bank_account: typing_extensions.NotRequired[BankAccountParams]
+ """
+ The 'BankAccount' that was created.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
diff --git a/src/square/requests/create_booking_custom_attribute_definition_response.py b/src/square/requests/create_booking_custom_attribute_definition_response.py
new file mode 100644
index 00000000..3647b971
--- /dev/null
+++ b/src/square/requests/create_booking_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class CreateBookingCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [CreateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-CreateBookingCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The newly created custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_booking_response.py b/src/square/requests/create_booking_response.py
new file mode 100644
index 00000000..d6901d37
--- /dev/null
+++ b/src/square/requests/create_booking_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking import BookingParams
+from .error import ErrorParams
+
+
+class CreateBookingResponseParams(typing_extensions.TypedDict):
+ booking: typing_extensions.NotRequired[BookingParams]
+ """
+ The booking that was created.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_break_type_response.py b/src/square/requests/create_break_type_response.py
new file mode 100644
index 00000000..92c1f4e2
--- /dev/null
+++ b/src/square/requests/create_break_type_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .break_type import BreakTypeParams
+from .error import ErrorParams
+
+
+class CreateBreakTypeResponseParams(typing_extensions.TypedDict):
+ """
+ The response to the request to create a `BreakType`. The response contains
+ the created `BreakType` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ break_type: typing_extensions.NotRequired[BreakTypeParams]
+ """
+ The `BreakType` that was created by the request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_card_response.py b/src/square/requests/create_card_response.py
new file mode 100644
index 00000000..a793c302
--- /dev/null
+++ b/src/square/requests/create_card_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card import CardParams
+from .error import ErrorParams
+
+
+class CreateCardResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CreateCard](api-endpoint:Cards-CreateCard) endpoint.
+
+ Note: if there are errors processing the request, the card field will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors resulting from the request.
+ """
+
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The card created by the request.
+ """
diff --git a/src/square/requests/create_catalog_image_request.py b/src/square/requests/create_catalog_image_request.py
new file mode 100644
index 00000000..bce1b221
--- /dev/null
+++ b/src/square/requests/create_catalog_image_request.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_object import CatalogObjectParams
+
+
+class CreateCatalogImageRequestParams(typing_extensions.TypedDict):
+ idempotency_key: str
+ """
+ A unique string that identifies this CreateCatalogImage request.
+ Keys can be any valid string but must be unique for every CreateCatalogImage request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+ """
+
+ object_id: typing_extensions.NotRequired[str]
+ """
+ Unique ID of the `CatalogObject` to attach this `CatalogImage` object to. Leave this
+ field empty to create unattached images, for example if you are building an integration
+ where an image can be attached to catalog items at a later time.
+ """
+
+ image: CatalogObjectParams
+ """
+ The new `CatalogObject` of the `IMAGE` type, namely, a `CatalogImage` object, to encapsulate the specified image file.
+ """
+
+ is_primary: typing_extensions.NotRequired[bool]
+ """
+ If this is set to `true`, the image created will be the primary, or first image of the object referenced by `object_id`.
+ If the `CatalogObject` already has a primary `CatalogImage`, setting this field to `true` will replace the primary image.
+ If this is set to `false` and you use the Square API version 2021-12-15 or later, the image id will be appended to the list of `image_ids` on the object.
+
+ With Square API version 2021-12-15 or later, the default value is `false`. Otherwise, the effective default value is `true`.
+ """
diff --git a/src/square/requests/create_catalog_image_response.py b/src/square/requests/create_catalog_image_response.py
new file mode 100644
index 00000000..1e4adee5
--- /dev/null
+++ b/src/square/requests/create_catalog_image_response.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_object import CatalogObjectParams
+from .error import ErrorParams
+
+
+class CreateCatalogImageResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ image: typing_extensions.NotRequired[CatalogObjectParams]
+ """
+ The newly created `CatalogImage` including a Square-generated
+ URL for the encapsulated image file.
+ """
diff --git a/src/square/requests/create_checkout_response.py b/src/square/requests/create_checkout_response.py
new file mode 100644
index 00000000..fdb0a729
--- /dev/null
+++ b/src/square/requests/create_checkout_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .checkout import CheckoutParams
+from .error import ErrorParams
+
+
+class CreateCheckoutResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `CreateCheckout` endpoint.
+ """
+
+ checkout: typing_extensions.NotRequired[CheckoutParams]
+ """
+ The newly created `checkout` object associated with the provided idempotency key.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_customer_card_response.py b/src/square/requests/create_customer_card_response.py
new file mode 100644
index 00000000..8b296f24
--- /dev/null
+++ b/src/square/requests/create_customer_card_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card import CardParams
+from .error import ErrorParams
+
+
+class CreateCustomerCardResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `CreateCustomerCard` endpoint.
+
+ Either `errors` or `card` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The created card on file.
+ """
diff --git a/src/square/requests/create_customer_custom_attribute_definition_response.py b/src/square/requests/create_customer_custom_attribute_definition_response.py
new file mode 100644
index 00000000..9db205d3
--- /dev/null
+++ b/src/square/requests/create_customer_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class CreateCustomerCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The new custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_customer_group_response.py b/src/square/requests/create_customer_group_response.py
new file mode 100644
index 00000000..04427382
--- /dev/null
+++ b/src/square/requests/create_customer_group_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_group import CustomerGroupParams
+from .error import ErrorParams
+
+
+class CreateCustomerGroupResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CreateCustomerGroup](api-endpoint:CustomerGroups-CreateCustomerGroup) endpoint.
+
+ Either `errors` or `group` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ group: typing_extensions.NotRequired[CustomerGroupParams]
+ """
+ The successfully created customer group.
+ """
diff --git a/src/square/requests/create_customer_response.py b/src/square/requests/create_customer_response.py
new file mode 100644
index 00000000..050ac978
--- /dev/null
+++ b/src/square/requests/create_customer_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer import CustomerParams
+from .error import ErrorParams
+
+
+class CreateCustomerResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CreateCustomer](api-endpoint:Customers-CreateCustomer) or
+ [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint.
+
+ Either `errors` or `customer` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ customer: typing_extensions.NotRequired[CustomerParams]
+ """
+ The created customer.
+ """
diff --git a/src/square/requests/create_device_code_response.py b/src/square/requests/create_device_code_response.py
new file mode 100644
index 00000000..f636eb6d
--- /dev/null
+++ b/src/square/requests/create_device_code_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .device_code import DeviceCodeParams
+from .error import ErrorParams
+
+
+class CreateDeviceCodeResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ device_code: typing_extensions.NotRequired[DeviceCodeParams]
+ """
+ The created DeviceCode object containing the device code string.
+ """
diff --git a/src/square/requests/create_dispute_evidence_file_request.py b/src/square/requests/create_dispute_evidence_file_request.py
new file mode 100644
index 00000000..1e3b9bd0
--- /dev/null
+++ b/src/square/requests/create_dispute_evidence_file_request.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.dispute_evidence_type import DisputeEvidenceType
+
+
+class CreateDisputeEvidenceFileRequestParams(typing_extensions.TypedDict):
+ """
+ Defines the parameters for a `CreateDisputeEvidenceFile` request.
+ """
+
+ idempotency_key: str
+ """
+ A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+ """
+
+ evidence_type: typing_extensions.NotRequired[DisputeEvidenceType]
+ """
+ The type of evidence you are uploading.
+ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
+ """
+
+ content_type: typing_extensions.NotRequired[str]
+ """
+ The MIME type of the uploaded file.
+ The type can be image/heic, image/heif, image/jpeg, application/pdf, image/png, or image/tiff.
+ """
diff --git a/src/square/requests/create_dispute_evidence_file_response.py b/src/square/requests/create_dispute_evidence_file_response.py
new file mode 100644
index 00000000..64e6f115
--- /dev/null
+++ b/src/square/requests/create_dispute_evidence_file_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence import DisputeEvidenceParams
+from .error import ErrorParams
+
+
+class CreateDisputeEvidenceFileResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields in a `CreateDisputeEvidenceFile` response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ evidence: typing_extensions.NotRequired[DisputeEvidenceParams]
+ """
+ The metadata of the newly uploaded dispute evidence.
+ """
diff --git a/src/square/requests/create_dispute_evidence_text_response.py b/src/square/requests/create_dispute_evidence_text_response.py
new file mode 100644
index 00000000..bcc2364b
--- /dev/null
+++ b/src/square/requests/create_dispute_evidence_text_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence import DisputeEvidenceParams
+from .error import ErrorParams
+
+
+class CreateDisputeEvidenceTextResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields in a `CreateDisputeEvidenceText` response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ evidence: typing_extensions.NotRequired[DisputeEvidenceParams]
+ """
+ The newly uploaded dispute evidence metadata.
+ """
diff --git a/src/square/requests/create_gift_card_activity_response.py b/src/square/requests/create_gift_card_activity_response.py
new file mode 100644
index 00000000..89f46ff3
--- /dev/null
+++ b/src/square/requests/create_gift_card_activity_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .gift_card_activity import GiftCardActivityParams
+
+
+class CreateGiftCardActivityResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains a `GiftCardActivity` that was created.
+ The response might contain a set of `Error` objects if the request resulted in errors.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card_activity: typing_extensions.NotRequired[GiftCardActivityParams]
+ """
+ The gift card activity that was created.
+ """
diff --git a/src/square/requests/create_gift_card_response.py b/src/square/requests/create_gift_card_response.py
new file mode 100644
index 00000000..b8349fd4
--- /dev/null
+++ b/src/square/requests/create_gift_card_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .gift_card import GiftCardParams
+
+
+class CreateGiftCardResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains a `GiftCard`. The response might contain a set of `Error` objects if the request
+ resulted in errors.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing_extensions.NotRequired[GiftCardParams]
+ """
+ The new gift card.
+ """
diff --git a/src/square/requests/create_inventory_adjustment_reason_response.py b/src/square/requests/create_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..fad600c2
--- /dev/null
+++ b/src/square/requests/create_inventory_adjustment_reason_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class CreateInventoryAdjustmentReasonResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing_extensions.NotRequired[InventoryAdjustmentReasonParams]
+ """
+ The successfully created inventory adjustment reason.
+ """
diff --git a/src/square/requests/create_invoice_attachment_request_data.py b/src/square/requests/create_invoice_attachment_request_data.py
new file mode 100644
index 00000000..11becef2
--- /dev/null
+++ b/src/square/requests/create_invoice_attachment_request_data.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CreateInvoiceAttachmentRequestDataParams(typing_extensions.TypedDict):
+ """
+ Represents a [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) request.
+ """
+
+ idempotency_key: typing_extensions.NotRequired[str]
+ """
+ A unique string that identifies the `CreateInvoiceAttachment` request.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
+
+ description: typing_extensions.NotRequired[str]
+ """
+ The description of the attachment to display on the invoice.
+ """
diff --git a/src/square/requests/create_invoice_attachment_response.py b/src/square/requests/create_invoice_attachment_response.py
new file mode 100644
index 00000000..b1f9f00a
--- /dev/null
+++ b/src/square/requests/create_invoice_attachment_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .invoice_attachment import InvoiceAttachmentParams
+
+
+class CreateInvoiceAttachmentResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) response.
+ """
+
+ attachment: typing_extensions.NotRequired[InvoiceAttachmentParams]
+ """
+ Metadata about the attachment that was added to the invoice.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/create_invoice_response.py b/src/square/requests/create_invoice_response.py
new file mode 100644
index 00000000..0185cc7e
--- /dev/null
+++ b/src/square/requests/create_invoice_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .invoice import InvoiceParams
+
+
+class CreateInvoiceResponseParams(typing_extensions.TypedDict):
+ """
+ The response returned by the `CreateInvoice` request.
+ """
+
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The newly created invoice.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/create_job_response.py b/src/square/requests/create_job_response.py
new file mode 100644
index 00000000..768c98d2
--- /dev/null
+++ b/src/square/requests/create_job_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .job import JobParams
+
+
+class CreateJobResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [CreateJob](api-endpoint:Team-CreateJob) response. Either `job` or `errors`
+ is present in the response.
+ """
+
+ job: typing_extensions.NotRequired[JobParams]
+ """
+ The new job.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_location_custom_attribute_definition_response.py b/src/square/requests/create_location_custom_attribute_definition_response.py
new file mode 100644
index 00000000..967500c1
--- /dev/null
+++ b/src/square/requests/create_location_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class CreateLocationCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The new custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_location_response.py b/src/square/requests/create_location_response.py
new file mode 100644
index 00000000..6d07b122
--- /dev/null
+++ b/src/square/requests/create_location_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .location import LocationParams
+
+
+class CreateLocationResponseParams(typing_extensions.TypedDict):
+ """
+ The response object returned by the [CreateLocation](api-endpoint:Locations-CreateLocation) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about [errors](https://developer.squareup.com/docs/build-basics/handling-errors) encountered during the request.
+ """
+
+ location: typing_extensions.NotRequired[LocationParams]
+ """
+ The newly created `Location` object.
+ """
diff --git a/src/square/requests/create_loyalty_account_response.py b/src/square/requests/create_loyalty_account_response.py
new file mode 100644
index 00000000..1a17f224
--- /dev/null
+++ b/src/square/requests/create_loyalty_account_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_account import LoyaltyAccountParams
+
+
+class CreateLoyaltyAccountResponseParams(typing_extensions.TypedDict):
+ """
+ A response that includes loyalty account created.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_account: typing_extensions.NotRequired[LoyaltyAccountParams]
+ """
+ The newly created loyalty account.
+ """
diff --git a/src/square/requests/create_loyalty_promotion_response.py b/src/square/requests/create_loyalty_promotion_response.py
new file mode 100644
index 00000000..1d8ba6f4
--- /dev/null
+++ b/src/square/requests/create_loyalty_promotion_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_promotion import LoyaltyPromotionParams
+
+
+class CreateLoyaltyPromotionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [CreateLoyaltyPromotion](api-endpoint:Loyalty-CreateLoyaltyPromotion) response.
+ Either `loyalty_promotion` or `errors` is present in the response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_promotion: typing_extensions.NotRequired[LoyaltyPromotionParams]
+ """
+ The new loyalty promotion.
+ """
diff --git a/src/square/requests/create_loyalty_reward_response.py b/src/square/requests/create_loyalty_reward_response.py
new file mode 100644
index 00000000..cbbd33b0
--- /dev/null
+++ b/src/square/requests/create_loyalty_reward_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_reward import LoyaltyRewardParams
+
+
+class CreateLoyaltyRewardResponseParams(typing_extensions.TypedDict):
+ """
+ A response that includes the loyalty reward created.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ reward: typing_extensions.NotRequired[LoyaltyRewardParams]
+ """
+ The loyalty reward created.
+ """
diff --git a/src/square/requests/create_merchant_custom_attribute_definition_response.py b/src/square/requests/create_merchant_custom_attribute_definition_response.py
new file mode 100644
index 00000000..3067c1f9
--- /dev/null
+++ b/src/square/requests/create_merchant_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class CreateMerchantCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The new custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_order_custom_attribute_definition_response.py b/src/square/requests/create_order_custom_attribute_definition_response.py
new file mode 100644
index 00000000..9272534c
--- /dev/null
+++ b/src/square/requests/create_order_custom_attribute_definition_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class CreateOrderCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from creating an order custom attribute definition.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The new custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_order_request.py b/src/square/requests/create_order_request.py
new file mode 100644
index 00000000..cd43aef5
--- /dev/null
+++ b/src/square/requests/create_order_request.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .order import OrderParams
+
+
+class CreateOrderRequestParams(typing_extensions.TypedDict):
+ order: typing_extensions.NotRequired[OrderParams]
+ """
+ The order to create. If this field is set, the only other top-level field that can be
+ set is the `idempotency_key`.
+ """
+
+ idempotency_key: typing_extensions.NotRequired[str]
+ """
+ A value you specify that uniquely identifies this
+ order among orders you have created.
+
+ If you are unsure whether a particular order was created successfully,
+ you can try it again with the same idempotency key without
+ worrying about creating duplicate orders.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
diff --git a/src/square/requests/create_order_response.py b/src/square/requests/create_order_response.py
new file mode 100644
index 00000000..efb02685
--- /dev/null
+++ b/src/square/requests/create_order_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .order import OrderParams
+
+
+class CreateOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `CreateOrder` endpoint.
+
+ Either `errors` or `order` is present in a given response, but never both.
+ """
+
+ order: typing_extensions.NotRequired[OrderParams]
+ """
+ The newly created order.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_payment_link_response.py b/src/square/requests/create_payment_link_response.py
new file mode 100644
index 00000000..6a7a0355
--- /dev/null
+++ b/src/square/requests/create_payment_link_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment_link import PaymentLinkParams
+from .payment_link_related_resources import PaymentLinkRelatedResourcesParams
+
+
+class CreatePaymentLinkResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ payment_link: typing_extensions.NotRequired[PaymentLinkParams]
+ """
+ The created payment link.
+ """
+
+ related_resources: typing_extensions.NotRequired[PaymentLinkRelatedResourcesParams]
+ """
+ The list of related objects.
+ """
diff --git a/src/square/requests/create_payment_response.py b/src/square/requests/create_payment_response.py
new file mode 100644
index 00000000..d5b3dc15
--- /dev/null
+++ b/src/square/requests/create_payment_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment import PaymentParams
+
+
+class CreatePaymentResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response returned by [CreatePayment](api-endpoint:Payments-CreatePayment).
+
+ If there are errors processing the request, the `payment` field might not be
+ present, or it might be present with a status of `FAILED`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ payment: typing_extensions.NotRequired[PaymentParams]
+ """
+ The newly created payment.
+ """
diff --git a/src/square/requests/create_scheduled_shift_response.py b/src/square/requests/create_scheduled_shift_response.py
new file mode 100644
index 00000000..bb260c55
--- /dev/null
+++ b/src/square/requests/create_scheduled_shift_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .scheduled_shift import ScheduledShiftParams
+
+
+class CreateScheduledShiftResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [CreateScheduledShift](api-endpoint:Labor-CreateScheduledShift) response.
+ Either `scheduled_shift` or `errors` is present in the response.
+ """
+
+ scheduled_shift: typing_extensions.NotRequired[ScheduledShiftParams]
+ """
+ The new scheduled shift. To make the shift public, call
+ [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) or
+ [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_shift_response.py b/src/square/requests/create_shift_response.py
new file mode 100644
index 00000000..95ed60ef
--- /dev/null
+++ b/src/square/requests/create_shift_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .shift import ShiftParams
+
+
+class CreateShiftResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request to create a `Shift`. The response contains
+ the created `Shift` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ shift: typing_extensions.NotRequired[ShiftParams]
+ """
+ The `Shift` that was created on the request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_subscription_response.py b/src/square/requests/create_subscription_response.py
new file mode 100644
index 00000000..959192a3
--- /dev/null
+++ b/src/square/requests/create_subscription_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription import SubscriptionParams
+
+
+class CreateSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response from the
+ [CreateSubscription](api-endpoint:Subscriptions-CreateSubscription) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The newly created subscription.
+
+ For more information, see
+ [Subscription object](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#subscription-object).
+ """
diff --git a/src/square/requests/create_team_member_request.py b/src/square/requests/create_team_member_request.py
new file mode 100644
index 00000000..464ecf13
--- /dev/null
+++ b/src/square/requests/create_team_member_request.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .team_member import TeamMemberParams
+
+
+class CreateTeamMemberRequestParams(typing_extensions.TypedDict):
+ """
+ Represents a create request for a `TeamMember` object.
+ """
+
+ idempotency_key: typing_extensions.NotRequired[str]
+ """
+ A unique string that identifies this `CreateTeamMember` request.
+ Keys can be any valid string, but must be unique for every request.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ The minimum length is 1 and the maximum length is 45.
+ """
+
+ team_member: typing_extensions.NotRequired[TeamMemberParams]
+ """
+ **Required** The data used to create the `TeamMember` object. If you include `wage_setting`, you must provide
+ `job_id` for each job assignment. To get job IDs, call [ListJobs](api-endpoint:Team-ListJobs).
+ """
diff --git a/src/square/requests/create_team_member_response.py b/src/square/requests/create_team_member_response.py
new file mode 100644
index 00000000..4db2914f
--- /dev/null
+++ b/src/square/requests/create_team_member_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .team_member import TeamMemberParams
+
+
+class CreateTeamMemberResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from a create request containing the created `TeamMember` object or error messages.
+ """
+
+ team_member: typing_extensions.NotRequired[TeamMemberParams]
+ """
+ The successfully created `TeamMember` object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_terminal_action_response.py b/src/square/requests/create_terminal_action_response.py
new file mode 100644
index 00000000..8e8ff6ae
--- /dev/null
+++ b/src/square/requests/create_terminal_action_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_action import TerminalActionParams
+
+
+class CreateTerminalActionResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ action: typing_extensions.NotRequired[TerminalActionParams]
+ """
+ The created `TerminalAction`
+ """
diff --git a/src/square/requests/create_terminal_checkout_response.py b/src/square/requests/create_terminal_checkout_response.py
new file mode 100644
index 00000000..524cdca7
--- /dev/null
+++ b/src/square/requests/create_terminal_checkout_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_checkout import TerminalCheckoutParams
+
+
+class CreateTerminalCheckoutResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ checkout: typing_extensions.NotRequired[TerminalCheckoutParams]
+ """
+ The created `TerminalCheckout`.
+ """
diff --git a/src/square/requests/create_terminal_refund_response.py b/src/square/requests/create_terminal_refund_response.py
new file mode 100644
index 00000000..f4207f37
--- /dev/null
+++ b/src/square/requests/create_terminal_refund_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_refund import TerminalRefundParams
+
+
+class CreateTerminalRefundResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ refund: typing_extensions.NotRequired[TerminalRefundParams]
+ """
+ The created `TerminalRefund`.
+ """
diff --git a/src/square/requests/create_timecard_response.py b/src/square/requests/create_timecard_response.py
new file mode 100644
index 00000000..7a1c6d17
--- /dev/null
+++ b/src/square/requests/create_timecard_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .timecard import TimecardParams
+
+
+class CreateTimecardResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request to create a `Timecard`. The response contains
+ the created `Timecard` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ timecard: typing_extensions.NotRequired[TimecardParams]
+ """
+ The `Timecard` that was created on the request.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/create_transfer_order_data.py b/src/square/requests/create_transfer_order_data.py
new file mode 100644
index 00000000..f85bfcd2
--- /dev/null
+++ b/src/square/requests/create_transfer_order_data.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .create_transfer_order_line_data import CreateTransferOrderLineDataParams
+
+
+class CreateTransferOrderDataParams(typing_extensions.TypedDict):
+ """
+ Data for creating a new transfer order to move [CatalogItemVariation](entity:CatalogItemVariation)s
+ between [Location](entity:Location)s. Used with the [CreateTransferOrder](api-endpoint:TransferOrders-CreateTransferOrder)
+ endpoint.
+ """
+
+ source_location_id: str
+ """
+ The source [Location](entity:Location) that will send the items. Must be an active location
+ in your Square account with sufficient inventory of the requested items.
+ """
+
+ destination_location_id: str
+ """
+ The destination [Location](entity:Location) that will receive the items. Must be an active location
+ in your Square account
+ """
+
+ expected_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Expected transfer date in RFC 3339 format (e.g. "2023-10-01T12:00:00Z").
+ """
+
+ notes: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Optional notes about the transfer
+ """
+
+ tracking_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Optional shipment tracking number
+ """
+
+ created_by_team_member_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ ID of the [TeamMember](entity:TeamMember) creating this transfer order. Used for tracking
+ and auditing purposes.
+ """
+
+ line_items: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CreateTransferOrderLineDataParams]]]
+ """
+ List of [CatalogItemVariation](entity:CatalogItemVariation)s to transfer, including quantities
+ """
diff --git a/src/square/requests/create_transfer_order_line_data.py b/src/square/requests/create_transfer_order_line_data.py
new file mode 100644
index 00000000..1cf2d6af
--- /dev/null
+++ b/src/square/requests/create_transfer_order_line_data.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CreateTransferOrderLineDataParams(typing_extensions.TypedDict):
+ """
+ Data for creating a new transfer order line item. Each line item specifies a
+ [CatalogItemVariation](entity:CatalogItemVariation) and quantity to transfer.
+ """
+
+ item_variation_id: str
+ """
+ ID of the [CatalogItemVariation](entity:CatalogItemVariation) to transfer. Must reference a valid
+ item variation in the [Catalog](api:Catalog). The item variation must be:
+ - Active and available for sale
+ - Enabled for inventory tracking
+ - Available at the source location
+ """
+
+ quantity_ordered: str
+ """
+ Total quantity ordered
+ """
diff --git a/src/square/requests/create_transfer_order_response.py b/src/square/requests/create_transfer_order_response.py
new file mode 100644
index 00000000..cb6ceefa
--- /dev/null
+++ b/src/square/requests/create_transfer_order_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .transfer_order import TransferOrderParams
+
+
+class CreateTransferOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Response for creating a transfer order.
+ """
+
+ transfer_order: typing_extensions.NotRequired[TransferOrderParams]
+ """
+ The created transfer order
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request
+ """
diff --git a/src/square/requests/create_vendor_response.py b/src/square/requests/create_vendor_response.py
new file mode 100644
index 00000000..ee87970d
--- /dev/null
+++ b/src/square/requests/create_vendor_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .vendor import VendorParams
+
+
+class CreateVendorResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [CreateVendor](api-endpoint:Vendors-CreateVendor).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ vendor: typing_extensions.NotRequired[VendorParams]
+ """
+ The successfully created [Vendor](entity:Vendor) object.
+ """
diff --git a/src/square/requests/create_webhook_subscription_response.py b/src/square/requests/create_webhook_subscription_response.py
new file mode 100644
index 00000000..e33ee212
--- /dev/null
+++ b/src/square/requests/create_webhook_subscription_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .webhook_subscription import WebhookSubscriptionParams
+
+
+class CreateWebhookSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) endpoint.
+
+ Note: if there are errors processing the request, the [Subscription](entity:WebhookSubscription) will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[WebhookSubscriptionParams]
+ """
+ The new [Subscription](entity:WebhookSubscription).
+ """
diff --git a/src/square/requests/cube.py b/src/square/requests/cube.py
new file mode 100644
index 00000000..8936da33
--- /dev/null
+++ b/src/square/requests/cube.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from ..types.cube_type import CubeType
+from .cube_join import CubeJoinParams
+from .dimension import DimensionParams
+from .folder import FolderParams
+from .hierarchy import HierarchyParams
+from .measure import MeasureParams
+from .nested_folder import NestedFolderParams
+from .segment import SegmentParams
+
+
+class CubeParams(typing_extensions.TypedDict):
+ name: str
+ title: typing_extensions.NotRequired[str]
+ type: CubeType
+ meta: typing_extensions.NotRequired[typing.Dict[str, typing.Any]]
+ description: typing_extensions.NotRequired[str]
+ measures: typing.Sequence[MeasureParams]
+ dimensions: typing.Sequence[DimensionParams]
+ segments: typing.Sequence[SegmentParams]
+ joins: typing_extensions.NotRequired[typing.Sequence[CubeJoinParams]]
+ folders: typing_extensions.NotRequired[typing.Sequence[FolderParams]]
+ nested_folders: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[NestedFolderParams], FieldMetadata(alias="nestedFolders")]
+ ]
+ hierarchies: typing_extensions.NotRequired[typing.Sequence[HierarchyParams]]
diff --git a/src/square/requests/cube_join.py b/src/square/requests/cube_join.py
new file mode 100644
index 00000000..d84a9587
--- /dev/null
+++ b/src/square/requests/cube_join.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CubeJoinParams(typing_extensions.TypedDict):
+ name: str
+ relationship: str
diff --git a/src/square/requests/custom_attribute.py b/src/square/requests/custom_attribute.py
new file mode 100644
index 00000000..60346299
--- /dev/null
+++ b/src/square/requests/custom_attribute.py
@@ -0,0 +1,70 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.custom_attribute_definition_visibility import CustomAttributeDefinitionVisibility
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+
+
+class CustomAttributeParams(typing_extensions.TypedDict):
+ """
+ A custom attribute value. Each custom attribute value has a corresponding
+ `CustomAttributeDefinition` object.
+ """
+
+ key: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The identifier
+ of the custom attribute definition and its corresponding custom attributes. This value
+ can be a simple key, which is the key that is provided when the custom attribute definition
+ is created, or a qualified key, if the requesting
+ application is not the definition owner. The qualified key consists of the application ID
+ of the custom attribute definition owner
+ followed by the simple key that was provided when the definition was created. It has the
+ format application_id:simple key.
+
+ The value for a simple key can contain up to 60 alphanumeric characters, periods (.),
+ underscores (_), and hyphens (-).
+ """
+
+ value: typing_extensions.NotRequired[typing.Optional[typing.Any]]
+ """
+ The value assigned to the custom attribute. It is validated against the custom
+ attribute definition's schema on write operations. For more information about custom
+ attribute values,
+ see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview).
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ Read only. The current version of the custom attribute. This field is incremented when the custom attribute is changed.
+ When updating an existing custom attribute value, you can provide this field
+ and specify the current version of the custom attribute to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency).
+ This field can also be used to enforce strong consistency for reads. For more information about strong consistency for reads,
+ see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview).
+ """
+
+ visibility: typing_extensions.NotRequired[CustomAttributeDefinitionVisibility]
+ """
+ A copy of the `visibility` field value for the associated custom attribute definition.
+ See [CustomAttributeDefinitionVisibility](#type-customattributedefinitionvisibility) for possible values
+ """
+
+ definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ A copy of the associated custom attribute definition object. This field is only set when
+ the optional field is specified on the request.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the custom attribute was created or was most recently
+ updated, in RFC 3339 format.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the custom attribute was created, in RFC 3339 format.
+ """
diff --git a/src/square/requests/custom_attribute_definition.py b/src/square/requests/custom_attribute_definition.py
new file mode 100644
index 00000000..cab5bea0
--- /dev/null
+++ b/src/square/requests/custom_attribute_definition.py
@@ -0,0 +1,84 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.custom_attribute_definition_visibility import CustomAttributeDefinitionVisibility
+
+
+class CustomAttributeDefinitionParams(typing_extensions.TypedDict):
+ """
+ Represents a definition for custom attribute values. A custom attribute definition
+ specifies the key, visibility, schema, and other properties for a custom attribute.
+ """
+
+ key: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The identifier
+ of the custom attribute definition and its corresponding custom attributes. This value
+ can be a simple key, which is the key that is provided when the custom attribute definition
+ is created, or a qualified key, if the requesting
+ application is not the definition owner. The qualified key consists of the application ID
+ of the custom attribute definition owner
+ followed by the simple key that was provided when the definition was created. It has the
+ format application_id:simple key.
+
+ The value for a simple key can contain up to 60 alphanumeric characters, periods (.),
+ underscores (_), and hyphens (-).
+
+ This field can not be changed
+ after the custom attribute definition is created. This field is required when creating
+ a definition and must be unique per application, seller, and resource type.
+ """
+
+ schema: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Any]]]
+ """
+ The JSON schema for the custom attribute definition, which determines the data type of the corresponding custom attributes. For more information,
+ see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). This field is required when creating a definition.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the custom attribute definition for API and seller-facing UI purposes. The name must
+ be unique within the seller and application pair. This field is required if the
+ `visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Seller-oriented description of the custom attribute definition, including any constraints
+ that the seller should observe. May be displayed as a tooltip in Square UIs. This field is
+ required if the `visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ visibility: typing_extensions.NotRequired[CustomAttributeDefinitionVisibility]
+ """
+ Specifies how the custom attribute definition and its values should be shared with
+ the seller and other applications. If no value is specified, the value defaults to `VISIBILITY_HIDDEN`.
+ See [Visibility](#type-visibility) for possible values
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ Read only. The current version of the custom attribute definition.
+ The value is incremented each time the custom attribute definition is updated.
+ When updating a custom attribute definition, you can provide this field
+ and specify the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency).
+
+ On writes, this field must be set to the latest version. Stale writes are rejected.
+
+ This field can also be used to enforce strong consistency for reads. For more information about strong consistency for reads,
+ see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview).
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the custom attribute definition was created or most recently updated,
+ in RFC 3339 format.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the custom attribute definition was created, in RFC 3339 format.
+ """
diff --git a/src/square/requests/custom_attribute_definition_event_data.py b/src/square/requests/custom_attribute_definition_event_data.py
new file mode 100644
index 00000000..f49a8471
--- /dev/null
+++ b/src/square/requests/custom_attribute_definition_event_data.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data_object import CustomAttributeDefinitionEventDataObjectParams
+
+
+class CustomAttributeDefinitionEventDataParams(typing_extensions.TypedDict):
+ """
+ Represents an object in the CustomAttributeDefinition event notification
+ payload that contains the affected custom attribute definition.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `"custom_attribute_definition"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataObjectParams]
+ """
+ An object containing the custom attribute definition.
+ """
diff --git a/src/square/requests/custom_attribute_definition_event_data_object.py b/src/square/requests/custom_attribute_definition_event_data_object.py
new file mode 100644
index 00000000..ea06b2e5
--- /dev/null
+++ b/src/square/requests/custom_attribute_definition_event_data_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+
+
+class CustomAttributeDefinitionEventDataObjectParams(typing_extensions.TypedDict):
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The custom attribute definition.
+ """
diff --git a/src/square/requests/custom_attribute_event_data.py b/src/square/requests/custom_attribute_event_data.py
new file mode 100644
index 00000000..a36d7e48
--- /dev/null
+++ b/src/square/requests/custom_attribute_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data_object import CustomAttributeEventDataObjectParams
+
+
+class CustomAttributeEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `"custom_attribute"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[CustomAttributeEventDataObjectParams]
+ """
+ An object containing the custom attribute.
+ """
diff --git a/src/square/requests/custom_attribute_event_data_object.py b/src/square/requests/custom_attribute_event_data_object.py
new file mode 100644
index 00000000..d58226bb
--- /dev/null
+++ b/src/square/requests/custom_attribute_event_data_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+
+
+class CustomAttributeEventDataObjectParams(typing_extensions.TypedDict):
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The custom attribute.
+ """
diff --git a/src/square/requests/custom_attribute_filter.py b/src/square/requests/custom_attribute_filter.py
new file mode 100644
index 00000000..9e8f5886
--- /dev/null
+++ b/src/square/requests/custom_attribute_filter.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .range import RangeParams
+
+
+class CustomAttributeFilterParams(typing_extensions.TypedDict):
+ """
+ Supported custom attribute query expressions for calling the
+ [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems)
+ endpoint to search for items or item variations.
+ """
+
+ custom_attribute_definition_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A query expression to filter items or item variations by matching their custom attributes'
+ `custom_attribute_definition_id` property value against the the specified id.
+ Exactly one of `custom_attribute_definition_id` or `key` must be specified.
+ """
+
+ key: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A query expression to filter items or item variations by matching their custom attributes'
+ `key` property value against the specified key.
+ Exactly one of `custom_attribute_definition_id` or `key` must be specified.
+ """
+
+ string_filter: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A query expression to filter items or item variations by matching their custom attributes'
+ `string_value` property value against the specified text.
+ Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified.
+ """
+
+ number_filter: typing_extensions.NotRequired[RangeParams]
+ """
+ A query expression to filter items or item variations with their custom attributes
+ containing a number value within the specified range.
+ Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified.
+ """
+
+ selection_uids_filter: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A query expression to filter items or item variations by matching their custom attributes'
+ `selection_uid_values` values against the specified selection uids.
+ Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified.
+ """
+
+ bool_filter: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ A query expression to filter items or item variations by matching their custom attributes'
+ `boolean_value` property values against the specified Boolean expression.
+ Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified.
+ """
diff --git a/src/square/requests/custom_field.py b/src/square/requests/custom_field.py
new file mode 100644
index 00000000..5db33835
--- /dev/null
+++ b/src/square/requests/custom_field.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CustomFieldParams(typing_extensions.TypedDict):
+ """
+ Describes a custom form field to add to the checkout page to collect more information from buyers during checkout.
+ For more information,
+ see [Specify checkout options](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#specify-checkout-options-1).
+ """
+
+ title: str
+ """
+ The title of the custom field.
+ """
diff --git a/src/square/requests/custom_numeric_format.py b/src/square/requests/custom_numeric_format.py
new file mode 100644
index 00000000..15b8123f
--- /dev/null
+++ b/src/square/requests/custom_numeric_format.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CustomNumericFormatParams(typing_extensions.TypedDict):
+ """
+ Custom numeric format for numeric measures and dimensions
+ """
+
+ type: typing.Literal["custom-numeric"]
+ """
+ Type of the format (must be 'custom-numeric')
+ """
+
+ value: str
+ """
+ d3-format specifier string (e.g., '.2f', ',.0f', '$,.2f', '.0%', '.2s'). See https://d3js.org/d3-format
+ """
+
+ alias: typing_extensions.NotRequired[str]
+ """
+ Name of the predefined format (e.g., 'percent_2', 'currency_1'). Present only when a named format was used.
+ """
diff --git a/src/square/requests/custom_time_format.py b/src/square/requests/custom_time_format.py
new file mode 100644
index 00000000..bba2872f
--- /dev/null
+++ b/src/square/requests/custom_time_format.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CustomTimeFormatParams(typing_extensions.TypedDict):
+ """
+ Custom time format for time dimensions
+ """
+
+ type: typing.Literal["custom-time"]
+ """
+ Type of the format (must be 'custom-time')
+ """
+
+ value: str
+ """
+ POSIX strftime format string (IEEE Std 1003.1 / POSIX.1) with d3-time-format extensions (e.g., '%Y-%m-%d', '%d/%m/%Y %H:%M:%S'). See https://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html and https://d3js.org/d3-time-format
+ """
diff --git a/src/square/requests/customer.py b/src/square/requests/customer.py
new file mode 100644
index 00000000..f26bbb19
--- /dev/null
+++ b/src/square/requests/customer.py
@@ -0,0 +1,117 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.customer_creation_source import CustomerCreationSource
+from .address import AddressParams
+from .customer_preferences import CustomerPreferencesParams
+from .customer_tax_ids import CustomerTaxIdsParams
+
+
+class CustomerParams(typing_extensions.TypedDict):
+ """
+ Represents a Square customer profile in the Customer Directory of a Square seller.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique Square-assigned ID for the customer profile.
+
+ If you need this ID for an API request, use the ID returned when you created the customer profile or call the [SearchCustomers](api-endpoint:Customers-SearchCustomers)
+ or [ListCustomers](api-endpoint:Customers-ListCustomers) endpoint.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the customer profile was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the customer profile was last updated, in RFC 3339 format.
+ """
+
+ given_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The given name (that is, the first name) associated with the customer profile.
+ """
+
+ family_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The family name (that is, the last name) associated with the customer profile.
+ """
+
+ nickname: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A nickname for the customer profile.
+ """
+
+ company_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A business name associated with the customer profile.
+ """
+
+ email_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The email address associated with the customer profile.
+ """
+
+ address: typing_extensions.NotRequired[AddressParams]
+ """
+ The physical address associated with the customer profile.
+ """
+
+ phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The phone number associated with the customer profile.
+ """
+
+ birthday: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The birthday associated with the customer profile, in `YYYY-MM-DD` format. For example, `1998-09-21`
+ represents September 21, 1998, and `0000-09-21` represents September 21 (without a birth year).
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A custom note associated with the customer profile.
+ """
+
+ preferences: typing_extensions.NotRequired[CustomerPreferencesParams]
+ """
+ Represents general customer preferences.
+ """
+
+ creation_source: typing_extensions.NotRequired[CustomerCreationSource]
+ """
+ The method used to create the customer profile.
+ See [CustomerCreationSource](#type-customercreationsource) for possible values
+ """
+
+ group_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of [customer groups](entity:CustomerGroup) the customer belongs to.
+ """
+
+ segment_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of [customer segments](entity:CustomerSegment) the customer belongs to.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The Square-assigned version number of the customer profile. The version number is incremented each time an update is committed to the customer profile, except for changes to customer segment membership.
+ """
+
+ tax_ids: typing_extensions.NotRequired[CustomerTaxIdsParams]
+ """
+ The tax ID associated with the customer profile. This field is present only for customers of sellers in EU countries or the United Kingdom.
+ For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+ """
diff --git a/src/square/requests/customer_address_filter.py b/src/square/requests/customer_address_filter.py
new file mode 100644
index 00000000..3b94867b
--- /dev/null
+++ b/src/square/requests/customer_address_filter.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.country import Country
+from .customer_text_filter import CustomerTextFilterParams
+
+
+class CustomerAddressFilterParams(typing_extensions.TypedDict):
+ """
+ The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue](entity:CustomerCustomAttributeFilterValue) filter when
+ searching by an `Address`-type custom attribute.
+ """
+
+ postal_code: typing_extensions.NotRequired[CustomerTextFilterParams]
+ """
+ The postal code to search for. Only an `exact` match is supported.
+ """
+
+ country: typing_extensions.NotRequired[Country]
+ """
+ The country code to search for.
+ See [Country](#type-country) for possible values
+ """
diff --git a/src/square/requests/customer_created_event.py b/src/square/requests/customer_created_event.py
new file mode 100644
index 00000000..9ebf43cc
--- /dev/null
+++ b/src/square/requests/customer_created_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_created_event_data import CustomerCreatedEventDataParams
+
+
+class CustomerCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [customer](entity:Customer) is created. Subscribe to this event to track customer profiles affected by a merge operation.
+ For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks).
+
+ The `customer` object in the event notification does not include the `segment_ids` field.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this object, the value is `customer.created`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomerCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/customer_created_event_data.py b/src/square/requests/customer_created_event_data.py
new file mode 100644
index 00000000..4d18ec3a
--- /dev/null
+++ b/src/square/requests/customer_created_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_created_event_object import CustomerCreatedEventObjectParams
+
+
+class CustomerCreatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `customer`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the new customer.
+ """
+
+ object: typing_extensions.NotRequired[CustomerCreatedEventObjectParams]
+ """
+ An object that contains the new customer.
+ """
diff --git a/src/square/requests/customer_created_event_event_context.py b/src/square/requests/customer_created_event_event_context.py
new file mode 100644
index 00000000..1baf7927
--- /dev/null
+++ b/src/square/requests/customer_created_event_event_context.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .customer_created_event_event_context_merge import CustomerCreatedEventEventContextMergeParams
+
+
+class CustomerCreatedEventEventContextParams(typing_extensions.TypedDict):
+ """
+ Information about the change that triggered the event.
+ """
+
+ merge: typing_extensions.NotRequired[CustomerCreatedEventEventContextMergeParams]
+ """
+ Information about the merge operation associated with the event.
+ """
diff --git a/src/square/requests/customer_created_event_event_context_merge.py b/src/square/requests/customer_created_event_event_context_merge.py
new file mode 100644
index 00000000..bb8477e7
--- /dev/null
+++ b/src/square/requests/customer_created_event_event_context_merge.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CustomerCreatedEventEventContextMergeParams(typing_extensions.TypedDict):
+ """
+ Information about a merge operation, which creates a new customer using aggregated properties from two or more existing customers.
+ """
+
+ from_customer_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of the existing customers that were merged and then deleted.
+ """
+
+ to_customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the new customer created by the merge.
+ """
diff --git a/src/square/requests/customer_created_event_object.py b/src/square/requests/customer_created_event_object.py
new file mode 100644
index 00000000..7789e1b1
--- /dev/null
+++ b/src/square/requests/customer_created_event_object.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .customer import CustomerParams
+from .customer_created_event_event_context import CustomerCreatedEventEventContextParams
+
+
+class CustomerCreatedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the customer associated with the event.
+ """
+
+ customer: typing_extensions.NotRequired[CustomerParams]
+ """
+ The new customer.
+ """
+
+ event_context: typing_extensions.NotRequired[CustomerCreatedEventEventContextParams]
+ """
+ Information about the change that triggered the event. This field is returned only if the customer is created by a merge operation.
+ """
diff --git a/src/square/requests/customer_creation_source_filter.py b/src/square/requests/customer_creation_source_filter.py
new file mode 100644
index 00000000..133a4b73
--- /dev/null
+++ b/src/square/requests/customer_creation_source_filter.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.customer_creation_source import CustomerCreationSource
+from ..types.customer_inclusion_exclusion import CustomerInclusionExclusion
+
+
+class CustomerCreationSourceFilterParams(typing_extensions.TypedDict):
+ """
+ The creation source filter.
+
+ If one or more creation sources are set, customer profiles are included in,
+ or excluded from, the result if they match at least one of the filter criteria.
+ """
+
+ values: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CustomerCreationSource]]]
+ """
+ The list of creation sources used as filtering criteria.
+ See [CustomerCreationSource](#type-customercreationsource) for possible values
+ """
+
+ rule: typing_extensions.NotRequired[CustomerInclusionExclusion]
+ """
+ Indicates whether a customer profile matching the filter criteria
+ should be included in the result or excluded from the result.
+
+ Default: `INCLUDE`.
+ See [CustomerInclusionExclusion](#type-customerinclusionexclusion) for possible values
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_created_event.py b/src/square/requests/customer_custom_attribute_definition_created_event.py
new file mode 100644
index 00000000..45c6dcb3
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_created_event.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ is created by the subscribing application.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.owned.created](webhook:customer.custom_attribute_definition.owned.created).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_created_public_event.py b/src/square/requests/customer_custom_attribute_definition_created_public_event.py
new file mode 100644
index 00000000..dfb21386
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_created_public_event.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionCreatedPublicEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to all applications is created. A notification is sent when any application creates a custom
+ attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.visible.created](webhook:customer.custom_attribute_definition.visible.created),
+ which applies to custom attribute definitions that are visible to the subscribing application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.public.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_deleted_event.py b/src/square/requests/customer_custom_attribute_definition_deleted_event.py
new file mode 100644
index 00000000..c171c9ed
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_deleted_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is deleted. A custom attribute definition can only be deleted by
+ the application that created it.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.owned.deleted](webhook:customer.custom_attribute_definition.owned.deleted).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_deleted_public_event.py b/src/square/requests/customer_custom_attribute_definition_deleted_public_event.py
new file mode 100644
index 00000000..0696a9b2
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_deleted_public_event.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionDeletedPublicEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to all applications is deleted. A notification is sent when any application deletes a custom
+ attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.visible.deleted](webhook:customer.custom_attribute_definition.visible.deleted),
+ which applies to custom attribute definitions that are visible to the subscribing application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.public.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_owned_created_event.py b/src/square/requests/customer_custom_attribute_definition_owned_created_event.py
new file mode 100644
index 00000000..e16c7700
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_owned_created_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionOwnedCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ is created by the subscribing application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.owned.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_owned_deleted_event.py b/src/square/requests/customer_custom_attribute_definition_owned_deleted_event.py
new file mode 100644
index 00000000..982353e7
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_owned_deleted_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionOwnedDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is deleted. A custom attribute definition can only be deleted by
+ the application that created it.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.owned.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_owned_updated_event.py b/src/square/requests/customer_custom_attribute_definition_owned_updated_event.py
new file mode 100644
index 00000000..cf76c30b
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_owned_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionOwnedUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is updated. A custom attribute definition can only be updated by
+ the application that created it.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.owned.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_updated_event.py b/src/square/requests/customer_custom_attribute_definition_updated_event.py
new file mode 100644
index 00000000..03334bc3
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_updated_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is updated. A custom attribute definition can only be updated by
+ the application that created it.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.owned.updated](webhook:customer.custom_attribute_definition.owned.updated).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_updated_public_event.py b/src/square/requests/customer_custom_attribute_definition_updated_public_event.py
new file mode 100644
index 00000000..e936c84c
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_updated_public_event.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionUpdatedPublicEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to all applications is updated. A notification is sent when any application updates a custom
+ attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.visible.updated](webhook:customer.custom_attribute_definition.visible.updated),
+ which applies to custom attribute definitions that are visible to the subscribing application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.public.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_visible_created_event.py b/src/square/requests/customer_custom_attribute_definition_visible_created_event.py
new file mode 100644
index 00000000..9e85c7da
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_visible_created_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionVisibleCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is created. A notification is sent when your application
+ creates a custom attribute definition or another application creates a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.visible.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_visible_deleted_event.py b/src/square/requests/customer_custom_attribute_definition_visible_deleted_event.py
new file mode 100644
index 00000000..5abb49e5
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_visible_deleted_event.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionVisibleDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is deleted. A custom attribute definition can only be deleted
+ by the application that created it. A notification is sent when your application deletes a custom attribute
+ definition or when another application deletes a custom attribute definition whose `visibility` is
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.visible.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_definition_visible_updated_event.py b/src/square/requests/customer_custom_attribute_definition_visible_updated_event.py
new file mode 100644
index 00000000..50081ddc
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_definition_visible_updated_event.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class CustomerCustomAttributeDefinitionVisibleUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is updated. A custom attribute definition can only be updated
+ by the application that created it. A notification is sent when your application updates a custom
+ attribute definition or when another application updates a custom attribute definition whose `visibility` is
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.visible.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_deleted_event.py b/src/square/requests/customer_custom_attribute_deleted_event.py
new file mode 100644
index 00000000..3c91e98f
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_deleted_event.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class CustomerCustomAttributeDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) owned by the
+ subscribing application is deleted. Custom attributes are owned by the application that created the
+ corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose
+ `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application.
+
+ This event is replaced by
+ [customer.custom_attribute.owned.deleted](webhook:customer.custom_attribute.owned.deleted).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_deleted_public_event.py b/src/square/requests/customer_custom_attribute_deleted_public_event.py
new file mode 100644
index 00000000..7ecffdaa
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_deleted_public_event.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class CustomerCustomAttributeDeletedPublicEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) that is visible
+ to all applications is deleted. A notification is sent when any application deletes a custom attribute
+ whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ This event is replaced by
+ [customer.custom_attribute.visible.deleted](webhook:customer.custom_attribute.visible.deleted),
+ which applies to custom attributes that are visible to the subscribing application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute.public.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_filter.py b/src/square/requests/customer_custom_attribute_filter.py
new file mode 100644
index 00000000..cddaef85
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_filter.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .customer_custom_attribute_filter_value import CustomerCustomAttributeFilterValueParams
+from .time_range import TimeRangeParams
+
+
+class CustomerCustomAttributeFilterParams(typing_extensions.TypedDict):
+ """
+ The custom attribute filter. Use this filter in a set of [custom attribute filters](entity:CustomerCustomAttributeFilters) to search
+ based on the value or last updated date of a customer-related [custom attribute](entity:CustomAttribute).
+ """
+
+ key: str
+ """
+ The `key` of the [custom attribute](entity:CustomAttribute) to filter by. The key is the identifier of the custom attribute
+ (and the corresponding custom attribute definition) and can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes).
+ """
+
+ filter: typing_extensions.NotRequired[CustomerCustomAttributeFilterValueParams]
+ """
+ A filter that corresponds to the data type of the target custom attribute. For example, provide the `phone` filter to
+ search based on the value of a `PhoneNumber`-type custom attribute. The data type is specified by the schema field of the custom attribute definition,
+ which can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes).
+
+ You must provide this `filter` field, the `updated_at` field, or both.
+ """
+
+ updated_at: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ The date range for when the custom attribute was last updated. The date range can include `start_at`, `end_at`, or
+ both. Range boundaries are inclusive. Dates are specified as RFC 3339 timestamps.
+
+ You must provide this `updated_at` field, the `filter` field, or both.
+ """
diff --git a/src/square/requests/customer_custom_attribute_filter_value.py b/src/square/requests/customer_custom_attribute_filter_value.py
new file mode 100644
index 00000000..7c48d1e2
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_filter_value.py
@@ -0,0 +1,98 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_address_filter import CustomerAddressFilterParams
+from .customer_text_filter import CustomerTextFilterParams
+from .filter_value import FilterValueParams
+from .float_number_range import FloatNumberRangeParams
+from .time_range import TimeRangeParams
+
+
+class CustomerCustomAttributeFilterValueParams(typing_extensions.TypedDict):
+ """
+ A type-specific filter used in a [custom attribute filter](entity:CustomerCustomAttributeFilter) to search based on the value
+ of a customer-related [custom attribute](entity:CustomAttribute).
+ """
+
+ email: typing_extensions.NotRequired[CustomerTextFilterParams]
+ """
+ A filter for a query based on the value of an `Email`-type custom attribute. This filter is case-insensitive and can
+ include `exact` or `fuzzy`, but not both.
+
+ For an `exact` match, provide the complete email address.
+
+ For a `fuzzy` match, provide a query expression containing one or more query tokens to match against the email address. Square removes
+ any punctuation (including periods (.), underscores (_), and the @ symbol) and tokenizes the email addresses on spaces. A match is found
+ if a tokenized email address contains all the tokens in the search query, irrespective of the token order. For example, `Steven gmail`
+ matches steven.jones@gmail.com and mygmail@stevensbakery.com.
+ """
+
+ phone: typing_extensions.NotRequired[CustomerTextFilterParams]
+ """
+ A filter for a query based on the value of a `PhoneNumber`-type custom attribute. This filter is case-insensitive and
+ can include `exact` or `fuzzy`, but not both.
+
+ For an `exact` match, provide the complete phone number. This is always an E.164-compliant phone number that starts
+ with the + sign followed by the country code and subscriber number. For example, the format for a US phone number is +12061112222.
+
+ For a `fuzzy` match, provide a query expression containing one or more query tokens to match against the phone number.
+ Square removes any punctuation and tokenizes the expression on spaces. A match is found if a tokenized phone number contains
+ all the tokens in the search query, irrespective of the token order. For example, `415 123 45` is tokenized to `415`, `123`, and `45`,
+ which matches +14151234567 and +12345674158, but does not match +1234156780. Similarly, the expression `415` matches
+ +14151234567, +12345674158, and +1234156780.
+ """
+
+ text: typing_extensions.NotRequired[CustomerTextFilterParams]
+ """
+ A filter for a query based on the value of a `String`-type custom attribute. This filter is case-insensitive and
+ can include `exact` or `fuzzy`, but not both.
+
+ For an `exact` match, provide the complete string.
+
+ For a `fuzzy` match, provide a query expression containing one or more query tokens in any order that contain complete words
+ to match against the string. Square tokenizes the expression using a grammar-based tokenizer. For example, the expressions `quick brown`,
+ `brown quick`, and `quick fox` match "The quick brown fox jumps over the lazy dog". However, `quick foxes` and `qui` do not match.
+ """
+
+ selection: typing_extensions.NotRequired[FilterValueParams]
+ """
+ A filter for a query based on the display name for a `Selection`-type custom attribute value. This filter is case-sensitive
+ and can contain `any`, `all`, or both. The `none` condition is not supported.
+
+ Provide the display name of each item that you want to search for. To find the display names for the selection, use the
+ [Customer Custom Attributes API](api:CustomerCustomAttributes) to retrieve the corresponding custom attribute definition
+ and then check the `schema.items.names` field. For more information, see
+ [Search based on selection](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#custom-attribute-value-filter-selection).
+
+ Note that when a `Selection`-type custom attribute is assigned to a customer profile, the custom attribute value is a list of one
+ or more UUIDs (sourced from the `schema.items.enum` field) that map to the item names. These UUIDs are unique per seller.
+ """
+
+ date: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ A filter for a query based on the value of a `Date`-type custom attribute.
+
+ Provide a date range for this filter using `start_at`, `end_at`, or both. Range boundaries are inclusive. Dates can be specified
+ in `YYYY-MM-DD` format or as RFC 3339 timestamps.
+ """
+
+ number: typing_extensions.NotRequired[FloatNumberRangeParams]
+ """
+ A filter for a query based on the value of a `Number`-type custom attribute, which can be an integer or a decimal with up to
+ 5 digits of precision.
+
+ Provide a numerical range for this filter using `start_at`, `end_at`, or both. Range boundaries are inclusive. Numbers are specified
+ as decimals or integers. The absolute value of range boundaries must not exceed `(2^63-1)/10^5`, or 92233720368547.
+ """
+
+ boolean: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ A filter for a query based on the value of a `Boolean`-type custom attribute.
+ """
+
+ address: typing_extensions.NotRequired[CustomerAddressFilterParams]
+ """
+ A filter for a query based on the value of an `Address`-type custom attribute. The filter can include `postal_code`, `country`, or both.
+ """
diff --git a/src/square/requests/customer_custom_attribute_filters.py b/src/square/requests/customer_custom_attribute_filters.py
new file mode 100644
index 00000000..6a1c13d9
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_filters.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_custom_attribute_filter import CustomerCustomAttributeFilterParams
+
+
+class CustomerCustomAttributeFiltersParams(typing_extensions.TypedDict):
+ """
+ The custom attribute filters in a set of [customer filters](entity:CustomerFilter) used in a search query. Use this filter
+ to search based on [custom attributes](entity:CustomAttribute) that are assigned to customer profiles. For more information, see
+ [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute).
+ """
+
+ filters: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CustomerCustomAttributeFilterParams]]]
+ """
+ The custom attribute filters. Each filter must specify `key` and include the `filter` field with a type-specific filter,
+ the `updated_at` field, or both. The provided keys must be unique within the list of custom attribute filters.
+ """
diff --git a/src/square/requests/customer_custom_attribute_owned_deleted_event.py b/src/square/requests/customer_custom_attribute_owned_deleted_event.py
new file mode 100644
index 00000000..f6aaaf81
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_owned_deleted_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class CustomerCustomAttributeOwnedDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) owned by the
+ subscribing application is deleted. Custom attributes are owned by the application that created the
+ corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose
+ `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute.owned.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_owned_updated_event.py b/src/square/requests/customer_custom_attribute_owned_updated_event.py
new file mode 100644
index 00000000..d35fa2c6
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_owned_updated_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class CustomerCustomAttributeOwnedUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) owned by the
+ subscribing application is created or updated. Custom attributes are owned by the application that created
+ the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose
+ `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute.owned.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_updated_event.py b/src/square/requests/customer_custom_attribute_updated_event.py
new file mode 100644
index 00000000..972a3a89
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_updated_event.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class CustomerCustomAttributeUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) owned by the
+ subscribing application is created or updated. Custom attributes are owned by the application that created
+ the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose
+ `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application.
+
+ This event is replaced by
+ [customer.custom_attribute.owned.updated](webhook:customer.custom_attribute.owned.updated).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_updated_public_event.py b/src/square/requests/customer_custom_attribute_updated_public_event.py
new file mode 100644
index 00000000..3aa1cbb8
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_updated_public_event.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class CustomerCustomAttributeUpdatedPublicEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) that is visible
+ to all applications is created or updated. A notification is sent when any application creates or updates
+ a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ This event is replaced by
+ [customer.custom_attribute.visible.updated](webhook:customer.custom_attribute.visible.updated),
+ which applies to custom attributes that are visible to the subscribing application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute.public.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_visible_deleted_event.py b/src/square/requests/customer_custom_attribute_visible_deleted_event.py
new file mode 100644
index 00000000..da7b562c
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_visible_deleted_event.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class CustomerCustomAttributeVisibleDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) that is visible to the
+ subscribing application is deleted. A notification is sent when:
+ - Your application deletes a custom attribute owned by your application, regardless of the `visibility` setting.
+ - Any application deletes a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY`
+ or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application, but those set to
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be deleted by the owner. Custom attributes are owned
+ by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute.visible.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_custom_attribute_visible_updated_event.py b/src/square/requests/customer_custom_attribute_visible_updated_event.py
new file mode 100644
index 00000000..3cfcf73f
--- /dev/null
+++ b/src/square/requests/customer_custom_attribute_visible_updated_event.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class CustomerCustomAttributeVisibleUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) that is visible to the
+ subscribing application is created or updated. A notification is sent when:
+ - Your application creates or updates a custom attribute owned by your application, regardless of the `visibility` setting.
+ - Any application creates or updates a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY`
+ or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application, but those set to
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be created or updated by the owner. Custom attributes are owned
+ by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"customer.custom_attribute.visible.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/customer_deleted_event.py b/src/square/requests/customer_deleted_event.py
new file mode 100644
index 00000000..50b7027e
--- /dev/null
+++ b/src/square/requests/customer_deleted_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_deleted_event_data import CustomerDeletedEventDataParams
+
+
+class CustomerDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [customer](entity:Customer) is deleted. For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks).
+
+ The `customer` object in the event notification does not include the following fields: `group_ids` and `segment_ids`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this object, the value is `customer.deleted`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomerDeletedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/customer_deleted_event_data.py b/src/square/requests/customer_deleted_event_data.py
new file mode 100644
index 00000000..9612077a
--- /dev/null
+++ b/src/square/requests/customer_deleted_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_deleted_event_object import CustomerDeletedEventObjectParams
+
+
+class CustomerDeletedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `customer`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the deleted customer.
+ """
+
+ object: typing_extensions.NotRequired[CustomerDeletedEventObjectParams]
+ """
+ An object that contains the deleted customer.
+ """
diff --git a/src/square/requests/customer_deleted_event_event_context.py b/src/square/requests/customer_deleted_event_event_context.py
new file mode 100644
index 00000000..adb7ca57
--- /dev/null
+++ b/src/square/requests/customer_deleted_event_event_context.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .customer_deleted_event_event_context_merge import CustomerDeletedEventEventContextMergeParams
+
+
+class CustomerDeletedEventEventContextParams(typing_extensions.TypedDict):
+ """
+ Information about the change that triggered the event.
+ """
+
+ merge: typing_extensions.NotRequired[CustomerDeletedEventEventContextMergeParams]
+ """
+ Information about the merge operation associated with the event.
+ """
diff --git a/src/square/requests/customer_deleted_event_event_context_merge.py b/src/square/requests/customer_deleted_event_event_context_merge.py
new file mode 100644
index 00000000..42797bd6
--- /dev/null
+++ b/src/square/requests/customer_deleted_event_event_context_merge.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CustomerDeletedEventEventContextMergeParams(typing_extensions.TypedDict):
+ """
+ Information about a merge operation, which creates a new customer using aggregated properties from two or more existing customers.
+ """
+
+ from_customer_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of the existing customers that were merged and then deleted.
+ """
+
+ to_customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the new customer created by the merge.
+ """
diff --git a/src/square/requests/customer_deleted_event_object.py b/src/square/requests/customer_deleted_event_object.py
new file mode 100644
index 00000000..26fc18c3
--- /dev/null
+++ b/src/square/requests/customer_deleted_event_object.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .customer import CustomerParams
+from .customer_deleted_event_event_context import CustomerDeletedEventEventContextParams
+
+
+class CustomerDeletedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the customer associated with the event.
+ """
+
+ customer: typing_extensions.NotRequired[CustomerParams]
+ """
+ The deleted customer.
+ """
+
+ event_context: typing_extensions.NotRequired[CustomerDeletedEventEventContextParams]
+ """
+ Information about the change that triggered the event. This field is returned only if the customer is deleted by a merge operation.
+ """
diff --git a/src/square/requests/customer_details.py b/src/square/requests/customer_details.py
new file mode 100644
index 00000000..d11b5a62
--- /dev/null
+++ b/src/square/requests/customer_details.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CustomerDetailsParams(typing_extensions.TypedDict):
+ """
+ Details about the customer making the payment.
+ """
+
+ customer_initiated: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the customer initiated the payment.
+ """
+
+ seller_keyed_in: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates that the seller keyed in payment details on behalf of the customer.
+ This is used to flag a payment as Mail Order / Telephone Order (MOTO).
+ """
diff --git a/src/square/requests/customer_filter.py b/src/square/requests/customer_filter.py
new file mode 100644
index 00000000..2a758fa0
--- /dev/null
+++ b/src/square/requests/customer_filter.py
@@ -0,0 +1,144 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .customer_creation_source_filter import CustomerCreationSourceFilterParams
+from .customer_custom_attribute_filters import CustomerCustomAttributeFiltersParams
+from .customer_text_filter import CustomerTextFilterParams
+from .filter_value import FilterValueParams
+from .time_range import TimeRangeParams
+
+
+class CustomerFilterParams(typing_extensions.TypedDict):
+ """
+ Represents the filtering criteria in a [search query](entity:CustomerQuery) that defines how to filter
+ customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results.
+ """
+
+ creation_source: typing_extensions.NotRequired[CustomerCreationSourceFilterParams]
+ """
+ A filter to select customers based on their creation source.
+ """
+
+ created_at: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ A filter to select customers based on when they were created.
+ """
+
+ updated_at: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ A filter to select customers based on when they were last updated.
+ """
+
+ email_address: typing_extensions.NotRequired[CustomerTextFilterParams]
+ """
+ A filter to [select customers by their email address](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-email-address)
+ visible to the seller.
+ This filter is case-insensitive.
+
+ For [exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-email-address), this
+ filter causes the search to return customer profiles
+ whose `email_address` field value are identical to the email address provided
+ in the query.
+
+ For [fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-email-address),
+ this filter causes the search to return customer profiles
+ whose `email_address` field value has a token-wise partial match against the filtering
+ expression in the query. For example, with `Steven gmail` provided in a search
+ query, the search returns customers whose email address is `steven.johnson@gmail.com`
+ or `mygmail@stevensbakery.com`. Square removes any punctuation (including periods (.),
+ underscores (_), and the @ symbol) and tokenizes the email addresses on spaces. A match is
+ found if a tokenized email address contains all the tokens in the search query,
+ irrespective of the token order.
+ """
+
+ phone_number: typing_extensions.NotRequired[CustomerTextFilterParams]
+ """
+ A filter to [select customers by their phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-phone-number)
+ visible to the seller.
+
+ For [exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-phone-number),
+ this filter returns customers whose phone number matches the specified query expression. The number in the query must be of an
+ E.164-compliant form. In particular, it must include the leading `+` sign followed by a country code and then a subscriber number.
+ For example, the standard E.164 form of a US phone number is `+12062223333` and an E.164-compliant variation is `+1 (206) 222-3333`.
+ To match the query expression, stored customer phone numbers are converted to the standard E.164 form.
+
+ For [fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-phone-number),
+ this filter returns customers whose phone number matches the token or tokens provided in the query expression. For example, with `415`
+ provided in a search query, the search returns customers with the phone numbers `+1-415-212-1200`, `+1-212-415-1234`, and `+1 (551) 234-1567`.
+ Similarly, a search query of `415 123` returns customers with the phone numbers `+1-212-415-1234` and `+1 (551) 234-1567` but not
+ `+1-212-415-1200`. A match is found if a tokenized phone number contains all the tokens in the search query, irrespective of the token order.
+ """
+
+ reference_id: typing_extensions.NotRequired[CustomerTextFilterParams]
+ """
+ A filter to [select customers by their reference IDs](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-reference-id).
+ This filter is case-insensitive.
+
+ [Exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-reference-id)
+ of a customer's reference ID against a query's reference ID is evaluated as an
+ exact match between two strings, character by character in the given order.
+
+ [Fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-reference-id)
+ of stored reference IDs against queried reference IDs works
+ exactly the same as fuzzy matching on email addresses. Non-alphanumeric characters
+ are replaced by spaces to tokenize stored and queried reference IDs. A match is found
+ if a tokenized stored reference ID contains all tokens specified in any order in the query. For example,
+ a query of `NYC M` matches customer profiles with the `reference_id` value of `NYC_M_35_JOHNSON`
+ and `NYC_27_MURRAY`.
+ """
+
+ group_ids: typing_extensions.NotRequired[FilterValueParams]
+ """
+ A filter to select customers based on the [groups](entity:CustomerGroup) they belong to.
+ Group membership is controlled by sellers and developers.
+
+ The `group_ids` filter has the following syntax:
+ ```
+ "group_ids": {
+ "any": ["{group_a_id}", "{group_b_id}", ...],
+ "all": ["{group_1_id}", "{group_2_id}", ...],
+ "none": ["{group_i_id}", "{group_ii_id}", ...]
+ }
+ ```
+
+ You can use any combination of the `any`, `all`, and `none` fields in the filter.
+ With `any`, the search returns customers in groups `a` or `b` or any other group specified in the list.
+ With `all`, the search returns customers in groups `1` and `2` and all other groups specified in the list.
+ With `none`, the search returns customers not in groups `i` or `ii` or any other group specified in the list.
+
+ If any of the search conditions are not met, including when an invalid or non-existent group ID is provided,
+ the result is an empty object (`{}`).
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomerCustomAttributeFiltersParams]
+ """
+ A filter to select customers based on one or more custom attributes.
+ This filter can contain up to 10 custom attribute filters. Each custom attribute filter specifies filtering criteria for a target custom
+ attribute. If multiple custom attribute filters are provided, they are combined as an `AND` operation.
+
+ To be valid for a search, the custom attributes must be visible to the requesting application. For more information, including example queries,
+ see [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute).
+
+ Square returns matching customer profiles, which do not contain custom attributes. To retrieve customer-related custom attributes,
+ use the [Customer Custom Attributes API](api:CustomerCustomAttributes). For example, you can call
+ [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) using a customer ID from the result set.
+ """
+
+ segment_ids: typing_extensions.NotRequired[FilterValueParams]
+ """
+ A filter to select customers based on the [segments](entity:CustomerSegment) they belong to.
+ Segment membership is dynamic and adjusts automatically based on whether customers meet the segment criteria.
+
+ You can provide up to three segment IDs in the filter, using any combination of the `all`, `any`, and `none` fields.
+ For the following example, the results include customers who belong to both segment A and segment B but do not belong to segment C.
+
+ ```
+ "segment_ids": {
+ "all": ["{segment_A_id}", "{segment_B_id}"],
+ "none": ["{segment_C_id}"]
+ }
+ ```
+
+ If an invalid or non-existent segment ID is provided in the filter, Square stops processing the request
+ and returns a `400 BAD_REQUEST` error that includes the segment ID.
+ """
diff --git a/src/square/requests/customer_group.py b/src/square/requests/customer_group.py
new file mode 100644
index 00000000..9d0b9f75
--- /dev/null
+++ b/src/square/requests/customer_group.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CustomerGroupParams(typing_extensions.TypedDict):
+ """
+ Represents a group of customer profiles.
+
+ Customer groups can be created, be modified, and have their membership defined using
+ the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique Square-generated ID for the customer group.
+ """
+
+ name: str
+ """
+ The name of the customer group.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the customer group was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the customer group was last updated, in RFC 3339 format.
+ """
diff --git a/src/square/requests/customer_preferences.py b/src/square/requests/customer_preferences.py
new file mode 100644
index 00000000..81161028
--- /dev/null
+++ b/src/square/requests/customer_preferences.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CustomerPreferencesParams(typing_extensions.TypedDict):
+ """
+ Represents communication preferences for the customer profile.
+ """
+
+ email_unsubscribed: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the customer has unsubscribed from marketing campaign emails. A value of `true` means that the customer chose to opt out of email marketing from the current Square seller or from all Square sellers. This value is read-only from the Customers API.
+ """
diff --git a/src/square/requests/customer_query.py b/src/square/requests/customer_query.py
new file mode 100644
index 00000000..1b38853f
--- /dev/null
+++ b/src/square/requests/customer_query.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .customer_filter import CustomerFilterParams
+from .customer_sort import CustomerSortParams
+
+
+class CustomerQueryParams(typing_extensions.TypedDict):
+ """
+ Represents filtering and sorting criteria for a [SearchCustomers](api-endpoint:Customers-SearchCustomers) request.
+ """
+
+ filter: typing_extensions.NotRequired[CustomerFilterParams]
+ """
+ The filtering criteria for the search query. A query can contain multiple filters in any combination.
+ Multiple filters are combined as `AND` statements.
+
+ __Note:__ Combining multiple filters as `OR` statements is not supported. Instead, send multiple single-filter
+ searches and join the result sets.
+ """
+
+ sort: typing_extensions.NotRequired[CustomerSortParams]
+ """
+ Sorting criteria for query results. The default behavior is to sort
+ customers alphabetically by `given_name` and `family_name`.
+ """
diff --git a/src/square/requests/customer_segment.py b/src/square/requests/customer_segment.py
new file mode 100644
index 00000000..1b5cafac
--- /dev/null
+++ b/src/square/requests/customer_segment.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class CustomerSegmentParams(typing_extensions.TypedDict):
+ """
+ Represents a group of customer profiles that match one or more predefined filter criteria.
+
+ Segments (also known as Smart Groups) are defined and created within the Customer Directory in the
+ Square Seller Dashboard or Point of Sale.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique Square-generated ID for the segment.
+ """
+
+ name: typing_extensions.NotRequired[str]
+ """
+ The name of the segment.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the segment was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the segment was last updated, in RFC 3339 format.
+ """
diff --git a/src/square/requests/customer_sort.py b/src/square/requests/customer_sort.py
new file mode 100644
index 00000000..6f2b4008
--- /dev/null
+++ b/src/square/requests/customer_sort.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.customer_sort_field import CustomerSortField
+from ..types.sort_order import SortOrder
+
+
+class CustomerSortParams(typing_extensions.TypedDict):
+ """
+ Represents the sorting criteria in a [search query](entity:CustomerQuery) that defines how to sort
+ customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results.
+ """
+
+ field: typing_extensions.NotRequired[CustomerSortField]
+ """
+ Indicates the fields to use as the sort key, which is either the default set of fields or `created_at`.
+
+ The default value is `DEFAULT`.
+ See [CustomerSortField](#type-customersortfield) for possible values
+ """
+
+ order: typing_extensions.NotRequired[SortOrder]
+ """
+ Indicates the order in which results should be sorted based on the
+ sort field value. Strings use standard alphabetic comparison
+ to determine order. Strings representing numbers are sorted as strings.
+
+ The default value is `ASC`.
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/customer_tax_ids.py b/src/square/requests/customer_tax_ids.py
new file mode 100644
index 00000000..fe673b7f
--- /dev/null
+++ b/src/square/requests/customer_tax_ids.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CustomerTaxIdsParams(typing_extensions.TypedDict):
+ """
+ Represents the tax ID associated with a [customer profile](entity:Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom.
+ For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+ """
+
+ eu_vat: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The EU VAT identification number for the customer. For example, `IE3426675K`. The ID can contain alphanumeric characters only.
+ """
diff --git a/src/square/requests/customer_text_filter.py b/src/square/requests/customer_text_filter.py
new file mode 100644
index 00000000..191f5595
--- /dev/null
+++ b/src/square/requests/customer_text_filter.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class CustomerTextFilterParams(typing_extensions.TypedDict):
+ """
+ A filter to select customers based on exact or fuzzy matching of
+ customer attributes against a specified query. Depending on the customer attributes,
+ the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both.
+ """
+
+ exact: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Use the exact filter to select customers whose attributes match exactly the specified query.
+ """
+
+ fuzzy: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Use the fuzzy filter to select customers whose attributes match the specified query
+ in a fuzzy manner. When the fuzzy option is used, search queries are tokenized, and then
+ each query token must be matched somewhere in the searched attribute. For single token queries,
+ this is effectively the same behavior as a partial match operation.
+ """
diff --git a/src/square/requests/customer_updated_event.py b/src/square/requests/customer_updated_event.py
new file mode 100644
index 00000000..c80bb627
--- /dev/null
+++ b/src/square/requests/customer_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_updated_event_data import CustomerUpdatedEventDataParams
+
+
+class CustomerUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [customer](entity:Customer) is updated. For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks).
+
+ Updates to the 'segment_ids' customer field does not invoke a `customer.updated` event. In addition, the `customer` object in the event notification does not include this field.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this object, the value is `customer.updated`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomerUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/customer_updated_event_data.py b/src/square/requests/customer_updated_event_data.py
new file mode 100644
index 00000000..e2f35f28
--- /dev/null
+++ b/src/square/requests/customer_updated_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_updated_event_object import CustomerUpdatedEventObjectParams
+
+
+class CustomerUpdatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `customer`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the updated customer.
+ """
+
+ object: typing_extensions.NotRequired[CustomerUpdatedEventObjectParams]
+ """
+ An object that contains the updated customer.
+ """
diff --git a/src/square/requests/customer_updated_event_object.py b/src/square/requests/customer_updated_event_object.py
new file mode 100644
index 00000000..7ec0543e
--- /dev/null
+++ b/src/square/requests/customer_updated_event_object.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .customer import CustomerParams
+
+
+class CustomerUpdatedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the customer associated with the event.
+ """
+
+ customer: typing_extensions.NotRequired[CustomerParams]
+ """
+ The updated customer.
+ """
diff --git a/src/square/requests/data_collection_options.py b/src/square/requests/data_collection_options.py
new file mode 100644
index 00000000..28ea1ba8
--- /dev/null
+++ b/src/square/requests/data_collection_options.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.data_collection_options_input_type import DataCollectionOptionsInputType
+from .collected_data import CollectedDataParams
+
+
+class DataCollectionOptionsParams(typing_extensions.TypedDict):
+ title: str
+ """
+ The title text to display in the data collection flow on the Terminal.
+ """
+
+ body: str
+ """
+ The body text to display under the title in the data collection screen flow on the
+ Terminal.
+ """
+
+ input_type: DataCollectionOptionsInputType
+ """
+ Represents the type of the input text.
+ See [InputType](#type-inputtype) for possible values
+ """
+
+ collected_data: typing_extensions.NotRequired[CollectedDataParams]
+ """
+ The buyer’s input text from the data collection screen.
+ """
diff --git a/src/square/requests/date_range.py b/src/square/requests/date_range.py
new file mode 100644
index 00000000..4ca91c85
--- /dev/null
+++ b/src/square/requests/date_range.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class DateRangeParams(typing_extensions.TypedDict):
+ """
+ A range defined by two dates. Used for filtering a query for Connect v2
+ objects that have date properties.
+ """
+
+ start_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601
+ extended format for calendar dates.
+ The beginning of a date range (inclusive).
+ """
+
+ end_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601
+ extended format for calendar dates.
+ The end of a date range (inclusive).
+ """
diff --git a/src/square/requests/delete_booking_custom_attribute_definition_response.py b/src/square/requests/delete_booking_custom_attribute_definition_response.py
new file mode 100644
index 00000000..0987947c
--- /dev/null
+++ b/src/square/requests/delete_booking_custom_attribute_definition_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteBookingCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [DeleteBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttributeDefinition) response
+ containing error messages when errors occurred during the request. The successful response does not contain any payload.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_booking_custom_attribute_response.py b/src/square/requests/delete_booking_custom_attribute_response.py
new file mode 100644
index 00000000..1c6ae976
--- /dev/null
+++ b/src/square/requests/delete_booking_custom_attribute_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteBookingCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [DeleteBookingCustomAttribute](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttribute) response.
+ Either an empty object `{}` (for a successful deletion) or `errors` is present in the response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_break_type_response.py b/src/square/requests/delete_break_type_response.py
new file mode 100644
index 00000000..ffa46882
--- /dev/null
+++ b/src/square/requests/delete_break_type_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteBreakTypeResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request to delete a `BreakType`. The response might contain a set
+ of `Error` objects if the request resulted in errors.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_catalog_object_response.py b/src/square/requests/delete_catalog_object_response.py
new file mode 100644
index 00000000..0cac152f
--- /dev/null
+++ b/src/square/requests/delete_catalog_object_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteCatalogObjectResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ deleted_object_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ The IDs of all catalog objects deleted by this request.
+ Multiple IDs may be returned when associated objects are also deleted, for example
+ a catalog item variation will be deleted (and its ID included in this field)
+ when its parent catalog item is deleted.
+ """
+
+ deleted_at: typing_extensions.NotRequired[str]
+ """
+ The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ of this deletion in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`.
+ """
diff --git a/src/square/requests/delete_customer_card_response.py b/src/square/requests/delete_customer_card_response.py
new file mode 100644
index 00000000..26cb66da
--- /dev/null
+++ b/src/square/requests/delete_customer_card_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteCustomerCardResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `DeleteCustomerCard` endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_customer_custom_attribute_definition_response.py b/src/square/requests/delete_customer_custom_attribute_definition_response.py
new file mode 100644
index 00000000..12f4a350
--- /dev/null
+++ b/src/square/requests/delete_customer_custom_attribute_definition_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteCustomerCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from a delete request containing error messages if there are any.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_customer_custom_attribute_response.py b/src/square/requests/delete_customer_custom_attribute_response.py
new file mode 100644
index 00000000..d40cb609
--- /dev/null
+++ b/src/square/requests/delete_customer_custom_attribute_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteCustomerCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [DeleteCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-DeleteCustomerCustomAttribute) response.
+ Either an empty object `{}` (for a successful deletion) or `errors` is present in the response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_customer_group_response.py b/src/square/requests/delete_customer_group_response.py
new file mode 100644
index 00000000..bff544e0
--- /dev/null
+++ b/src/square/requests/delete_customer_group_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteCustomerGroupResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [DeleteCustomerGroup](api-endpoint:CustomerGroups-DeleteCustomerGroup) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_customer_response.py b/src/square/requests/delete_customer_response.py
new file mode 100644
index 00000000..f1a3dd54
--- /dev/null
+++ b/src/square/requests/delete_customer_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteCustomerResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `DeleteCustomer` endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_dispute_evidence_response.py b/src/square/requests/delete_dispute_evidence_response.py
new file mode 100644
index 00000000..dc20b608
--- /dev/null
+++ b/src/square/requests/delete_dispute_evidence_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteDisputeEvidenceResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields in a `DeleteDisputeEvidence` response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/delete_inventory_adjustment_reason_response.py b/src/square/requests/delete_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..08a97317
--- /dev/null
+++ b/src/square/requests/delete_inventory_adjustment_reason_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class DeleteInventoryAdjustmentReasonResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [DeleteInventoryAdjustmentReason](api-endpoint:Inventory-DeleteInventoryAdjustmentReason).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing_extensions.NotRequired[InventoryAdjustmentReasonParams]
+ """
+ The successfully soft-deleted inventory adjustment reason.
+ """
diff --git a/src/square/requests/delete_invoice_attachment_response.py b/src/square/requests/delete_invoice_attachment_response.py
new file mode 100644
index 00000000..b42e0d8e
--- /dev/null
+++ b/src/square/requests/delete_invoice_attachment_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteInvoiceAttachmentResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/delete_invoice_response.py b/src/square/requests/delete_invoice_response.py
new file mode 100644
index 00000000..36eab557
--- /dev/null
+++ b/src/square/requests/delete_invoice_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteInvoiceResponseParams(typing_extensions.TypedDict):
+ """
+ Describes a `DeleteInvoice` response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/delete_location_custom_attribute_definition_response.py b/src/square/requests/delete_location_custom_attribute_definition_response.py
new file mode 100644
index 00000000..06e687e2
--- /dev/null
+++ b/src/square/requests/delete_location_custom_attribute_definition_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteLocationCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from a delete request containing error messages if there are any.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_location_custom_attribute_response.py b/src/square/requests/delete_location_custom_attribute_response.py
new file mode 100644
index 00000000..57e7b072
--- /dev/null
+++ b/src/square/requests/delete_location_custom_attribute_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteLocationCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [DeleteLocationCustomAttribute](api-endpoint:LocationCustomAttributes-DeleteLocationCustomAttribute) response.
+ Either an empty object `{}` (for a successful deletion) or `errors` is present in the response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_loyalty_reward_response.py b/src/square/requests/delete_loyalty_reward_response.py
new file mode 100644
index 00000000..a2d666e4
--- /dev/null
+++ b/src/square/requests/delete_loyalty_reward_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteLoyaltyRewardResponseParams(typing_extensions.TypedDict):
+ """
+ A response returned by the API call.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_merchant_custom_attribute_definition_response.py b/src/square/requests/delete_merchant_custom_attribute_definition_response.py
new file mode 100644
index 00000000..0a6ed9db
--- /dev/null
+++ b/src/square/requests/delete_merchant_custom_attribute_definition_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteMerchantCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from a delete request containing error messages if there are any.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_merchant_custom_attribute_response.py b/src/square/requests/delete_merchant_custom_attribute_response.py
new file mode 100644
index 00000000..306acfd3
--- /dev/null
+++ b/src/square/requests/delete_merchant_custom_attribute_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteMerchantCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [DeleteMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-DeleteMerchantCustomAttribute) response.
+ Either an empty object `{}` (for a successful deletion) or `errors` is present in the response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_order_custom_attribute_definition_response.py b/src/square/requests/delete_order_custom_attribute_definition_response.py
new file mode 100644
index 00000000..44497bf1
--- /dev/null
+++ b/src/square/requests/delete_order_custom_attribute_definition_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteOrderCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from deleting an order custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_order_custom_attribute_response.py b/src/square/requests/delete_order_custom_attribute_response.py
new file mode 100644
index 00000000..0365f527
--- /dev/null
+++ b/src/square/requests/delete_order_custom_attribute_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteOrderCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from deleting an order custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_payment_link_response.py b/src/square/requests/delete_payment_link_response.py
new file mode 100644
index 00000000..7699b5da
--- /dev/null
+++ b/src/square/requests/delete_payment_link_response.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeletePaymentLinkResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the link that is deleted.
+ """
+
+ cancelled_order_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the order that is canceled. When a payment link is deleted, Square updates the
+ the `state` (of the order that the checkout link created) to CANCELED.
+ """
diff --git a/src/square/requests/delete_shift_response.py b/src/square/requests/delete_shift_response.py
new file mode 100644
index 00000000..55959297
--- /dev/null
+++ b/src/square/requests/delete_shift_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteShiftResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request to delete a `Shift`. The response might contain a set of
+ `Error` objects if the request resulted in errors.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_snippet_response.py b/src/square/requests/delete_snippet_response.py
new file mode 100644
index 00000000..940b0bd7
--- /dev/null
+++ b/src/square/requests/delete_snippet_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteSnippetResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a `DeleteSnippet` response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_subscription_action_response.py b/src/square/requests/delete_subscription_action_response.py
new file mode 100644
index 00000000..ab00e5b0
--- /dev/null
+++ b/src/square/requests/delete_subscription_action_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription import SubscriptionParams
+
+
+class DeleteSubscriptionActionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response of the [DeleteSubscriptionAction](api-endpoint:Subscriptions-DeleteSubscriptionAction)
+ endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The subscription that has the specified action deleted.
+ """
diff --git a/src/square/requests/delete_timecard_response.py b/src/square/requests/delete_timecard_response.py
new file mode 100644
index 00000000..12cff5de
--- /dev/null
+++ b/src/square/requests/delete_timecard_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteTimecardResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request to delete a `Timecard`. The response might contain a set of
+ `Error` objects if the request resulted in errors.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/delete_transfer_order_response.py b/src/square/requests/delete_transfer_order_response.py
new file mode 100644
index 00000000..32302ca8
--- /dev/null
+++ b/src/square/requests/delete_transfer_order_response.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteTransferOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Response for deleting a transfer order
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request
+ """
diff --git a/src/square/requests/delete_webhook_subscription_response.py b/src/square/requests/delete_webhook_subscription_response.py
new file mode 100644
index 00000000..5036123e
--- /dev/null
+++ b/src/square/requests/delete_webhook_subscription_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DeleteWebhookSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [DeleteWebhookSubscription](api-endpoint:WebhookSubscriptions-DeleteWebhookSubscription) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
diff --git a/src/square/requests/destination.py b/src/square/requests/destination.py
new file mode 100644
index 00000000..e50e418e
--- /dev/null
+++ b/src/square/requests/destination.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.destination_type import DestinationType
+
+
+class DestinationParams(typing_extensions.TypedDict):
+ """
+ Information about the destination against which the payout was made.
+ """
+
+ type: typing_extensions.NotRequired[DestinationType]
+ """
+ Type of the destination such as a bank account or debit card.
+ See [DestinationType](#type-destinationtype) for possible values
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ Square issued unique ID (also known as the instrument ID) associated with this destination.
+ """
diff --git a/src/square/requests/destination_details.py b/src/square/requests/destination_details.py
new file mode 100644
index 00000000..f7bd07e6
--- /dev/null
+++ b/src/square/requests/destination_details.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .destination_details_card_refund_details import DestinationDetailsCardRefundDetailsParams
+from .destination_details_cash_refund_details import DestinationDetailsCashRefundDetailsParams
+from .destination_details_external_refund_details import DestinationDetailsExternalRefundDetailsParams
+
+
+class DestinationDetailsParams(typing_extensions.TypedDict):
+ """
+ Details about a refund's destination.
+ """
+
+ card_details: typing_extensions.NotRequired[DestinationDetailsCardRefundDetailsParams]
+ """
+ Details about a card refund. Only populated if the destination_type is `CARD`.
+ """
+
+ cash_details: typing_extensions.NotRequired[DestinationDetailsCashRefundDetailsParams]
+ """
+ Details about a cash refund. Only populated if the destination_type is `CASH`.
+ """
+
+ external_details: typing_extensions.NotRequired[DestinationDetailsExternalRefundDetailsParams]
+ """
+ Details about an external refund. Only populated if the destination_type is `EXTERNAL`.
+ """
diff --git a/src/square/requests/destination_details_card_refund_details.py b/src/square/requests/destination_details_card_refund_details.py
new file mode 100644
index 00000000..14e400c8
--- /dev/null
+++ b/src/square/requests/destination_details_card_refund_details.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card import CardParams
+
+
+class DestinationDetailsCardRefundDetailsParams(typing_extensions.TypedDict):
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The card's non-confidential details.
+ """
+
+ entry_method: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The method used to enter the card's details for the refund. The method can be
+ `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
+ """
+
+ auth_result_code: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The authorization code provided by the issuer when a refund is approved.
+ """
diff --git a/src/square/requests/destination_details_cash_refund_details.py b/src/square/requests/destination_details_cash_refund_details.py
new file mode 100644
index 00000000..d3658d71
--- /dev/null
+++ b/src/square/requests/destination_details_cash_refund_details.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class DestinationDetailsCashRefundDetailsParams(typing_extensions.TypedDict):
+ """
+ Stores details about a cash refund. Contains only non-confidential information.
+ """
+
+ seller_supplied_money: MoneyParams
+ """
+ The amount and currency of the money supplied by the seller.
+ """
+
+ change_back_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of change due back to the seller.
+ This read-only field is calculated
+ from the `amount_money` and `seller_supplied_money` fields.
+ """
diff --git a/src/square/requests/destination_details_external_refund_details.py b/src/square/requests/destination_details_external_refund_details.py
new file mode 100644
index 00000000..382e40f7
--- /dev/null
+++ b/src/square/requests/destination_details_external_refund_details.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class DestinationDetailsExternalRefundDetailsParams(typing_extensions.TypedDict):
+ """
+ Stores details about an external refund. Contains only non-confidential information.
+ """
+
+ type: str
+ """
+ The type of external refund the seller paid to the buyer. It can be one of the
+ following:
+ - CHECK - Refunded using a physical check.
+ - BANK_TRANSFER - Refunded using external bank transfer.
+ - OTHER\\_GIFT\\_CARD - Refunded using a non-Square gift card.
+ - CRYPTO - Refunded using a crypto currency.
+ - SQUARE_CASH - Refunded using Square Cash App.
+ - SOCIAL - Refunded using peer-to-peer payment applications.
+ - EXTERNAL - A third-party application gathered this refund outside of Square.
+ - EMONEY - Refunded using an E-money provider.
+ - CARD - A credit or debit card that Square does not support.
+ - STORED_BALANCE - Use for house accounts, store credit, and so forth.
+ - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals
+ - OTHER - A type not listed here.
+ """
+
+ source: str
+ """
+ A description of the external refund source. For example,
+ "Food Delivery Service".
+ """
+
+ source_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An ID to associate the refund to its originating source.
+ """
diff --git a/src/square/requests/device.py b/src/square/requests/device.py
new file mode 100644
index 00000000..d1a1e8db
--- /dev/null
+++ b/src/square/requests/device.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .component import ComponentParams
+from .device_attributes import DeviceAttributesParams
+from .device_status import DeviceStatusParams
+
+
+class DeviceParams(typing_extensions.TypedDict):
+ id: typing_extensions.NotRequired[str]
+ """
+ A synthetic identifier for the device. The identifier includes a standardized prefix and
+ is otherwise an opaque id generated from key device fields.
+ """
+
+ attributes: DeviceAttributesParams
+ """
+ A collection of DeviceAttributes representing the device.
+ """
+
+ components: typing_extensions.NotRequired[typing.Optional[typing.Sequence[ComponentParams]]]
+ """
+ A list of components applicable to the device.
+ """
+
+ status: typing_extensions.NotRequired[DeviceStatusParams]
+ """
+ The current status of the device.
+ """
diff --git a/src/square/requests/device_attributes.py b/src/square/requests/device_attributes.py
new file mode 100644
index 00000000..506cbbb6
--- /dev/null
+++ b/src/square/requests/device_attributes.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.device_attributes_device_type import DeviceAttributesDeviceType
+
+
+class DeviceAttributesParams(typing_extensions.TypedDict):
+ type: DeviceAttributesDeviceType
+ """
+ The device type.
+ See [DeviceType](#type-devicetype) for possible values
+ """
+
+ manufacturer: str
+ """
+ The maker of the device.
+ """
+
+ model: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The specific model of the device.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A seller-specified name for the device.
+ """
+
+ manufacturers_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The manufacturer-supplied identifier for the device (where available). In many cases,
+ this identifier will be a serial number.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The RFC 3339-formatted value of the most recent update to the device information.
+ (Could represent any field update on the device.)
+ """
+
+ version: typing_extensions.NotRequired[str]
+ """
+ The current version of software installed on the device.
+ """
+
+ merchant_token: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The merchant_token identifying the merchant controlling the device.
+ """
diff --git a/src/square/requests/device_checkout_options.py b/src/square/requests/device_checkout_options.py
new file mode 100644
index 00000000..f52c2666
--- /dev/null
+++ b/src/square/requests/device_checkout_options.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .tip_settings import TipSettingsParams
+
+
+class DeviceCheckoutOptionsParams(typing_extensions.TypedDict):
+ device_id: str
+ """
+ The unique ID of the device intended for this `TerminalCheckout`.
+ A list of `DeviceCode` objects can be retrieved from the /v2/devices/codes endpoint.
+ Match a `DeviceCode.device_id` value with `device_id` to get the associated device code.
+ """
+
+ skip_receipt_screen: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Instructs the device to skip the receipt screen. Defaults to false.
+ """
+
+ collect_signature: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates that signature collection is desired during checkout. Defaults to false.
+ """
+
+ tip_settings: typing_extensions.NotRequired[TipSettingsParams]
+ """
+ Tip-specific settings.
+ """
+
+ show_itemized_cart: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Show the itemization screen prior to taking a payment. This field is only meaningful when the
+ checkout includes an order ID. Defaults to true.
+ """
+
+ allow_auto_card_surcharge: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout.
+ If true, ACS is applied based on Dashboard configuration.
+ If false, ACS is not applied regardless of that configuration.
+ For more information, see [Add a Card Surcharge](https://developer.squareup.com/docs/terminal-api/additional-payment-checkout-features#add-a-card-surcharge).
+ """
diff --git a/src/square/requests/device_code.py b/src/square/requests/device_code.py
new file mode 100644
index 00000000..c2f12526
--- /dev/null
+++ b/src/square/requests/device_code.py
@@ -0,0 +1,65 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.device_code_status import DeviceCodeStatus
+from ..types.product_type import ProductType
+
+
+class DeviceCodeParams(typing_extensions.TypedDict):
+ id: typing_extensions.NotRequired[str]
+ """
+ The unique id for this device code.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional user-defined name for the device code.
+ """
+
+ code: typing_extensions.NotRequired[str]
+ """
+ The unique code that can be used to login.
+ """
+
+ device_id: typing_extensions.NotRequired[str]
+ """
+ The unique id of the device that used this code. Populated when the device is paired up.
+ """
+
+ product_type: ProductType
+ """
+ The targeting product type of the device code.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The location assigned to this code.
+ """
+
+ status: typing_extensions.NotRequired[DeviceCodeStatus]
+ """
+ The pairing status of the device code.
+ See [DeviceCodeStatus](#type-devicecodestatus) for possible values
+ """
+
+ pair_by: typing_extensions.NotRequired[str]
+ """
+ When this DeviceCode will expire and no longer login. Timestamp in RFC 3339 format.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ When this DeviceCode was created. Timestamp in RFC 3339 format.
+ """
+
+ status_changed_at: typing_extensions.NotRequired[str]
+ """
+ When this DeviceCode's status was last changed. Timestamp in RFC 3339 format.
+ """
+
+ paired_at: typing_extensions.NotRequired[str]
+ """
+ When this DeviceCode was paired. Timestamp in RFC 3339 format.
+ """
diff --git a/src/square/requests/device_code_paired_event.py b/src/square/requests/device_code_paired_event.py
new file mode 100644
index 00000000..83f74513
--- /dev/null
+++ b/src/square/requests/device_code_paired_event.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .device_code_paired_event_data import DeviceCodePairedEventDataParams
+
+
+class DeviceCodePairedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a Square Terminal has been paired with a
+ Terminal API client and the device_id of the paired Square Terminal is
+ available.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"device.code.paired"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing_extensions.NotRequired[DeviceCodePairedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/device_code_paired_event_data.py b/src/square/requests/device_code_paired_event_data.py
new file mode 100644
index 00000000..aef51a52
--- /dev/null
+++ b/src/square/requests/device_code_paired_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .device_code_paired_event_object import DeviceCodePairedEventObjectParams
+
+
+class DeviceCodePairedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the paired object’s type, `"device_code"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the paired device code.
+ """
+
+ object: typing_extensions.NotRequired[DeviceCodePairedEventObjectParams]
+ """
+ An object containing the paired device code.
+ """
diff --git a/src/square/requests/device_code_paired_event_object.py b/src/square/requests/device_code_paired_event_object.py
new file mode 100644
index 00000000..4e701845
--- /dev/null
+++ b/src/square/requests/device_code_paired_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .device_code import DeviceCodeParams
+
+
+class DeviceCodePairedEventObjectParams(typing_extensions.TypedDict):
+ device_code: typing_extensions.NotRequired[DeviceCodeParams]
+ """
+ The created terminal checkout
+ """
diff --git a/src/square/requests/device_component_details_application_details.py b/src/square/requests/device_component_details_application_details.py
new file mode 100644
index 00000000..c192688c
--- /dev/null
+++ b/src/square/requests/device_component_details_application_details.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.application_type import ApplicationType
+
+
+class DeviceComponentDetailsApplicationDetailsParams(typing_extensions.TypedDict):
+ application_type: typing_extensions.NotRequired[ApplicationType]
+ """
+ The type of application.
+ See [ApplicationType](#type-applicationtype) for possible values
+ """
+
+ version: typing_extensions.NotRequired[str]
+ """
+ The version of the application.
+ """
+
+ session_location: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The location_id of the session for the application.
+ """
+
+ device_code_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The id of the device code that was used to log in to the device.
+ """
diff --git a/src/square/requests/device_component_details_battery_details.py b/src/square/requests/device_component_details_battery_details.py
new file mode 100644
index 00000000..bb8d8da9
--- /dev/null
+++ b/src/square/requests/device_component_details_battery_details.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.device_component_details_external_power import DeviceComponentDetailsExternalPower
+
+
+class DeviceComponentDetailsBatteryDetailsParams(typing_extensions.TypedDict):
+ visible_percent: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The battery charge percentage as displayed on the device.
+ """
+
+ external_power: typing_extensions.NotRequired[DeviceComponentDetailsExternalPower]
+ """
+ The status of external_power.
+ See [ExternalPower](#type-externalpower) for possible values
+ """
diff --git a/src/square/requests/device_component_details_card_reader_details.py b/src/square/requests/device_component_details_card_reader_details.py
new file mode 100644
index 00000000..854ec50c
--- /dev/null
+++ b/src/square/requests/device_component_details_card_reader_details.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class DeviceComponentDetailsCardReaderDetailsParams(typing_extensions.TypedDict):
+ version: typing_extensions.NotRequired[str]
+ """
+ The version of the card reader.
+ """
diff --git a/src/square/requests/device_component_details_ethernet_details.py b/src/square/requests/device_component_details_ethernet_details.py
new file mode 100644
index 00000000..a26bfdc1
--- /dev/null
+++ b/src/square/requests/device_component_details_ethernet_details.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class DeviceComponentDetailsEthernetDetailsParams(typing_extensions.TypedDict):
+ active: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ A boolean to represent whether the Ethernet interface is currently active.
+ """
+
+ ip_address_v4: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The string representation of the device’s IPv4 address.
+ """
+
+ mac_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The mac address of the device in this network.
+ """
diff --git a/src/square/requests/device_component_details_measurement.py b/src/square/requests/device_component_details_measurement.py
new file mode 100644
index 00000000..bcd482fc
--- /dev/null
+++ b/src/square/requests/device_component_details_measurement.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class DeviceComponentDetailsMeasurementParams(typing_extensions.TypedDict):
+ """
+ A value qualified by unit of measure.
+ """
+
+ value: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ Value of measure.
+ """
diff --git a/src/square/requests/device_component_details_wi_fi_details.py b/src/square/requests/device_component_details_wi_fi_details.py
new file mode 100644
index 00000000..b5ea9181
--- /dev/null
+++ b/src/square/requests/device_component_details_wi_fi_details.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .device_component_details_measurement import DeviceComponentDetailsMeasurementParams
+
+
+class DeviceComponentDetailsWiFiDetailsParams(typing_extensions.TypedDict):
+ active: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ A boolean to represent whether the WiFI interface is currently active.
+ """
+
+ ssid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the connected WIFI network.
+ """
+
+ ip_address_v4: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The string representation of the device’s IPv4 address.
+ """
+
+ secure_connection: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The security protocol for a secure connection (e.g. WPA2). None provided if the connection
+ is unsecured.
+ """
+
+ signal_strength: typing_extensions.NotRequired[DeviceComponentDetailsMeasurementParams]
+ """
+ A representation of signal strength of the WIFI network connection.
+ """
+
+ mac_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The mac address of the device in this network.
+ """
diff --git a/src/square/requests/device_created_event.py b/src/square/requests/device_created_event.py
new file mode 100644
index 00000000..4299d740
--- /dev/null
+++ b/src/square/requests/device_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .device_created_event_data import DeviceCreatedEventDataParams
+
+
+class DeviceCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a Device is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The merchant the newly created device belongs to.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents. The value is `"device.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A UUID that uniquely identifies this device creation event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The time when the device creation event was first created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[DeviceCreatedEventDataParams]
+ """
+ The metadata associated with the device creation event.
+ """
diff --git a/src/square/requests/device_created_event_data.py b/src/square/requests/device_created_event_data.py
new file mode 100644
index 00000000..5c8697a8
--- /dev/null
+++ b/src/square/requests/device_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .device_created_event_object import DeviceCreatedEventObjectParams
+
+
+class DeviceCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `"device"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the device.
+ """
+
+ object: typing_extensions.NotRequired[DeviceCreatedEventObjectParams]
+ """
+ An object containing the created device.
+ """
diff --git a/src/square/requests/device_created_event_object.py b/src/square/requests/device_created_event_object.py
new file mode 100644
index 00000000..f331f032
--- /dev/null
+++ b/src/square/requests/device_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .device import DeviceParams
+
+
+class DeviceCreatedEventObjectParams(typing_extensions.TypedDict):
+ device: typing_extensions.NotRequired[DeviceParams]
+ """
+ The created device.
+ """
diff --git a/src/square/requests/device_details.py b/src/square/requests/device_details.py
new file mode 100644
index 00000000..caae2bb5
--- /dev/null
+++ b/src/square/requests/device_details.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class DeviceDetailsParams(typing_extensions.TypedDict):
+ """
+ Details about the device that took the payment.
+ """
+
+ device_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-issued ID of the device.
+ """
+
+ device_installation_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-issued installation ID for the device.
+ """
+
+ device_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the device set by the seller.
+ """
diff --git a/src/square/requests/device_metadata.py b/src/square/requests/device_metadata.py
new file mode 100644
index 00000000..a995db21
--- /dev/null
+++ b/src/square/requests/device_metadata.py
@@ -0,0 +1,71 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class DeviceMetadataParams(typing_extensions.TypedDict):
+ battery_percentage: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Terminal’s remaining battery percentage, between 1-100.
+ """
+
+ charging_state: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The current charging state of the Terminal.
+ Options: `CHARGING`, `NOT_CHARGING`
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller business location associated with the Terminal.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square merchant account that is currently signed-in to the Terminal.
+ """
+
+ network_connection_type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Terminal’s current network connection type.
+ Options: `WIFI`, `ETHERNET`
+ """
+
+ payment_region: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The country in which the Terminal is authorized to take payments.
+ """
+
+ serial_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique identifier assigned to the Terminal, which can be found on the lower back
+ of the device.
+ """
+
+ os_version: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The current version of the Terminal’s operating system.
+ """
+
+ app_version: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The current version of the application running on the Terminal.
+ """
+
+ wifi_network_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the Wi-Fi network to which the Terminal is connected.
+ """
+
+ wifi_network_strength: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The signal strength of the Wi-FI network connection.
+ Options: `POOR`, `FAIR`, `GOOD`, `EXCELLENT`
+ """
+
+ ip_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The IP address of the Terminal.
+ """
diff --git a/src/square/requests/device_status.py b/src/square/requests/device_status.py
new file mode 100644
index 00000000..a264a33f
--- /dev/null
+++ b/src/square/requests/device_status.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.device_status_category import DeviceStatusCategory
+
+
+class DeviceStatusParams(typing_extensions.TypedDict):
+ category: typing_extensions.NotRequired[DeviceStatusCategory]
+ """
+ Category of the device status.
+ See [Category](#type-category) for possible values
+ """
diff --git a/src/square/requests/digital_wallet_details.py b/src/square/requests/digital_wallet_details.py
new file mode 100644
index 00000000..9bdb4967
--- /dev/null
+++ b/src/square/requests/digital_wallet_details.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .cash_app_details import CashAppDetailsParams
+from .error import ErrorParams
+from .lightning_details import LightningDetailsParams
+
+
+class DigitalWalletDetailsParams(typing_extensions.TypedDict):
+ """
+ Additional details about `WALLET` type payments. Contains only non-confidential information.
+ """
+
+ status: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The status of the `WALLET` payment. The status can be `AUTHORIZED`, `CAPTURED`, `VOIDED`, or
+ `FAILED`.
+ """
+
+ brand: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The brand used for the `WALLET` payment. The brand can be `CASH_APP`, `PAYPAY`, `ALIPAY`,
+ `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY`, `LIGHTNING` or `UNKNOWN`.
+ """
+
+ cash_app_details: typing_extensions.NotRequired[CashAppDetailsParams]
+ """
+ Brand-specific details for payments with the `brand` of `CASH_APP`.
+ """
+
+ lightning_details: typing_extensions.NotRequired[LightningDetailsParams]
+ """
+ Brand-specific details for payments with the `brand` of `LIGHTNING`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the payment.
+ """
diff --git a/src/square/requests/dimension.py b/src/square/requests/dimension.py
new file mode 100644
index 00000000..d9037136
--- /dev/null
+++ b/src/square/requests/dimension.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from ..types.dimension_order import DimensionOrder
+from .dimension_granularity import DimensionGranularityParams
+from .format import FormatParams
+from .format_description import FormatDescriptionParams
+
+
+class DimensionParams(typing_extensions.TypedDict):
+ name: str
+ title: typing_extensions.NotRequired[str]
+ short_title: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="shortTitle")]]
+ description: typing_extensions.NotRequired[str]
+ type: str
+ alias_member: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="aliasMember")]]
+ """
+ When dimension is defined in View, it keeps the original path: Cube.dimension
+ """
+
+ granularities: typing_extensions.NotRequired[typing.Sequence[DimensionGranularityParams]]
+ meta: typing_extensions.NotRequired[typing.Dict[str, typing.Any]]
+ format: typing_extensions.NotRequired[FormatParams]
+ format_description: typing_extensions.NotRequired[
+ typing_extensions.Annotated[FormatDescriptionParams, FieldMetadata(alias="formatDescription")]
+ ]
+ currency: typing_extensions.NotRequired[str]
+ """
+ ISO 4217 currency code in uppercase (3 characters, e.g. USD, EUR)
+ """
+
+ order: typing_extensions.NotRequired[DimensionOrder]
+ key: typing_extensions.NotRequired[str]
+ """
+ Key reference for the dimension
+ """
diff --git a/src/square/requests/dimension_granularity.py b/src/square/requests/dimension_granularity.py
new file mode 100644
index 00000000..f8c0b20a
--- /dev/null
+++ b/src/square/requests/dimension_granularity.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class DimensionGranularityParams(typing_extensions.TypedDict):
+ name: str
+ title: str
+ interval: typing_extensions.NotRequired[str]
+ sql: typing_extensions.NotRequired[str]
+ offset: typing_extensions.NotRequired[str]
+ origin: typing_extensions.NotRequired[str]
diff --git a/src/square/requests/disable_bank_account_response.py b/src/square/requests/disable_bank_account_response.py
new file mode 100644
index 00000000..34634ebf
--- /dev/null
+++ b/src/square/requests/disable_bank_account_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account import BankAccountParams
+from .error import ErrorParams
+
+
+class DisableBankAccountResponseParams(typing_extensions.TypedDict):
+ """
+ Response object returned by `DisableBankAccount`.
+ """
+
+ bank_account: typing_extensions.NotRequired[BankAccountParams]
+ """
+ The disabled 'BankAccount'
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
diff --git a/src/square/requests/disable_card_response.py b/src/square/requests/disable_card_response.py
new file mode 100644
index 00000000..af24fb41
--- /dev/null
+++ b/src/square/requests/disable_card_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card import CardParams
+from .error import ErrorParams
+
+
+class DisableCardResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [DisableCard](api-endpoint:Cards-DisableCard) endpoint.
+
+ Note: if there are errors processing the request, the card field will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The retrieved card.
+ """
diff --git a/src/square/requests/disable_events_response.py b/src/square/requests/disable_events_response.py
new file mode 100644
index 00000000..87bfa929
--- /dev/null
+++ b/src/square/requests/disable_events_response.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class DisableEventsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [DisableEvents](api-endpoint:Events-DisableEvents) endpoint.
+
+ Note: if there are errors processing the request, the events field will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
diff --git a/src/square/requests/dismiss_terminal_action_response.py b/src/square/requests/dismiss_terminal_action_response.py
new file mode 100644
index 00000000..d3e5d8f6
--- /dev/null
+++ b/src/square/requests/dismiss_terminal_action_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_action import TerminalActionParams
+
+
+class DismissTerminalActionResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ action: typing_extensions.NotRequired[TerminalActionParams]
+ """
+ Current state of the action to be dismissed.
+ """
diff --git a/src/square/requests/dismiss_terminal_checkout_response.py b/src/square/requests/dismiss_terminal_checkout_response.py
new file mode 100644
index 00000000..b9517d8f
--- /dev/null
+++ b/src/square/requests/dismiss_terminal_checkout_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_checkout import TerminalCheckoutParams
+
+
+class DismissTerminalCheckoutResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ checkout: typing_extensions.NotRequired[TerminalCheckoutParams]
+ """
+ Current state of the checkout to be dismissed.
+ """
diff --git a/src/square/requests/dismiss_terminal_refund_response.py b/src/square/requests/dismiss_terminal_refund_response.py
new file mode 100644
index 00000000..c006b19b
--- /dev/null
+++ b/src/square/requests/dismiss_terminal_refund_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_refund import TerminalRefundParams
+
+
+class DismissTerminalRefundResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ refund: typing_extensions.NotRequired[TerminalRefundParams]
+ """
+ Current state of the refund to be dismissed.
+ """
diff --git a/src/square/requests/dispute.py b/src/square/requests/dispute.py
new file mode 100644
index 00000000..68a6b55c
--- /dev/null
+++ b/src/square/requests/dispute.py
@@ -0,0 +1,100 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.card_brand import CardBrand
+from ..types.dispute_reason import DisputeReason
+from ..types.dispute_state import DisputeState
+from .disputed_payment import DisputedPaymentParams
+from .money import MoneyParams
+
+
+class DisputeParams(typing_extensions.TypedDict):
+ """
+ Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank.
+ """
+
+ dispute_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for this `Dispute`, generated by Square.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The unique ID for this `Dispute`, generated by Square.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The disputed amount, which can be less than the total transaction amount.
+ For instance, if multiple items were purchased but the cardholder only initiates a dispute over some of the items.
+ """
+
+ reason: typing_extensions.NotRequired[DisputeReason]
+ """
+ The reason why the cardholder initiated the dispute.
+ See [DisputeReason](#type-disputereason) for possible values
+ """
+
+ state: typing_extensions.NotRequired[DisputeState]
+ """
+ The current state of this dispute.
+ See [DisputeState](#type-disputestate) for possible values
+ """
+
+ due_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The deadline by which the seller must respond to the dispute, in [RFC 3339 format](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates).
+ """
+
+ disputed_payment: typing_extensions.NotRequired[DisputedPaymentParams]
+ """
+ The payment challenged in this dispute.
+ """
+
+ evidence_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of the evidence associated with the dispute.
+ """
+
+ card_brand: typing_extensions.NotRequired[CardBrand]
+ """
+ The card brand used in the disputed payment.
+ See [CardBrand](#type-cardbrand) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the dispute was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the dispute was last updated, in RFC 3339 format.
+ """
+
+ brand_dispute_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the dispute in the card brand system, generated by the card brand.
+ """
+
+ reported_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timestamp when the dispute was reported, in RFC 3339 format.
+ """
+
+ reported_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timestamp when the dispute was reported, in RFC 3339 format.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The current version of the `Dispute`.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the location where the dispute originated.
+ """
diff --git a/src/square/requests/dispute_created_event.py b/src/square/requests/dispute_created_event.py
new file mode 100644
index 00000000..3f10eb86
--- /dev/null
+++ b/src/square/requests/dispute_created_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_created_event_data import DisputeCreatedEventDataParams
+
+
+class DisputeCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Dispute](entity:Dispute) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[DisputeCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/dispute_created_event_data.py b/src/square/requests/dispute_created_event_data.py
new file mode 100644
index 00000000..9b255396
--- /dev/null
+++ b/src/square/requests/dispute_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_created_event_object import DisputeCreatedEventObjectParams
+
+
+class DisputeCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing_extensions.NotRequired[DisputeCreatedEventObjectParams]
+ """
+ An object containing fields and values relevant to the event.
+ """
diff --git a/src/square/requests/dispute_created_event_object.py b/src/square/requests/dispute_created_event_object.py
new file mode 100644
index 00000000..3495e782
--- /dev/null
+++ b/src/square/requests/dispute_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .dispute import DisputeParams
+
+
+class DisputeCreatedEventObjectParams(typing_extensions.TypedDict):
+ object: typing_extensions.NotRequired[DisputeParams]
+ """
+ The dispute object.
+ """
diff --git a/src/square/requests/dispute_evidence.py b/src/square/requests/dispute_evidence.py
new file mode 100644
index 00000000..7d046e99
--- /dev/null
+++ b/src/square/requests/dispute_evidence.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.dispute_evidence_type import DisputeEvidenceType
+from .dispute_evidence_file import DisputeEvidenceFileParams
+
+
+class DisputeEvidenceParams(typing_extensions.TypedDict):
+ evidence_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the evidence.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-generated ID of the evidence.
+ """
+
+ dispute_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the dispute the evidence is associated with.
+ """
+
+ evidence_file: typing_extensions.NotRequired[DisputeEvidenceFileParams]
+ """
+ Image, PDF, TXT
+ """
+
+ evidence_text: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Raw text
+ """
+
+ uploaded_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The time when the evidence was uploaded, in RFC 3339 format.
+ """
+
+ evidence_type: typing_extensions.NotRequired[DisputeEvidenceType]
+ """
+ The type of the evidence.
+ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
+ """
diff --git a/src/square/requests/dispute_evidence_added_event.py b/src/square/requests/dispute_evidence_added_event.py
new file mode 100644
index 00000000..36af4375
--- /dev/null
+++ b/src/square/requests/dispute_evidence_added_event.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence_added_event_data import DisputeEvidenceAddedEventDataParams
+
+
+class DisputeEvidenceAddedEventParams(typing_extensions.TypedDict):
+ """
+ Published when evidence is added to a [Dispute](entity:Dispute)
+ from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app,
+ or by calling either [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) or [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[DisputeEvidenceAddedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/dispute_evidence_added_event_data.py b/src/square/requests/dispute_evidence_added_event_data.py
new file mode 100644
index 00000000..687b0630
--- /dev/null
+++ b/src/square/requests/dispute_evidence_added_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence_added_event_object import DisputeEvidenceAddedEventObjectParams
+
+
+class DisputeEvidenceAddedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing_extensions.NotRequired[DisputeEvidenceAddedEventObjectParams]
+ """
+ An object containing fields and values relevant to the event.
+ """
diff --git a/src/square/requests/dispute_evidence_added_event_object.py b/src/square/requests/dispute_evidence_added_event_object.py
new file mode 100644
index 00000000..66675a98
--- /dev/null
+++ b/src/square/requests/dispute_evidence_added_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .dispute import DisputeParams
+
+
+class DisputeEvidenceAddedEventObjectParams(typing_extensions.TypedDict):
+ object: typing_extensions.NotRequired[DisputeParams]
+ """
+ The dispute object.
+ """
diff --git a/src/square/requests/dispute_evidence_created_event.py b/src/square/requests/dispute_evidence_created_event.py
new file mode 100644
index 00000000..d2cca7c9
--- /dev/null
+++ b/src/square/requests/dispute_evidence_created_event.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence_created_event_data import DisputeEvidenceCreatedEventDataParams
+
+
+class DisputeEvidenceCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when evidence is added to a [Dispute](entity:Dispute)
+ from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app,
+ or by calling either [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) or [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[DisputeEvidenceCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/dispute_evidence_created_event_data.py b/src/square/requests/dispute_evidence_created_event_data.py
new file mode 100644
index 00000000..ae812dec
--- /dev/null
+++ b/src/square/requests/dispute_evidence_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence_created_event_object import DisputeEvidenceCreatedEventObjectParams
+
+
+class DisputeEvidenceCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing_extensions.NotRequired[DisputeEvidenceCreatedEventObjectParams]
+ """
+ An object containing fields and values relevant to the event.
+ """
diff --git a/src/square/requests/dispute_evidence_created_event_object.py b/src/square/requests/dispute_evidence_created_event_object.py
new file mode 100644
index 00000000..5c19da6b
--- /dev/null
+++ b/src/square/requests/dispute_evidence_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .dispute import DisputeParams
+
+
+class DisputeEvidenceCreatedEventObjectParams(typing_extensions.TypedDict):
+ object: typing_extensions.NotRequired[DisputeParams]
+ """
+ The dispute object.
+ """
diff --git a/src/square/requests/dispute_evidence_deleted_event.py b/src/square/requests/dispute_evidence_deleted_event.py
new file mode 100644
index 00000000..b8b19ba8
--- /dev/null
+++ b/src/square/requests/dispute_evidence_deleted_event.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence_deleted_event_data import DisputeEvidenceDeletedEventDataParams
+
+
+class DisputeEvidenceDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when evidence is removed from a [Dispute](entity:Dispute)
+ from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app,
+ or by calling [DeleteDisputeEvidence](api-endpoint:Disputes-DeleteDisputeEvidence).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[DisputeEvidenceDeletedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/dispute_evidence_deleted_event_data.py b/src/square/requests/dispute_evidence_deleted_event_data.py
new file mode 100644
index 00000000..5374a3c0
--- /dev/null
+++ b/src/square/requests/dispute_evidence_deleted_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence_deleted_event_object import DisputeEvidenceDeletedEventObjectParams
+
+
+class DisputeEvidenceDeletedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing_extensions.NotRequired[DisputeEvidenceDeletedEventObjectParams]
+ """
+ An object containing fields and values relevant to the event.
+ """
diff --git a/src/square/requests/dispute_evidence_deleted_event_object.py b/src/square/requests/dispute_evidence_deleted_event_object.py
new file mode 100644
index 00000000..599d1c6f
--- /dev/null
+++ b/src/square/requests/dispute_evidence_deleted_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .dispute import DisputeParams
+
+
+class DisputeEvidenceDeletedEventObjectParams(typing_extensions.TypedDict):
+ object: typing_extensions.NotRequired[DisputeParams]
+ """
+ The dispute object.
+ """
diff --git a/src/square/requests/dispute_evidence_file.py b/src/square/requests/dispute_evidence_file.py
new file mode 100644
index 00000000..15c34c82
--- /dev/null
+++ b/src/square/requests/dispute_evidence_file.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class DisputeEvidenceFileParams(typing_extensions.TypedDict):
+ """
+ A file to be uploaded as dispute evidence.
+ """
+
+ filename: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The file name including the file extension. For example: "receipt.tiff".
+ """
+
+ filetype: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Dispute evidence files must be application/pdf, image/heic, image/heif, image/jpeg, image/png, or image/tiff formats.
+ """
diff --git a/src/square/requests/dispute_evidence_removed_event.py b/src/square/requests/dispute_evidence_removed_event.py
new file mode 100644
index 00000000..c0b3a0c5
--- /dev/null
+++ b/src/square/requests/dispute_evidence_removed_event.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence_removed_event_data import DisputeEvidenceRemovedEventDataParams
+
+
+class DisputeEvidenceRemovedEventParams(typing_extensions.TypedDict):
+ """
+ Published when evidence is removed from a [Dispute](entity:Dispute)
+ from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app,
+ or by calling [DeleteDisputeEvidence](api-endpoint:Disputes-DeleteDisputeEvidence).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[DisputeEvidenceRemovedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/dispute_evidence_removed_event_data.py b/src/square/requests/dispute_evidence_removed_event_data.py
new file mode 100644
index 00000000..2761cba0
--- /dev/null
+++ b/src/square/requests/dispute_evidence_removed_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence_removed_event_object import DisputeEvidenceRemovedEventObjectParams
+
+
+class DisputeEvidenceRemovedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing_extensions.NotRequired[DisputeEvidenceRemovedEventObjectParams]
+ """
+ An object containing fields and values relevant to the event.
+ """
diff --git a/src/square/requests/dispute_evidence_removed_event_object.py b/src/square/requests/dispute_evidence_removed_event_object.py
new file mode 100644
index 00000000..4dff246c
--- /dev/null
+++ b/src/square/requests/dispute_evidence_removed_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .dispute import DisputeParams
+
+
+class DisputeEvidenceRemovedEventObjectParams(typing_extensions.TypedDict):
+ object: typing_extensions.NotRequired[DisputeParams]
+ """
+ The dispute object.
+ """
diff --git a/src/square/requests/dispute_state_changed_event.py b/src/square/requests/dispute_state_changed_event.py
new file mode 100644
index 00000000..c03f4300
--- /dev/null
+++ b/src/square/requests/dispute_state_changed_event.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_state_changed_event_data import DisputeStateChangedEventDataParams
+
+
+class DisputeStateChangedEventParams(typing_extensions.TypedDict):
+ """
+ Published when the state of a [Dispute](entity:Dispute) changes.
+ This includes the dispute resolution (WON, LOST) reported by the bank. The event
+ data includes details of what changed.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[DisputeStateChangedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/dispute_state_changed_event_data.py b/src/square/requests/dispute_state_changed_event_data.py
new file mode 100644
index 00000000..ba3778b0
--- /dev/null
+++ b/src/square/requests/dispute_state_changed_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_state_changed_event_object import DisputeStateChangedEventObjectParams
+
+
+class DisputeStateChangedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing_extensions.NotRequired[DisputeStateChangedEventObjectParams]
+ """
+ An object containing fields and values relevant to the event.
+ """
diff --git a/src/square/requests/dispute_state_changed_event_object.py b/src/square/requests/dispute_state_changed_event_object.py
new file mode 100644
index 00000000..4cc12695
--- /dev/null
+++ b/src/square/requests/dispute_state_changed_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .dispute import DisputeParams
+
+
+class DisputeStateChangedEventObjectParams(typing_extensions.TypedDict):
+ object: typing_extensions.NotRequired[DisputeParams]
+ """
+ The dispute object.
+ """
diff --git a/src/square/requests/dispute_state_updated_event.py b/src/square/requests/dispute_state_updated_event.py
new file mode 100644
index 00000000..dd45b1b0
--- /dev/null
+++ b/src/square/requests/dispute_state_updated_event.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_state_updated_event_data import DisputeStateUpdatedEventDataParams
+
+
+class DisputeStateUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when the state of a [Dispute](entity:Dispute) changes.
+ This includes the dispute resolution (WON, LOST) reported by the bank. The event
+ data includes details of what changed.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[DisputeStateUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/dispute_state_updated_event_data.py b/src/square/requests/dispute_state_updated_event_data.py
new file mode 100644
index 00000000..1b1966ba
--- /dev/null
+++ b/src/square/requests/dispute_state_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_state_updated_event_object import DisputeStateUpdatedEventObjectParams
+
+
+class DisputeStateUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing_extensions.NotRequired[DisputeStateUpdatedEventObjectParams]
+ """
+ An object containing fields and values relevant to the event.
+ """
diff --git a/src/square/requests/dispute_state_updated_event_object.py b/src/square/requests/dispute_state_updated_event_object.py
new file mode 100644
index 00000000..3a6654cf
--- /dev/null
+++ b/src/square/requests/dispute_state_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .dispute import DisputeParams
+
+
+class DisputeStateUpdatedEventObjectParams(typing_extensions.TypedDict):
+ object: typing_extensions.NotRequired[DisputeParams]
+ """
+ The dispute object.
+ """
diff --git a/src/square/requests/disputed_payment.py b/src/square/requests/disputed_payment.py
new file mode 100644
index 00000000..68f455db
--- /dev/null
+++ b/src/square/requests/disputed_payment.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class DisputedPaymentParams(typing_extensions.TypedDict):
+ """
+ The payment the cardholder disputed.
+ """
+
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Square-generated unique ID of the payment being disputed.
+ """
diff --git a/src/square/requests/electronic_money_details.py b/src/square/requests/electronic_money_details.py
new file mode 100644
index 00000000..b7d4720a
--- /dev/null
+++ b/src/square/requests/electronic_money_details.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .felica_details import FelicaDetailsParams
+
+
+class ElectronicMoneyDetailsParams(typing_extensions.TypedDict):
+ """
+ Details specific to electronic money payments.
+ """
+
+ felica_details: typing_extensions.NotRequired[FelicaDetailsParams]
+ """
+ Details specific to FeliCa payments.
+ """
diff --git a/src/square/requests/employee.py b/src/square/requests/employee.py
new file mode 100644
index 00000000..a3d92c1f
--- /dev/null
+++ b/src/square/requests/employee.py
@@ -0,0 +1,67 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.employee_status import EmployeeStatus
+
+
+class EmployeeParams(typing_extensions.TypedDict):
+ """
+ An employee object that is used by the external API.
+
+ DEPRECATED at version 2020-08-26. Replaced by [TeamMember](entity:TeamMember).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ UUID for this object.
+ """
+
+ first_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The employee's first name.
+ """
+
+ last_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The employee's last name.
+ """
+
+ email: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The employee's email address
+ """
+
+ phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The employee's phone number in E.164 format, i.e. "+12125554250"
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A list of location IDs where this employee has access to.
+ """
+
+ status: typing_extensions.NotRequired[EmployeeStatus]
+ """
+ Specifies the status of the employees being fetched.
+ See [EmployeeStatus](#type-employeestatus) for possible values
+ """
+
+ is_owner: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether this employee is the owner of the merchant. Each merchant
+ has one owner employee, and that employee has full authority over
+ the account.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ A read-only timestamp in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ A read-only timestamp in RFC 3339 format.
+ """
diff --git a/src/square/requests/employee_wage.py b/src/square/requests/employee_wage.py
new file mode 100644
index 00000000..62ba2f92
--- /dev/null
+++ b/src/square/requests/employee_wage.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class EmployeeWageParams(typing_extensions.TypedDict):
+ """
+ The hourly wage rate that an employee earns on a `Shift` for doing the job specified by the `title` property of this object. Deprecated at version 2020-08-26. Use [TeamMemberWage](entity:TeamMemberWage).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The UUID for this object.
+ """
+
+ employee_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `Employee` that this wage is assigned to.
+ """
+
+ title: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The job title that this wage relates to.
+ """
+
+ hourly_rate: typing_extensions.NotRequired[MoneyParams]
+ """
+ Can be a custom-set hourly wage or the calculated effective hourly
+ wage based on the annual wage and hours worked per week.
+ """
diff --git a/src/square/requests/enable_events_response.py b/src/square/requests/enable_events_response.py
new file mode 100644
index 00000000..586054c3
--- /dev/null
+++ b/src/square/requests/enable_events_response.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class EnableEventsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [EnableEvents](api-endpoint:Events-EnableEvents) endpoint.
+
+ Note: if there are errors processing the request, the events field will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
diff --git a/src/square/requests/error.py b/src/square/requests/error.py
new file mode 100644
index 00000000..f3cbac36
--- /dev/null
+++ b/src/square/requests/error.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.error_category import ErrorCategory
+from ..types.error_code import ErrorCode
+
+
+class ErrorParams(typing_extensions.TypedDict):
+ """
+ Represents an error encountered during a request to the Connect API.
+
+ See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information.
+ """
+
+ category: ErrorCategory
+ """
+ The high-level category for the error.
+ See [ErrorCategory](#type-errorcategory) for possible values
+ """
+
+ code: ErrorCode
+ """
+ The specific code of the error.
+ See [ErrorCode](#type-errorcode) for possible values
+ """
+
+ detail: typing_extensions.NotRequired[str]
+ """
+ A human-readable description of the error for debugging purposes.
+ """
+
+ field: typing_extensions.NotRequired[str]
+ """
+ The name of the field provided in the original request (if any) that
+ the error pertains to.
+ """
diff --git a/src/square/requests/event.py b/src/square/requests/event.py
new file mode 100644
index 00000000..5bf97c5a
--- /dev/null
+++ b/src/square/requests/event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .event_data import EventDataParams
+
+
+class EventParams(typing_extensions.TypedDict):
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[EventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/event_data.py b/src/square/requests/event_data.py
new file mode 100644
index 00000000..70ab38aa
--- /dev/null
+++ b/src/square/requests/event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class EventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the affected object’s type.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected object.
+ """
+
+ deleted: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ This is true if the affected object has been deleted; otherwise, it's absent.
+ """
+
+ object: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Any]]]
+ """
+ An object containing fields and values relevant to the event. It is absent if the affected object has been deleted.
+ """
diff --git a/src/square/requests/event_metadata.py b/src/square/requests/event_metadata.py
new file mode 100644
index 00000000..66c9e0eb
--- /dev/null
+++ b/src/square/requests/event_metadata.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class EventMetadataParams(typing_extensions.TypedDict):
+ """
+ Contains metadata about a particular [Event](entity:Event).
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ api_version: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The API version of the event. This corresponds to the default API version of the developer application at the time when the event was created.
+ """
diff --git a/src/square/requests/event_type_metadata.py b/src/square/requests/event_type_metadata.py
new file mode 100644
index 00000000..75201a66
--- /dev/null
+++ b/src/square/requests/event_type_metadata.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class EventTypeMetadataParams(typing_extensions.TypedDict):
+ """
+ Contains the metadata of a webhook event type.
+ """
+
+ event_type: typing_extensions.NotRequired[str]
+ """
+ The event type.
+ """
+
+ api_version_introduced: typing_extensions.NotRequired[str]
+ """
+ The API version at which the event type was introduced.
+ """
+
+ release_status: typing_extensions.NotRequired[str]
+ """
+ The release status of the event type.
+ """
diff --git a/src/square/requests/external_payment_details.py b/src/square/requests/external_payment_details.py
new file mode 100644
index 00000000..abb715ec
--- /dev/null
+++ b/src/square/requests/external_payment_details.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class ExternalPaymentDetailsParams(typing_extensions.TypedDict):
+ """
+ Stores details about an external payment. Contains only non-confidential information.
+ For more information, see
+ [Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments).
+ """
+
+ type: str
+ """
+ The type of external payment the seller received. It can be one of the following:
+ - CHECK - Paid using a physical check.
+ - BANK_TRANSFER - Paid using external bank transfer.
+ - OTHER\\_GIFT\\_CARD - Paid using a non-Square gift card.
+ - CRYPTO - Paid using a crypto currency.
+ - SQUARE_CASH - Paid using Square Cash App.
+ - SOCIAL - Paid using peer-to-peer payment applications.
+ - EXTERNAL - A third-party application gathered this payment outside of Square.
+ - EMONEY - Paid using an E-money provider.
+ - CARD - A credit or debit card that Square does not support.
+ - STORED_BALANCE - Use for house accounts, store credit, and so forth.
+ - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals
+ - OTHER - A type not listed here.
+ """
+
+ source: str
+ """
+ A description of the external payment source. For example,
+ "Food Delivery Service".
+ """
+
+ source_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An ID to associate the payment to its originating source.
+ """
+
+ source_fee_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The fees paid to the source. The `amount_money` minus this field is
+ the net amount seller receives.
+ """
diff --git a/src/square/requests/felica_details.py b/src/square/requests/felica_details.py
new file mode 100644
index 00000000..7c36008d
--- /dev/null
+++ b/src/square/requests/felica_details.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.felica_details_felica_brand import FelicaDetailsFelicaBrand
+
+
+class FelicaDetailsParams(typing_extensions.TypedDict):
+ """
+ Details for Felica payments.
+ """
+
+ terminal_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The terminal id for a Felica payment.
+ """
+
+ felica_masked_card_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The masked card number for a Felica payment.
+ """
+
+ felica_brand: typing_extensions.NotRequired[FelicaDetailsFelicaBrand]
+ """
+ The Felica sub-brand of the payment.
+ See [FelicaBrand](#type-felicabrand) for possible values
+ """
diff --git a/src/square/requests/filter_value.py b/src/square/requests/filter_value.py
new file mode 100644
index 00000000..8ddba4b9
--- /dev/null
+++ b/src/square/requests/filter_value.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+
+
+class FilterValueParams(typing_extensions.TypedDict):
+ """
+ A filter to select resources based on an exact field value. For any given
+ value, the value can only be in one property. Depending on the field, either
+ all properties can be set or only a subset will be available.
+
+ Refer to the documentation of the field.
+ """
+
+ all_: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Optional[typing.Sequence[str]], FieldMetadata(alias="all")]
+ ]
+ """
+ A list of terms that must be present on the field of the resource.
+ """
+
+ any: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A list of terms where at least one of them must be present on the
+ field of the resource.
+ """
+
+ none: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A list of terms that must not be present on the field the resource
+ """
diff --git a/src/square/requests/float_number_range.py b/src/square/requests/float_number_range.py
new file mode 100644
index 00000000..a453b8da
--- /dev/null
+++ b/src/square/requests/float_number_range.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class FloatNumberRangeParams(typing_extensions.TypedDict):
+ """
+ Specifies a decimal number range.
+ """
+
+ start_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A decimal value indicating where the range starts.
+ """
+
+ end_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A decimal value indicating where the range ends.
+ """
diff --git a/src/square/requests/folder.py b/src/square/requests/folder.py
new file mode 100644
index 00000000..3e6f4e75
--- /dev/null
+++ b/src/square/requests/folder.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class FolderParams(typing_extensions.TypedDict):
+ name: str
+ members: typing.Sequence[str]
diff --git a/src/square/requests/format.py b/src/square/requests/format.py
new file mode 100644
index 00000000..972e38a0
--- /dev/null
+++ b/src/square/requests/format.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..types.simple_format import SimpleFormat
+from .custom_numeric_format import CustomNumericFormatParams
+from .custom_time_format import CustomTimeFormatParams
+from .link_format import LinkFormatParams
+
+FormatParams = typing.Union[SimpleFormat, LinkFormatParams, CustomTimeFormatParams, CustomNumericFormatParams]
diff --git a/src/square/requests/format_description.py b/src/square/requests/format_description.py
new file mode 100644
index 00000000..6a91180d
--- /dev/null
+++ b/src/square/requests/format_description.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class FormatDescriptionParams(typing_extensions.TypedDict):
+ """
+ Resolved format description with the predefined name and d3-format specifier
+ """
+
+ name: str
+ """
+ Predefined format name (e.g., 'percent_2', 'currency_1') or a base name like 'number', or 'custom' for ad-hoc specifiers
+ """
+
+ specifier: str
+ """
+ d3-format specifier string (e.g., '.2f', ',.0f', '$,.2f'). See https://d3js.org/d3-format
+ """
+
+ currency: typing_extensions.NotRequired[str]
+ """
+ ISO 4217 currency code in uppercase (e.g. USD, EUR). Present when a currency format is used.
+ """
diff --git a/src/square/requests/fulfillment.py b/src/square/requests/fulfillment.py
new file mode 100644
index 00000000..1286a572
--- /dev/null
+++ b/src/square/requests/fulfillment.py
@@ -0,0 +1,113 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.fulfillment_fulfillment_line_item_application import FulfillmentFulfillmentLineItemApplication
+from ..types.fulfillment_state import FulfillmentState
+from ..types.fulfillment_type import FulfillmentType
+from .fulfillment_delivery_details import FulfillmentDeliveryDetailsParams
+from .fulfillment_fulfillment_entry import FulfillmentFulfillmentEntryParams
+from .fulfillment_in_store_details import FulfillmentInStoreDetailsParams
+from .fulfillment_pickup_details import FulfillmentPickupDetailsParams
+from .fulfillment_shipment_details import FulfillmentShipmentDetailsParams
+
+
+class FulfillmentParams(typing_extensions.TypedDict):
+ """
+ Contains details about how to fulfill this order.
+ Orders can only be created with at most one fulfillment using the API.
+ However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the fulfillment only within this order.
+ """
+
+ type: typing_extensions.NotRequired[FulfillmentType]
+ """
+ The type of the fulfillment.
+ See [FulfillmentType](#type-fulfillmenttype) for possible values
+ """
+
+ state: typing_extensions.NotRequired[FulfillmentState]
+ """
+ The state of the fulfillment.
+ See [FulfillmentState](#type-fulfillmentstate) for possible values
+ """
+
+ line_item_application: typing_extensions.NotRequired[FulfillmentFulfillmentLineItemApplication]
+ """
+ Describes what order line items this fulfillment applies to.
+ It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries.
+ See [FulfillmentFulfillmentLineItemApplication](#type-fulfillmentfulfillmentlineitemapplication) for possible values
+ """
+
+ entries: typing_extensions.NotRequired[typing.Sequence[FulfillmentFulfillmentEntryParams]]
+ """
+ A list of entries pertaining to the fulfillment of an order. Each entry must reference
+ a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to
+ fulfill.
+
+ Multiple entries can reference the same line item `uid`, as long as the total quantity among
+ all fulfillment entries referencing a single line item does not exceed the quantity of the
+ order's line item itself.
+
+ An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`,
+ `CANCELED`, or `FAILED`. Fulfillments can be created and completed independently
+ before order completion.
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Optional[str]]]]
+ """
+ Application-defined data attached to this fulfillment. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ pickup_details: typing_extensions.NotRequired[FulfillmentPickupDetailsParams]
+ """
+ Contains details for a pickup fulfillment. These details are required when the fulfillment
+ type is `PICKUP`.
+ """
+
+ shipment_details: typing_extensions.NotRequired[FulfillmentShipmentDetailsParams]
+ """
+ Contains details for a shipment fulfillment. These details are required when the fulfillment type
+ is `SHIPMENT`.
+
+ A shipment fulfillment's relationship to fulfillment `state`:
+ `PROPOSED`: A shipment is requested.
+ `RESERVED`: Fulfillment in progress. Shipment processing.
+ `PREPARED`: Shipment packaged. Shipping label created.
+ `COMPLETED`: Package has been shipped.
+ `CANCELED`: Shipment has been canceled.
+ `FAILED`: Shipment has failed.
+ """
+
+ delivery_details: typing_extensions.NotRequired[FulfillmentDeliveryDetailsParams]
+ """
+ Describes delivery details of an order fulfillment.
+ """
+
+ in_store_details: typing_extensions.NotRequired[FulfillmentInStoreDetailsParams]
+ """
+ Contains details for an in-store fulfillment. These details are required when the fulfillment
+ type is `IN_STORE`.
+ """
diff --git a/src/square/requests/fulfillment_delivery_details.py b/src/square/requests/fulfillment_delivery_details.py
new file mode 100644
index 00000000..95c40140
--- /dev/null
+++ b/src/square/requests/fulfillment_delivery_details.py
@@ -0,0 +1,182 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.fulfillment_delivery_details_order_fulfillment_delivery_details_schedule_type import (
+ FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType,
+)
+from .fulfillment_recipient import FulfillmentRecipientParams
+
+
+class FulfillmentDeliveryDetailsParams(typing_extensions.TypedDict):
+ """
+ Describes delivery details of an order fulfillment.
+ """
+
+ recipient: typing_extensions.NotRequired[FulfillmentRecipientParams]
+ """
+ The contact information for the person to receive the fulfillment.
+ """
+
+ schedule_type: typing_extensions.NotRequired[FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType]
+ """
+ Indicates the fulfillment delivery schedule type. If `SCHEDULED`, then
+ `deliver_at` is required. The default is `SCHEDULED`.
+ See [OrderFulfillmentDeliveryDetailsScheduleType](#type-orderfulfillmentdeliverydetailsscheduletype) for possible values
+ """
+
+ placed_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was placed.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+
+ Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z".
+ """
+
+ deliver_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ that represents the start of the delivery period.
+ The application can set this field while the fulfillment `state` is
+ `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the
+ terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`).
+
+ The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+
+ For fulfillments with the schedule type `ASAP`, this is automatically set
+ to the current time plus `prep_time_duration`, if available.
+ """
+
+ prep_time_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ needed to prepare and deliver this fulfillment.
+ The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse
+ "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.
+ """
+
+ delivery_window_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ after `deliver_at` in which to deliver the order.
+ Applications can set this field when the fulfillment `state` is
+ `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state
+ such as `COMPLETED`, `CANCELED`, and `FAILED`).
+
+ The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse
+ "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Provides additional instructions about the delivery fulfillment.
+ It is displayed in the Square Point of Sale application and set by the API.
+ """
+
+ completed_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicates when the seller completed the fulfillment.
+ This field is automatically set when fulfillment `state` changes to `COMPLETED`.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ in_progress_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicates when the seller started processing the fulfillment.
+ This field is automatically set when the fulfillment `state` changes to `RESERVED`.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ rejected_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was rejected. This field is
+ automatically set when the fulfillment `state` changes to `FAILED`.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ ready_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the seller marked the fulfillment as ready for
+ courier pickup. This field is automatically set when the fulfillment `state` changes
+ to PREPARED.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ delivered_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was delivered to the recipient.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ canceled_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was canceled. This field is automatically
+ set when the fulfillment `state` changes to `CANCELED`.
+
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ cancel_reason: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The delivery cancellation reason. Max length: 100 characters.
+ """
+
+ courier_pickup_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when an order can be picked up by the courier for delivery.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ courier_pickup_window_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ after `courier_pickup_at` in which the courier should pick up the order.
+ The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse
+ "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.
+ """
+
+ is_no_contact_delivery: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether the delivery is preferred to be no contact.
+ """
+
+ dropoff_notes: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note to provide additional instructions about how to deliver the order.
+ """
+
+ courier_provider_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the courier provider.
+ """
+
+ courier_support_phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The support phone number of the courier.
+ """
+
+ square_delivery_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The identifier for the delivery created by Square.
+ """
+
+ external_delivery_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The identifier for the delivery created by the third-party courier service.
+ """
+
+ managed_delivery: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ The flag to indicate the delivery is managed by a third party (ie DoorDash), which means
+ we may not receive all recipient information for PII purposes.
+ """
diff --git a/src/square/requests/fulfillment_fulfillment_entry.py b/src/square/requests/fulfillment_fulfillment_entry.py
new file mode 100644
index 00000000..211b7d4a
--- /dev/null
+++ b/src/square/requests/fulfillment_fulfillment_entry.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class FulfillmentFulfillmentEntryParams(typing_extensions.TypedDict):
+ """
+ Links an order line item to a fulfillment. Each entry must reference
+ a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to
+ fulfill.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the fulfillment entry only within this order.
+ """
+
+ line_item_uid: str
+ """
+ The `uid` from the order line item.
+ """
+
+ quantity: str
+ """
+ The quantity of the line item being fulfilled, formatted as a decimal number.
+ For example, `"3"`.
+
+ Fulfillments for line items with a `quantity_unit` can have non-integer quantities.
+ For example, `"1.70000"`.
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Optional[str]]]]
+ """
+ Application-defined data attached to this fulfillment entry. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
diff --git a/src/square/requests/fulfillment_in_store_details.py b/src/square/requests/fulfillment_in_store_details.py
new file mode 100644
index 00000000..5b38edc2
--- /dev/null
+++ b/src/square/requests/fulfillment_in_store_details.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .fulfillment_recipient import FulfillmentRecipientParams
+
+
+class FulfillmentInStoreDetailsParams(typing_extensions.TypedDict):
+ """
+ Contains the details necessary to fulfill an in-store order.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note to provide additional instructions about the in-store fulfillment
+ displayed in the Square Point of Sale application and set by the API.
+ """
+
+ recipient: typing_extensions.NotRequired[FulfillmentRecipientParams]
+ """
+ Information about the person to receive this in-store fulfillment.
+ """
+
+ placed_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ completed_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was completed. This field is automatically set when the
+ fulfillment `state` changes to `COMPLETED`. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ in_progress_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicates when the seller started processing the fulfillment.
+ This field is automatically set when the fulfillment `state` changes to `RESERVED`.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ prepared_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was moved to the `PREPARED` state, which indicates that the
+ fulfillment is ready. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ canceled_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was canceled. This field is automatically set when the
+ fulfillment `state` changes to `CANCELED`. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
diff --git a/src/square/requests/fulfillment_pickup_details.py b/src/square/requests/fulfillment_pickup_details.py
new file mode 100644
index 00000000..0e0cc084
--- /dev/null
+++ b/src/square/requests/fulfillment_pickup_details.py
@@ -0,0 +1,142 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.fulfillment_pickup_details_schedule_type import FulfillmentPickupDetailsScheduleType
+from .fulfillment_pickup_details_curbside_pickup_details import FulfillmentPickupDetailsCurbsidePickupDetailsParams
+from .fulfillment_recipient import FulfillmentRecipientParams
+
+
+class FulfillmentPickupDetailsParams(typing_extensions.TypedDict):
+ """
+ Contains details necessary to fulfill a pickup order.
+ """
+
+ recipient: typing_extensions.NotRequired[FulfillmentRecipientParams]
+ """
+ Information about the person to pick up this fulfillment from a physical
+ location.
+ """
+
+ expires_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when this fulfillment expires if it is not marked in progress. The timestamp must be
+ in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set
+ up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order
+ are automatically completed.
+ """
+
+ auto_complete_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ after which an in-progress pickup fulfillment is automatically moved
+ to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "PT4H" for 4 hours).
+
+ If not set, this pickup fulfillment remains in progress until it is canceled or completed.
+ """
+
+ schedule_type: typing_extensions.NotRequired[FulfillmentPickupDetailsScheduleType]
+ """
+ The schedule type of the pickup fulfillment. Defaults to `SCHEDULED`.
+ See [FulfillmentPickupDetailsScheduleType](#type-fulfillmentpickupdetailsscheduletype) for possible values
+ """
+
+ pickup_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g.,
+ "2016-09-04T23:59:33.123Z".
+
+ For fulfillments with the schedule type `ASAP`, this is automatically set
+ to the current time plus `prep_time_duration`, if available.
+ """
+
+ pickup_window_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ in which the order should be picked up after the `pickup_at` timestamp.
+ The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse
+ "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.
+
+ Can be used as an informational guideline for merchants.
+ """
+
+ prep_time_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ needed to prepare this fulfillment.
+ The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse
+ "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note to provide additional instructions about the pickup
+ fulfillment displayed in the Square Point of Sale application and set by the API.
+ """
+
+ placed_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ accepted_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ rejected_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ ready_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ expired_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment expired. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ picked_up_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ canceled_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ cancel_reason: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A description of why the pickup was canceled. The maximum length: 100 characters.
+ """
+
+ is_curbside_pickup: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup.
+ """
+
+ curbside_pickup_details: typing_extensions.NotRequired[FulfillmentPickupDetailsCurbsidePickupDetailsParams]
+ """
+ Specific details for curbside pickup. These details can only be populated if `is_curbside_pickup` is set to `true`.
+ """
diff --git a/src/square/requests/fulfillment_pickup_details_curbside_pickup_details.py b/src/square/requests/fulfillment_pickup_details_curbside_pickup_details.py
new file mode 100644
index 00000000..f9ffedf3
--- /dev/null
+++ b/src/square/requests/fulfillment_pickup_details_curbside_pickup_details.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class FulfillmentPickupDetailsCurbsidePickupDetailsParams(typing_extensions.TypedDict):
+ """
+ Specific details for curbside pickup.
+ """
+
+ curbside_details: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Specific details for curbside pickup, such as parking number and vehicle model.
+ """
+
+ buyer_arrived_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
diff --git a/src/square/requests/fulfillment_recipient.py b/src/square/requests/fulfillment_recipient.py
new file mode 100644
index 00000000..36134644
--- /dev/null
+++ b/src/square/requests/fulfillment_recipient.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .address import AddressParams
+
+
+class FulfillmentRecipientParams(typing_extensions.TypedDict):
+ """
+ Information about the fulfillment recipient.
+ """
+
+ customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the customer associated with the fulfillment.
+
+ If `customer_id` is provided, the fulfillment recipient's `display_name`,
+ `email_address`, and `phone_number` are automatically populated from the
+ targeted customer profile. If these fields are set in the request, the request
+ values override the information from the customer profile. If the
+ targeted customer profile does not contain the necessary information and
+ these fields are left unset, the request results in an error.
+ """
+
+ display_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The display name of the fulfillment recipient. This field is required.
+
+ If provided, the display name overrides the corresponding customer profile value
+ indicated by `customer_id`.
+ """
+
+ email_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The email address of the fulfillment recipient.
+
+ If provided, the email address overrides the corresponding customer profile value
+ indicated by `customer_id`.
+ """
+
+ phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The phone number of the fulfillment recipient. This field is required.
+
+ If provided, the phone number overrides the corresponding customer profile value
+ indicated by `customer_id`.
+ """
+
+ address: typing_extensions.NotRequired[AddressParams]
+ """
+ The address of the fulfillment recipient. This field is required.
+
+ If provided, the address overrides the corresponding customer profile value
+ indicated by `customer_id`.
+ """
diff --git a/src/square/requests/fulfillment_shipment_details.py b/src/square/requests/fulfillment_shipment_details.py
new file mode 100644
index 00000000..9404fc82
--- /dev/null
+++ b/src/square/requests/fulfillment_shipment_details.py
@@ -0,0 +1,103 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .fulfillment_recipient import FulfillmentRecipientParams
+
+
+class FulfillmentShipmentDetailsParams(typing_extensions.TypedDict):
+ """
+ Contains the details necessary to fulfill a shipment order.
+ """
+
+ recipient: typing_extensions.NotRequired[FulfillmentRecipientParams]
+ """
+ Information about the person to receive this shipment fulfillment.
+ """
+
+ carrier: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS).
+ """
+
+ shipping_note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note with additional information for the shipping carrier.
+ """
+
+ shipping_type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A description of the type of shipping product purchased from the carrier
+ (such as First Class, Priority, or Express).
+ """
+
+ tracking_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The reference number provided by the carrier to track the shipment's progress.
+ """
+
+ tracking_url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A link to the tracking webpage on the carrier's website.
+ """
+
+ placed_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the shipment was requested. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ in_progress_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation
+ of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ packaged_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the
+ fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ expected_shipped_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the shipment is expected to be delivered to the shipping carrier.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ shipped_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that
+ the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ canceled_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating the shipment was canceled.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ cancel_reason: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A description of why the shipment was canceled.
+ """
+
+ failed_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ failure_reason: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A description of why the shipment failed to be completed.
+ """
diff --git a/src/square/requests/get_bank_account_by_v1id_response.py b/src/square/requests/get_bank_account_by_v1id_response.py
new file mode 100644
index 00000000..02d288f2
--- /dev/null
+++ b/src/square/requests/get_bank_account_by_v1id_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account import BankAccountParams
+from .error import ErrorParams
+
+
+class GetBankAccountByV1IdResponseParams(typing_extensions.TypedDict):
+ """
+ Response object returned by GetBankAccountByV1Id.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ bank_account: typing_extensions.NotRequired[BankAccountParams]
+ """
+ The requested `BankAccount` object.
+ """
diff --git a/src/square/requests/get_bank_account_response.py b/src/square/requests/get_bank_account_response.py
new file mode 100644
index 00000000..053c4a89
--- /dev/null
+++ b/src/square/requests/get_bank_account_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account import BankAccountParams
+from .error import ErrorParams
+
+
+class GetBankAccountResponseParams(typing_extensions.TypedDict):
+ """
+ Response object returned by `GetBankAccount`.
+ """
+
+ bank_account: typing_extensions.NotRequired[BankAccountParams]
+ """
+ The requested `BankAccount` object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
diff --git a/src/square/requests/get_booking_response.py b/src/square/requests/get_booking_response.py
new file mode 100644
index 00000000..06df7c4c
--- /dev/null
+++ b/src/square/requests/get_booking_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking import BookingParams
+from .error import ErrorParams
+
+
+class GetBookingResponseParams(typing_extensions.TypedDict):
+ booking: typing_extensions.NotRequired[BookingParams]
+ """
+ The booking that was requested.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_break_type_response.py b/src/square/requests/get_break_type_response.py
new file mode 100644
index 00000000..056c5c7e
--- /dev/null
+++ b/src/square/requests/get_break_type_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .break_type import BreakTypeParams
+from .error import ErrorParams
+
+
+class GetBreakTypeResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request to get a `BreakType`. The response contains
+ the requested `BreakType` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ break_type: typing_extensions.NotRequired[BreakTypeParams]
+ """
+ The response object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_business_booking_profile_response.py b/src/square/requests/get_business_booking_profile_response.py
new file mode 100644
index 00000000..cccb3721
--- /dev/null
+++ b/src/square/requests/get_business_booking_profile_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .business_booking_profile import BusinessBookingProfileParams
+from .error import ErrorParams
+
+
+class GetBusinessBookingProfileResponseParams(typing_extensions.TypedDict):
+ business_booking_profile: typing_extensions.NotRequired[BusinessBookingProfileParams]
+ """
+ The seller's booking profile.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_card_response.py b/src/square/requests/get_card_response.py
new file mode 100644
index 00000000..800c47ed
--- /dev/null
+++ b/src/square/requests/get_card_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card import CardParams
+from .error import ErrorParams
+
+
+class GetCardResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RetrieveCard](api-endpoint:Cards-RetrieveCard) endpoint.
+
+ Note: if there are errors processing the request, the card field will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The retrieved card.
+ """
diff --git a/src/square/requests/get_cash_drawer_shift_response.py b/src/square/requests/get_cash_drawer_shift_response.py
new file mode 100644
index 00000000..ec78d11d
--- /dev/null
+++ b/src/square/requests/get_cash_drawer_shift_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .cash_drawer_shift import CashDrawerShiftParams
+from .error import ErrorParams
+
+
+class GetCashDrawerShiftResponseParams(typing_extensions.TypedDict):
+ cash_drawer_shift: typing_extensions.NotRequired[CashDrawerShiftParams]
+ """
+ The cash drawer shift queried for.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_catalog_object_response.py b/src/square/requests/get_catalog_object_response.py
new file mode 100644
index 00000000..53800a11
--- /dev/null
+++ b/src/square/requests/get_catalog_object_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_object import CatalogObjectParams
+from .error import ErrorParams
+
+
+class GetCatalogObjectResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ object: typing_extensions.NotRequired[CatalogObjectParams]
+ """
+ The `CatalogObject`s returned.
+ """
+
+ related_objects: typing_extensions.NotRequired[typing.Sequence[CatalogObjectParams]]
+ """
+ A list of `CatalogObject`s referenced by the object in the `object` field.
+ """
diff --git a/src/square/requests/get_customer_custom_attribute_definition_response.py b/src/square/requests/get_customer_custom_attribute_definition_response.py
new file mode 100644
index 00000000..8b51289a
--- /dev/null
+++ b/src/square/requests/get_customer_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class GetCustomerCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The retrieved custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_customer_custom_attribute_response.py b/src/square/requests/get_customer_custom_attribute_response.py
new file mode 100644
index 00000000..0ccdee36
--- /dev/null
+++ b/src/square/requests/get_customer_custom_attribute_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class GetCustomerCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The retrieved custom attribute. If `with_definition` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_customer_group_response.py b/src/square/requests/get_customer_group_response.py
new file mode 100644
index 00000000..40a9d1fa
--- /dev/null
+++ b/src/square/requests/get_customer_group_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_group import CustomerGroupParams
+from .error import ErrorParams
+
+
+class GetCustomerGroupResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RetrieveCustomerGroup](api-endpoint:CustomerGroups-RetrieveCustomerGroup) endpoint.
+
+ Either `errors` or `group` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ group: typing_extensions.NotRequired[CustomerGroupParams]
+ """
+ The retrieved customer group.
+ """
diff --git a/src/square/requests/get_customer_response.py b/src/square/requests/get_customer_response.py
new file mode 100644
index 00000000..38d89c01
--- /dev/null
+++ b/src/square/requests/get_customer_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer import CustomerParams
+from .error import ErrorParams
+
+
+class GetCustomerResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `RetrieveCustomer` endpoint.
+
+ Either `errors` or `customer` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ customer: typing_extensions.NotRequired[CustomerParams]
+ """
+ The requested customer.
+ """
diff --git a/src/square/requests/get_customer_segment_response.py b/src/square/requests/get_customer_segment_response.py
new file mode 100644
index 00000000..9aa3e463
--- /dev/null
+++ b/src/square/requests/get_customer_segment_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_segment import CustomerSegmentParams
+from .error import ErrorParams
+
+
+class GetCustomerSegmentResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body for requests to the `RetrieveCustomerSegment` endpoint.
+
+ Either `errors` or `segment` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ segment: typing_extensions.NotRequired[CustomerSegmentParams]
+ """
+ The retrieved customer segment.
+ """
diff --git a/src/square/requests/get_device_code_response.py b/src/square/requests/get_device_code_response.py
new file mode 100644
index 00000000..5160a441
--- /dev/null
+++ b/src/square/requests/get_device_code_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .device_code import DeviceCodeParams
+from .error import ErrorParams
+
+
+class GetDeviceCodeResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ device_code: typing_extensions.NotRequired[DeviceCodeParams]
+ """
+ The queried DeviceCode.
+ """
diff --git a/src/square/requests/get_device_response.py b/src/square/requests/get_device_response.py
new file mode 100644
index 00000000..a06a06e6
--- /dev/null
+++ b/src/square/requests/get_device_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .device import DeviceParams
+from .error import ErrorParams
+
+
+class GetDeviceResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ device: typing_extensions.NotRequired[DeviceParams]
+ """
+ The requested `Device`.
+ """
diff --git a/src/square/requests/get_dispute_evidence_response.py b/src/square/requests/get_dispute_evidence_response.py
new file mode 100644
index 00000000..4326d987
--- /dev/null
+++ b/src/square/requests/get_dispute_evidence_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence import DisputeEvidenceParams
+from .error import ErrorParams
+
+
+class GetDisputeEvidenceResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields in a `RetrieveDisputeEvidence` response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ evidence: typing_extensions.NotRequired[DisputeEvidenceParams]
+ """
+ Metadata about the dispute evidence file.
+ """
diff --git a/src/square/requests/get_dispute_response.py b/src/square/requests/get_dispute_response.py
new file mode 100644
index 00000000..d23e4b21
--- /dev/null
+++ b/src/square/requests/get_dispute_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute import DisputeParams
+from .error import ErrorParams
+
+
+class GetDisputeResponseParams(typing_extensions.TypedDict):
+ """
+ Defines fields in a `RetrieveDispute` response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ dispute: typing_extensions.NotRequired[DisputeParams]
+ """
+ Details about the requested `Dispute`.
+ """
diff --git a/src/square/requests/get_employee_response.py b/src/square/requests/get_employee_response.py
new file mode 100644
index 00000000..bdd61566
--- /dev/null
+++ b/src/square/requests/get_employee_response.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .employee import EmployeeParams
+from .error import ErrorParams
+
+
+class GetEmployeeResponseParams(typing_extensions.TypedDict):
+ employee: typing_extensions.NotRequired[EmployeeParams]
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_employee_wage_response.py b/src/square/requests/get_employee_wage_response.py
new file mode 100644
index 00000000..133baffc
--- /dev/null
+++ b/src/square/requests/get_employee_wage_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .employee_wage import EmployeeWageParams
+from .error import ErrorParams
+
+
+class GetEmployeeWageResponseParams(typing_extensions.TypedDict):
+ """
+ A response to a request to get an `EmployeeWage`. The response contains
+ the requested `EmployeeWage` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ employee_wage: typing_extensions.NotRequired[EmployeeWageParams]
+ """
+ The requested `EmployeeWage` object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_gift_card_from_gan_response.py b/src/square/requests/get_gift_card_from_gan_response.py
new file mode 100644
index 00000000..32a3cb23
--- /dev/null
+++ b/src/square/requests/get_gift_card_from_gan_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .gift_card import GiftCardParams
+
+
+class GetGiftCardFromGanResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains a `GiftCard`. This response might contain a set of `Error` objects
+ if the request resulted in errors.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing_extensions.NotRequired[GiftCardParams]
+ """
+ A gift card that was fetched, if present. It returns empty if an error occurred.
+ """
diff --git a/src/square/requests/get_gift_card_from_nonce_response.py b/src/square/requests/get_gift_card_from_nonce_response.py
new file mode 100644
index 00000000..2fdcacdd
--- /dev/null
+++ b/src/square/requests/get_gift_card_from_nonce_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .gift_card import GiftCardParams
+
+
+class GetGiftCardFromNonceResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains a `GiftCard` object. If the request resulted in errors,
+ the response contains a set of `Error` objects.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing_extensions.NotRequired[GiftCardParams]
+ """
+ The retrieved gift card.
+ """
diff --git a/src/square/requests/get_gift_card_response.py b/src/square/requests/get_gift_card_response.py
new file mode 100644
index 00000000..59fe561c
--- /dev/null
+++ b/src/square/requests/get_gift_card_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .gift_card import GiftCardParams
+
+
+class GetGiftCardResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains a `GiftCard`. The response might contain a set of `Error` objects
+ if the request resulted in errors.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing_extensions.NotRequired[GiftCardParams]
+ """
+ The gift card retrieved.
+ """
diff --git a/src/square/requests/get_inventory_adjustment_response.py b/src/square/requests/get_inventory_adjustment_response.py
new file mode 100644
index 00000000..f4eab511
--- /dev/null
+++ b/src/square/requests/get_inventory_adjustment_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment import InventoryAdjustmentParams
+
+
+class GetInventoryAdjustmentResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ adjustment: typing_extensions.NotRequired[InventoryAdjustmentParams]
+ """
+ The requested [InventoryAdjustment](entity:InventoryAdjustment).
+ """
diff --git a/src/square/requests/get_inventory_changes_response.py b/src/square/requests/get_inventory_changes_response.py
new file mode 100644
index 00000000..06ce4306
--- /dev/null
+++ b/src/square/requests/get_inventory_changes_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_change import InventoryChangeParams
+
+
+class GetInventoryChangesResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ changes: typing_extensions.NotRequired[typing.Sequence[InventoryChangeParams]]
+ """
+ The set of inventory changes for the requested object and locations.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
diff --git a/src/square/requests/get_inventory_count_response.py b/src/square/requests/get_inventory_count_response.py
new file mode 100644
index 00000000..dcba3346
--- /dev/null
+++ b/src/square/requests/get_inventory_count_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_count import InventoryCountParams
+
+
+class GetInventoryCountResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ counts: typing_extensions.NotRequired[typing.Sequence[InventoryCountParams]]
+ """
+ The current calculated inventory counts for the requested object and
+ locations.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
diff --git a/src/square/requests/get_inventory_physical_count_response.py b/src/square/requests/get_inventory_physical_count_response.py
new file mode 100644
index 00000000..d2dc2ea9
--- /dev/null
+++ b/src/square/requests/get_inventory_physical_count_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_physical_count import InventoryPhysicalCountParams
+
+
+class GetInventoryPhysicalCountResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ count: typing_extensions.NotRequired[InventoryPhysicalCountParams]
+ """
+ The requested [InventoryPhysicalCount](entity:InventoryPhysicalCount).
+ """
diff --git a/src/square/requests/get_invoice_response.py b/src/square/requests/get_invoice_response.py
new file mode 100644
index 00000000..dd6ffd32
--- /dev/null
+++ b/src/square/requests/get_invoice_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .invoice import InvoiceParams
+
+
+class GetInvoiceResponseParams(typing_extensions.TypedDict):
+ """
+ Describes a `GetInvoice` response.
+ """
+
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The invoice requested.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/get_location_response.py b/src/square/requests/get_location_response.py
new file mode 100644
index 00000000..6e6d0be2
--- /dev/null
+++ b/src/square/requests/get_location_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .location import LocationParams
+
+
+class GetLocationResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that the [RetrieveLocation](api-endpoint:Locations-RetrieveLocation)
+ endpoint returns in a response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ location: typing_extensions.NotRequired[LocationParams]
+ """
+ The requested location.
+ """
diff --git a/src/square/requests/get_loyalty_account_response.py b/src/square/requests/get_loyalty_account_response.py
new file mode 100644
index 00000000..d75ae32c
--- /dev/null
+++ b/src/square/requests/get_loyalty_account_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_account import LoyaltyAccountParams
+
+
+class GetLoyaltyAccountResponseParams(typing_extensions.TypedDict):
+ """
+ A response that includes the loyalty account.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_account: typing_extensions.NotRequired[LoyaltyAccountParams]
+ """
+ The loyalty account.
+ """
diff --git a/src/square/requests/get_loyalty_program_response.py b/src/square/requests/get_loyalty_program_response.py
new file mode 100644
index 00000000..cbc4b47d
--- /dev/null
+++ b/src/square/requests/get_loyalty_program_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_program import LoyaltyProgramParams
+
+
+class GetLoyaltyProgramResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains the loyalty program.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ program: typing_extensions.NotRequired[LoyaltyProgramParams]
+ """
+ The loyalty program that was requested.
+ """
diff --git a/src/square/requests/get_loyalty_promotion_response.py b/src/square/requests/get_loyalty_promotion_response.py
new file mode 100644
index 00000000..24efb29a
--- /dev/null
+++ b/src/square/requests/get_loyalty_promotion_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_promotion import LoyaltyPromotionParams
+
+
+class GetLoyaltyPromotionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveLoyaltyPromotionPromotions](api-endpoint:Loyalty-RetrieveLoyaltyPromotion) response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_promotion: typing_extensions.NotRequired[LoyaltyPromotionParams]
+ """
+ The retrieved loyalty promotion.
+ """
diff --git a/src/square/requests/get_loyalty_reward_response.py b/src/square/requests/get_loyalty_reward_response.py
new file mode 100644
index 00000000..246b0cd7
--- /dev/null
+++ b/src/square/requests/get_loyalty_reward_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_reward import LoyaltyRewardParams
+
+
+class GetLoyaltyRewardResponseParams(typing_extensions.TypedDict):
+ """
+ A response that includes the loyalty reward.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ reward: typing_extensions.NotRequired[LoyaltyRewardParams]
+ """
+ The loyalty reward retrieved.
+ """
diff --git a/src/square/requests/get_merchant_response.py b/src/square/requests/get_merchant_response.py
new file mode 100644
index 00000000..f99f1305
--- /dev/null
+++ b/src/square/requests/get_merchant_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .merchant import MerchantParams
+
+
+class GetMerchantResponseParams(typing_extensions.TypedDict):
+ """
+ The response object returned by the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ merchant: typing_extensions.NotRequired[MerchantParams]
+ """
+ The requested `Merchant` object.
+ """
diff --git a/src/square/requests/get_order_response.py b/src/square/requests/get_order_response.py
new file mode 100644
index 00000000..abc6a9e7
--- /dev/null
+++ b/src/square/requests/get_order_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .order import OrderParams
+
+
+class GetOrderResponseParams(typing_extensions.TypedDict):
+ order: typing_extensions.NotRequired[OrderParams]
+ """
+ The requested order.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_payment_link_response.py b/src/square/requests/get_payment_link_response.py
new file mode 100644
index 00000000..12721cc4
--- /dev/null
+++ b/src/square/requests/get_payment_link_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment_link import PaymentLinkParams
+
+
+class GetPaymentLinkResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ payment_link: typing_extensions.NotRequired[PaymentLinkParams]
+ """
+ The payment link that is retrieved.
+ """
diff --git a/src/square/requests/get_payment_refund_response.py b/src/square/requests/get_payment_refund_response.py
new file mode 100644
index 00000000..a6e55a83
--- /dev/null
+++ b/src/square/requests/get_payment_refund_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment_refund import PaymentRefundParams
+
+
+class GetPaymentRefundResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response returned by [GetRefund](api-endpoint:Refunds-GetPaymentRefund).
+
+ Note: If there are errors processing the request, the refund field might not be
+ present or it might be present in a FAILED state.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ refund: typing_extensions.NotRequired[PaymentRefundParams]
+ """
+ The requested `PaymentRefund`.
+ """
diff --git a/src/square/requests/get_payment_response.py b/src/square/requests/get_payment_response.py
new file mode 100644
index 00000000..ff33cdc3
--- /dev/null
+++ b/src/square/requests/get_payment_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment import PaymentParams
+
+
+class GetPaymentResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response returned by [GetPayment](api-endpoint:Payments-GetPayment).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ payment: typing_extensions.NotRequired[PaymentParams]
+ """
+ The requested `Payment`.
+ """
diff --git a/src/square/requests/get_payout_response.py b/src/square/requests/get_payout_response.py
new file mode 100644
index 00000000..04ce2e34
--- /dev/null
+++ b/src/square/requests/get_payout_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payout import PayoutParams
+
+
+class GetPayoutResponseParams(typing_extensions.TypedDict):
+ payout: typing_extensions.NotRequired[PayoutParams]
+ """
+ The requested payout.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/get_shift_response.py b/src/square/requests/get_shift_response.py
new file mode 100644
index 00000000..04166cd9
--- /dev/null
+++ b/src/square/requests/get_shift_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .shift import ShiftParams
+
+
+class GetShiftResponseParams(typing_extensions.TypedDict):
+ """
+ A response to a request to get a `Shift`. The response contains
+ the requested `Shift` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ shift: typing_extensions.NotRequired[ShiftParams]
+ """
+ The requested `Shift`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_snippet_response.py b/src/square/requests/get_snippet_response.py
new file mode 100644
index 00000000..987e49bc
--- /dev/null
+++ b/src/square/requests/get_snippet_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .snippet import SnippetParams
+
+
+class GetSnippetResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a `RetrieveSnippet` response. The response can include either `snippet` or `errors`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ snippet: typing_extensions.NotRequired[SnippetParams]
+ """
+ The retrieved snippet.
+ """
diff --git a/src/square/requests/get_subscription_response.py b/src/square/requests/get_subscription_response.py
new file mode 100644
index 00000000..d7166742
--- /dev/null
+++ b/src/square/requests/get_subscription_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription import SubscriptionParams
+
+
+class GetSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response from the
+ [RetrieveSubscription](api-endpoint:Subscriptions-RetrieveSubscription) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The subscription retrieved.
+ """
diff --git a/src/square/requests/get_team_member_booking_profile_response.py b/src/square/requests/get_team_member_booking_profile_response.py
new file mode 100644
index 00000000..1743b712
--- /dev/null
+++ b/src/square/requests/get_team_member_booking_profile_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .team_member_booking_profile import TeamMemberBookingProfileParams
+
+
+class GetTeamMemberBookingProfileResponseParams(typing_extensions.TypedDict):
+ team_member_booking_profile: typing_extensions.NotRequired[TeamMemberBookingProfileParams]
+ """
+ The returned team member booking profile.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_team_member_response.py b/src/square/requests/get_team_member_response.py
new file mode 100644
index 00000000..9d71106d
--- /dev/null
+++ b/src/square/requests/get_team_member_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .team_member import TeamMemberParams
+
+
+class GetTeamMemberResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from a retrieve request containing a `TeamMember` object or error messages.
+ """
+
+ team_member: typing_extensions.NotRequired[TeamMemberParams]
+ """
+ The successfully retrieved `TeamMember` object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_team_member_wage_response.py b/src/square/requests/get_team_member_wage_response.py
new file mode 100644
index 00000000..9fc6b139
--- /dev/null
+++ b/src/square/requests/get_team_member_wage_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .team_member_wage import TeamMemberWageParams
+
+
+class GetTeamMemberWageResponseParams(typing_extensions.TypedDict):
+ """
+ A response to a request to get a `TeamMemberWage`. The response contains
+ the requested `TeamMemberWage` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ team_member_wage: typing_extensions.NotRequired[TeamMemberWageParams]
+ """
+ The requested `TeamMemberWage` object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_terminal_action_response.py b/src/square/requests/get_terminal_action_response.py
new file mode 100644
index 00000000..af56ec6a
--- /dev/null
+++ b/src/square/requests/get_terminal_action_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_action import TerminalActionParams
+
+
+class GetTerminalActionResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ action: typing_extensions.NotRequired[TerminalActionParams]
+ """
+ The requested `TerminalAction`
+ """
diff --git a/src/square/requests/get_terminal_checkout_response.py b/src/square/requests/get_terminal_checkout_response.py
new file mode 100644
index 00000000..1c71292d
--- /dev/null
+++ b/src/square/requests/get_terminal_checkout_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_checkout import TerminalCheckoutParams
+
+
+class GetTerminalCheckoutResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ checkout: typing_extensions.NotRequired[TerminalCheckoutParams]
+ """
+ The requested `TerminalCheckout`.
+ """
diff --git a/src/square/requests/get_terminal_refund_response.py b/src/square/requests/get_terminal_refund_response.py
new file mode 100644
index 00000000..27828ea6
--- /dev/null
+++ b/src/square/requests/get_terminal_refund_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_refund import TerminalRefundParams
+
+
+class GetTerminalRefundResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ refund: typing_extensions.NotRequired[TerminalRefundParams]
+ """
+ The requested `Refund`.
+ """
diff --git a/src/square/requests/get_transaction_response.py b/src/square/requests/get_transaction_response.py
new file mode 100644
index 00000000..10210ad4
--- /dev/null
+++ b/src/square/requests/get_transaction_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .transaction import TransactionParams
+
+
+class GetTransactionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RetrieveTransaction](api-endpoint:Transactions-RetrieveTransaction) endpoint.
+
+ One of `errors` or `transaction` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ transaction: typing_extensions.NotRequired[TransactionParams]
+ """
+ The requested transaction.
+ """
diff --git a/src/square/requests/get_vendor_response.py b/src/square/requests/get_vendor_response.py
new file mode 100644
index 00000000..c54a2c51
--- /dev/null
+++ b/src/square/requests/get_vendor_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .vendor import VendorParams
+
+
+class GetVendorResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [RetrieveVendor](api-endpoint:Vendors-RetrieveVendor).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ vendor: typing_extensions.NotRequired[VendorParams]
+ """
+ The successfully retrieved [Vendor](entity:Vendor) object.
+ """
diff --git a/src/square/requests/get_wage_setting_response.py b/src/square/requests/get_wage_setting_response.py
new file mode 100644
index 00000000..ba900f20
--- /dev/null
+++ b/src/square/requests/get_wage_setting_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .wage_setting import WageSettingParams
+
+
+class GetWageSettingResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from a retrieve request containing the specified `WageSetting` object or error messages.
+ """
+
+ wage_setting: typing_extensions.NotRequired[WageSettingParams]
+ """
+ The successfully retrieved `WageSetting` object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/get_webhook_subscription_response.py b/src/square/requests/get_webhook_subscription_response.py
new file mode 100644
index 00000000..c71c6e7d
--- /dev/null
+++ b/src/square/requests/get_webhook_subscription_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .webhook_subscription import WebhookSubscriptionParams
+
+
+class GetWebhookSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RetrieveWebhookSubscription](api-endpoint:WebhookSubscriptions-RetrieveWebhookSubscription) endpoint.
+
+ Note: if there are errors processing the request, the [Subscription](entity:WebhookSubscription) will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[WebhookSubscriptionParams]
+ """
+ The requested [Subscription](entity:WebhookSubscription).
+ """
diff --git a/src/square/requests/gift_card.py b/src/square/requests/gift_card.py
new file mode 100644
index 00000000..c4926a92
--- /dev/null
+++ b/src/square/requests/gift_card.py
@@ -0,0 +1,63 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.gift_card_gan_source import GiftCardGanSource
+from ..types.gift_card_status import GiftCardStatus
+from ..types.gift_card_type import GiftCardType
+from .money import MoneyParams
+
+
+class GiftCardParams(typing_extensions.TypedDict):
+ """
+ Represents a Square gift card.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the gift card.
+ """
+
+ type: GiftCardType
+ """
+ The gift card type.
+ See [Type](#type-type) for possible values
+ """
+
+ gan_source: typing_extensions.NotRequired[GiftCardGanSource]
+ """
+ The source that generated the gift card account number (GAN). The default value is `SQUARE`.
+ See [GANSource](#type-gansource) for possible values
+ """
+
+ state: typing_extensions.NotRequired[GiftCardStatus]
+ """
+ The current gift card state.
+ See [Status](#type-status) for possible values
+ """
+
+ balance_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The current gift card balance. This balance is always greater than or equal to zero.
+ """
+
+ gan: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The gift card account number (GAN). Buyers can use the GAN to make purchases or check
+ the gift card balance.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the gift card was created, in RFC 3339 format.
+ In the case of a digital gift card, it is the time when you create a card
+ (using the Square Point of Sale application, Seller Dashboard, or Gift Cards API).
+ In the case of a plastic gift card, it is the time when Square associates the card with the
+ seller at the time of activation.
+ """
+
+ customer_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ The IDs of the [customer profiles](entity:Customer) to whom this gift card is linked.
+ """
diff --git a/src/square/requests/gift_card_activity.py b/src/square/requests/gift_card_activity.py
new file mode 100644
index 00000000..25a353d7
--- /dev/null
+++ b/src/square/requests/gift_card_activity.py
@@ -0,0 +1,165 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.gift_card_activity_type import GiftCardActivityType
+from .gift_card_activity_activate import GiftCardActivityActivateParams
+from .gift_card_activity_adjust_decrement import GiftCardActivityAdjustDecrementParams
+from .gift_card_activity_adjust_increment import GiftCardActivityAdjustIncrementParams
+from .gift_card_activity_block import GiftCardActivityBlockParams
+from .gift_card_activity_clear_balance import GiftCardActivityClearBalanceParams
+from .gift_card_activity_deactivate import GiftCardActivityDeactivateParams
+from .gift_card_activity_import import GiftCardActivityImportParams
+from .gift_card_activity_import_reversal import GiftCardActivityImportReversalParams
+from .gift_card_activity_load import GiftCardActivityLoadParams
+from .gift_card_activity_redeem import GiftCardActivityRedeemParams
+from .gift_card_activity_refund import GiftCardActivityRefundParams
+from .gift_card_activity_transfer_balance_from import GiftCardActivityTransferBalanceFromParams
+from .gift_card_activity_transfer_balance_to import GiftCardActivityTransferBalanceToParams
+from .gift_card_activity_unblock import GiftCardActivityUnblockParams
+from .gift_card_activity_unlinked_activity_refund import GiftCardActivityUnlinkedActivityRefundParams
+from .money import MoneyParams
+
+
+class GiftCardActivityParams(typing_extensions.TypedDict):
+ """
+ Represents an action performed on a [gift card](entity:GiftCard) that affects its state or balance.
+ A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity
+ includes a `redeem_activity_details` field that contains information about the redemption.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the gift card activity.
+ """
+
+ type: GiftCardActivityType
+ """
+ The type of gift card activity.
+ See [Type](#type-type) for possible values
+ """
+
+ location_id: str
+ """
+ The ID of the [business location](entity:Location) where the activity occurred.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the gift card activity was created, in RFC 3339 format.
+ """
+
+ gift_card_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The gift card ID. When creating a gift card activity, `gift_card_id` is not required if
+ `gift_card_gan` is specified.
+ """
+
+ gift_card_gan: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The gift card account number (GAN). When creating a gift card activity, `gift_card_gan`
+ is not required if `gift_card_id` is specified.
+ """
+
+ gift_card_balance_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The final balance on the gift card after the action is completed.
+ """
+
+ load_activity_details: typing_extensions.NotRequired[GiftCardActivityLoadParams]
+ """
+ Additional details about a `LOAD` activity, which is used to reload money onto a gift card.
+ """
+
+ activate_activity_details: typing_extensions.NotRequired[GiftCardActivityActivateParams]
+ """
+ Additional details about an `ACTIVATE` activity, which is used to activate a gift card with
+ an initial balance.
+ """
+
+ redeem_activity_details: typing_extensions.NotRequired[GiftCardActivityRedeemParams]
+ """
+ Additional details about a `REDEEM` activity, which is used to redeem a gift card for a purchase.
+
+ For applications that process payments using the Square Payments API, Square creates a `REDEEM` activity that
+ updates the gift card balance after the corresponding [CreatePayment](api-endpoint:Payments-CreatePayment)
+ request is completed. Applications that use a custom payment processing system must call
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) to create the `REDEEM` activity.
+ """
+
+ clear_balance_activity_details: typing_extensions.NotRequired[GiftCardActivityClearBalanceParams]
+ """
+ Additional details about a `CLEAR_BALANCE` activity, which is used to set the balance of a gift card to zero.
+ """
+
+ deactivate_activity_details: typing_extensions.NotRequired[GiftCardActivityDeactivateParams]
+ """
+ Additional details about a `DEACTIVATE` activity, which is used to deactivate a gift card.
+ """
+
+ adjust_increment_activity_details: typing_extensions.NotRequired[GiftCardActivityAdjustIncrementParams]
+ """
+ Additional details about an `ADJUST_INCREMENT` activity, which is used to add money to a gift card
+ outside of a typical `ACTIVATE`, `LOAD`, or `REFUND` activity flow.
+ """
+
+ adjust_decrement_activity_details: typing_extensions.NotRequired[GiftCardActivityAdjustDecrementParams]
+ """
+ Additional details about an `ADJUST_DECREMENT` activity, which is used to deduct money from a gift
+ card outside of a typical `REDEEM` activity flow.
+ """
+
+ refund_activity_details: typing_extensions.NotRequired[GiftCardActivityRefundParams]
+ """
+ Additional details about a `REFUND` activity, which is used to add money to a gift card when
+ refunding a payment.
+
+ For applications that refund payments to a gift card using the Square Refunds API, Square automatically
+ creates a `REFUND` activity that updates the gift card balance after a [RefundPayment](api-endpoint:Refunds-RefundPayment)
+ request is completed. Applications that use a custom processing system must call
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) to create the `REFUND` activity.
+ """
+
+ unlinked_activity_refund_activity_details: typing_extensions.NotRequired[
+ GiftCardActivityUnlinkedActivityRefundParams
+ ]
+ """
+ Additional details about an `UNLINKED_ACTIVITY_REFUND` activity. This activity is used to add money
+ to a gift card when refunding a payment that was processed using a custom payment processing system
+ and not linked to the gift card.
+ """
+
+ import_activity_details: typing_extensions.NotRequired[GiftCardActivityImportParams]
+ """
+ Additional details about an `IMPORT` activity, which Square uses to import a third-party
+ gift card with a balance.
+ """
+
+ block_activity_details: typing_extensions.NotRequired[GiftCardActivityBlockParams]
+ """
+ Additional details about a `BLOCK` activity, which Square uses to temporarily block a gift card.
+ """
+
+ unblock_activity_details: typing_extensions.NotRequired[GiftCardActivityUnblockParams]
+ """
+ Additional details about an `UNBLOCK` activity, which Square uses to unblock a gift card.
+ """
+
+ import_reversal_activity_details: typing_extensions.NotRequired[GiftCardActivityImportReversalParams]
+ """
+ Additional details about an `IMPORT_REVERSAL` activity, which Square uses to reverse the
+ import of a third-party gift card.
+ """
+
+ transfer_balance_to_activity_details: typing_extensions.NotRequired[GiftCardActivityTransferBalanceToParams]
+ """
+ Additional details about a `TRANSFER_BALANCE_TO` activity, which Square uses to add money to
+ a gift card as the result of a transfer from another gift card.
+ """
+
+ transfer_balance_from_activity_details: typing_extensions.NotRequired[GiftCardActivityTransferBalanceFromParams]
+ """
+ Additional details about a `TRANSFER_BALANCE_FROM` activity, which Square uses to deduct money from
+ a gift as the result of a transfer to another gift card.
+ """
diff --git a/src/square/requests/gift_card_activity_activate.py b/src/square/requests/gift_card_activity_activate.py
new file mode 100644
index 00000000..1b0990a6
--- /dev/null
+++ b/src/square/requests/gift_card_activity_activate.py
@@ -0,0 +1,59 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class GiftCardActivityActivateParams(typing_extensions.TypedDict):
+ """
+ Represents details about an `ACTIVATE` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount added to the gift card. This value is a positive integer.
+
+ Applications that use a custom order processing system must specify this amount in the
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item.
+
+ Applications that use the Square Orders API to process orders must specify the order ID
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ line_item_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The UID of the `GIFT_CARD` line item in the order that represents the gift card purchase.
+
+ Applications that use the Square Orders API to process orders must specify the line item UID
+ in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A client-specified ID that associates the gift card activity with an entity in another system.
+
+ Applications that use a custom order processing system can use this field to track information
+ related to an order or payment.
+ """
+
+ buyer_payment_instrument_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The payment instrument IDs used to process the gift card purchase, such as a credit card ID
+ or bank account ID.
+
+ Applications that use a custom order processing system must specify payment instrument IDs in
+ the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ Square uses this information to perform compliance checks.
+
+ For applications that use the Square Orders API to process payments, Square has the necessary
+ instrument IDs to perform compliance checks.
+
+ Each buyer payment instrument ID can contain a maximum of 255 characters.
+ """
diff --git a/src/square/requests/gift_card_activity_adjust_decrement.py b/src/square/requests/gift_card_activity_adjust_decrement.py
new file mode 100644
index 00000000..20d74d63
--- /dev/null
+++ b/src/square/requests/gift_card_activity_adjust_decrement.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.gift_card_activity_adjust_decrement_reason import GiftCardActivityAdjustDecrementReason
+from .money import MoneyParams
+
+
+class GiftCardActivityAdjustDecrementParams(typing_extensions.TypedDict):
+ """
+ Represents details about an `ADJUST_DECREMENT` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount deducted from the gift card balance. This value is a positive integer.
+ """
+
+ reason: GiftCardActivityAdjustDecrementReason
+ """
+ The reason the gift card balance was adjusted.
+ See [Reason](#type-reason) for possible values
+ """
diff --git a/src/square/requests/gift_card_activity_adjust_increment.py b/src/square/requests/gift_card_activity_adjust_increment.py
new file mode 100644
index 00000000..2b288d8a
--- /dev/null
+++ b/src/square/requests/gift_card_activity_adjust_increment.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.gift_card_activity_adjust_increment_reason import GiftCardActivityAdjustIncrementReason
+from .money import MoneyParams
+
+
+class GiftCardActivityAdjustIncrementParams(typing_extensions.TypedDict):
+ """
+ Represents details about an `ADJUST_INCREMENT` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount added to the gift card balance. This value is a positive integer.
+ """
+
+ reason: GiftCardActivityAdjustIncrementReason
+ """
+ The reason the gift card balance was adjusted.
+ See [Reason](#type-reason) for possible values
+ """
diff --git a/src/square/requests/gift_card_activity_block.py b/src/square/requests/gift_card_activity_block.py
new file mode 100644
index 00000000..1de87927
--- /dev/null
+++ b/src/square/requests/gift_card_activity_block.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.gift_card_activity_block_reason import GiftCardActivityBlockReason
+
+
+class GiftCardActivityBlockParams(typing_extensions.TypedDict):
+ """
+ Represents details about a `BLOCK` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ reason: GiftCardActivityBlockReason
+ """
+ The reason the gift card was blocked.
+ See [Reason](#type-reason) for possible values
+ """
diff --git a/src/square/requests/gift_card_activity_clear_balance.py b/src/square/requests/gift_card_activity_clear_balance.py
new file mode 100644
index 00000000..20f74ee7
--- /dev/null
+++ b/src/square/requests/gift_card_activity_clear_balance.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.gift_card_activity_clear_balance_reason import GiftCardActivityClearBalanceReason
+
+
+class GiftCardActivityClearBalanceParams(typing_extensions.TypedDict):
+ """
+ Represents details about a `CLEAR_BALANCE` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ reason: GiftCardActivityClearBalanceReason
+ """
+ The reason the gift card balance was cleared.
+ See [Reason](#type-reason) for possible values
+ """
diff --git a/src/square/requests/gift_card_activity_created_event.py b/src/square/requests/gift_card_activity_created_event.py
new file mode 100644
index 00000000..bd0be1d8
--- /dev/null
+++ b/src/square/requests/gift_card_activity_created_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_activity_created_event_data import GiftCardActivityCreatedEventDataParams
+
+
+class GiftCardActivityCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [gift card activity](entity:GiftCardActivity) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `gift_card.activity.created`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[GiftCardActivityCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/gift_card_activity_created_event_data.py b/src/square/requests/gift_card_activity_created_event_data.py
new file mode 100644
index 00000000..79f23cea
--- /dev/null
+++ b/src/square/requests/gift_card_activity_created_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_activity_created_event_object import GiftCardActivityCreatedEventObjectParams
+
+
+class GiftCardActivityCreatedEventDataParams(typing_extensions.TypedDict):
+ """
+ Represents the data associated with a `gift_card.activity.created` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `gift_card_activity`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the new gift card activity.
+ """
+
+ object: typing_extensions.NotRequired[GiftCardActivityCreatedEventObjectParams]
+ """
+ An object that contains the new gift card activity.
+ """
diff --git a/src/square/requests/gift_card_activity_created_event_object.py b/src/square/requests/gift_card_activity_created_event_object.py
new file mode 100644
index 00000000..2f8e6b2f
--- /dev/null
+++ b/src/square/requests/gift_card_activity_created_event_object.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .gift_card_activity import GiftCardActivityParams
+
+
+class GiftCardActivityCreatedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the gift card activity associated with a
+ `gift_card.activity.created` event.
+ """
+
+ gift_card_activity: typing_extensions.NotRequired[GiftCardActivityParams]
+ """
+ The new gift card activity.
+ """
diff --git a/src/square/requests/gift_card_activity_deactivate.py b/src/square/requests/gift_card_activity_deactivate.py
new file mode 100644
index 00000000..a006a960
--- /dev/null
+++ b/src/square/requests/gift_card_activity_deactivate.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.gift_card_activity_deactivate_reason import GiftCardActivityDeactivateReason
+
+
+class GiftCardActivityDeactivateParams(typing_extensions.TypedDict):
+ """
+ Represents details about a `DEACTIVATE` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ reason: GiftCardActivityDeactivateReason
+ """
+ The reason the gift card was deactivated.
+ See [Reason](#type-reason) for possible values
+ """
diff --git a/src/square/requests/gift_card_activity_import.py b/src/square/requests/gift_card_activity_import.py
new file mode 100644
index 00000000..1ceb4bcb
--- /dev/null
+++ b/src/square/requests/gift_card_activity_import.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class GiftCardActivityImportParams(typing_extensions.TypedDict):
+ """
+ Represents details about an `IMPORT` [gift card activity type](entity:GiftCardActivityType).
+ This activity type is used when Square imports a third-party gift card, in which case the
+ `gan_source` of the gift card is set to `OTHER`.
+ """
+
+ amount_money: MoneyParams
+ """
+ The balance amount on the imported gift card.
+ """
diff --git a/src/square/requests/gift_card_activity_import_reversal.py b/src/square/requests/gift_card_activity_import_reversal.py
new file mode 100644
index 00000000..e07be00b
--- /dev/null
+++ b/src/square/requests/gift_card_activity_import_reversal.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class GiftCardActivityImportReversalParams(typing_extensions.TypedDict):
+ """
+ Represents details about an `IMPORT_REVERSAL` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount of money cleared from the third-party gift card when
+ the import was reversed.
+ """
diff --git a/src/square/requests/gift_card_activity_load.py b/src/square/requests/gift_card_activity_load.py
new file mode 100644
index 00000000..b7c85427
--- /dev/null
+++ b/src/square/requests/gift_card_activity_load.py
@@ -0,0 +1,59 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class GiftCardActivityLoadParams(typing_extensions.TypedDict):
+ """
+ Represents details about a `LOAD` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount added to the gift card. This value is a positive integer.
+
+ Applications that use a custom order processing system must specify this amount in the
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item.
+
+ Applications that use the Square Orders API to process orders must specify the order ID in the
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ line_item_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The UID of the `GIFT_CARD` line item in the order that represents the additional funds for the gift card.
+
+ Applications that use the Square Orders API to process orders must specify the line item UID
+ in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A client-specified ID that associates the gift card activity with an entity in another system.
+
+ Applications that use a custom order processing system can use this field to track information related to
+ an order or payment.
+ """
+
+ buyer_payment_instrument_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The payment instrument IDs used to process the order for the additional funds, such as a credit card ID
+ or bank account ID.
+
+ Applications that use a custom order processing system must specify payment instrument IDs in
+ the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ Square uses this information to perform compliance checks.
+
+ For applications that use the Square Orders API to process payments, Square has the necessary
+ instrument IDs to perform compliance checks.
+
+ Each buyer payment instrument ID can contain a maximum of 255 characters.
+ """
diff --git a/src/square/requests/gift_card_activity_redeem.py b/src/square/requests/gift_card_activity_redeem.py
new file mode 100644
index 00000000..4fd45a5e
--- /dev/null
+++ b/src/square/requests/gift_card_activity_redeem.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.gift_card_activity_redeem_status import GiftCardActivityRedeemStatus
+from .money import MoneyParams
+
+
+class GiftCardActivityRedeemParams(typing_extensions.TypedDict):
+ """
+ Represents details about a `REDEEM` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount deducted from the gift card for the redemption. This value is a positive integer.
+
+ Applications that use a custom payment processing system must specify this amount in the
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ payment_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the payment that represents the gift card redemption. Square populates this field
+ if the payment was processed by Square.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A client-specified ID that associates the gift card activity with an entity in another system.
+
+ Applications that use a custom payment processing system can use this field to track information
+ related to an order or payment.
+ """
+
+ status: typing_extensions.NotRequired[GiftCardActivityRedeemStatus]
+ """
+ The status of the gift card redemption. Gift cards redeemed from Square Point of Sale or the
+ Square Seller Dashboard use a two-state process: `PENDING`
+ to `COMPLETED` or `PENDING` to `CANCELED`. Gift cards redeemed using the Gift Card Activities API
+ always have a `COMPLETED` status.
+ See [Status](#type-status) for possible values
+ """
diff --git a/src/square/requests/gift_card_activity_refund.py b/src/square/requests/gift_card_activity_refund.py
new file mode 100644
index 00000000..30dc52c5
--- /dev/null
+++ b/src/square/requests/gift_card_activity_refund.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class GiftCardActivityRefundParams(typing_extensions.TypedDict):
+ """
+ Represents details about a `REFUND` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ redeem_activity_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the refunded `REDEEM` gift card activity. Square populates this field if the
+ `payment_id` in the corresponding [RefundPayment](api-endpoint:Refunds-RefundPayment) request
+ represents a gift card redemption.
+
+ For applications that use a custom payment processing system, this field is required when creating
+ a `REFUND` activity. The provided `REDEEM` activity ID must be linked to the same gift card.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount added to the gift card for the refund. This value is a positive integer.
+
+ This field is required when creating a `REFUND` activity. The amount can represent a full or partial refund.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A client-specified ID that associates the gift card activity with an entity in another system.
+ """
+
+ payment_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the refunded payment. Square populates this field if the refund is for a
+ payment processed by Square. This field matches the `payment_id` in the corresponding
+ [RefundPayment](api-endpoint:Refunds-RefundPayment) request.
+ """
diff --git a/src/square/requests/gift_card_activity_transfer_balance_from.py b/src/square/requests/gift_card_activity_transfer_balance_from.py
new file mode 100644
index 00000000..2bdfc78a
--- /dev/null
+++ b/src/square/requests/gift_card_activity_transfer_balance_from.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class GiftCardActivityTransferBalanceFromParams(typing_extensions.TypedDict):
+ """
+ Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ transfer_to_gift_card_id: str
+ """
+ The ID of the gift card to which the specified amount was transferred.
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount deducted from the gift card for the transfer. This value is a positive integer.
+ """
diff --git a/src/square/requests/gift_card_activity_transfer_balance_to.py b/src/square/requests/gift_card_activity_transfer_balance_to.py
new file mode 100644
index 00000000..3953168a
--- /dev/null
+++ b/src/square/requests/gift_card_activity_transfer_balance_to.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class GiftCardActivityTransferBalanceToParams(typing_extensions.TypedDict):
+ """
+ Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ transfer_from_gift_card_id: str
+ """
+ The ID of the gift card from which the specified amount was transferred.
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount added to the gift card balance for the transfer. This value is a positive integer.
+ """
diff --git a/src/square/requests/gift_card_activity_unblock.py b/src/square/requests/gift_card_activity_unblock.py
new file mode 100644
index 00000000..c1a8dd96
--- /dev/null
+++ b/src/square/requests/gift_card_activity_unblock.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.gift_card_activity_unblock_reason import GiftCardActivityUnblockReason
+
+
+class GiftCardActivityUnblockParams(typing_extensions.TypedDict):
+ """
+ Represents details about an `UNBLOCK` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ reason: GiftCardActivityUnblockReason
+ """
+ The reason the gift card was unblocked.
+ See [Reason](#type-reason) for possible values
+ """
diff --git a/src/square/requests/gift_card_activity_unlinked_activity_refund.py b/src/square/requests/gift_card_activity_unlinked_activity_refund.py
new file mode 100644
index 00000000..43158899
--- /dev/null
+++ b/src/square/requests/gift_card_activity_unlinked_activity_refund.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class GiftCardActivityUnlinkedActivityRefundParams(typing_extensions.TypedDict):
+ """
+ Represents details about an `UNLINKED_ACTIVITY_REFUND` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount added to the gift card for the refund. This value is a positive integer.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A client-specified ID that associates the gift card activity with an entity in another system.
+ """
+
+ payment_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the refunded payment. This field is not used starting in Square version 2022-06-16.
+ """
diff --git a/src/square/requests/gift_card_activity_updated_event.py b/src/square/requests/gift_card_activity_updated_event.py
new file mode 100644
index 00000000..42bdd134
--- /dev/null
+++ b/src/square/requests/gift_card_activity_updated_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_activity_updated_event_data import GiftCardActivityUpdatedEventDataParams
+
+
+class GiftCardActivityUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [gift card activity](entity:GiftCardActivity) is updated.
+ Subscribe to this event to be notified about the following changes:
+ - An update to the `REDEEM` activity for a gift card redemption made from a Square product (such as Square Point of Sale).
+ These redemptions are initially assigned a `PENDING` state, but then change to a `COMPLETED` or `CANCELED` state.
+ - An update to the `IMPORT` activity for an imported gift card when the balance is later adjusted by Square.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `gift_card.activity.updated`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[GiftCardActivityUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/gift_card_activity_updated_event_data.py b/src/square/requests/gift_card_activity_updated_event_data.py
new file mode 100644
index 00000000..7481491d
--- /dev/null
+++ b/src/square/requests/gift_card_activity_updated_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_activity_updated_event_object import GiftCardActivityUpdatedEventObjectParams
+
+
+class GiftCardActivityUpdatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `gift_card.activity.updated` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `gift_card_activity`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the updated gift card activity.
+ """
+
+ object: typing_extensions.NotRequired[GiftCardActivityUpdatedEventObjectParams]
+ """
+ An object that contains the updated gift card activity.
+ """
diff --git a/src/square/requests/gift_card_activity_updated_event_object.py b/src/square/requests/gift_card_activity_updated_event_object.py
new file mode 100644
index 00000000..8f35e099
--- /dev/null
+++ b/src/square/requests/gift_card_activity_updated_event_object.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .gift_card_activity import GiftCardActivityParams
+
+
+class GiftCardActivityUpdatedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the gift card activity associated with a
+ `gift_card.activity.updated` event.
+ """
+
+ gift_card_activity: typing_extensions.NotRequired[GiftCardActivityParams]
+ """
+ The updated gift card activity.
+ """
diff --git a/src/square/requests/gift_card_created_event.py b/src/square/requests/gift_card_created_event.py
new file mode 100644
index 00000000..5e27d0fe
--- /dev/null
+++ b/src/square/requests/gift_card_created_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_created_event_data import GiftCardCreatedEventDataParams
+
+
+class GiftCardCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [gift card](entity:GiftCard) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `gift_card.created`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[GiftCardCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/gift_card_created_event_data.py b/src/square/requests/gift_card_created_event_data.py
new file mode 100644
index 00000000..b4a08e70
--- /dev/null
+++ b/src/square/requests/gift_card_created_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_created_event_object import GiftCardCreatedEventObjectParams
+
+
+class GiftCardCreatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `gift_card.created` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `gift_card`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the new gift card.
+ """
+
+ object: typing_extensions.NotRequired[GiftCardCreatedEventObjectParams]
+ """
+ An object that contains the new gift card.
+ """
diff --git a/src/square/requests/gift_card_created_event_object.py b/src/square/requests/gift_card_created_event_object.py
new file mode 100644
index 00000000..b9df8bf4
--- /dev/null
+++ b/src/square/requests/gift_card_created_event_object.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .gift_card import GiftCardParams
+
+
+class GiftCardCreatedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the gift card associated with a `gift_card.created` event.
+ """
+
+ gift_card: typing_extensions.NotRequired[GiftCardParams]
+ """
+ The new gift card.
+ """
diff --git a/src/square/requests/gift_card_customer_linked_event.py b/src/square/requests/gift_card_customer_linked_event.py
new file mode 100644
index 00000000..b59831ad
--- /dev/null
+++ b/src/square/requests/gift_card_customer_linked_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_customer_linked_event_data import GiftCardCustomerLinkedEventDataParams
+
+
+class GiftCardCustomerLinkedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [customer](entity:Customer) is linked to a [gift card](entity:GiftCard).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `gift_card.customer_linked`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[GiftCardCustomerLinkedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/gift_card_customer_linked_event_data.py b/src/square/requests/gift_card_customer_linked_event_data.py
new file mode 100644
index 00000000..2920674e
--- /dev/null
+++ b/src/square/requests/gift_card_customer_linked_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_customer_linked_event_object import GiftCardCustomerLinkedEventObjectParams
+
+
+class GiftCardCustomerLinkedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `gift_card.customer_linked` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `gift_card`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the updated gift card.
+ """
+
+ object: typing_extensions.NotRequired[GiftCardCustomerLinkedEventObjectParams]
+ """
+ An object that contains the updated gift card and the ID of the linked customer.
+ """
diff --git a/src/square/requests/gift_card_customer_linked_event_object.py b/src/square/requests/gift_card_customer_linked_event_object.py
new file mode 100644
index 00000000..9c45a44a
--- /dev/null
+++ b/src/square/requests/gift_card_customer_linked_event_object.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card import GiftCardParams
+
+
+class GiftCardCustomerLinkedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the gift card and customer ID associated with a
+ `gift_card.customer_linked` event.
+ """
+
+ gift_card: typing_extensions.NotRequired[GiftCardParams]
+ """
+ The gift card with the updated `customer_ids` field.
+ """
+
+ linked_customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the linked [customer](entity:Customer).
+ """
diff --git a/src/square/requests/gift_card_customer_unlinked_event.py b/src/square/requests/gift_card_customer_unlinked_event.py
new file mode 100644
index 00000000..8013151c
--- /dev/null
+++ b/src/square/requests/gift_card_customer_unlinked_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_customer_unlinked_event_data import GiftCardCustomerUnlinkedEventDataParams
+
+
+class GiftCardCustomerUnlinkedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [customer](entity:Customer) is unlinked from a [gift card](entity:GiftCard).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `gift_card.customer_unlinked`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[GiftCardCustomerUnlinkedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/gift_card_customer_unlinked_event_data.py b/src/square/requests/gift_card_customer_unlinked_event_data.py
new file mode 100644
index 00000000..c378db15
--- /dev/null
+++ b/src/square/requests/gift_card_customer_unlinked_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_customer_unlinked_event_object import GiftCardCustomerUnlinkedEventObjectParams
+
+
+class GiftCardCustomerUnlinkedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `gift_card.customer_unlinked` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `gift_card`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the updated gift card.
+ """
+
+ object: typing_extensions.NotRequired[GiftCardCustomerUnlinkedEventObjectParams]
+ """
+ An object that contains the updated gift card and the ID of the unlinked customer.
+ """
diff --git a/src/square/requests/gift_card_customer_unlinked_event_object.py b/src/square/requests/gift_card_customer_unlinked_event_object.py
new file mode 100644
index 00000000..fa109b5f
--- /dev/null
+++ b/src/square/requests/gift_card_customer_unlinked_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card import GiftCardParams
+
+
+class GiftCardCustomerUnlinkedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the gift card and the customer ID associated with a
+ `gift_card.customer_linked` event.
+ """
+
+ gift_card: typing_extensions.NotRequired[GiftCardParams]
+ """
+ The gift card with the updated `customer_ids` field.
+ The field is removed if the gift card is not linked to any customers.
+ """
+
+ unlinked_customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the unlinked [customer](entity:Customer).
+ """
diff --git a/src/square/requests/gift_card_updated_event.py b/src/square/requests/gift_card_updated_event.py
new file mode 100644
index 00000000..21a10755
--- /dev/null
+++ b/src/square/requests/gift_card_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_updated_event_data import GiftCardUpdatedEventDataParams
+
+
+class GiftCardUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [gift card](entity:GiftCard) is updated. This includes
+ changes to the state, balance, and customer association.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. For this event, the value is `gift_card.updated`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[GiftCardUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/gift_card_updated_event_data.py b/src/square/requests/gift_card_updated_event_data.py
new file mode 100644
index 00000000..75893528
--- /dev/null
+++ b/src/square/requests/gift_card_updated_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .gift_card_updated_event_object import GiftCardUpdatedEventObjectParams
+
+
+class GiftCardUpdatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `gift_card.updated` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `gift_card`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the updated gift card.
+ """
+
+ object: typing_extensions.NotRequired[GiftCardUpdatedEventObjectParams]
+ """
+ An object that contains the updated gift card.
+ """
diff --git a/src/square/requests/gift_card_updated_event_object.py b/src/square/requests/gift_card_updated_event_object.py
new file mode 100644
index 00000000..715b18fb
--- /dev/null
+++ b/src/square/requests/gift_card_updated_event_object.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .gift_card import GiftCardParams
+
+
+class GiftCardUpdatedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the gift card associated with a `gift_card.updated` event.
+ """
+
+ gift_card: typing_extensions.NotRequired[GiftCardParams]
+ """
+ The gift card with the updated `balance_money`, `state`, or `customer_ids` field.
+ Some events can affect both `balance_money` and `state`.
+ """
diff --git a/src/square/requests/hierarchy.py b/src/square/requests/hierarchy.py
new file mode 100644
index 00000000..4365b8de
--- /dev/null
+++ b/src/square/requests/hierarchy.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+
+
+class HierarchyParams(typing_extensions.TypedDict):
+ name: str
+ alias_member: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="aliasMember")]]
+ """
+ When hierarchy is defined in Cube, it keeps the original path: Cube.hierarchy
+ """
+
+ title: typing_extensions.NotRequired[str]
+ levels: typing.Sequence[str]
diff --git a/src/square/requests/inventory_adjustment.py b/src/square/requests/inventory_adjustment.py
new file mode 100644
index 00000000..fe6bf54c
--- /dev/null
+++ b/src/square/requests/inventory_adjustment.py
@@ -0,0 +1,173 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.inventory_state import InventoryState
+from .inventory_adjustment_group import InventoryAdjustmentGroupParams
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonIdParams
+from .money import MoneyParams
+from .source_application import SourceApplicationParams
+
+
+class InventoryAdjustmentParams(typing_extensions.TypedDict):
+ """
+ Represents a change in state or quantity of product inventory at a
+ particular time and location.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique ID generated by Square for the
+ `InventoryAdjustment`.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional ID provided by the application to tie the
+ `InventoryAdjustment` to an external
+ system.
+ """
+
+ from_state: typing_extensions.NotRequired[InventoryState]
+ """
+ The [inventory state](entity:InventoryState) of the related quantity
+ of items before the adjustment.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ to_state: typing_extensions.NotRequired[InventoryState]
+ """
+ The [inventory state](entity:InventoryState) of the related quantity
+ of items after the adjustment.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ from_location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the [Location](entity:Location) where the related
+ quantity of items is being tracked before the adjustment.
+ """
+
+ to_location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the [Location](entity:Location) where the related
+ quantity of items is being tracked after the adjustment.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the
+ [CatalogObject](entity:CatalogObject) being tracked.
+ """
+
+ catalog_object_type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.
+
+ The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
+ In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
+ """
+
+ quantity: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The number of items affected by the adjustment as a decimal string.
+ Can support up to 5 digits after the decimal point.
+ """
+
+ total_price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total price paid for goods associated with the
+ adjustment. Present if and only if `to_state` is `SOLD`. Always
+ non-negative.
+ """
+
+ occurred_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A client-generated RFC 3339-formatted timestamp that indicates when
+ the inventory adjustment took place. For inventory adjustment updates, the `occurred_at`
+ timestamp cannot be older than 24 hours or in the future relative to the
+ time of the request.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ An RFC 3339-formatted timestamp that indicates when the inventory adjustment is received.
+ """
+
+ source: typing_extensions.NotRequired[SourceApplicationParams]
+ """
+ Information about the application that caused the
+ inventory adjustment.
+ """
+
+ employee_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the [Employee](entity:Employee) responsible for the
+ inventory adjustment.
+ """
+
+ team_member_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
+ inventory adjustment.
+ """
+
+ transaction_id: typing_extensions.NotRequired[str]
+ """
+ The Square-generated ID of the [Transaction](entity:Transaction) that
+ caused the adjustment. Only relevant for payment-related state
+ transitions.
+ """
+
+ refund_id: typing_extensions.NotRequired[str]
+ """
+ The Square-generated ID of the [Refund](entity:Refund) that
+ caused the adjustment. Only relevant for refund-related state
+ transitions.
+ """
+
+ purchase_order_id: typing_extensions.NotRequired[str]
+ """
+ The Square-generated ID of the purchase order that caused the
+ adjustment. Only relevant for state transitions from the Square for Retail
+ app.
+ """
+
+ goods_receipt_id: typing_extensions.NotRequired[str]
+ """
+ The Square-generated ID of the goods receipt that caused the
+ adjustment. Only relevant for state transitions from the Square for Retail
+ app.
+ """
+
+ adjustment_group: typing_extensions.NotRequired[InventoryAdjustmentGroupParams]
+ """
+ An adjustment group bundling the related adjustments of item variations through stock conversions in a single inventory event.
+ """
+
+ cost_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount paid by the merchant to the supplying vendor for these units of the product.
+ This field is only applicable for stock receive adjustments that introduce stock into the system (from_state is NONE or UNLINKED_RETURN).
+ May be empty.
+ This field will only accept writes if the merchant has an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
+
+ vendor_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the Vendor from which the merchant purchased this product.
+ This field is only applicable for stock receive adjustments that introduce stock into the system (from_state is NONE or UNLINKED_RETURN).
+ This field will only accept writes if the merchant has an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
+
+ physical_count_id: typing_extensions.NotRequired[str]
+ """
+ The Square-generated ID of the InventoryPhysicalCount (recount) that generated this adjustment, if applicable.
+ The quantity of an adjustment generated by a physical count cannot be edited.
+ """
+
+ reason_id: typing_extensions.NotRequired[InventoryAdjustmentReasonIdParams]
+ """
+ Identifies the reason for this inventory adjustment.
+ """
diff --git a/src/square/requests/inventory_adjustment_group.py b/src/square/requests/inventory_adjustment_group.py
new file mode 100644
index 00000000..ca76146d
--- /dev/null
+++ b/src/square/requests/inventory_adjustment_group.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.inventory_state import InventoryState
+
+
+class InventoryAdjustmentGroupParams(typing_extensions.TypedDict):
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique ID generated by Square for the
+ `InventoryAdjustmentGroup`.
+ """
+
+ root_adjustment_id: typing_extensions.NotRequired[str]
+ """
+ The inventory adjustment of the composed variation.
+ """
+
+ from_state: typing_extensions.NotRequired[InventoryState]
+ """
+ Representative `from_state` for adjustments within the group. For example, for a group adjustment from `IN_STOCK` to `SOLD`,
+ there can be two component adjustments in the group: one from `IN_STOCK`to `COMPOSED` and the other one from `COMPOSED` to `SOLD`.
+ Here, the representative `from_state` for the `InventoryAdjustmentGroup` is `IN_STOCK`.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ to_state: typing_extensions.NotRequired[InventoryState]
+ """
+ Representative `to_state` for adjustments within group. For example, for a group adjustment from `IN_STOCK` to `SOLD`,
+ the two component adjustments in the group can be from `IN_STOCK` to `COMPOSED` and from `COMPOSED` to `SOLD`.
+ Here, the representative `to_state` of the `InventoryAdjustmentGroup` is `SOLD`.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
diff --git a/src/square/requests/inventory_adjustment_reason.py b/src/square/requests/inventory_adjustment_reason.py
new file mode 100644
index 00000000..f6ac3fe7
--- /dev/null
+++ b/src/square/requests/inventory_adjustment_reason.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.inventory_adjustment_reason_direction import InventoryAdjustmentReasonDirection
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonIdParams
+
+
+class InventoryAdjustmentReasonParams(typing_extensions.TypedDict):
+ """
+ Represents an inventory adjustment reason.
+ """
+
+ id: InventoryAdjustmentReasonIdParams
+ """
+ The identifier for this inventory adjustment reason.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The seller-facing name for a custom inventory adjustment reason. This
+ field is empty for standard and system-generated adjustment reasons.
+ """
+
+ direction: typing_extensions.NotRequired[InventoryAdjustmentReasonDirection]
+ """
+ Indicates whether this inventory adjustment reason increases or
+ decreases inventory. This field is set for custom reasons and for standard
+ seller-selectable reasons. It is empty for system-generated inventory
+ events.
+ See [Direction](#type-direction) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ An RFC 3339-formatted timestamp that indicates when the custom
+ adjustment reason was created. This field is empty for standard
+ adjustment reasons.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ An RFC 3339-formatted timestamp that indicates when the custom
+ adjustment reason was last updated. This field is empty for standard
+ adjustment reasons.
+ """
+
+ is_deleted: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether this custom inventory adjustment reason has been
+ deleted. Deleted custom reasons can still be retrieved by ID, but are
+ omitted from list responses unless deleted reasons are explicitly included.
+ To restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+ This field is always `false` for standard and system-generated adjustment
+ reasons.
+ """
diff --git a/src/square/requests/inventory_adjustment_reason_id.py b/src/square/requests/inventory_adjustment_reason_id.py
new file mode 100644
index 00000000..159164b5
--- /dev/null
+++ b/src/square/requests/inventory_adjustment_reason_id.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.inventory_adjustment_reason_id_type import InventoryAdjustmentReasonIdType
+
+
+class InventoryAdjustmentReasonIdParams(typing_extensions.TypedDict):
+ """
+ Identifies a standard or custom inventory adjustment reason.
+ """
+
+ type: InventoryAdjustmentReasonIdType
+ """
+ The adjustment reason type.
+ See [Type](#type-type) for possible values
+ """
+
+ custom_reason_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the custom adjustment reason. This field
+ is only set when `type` is `CUSTOM`.
+ """
diff --git a/src/square/requests/inventory_change.py b/src/square/requests/inventory_change.py
new file mode 100644
index 00000000..3fe6404a
--- /dev/null
+++ b/src/square/requests/inventory_change.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.inventory_change_type import InventoryChangeType
+from .catalog_measurement_unit import CatalogMeasurementUnitParams
+from .inventory_adjustment import InventoryAdjustmentParams
+from .inventory_physical_count import InventoryPhysicalCountParams
+
+
+class InventoryChangeParams(typing_extensions.TypedDict):
+ """
+ Represents a single physical count, inventory, adjustment, or transfer
+ that is part of the history of inventory changes for a particular
+ [CatalogObject](entity:CatalogObject) instance.
+ """
+
+ type: typing_extensions.NotRequired[InventoryChangeType]
+ """
+ Indicates how the inventory change is applied. See
+ [InventoryChangeType](entity:InventoryChangeType) for all possible values.
+ See [InventoryChangeType](#type-inventorychangetype) for possible values
+ """
+
+ physical_count: typing_extensions.NotRequired[InventoryPhysicalCountParams]
+ """
+ Contains details about the physical count when `type` is
+ `PHYSICAL_COUNT`, and is unset for all other change types.
+ """
+
+ adjustment: typing_extensions.NotRequired[InventoryAdjustmentParams]
+ """
+ Contains details about the inventory adjustment when `type` is
+ `ADJUSTMENT`, and is unset for all other change types.
+ """
+
+ measurement_unit: typing_extensions.NotRequired[CatalogMeasurementUnitParams]
+ """
+ The [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change.
+ """
+
+ measurement_unit_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change.
+ """
diff --git a/src/square/requests/inventory_count.py b/src/square/requests/inventory_count.py
new file mode 100644
index 00000000..f99930d5
--- /dev/null
+++ b/src/square/requests/inventory_count.py
@@ -0,0 +1,63 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.inventory_state import InventoryState
+
+
+class InventoryCountParams(typing_extensions.TypedDict):
+ """
+ Represents Square-estimated quantity of items in a particular state at a
+ particular seller location based on the known history of physical counts and
+ inventory adjustments. The absence of an inventory count indicates that the
+ catalog object hasn't interacted with the given inventory state at the given location.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the
+ [CatalogObject](entity:CatalogObject) being tracked.
+ """
+
+ catalog_object_type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.
+
+ The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
+ In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
+ """
+
+ state: typing_extensions.NotRequired[InventoryState]
+ """
+ The current [inventory state](entity:InventoryState) for the related
+ quantity of items.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the [Location](entity:Location) where the related
+ quantity of items is being tracked.
+ """
+
+ quantity: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The number of items affected by the estimated count as a decimal string.
+ Can support up to 5 digits after the decimal point.
+ """
+
+ calculated_at: typing_extensions.NotRequired[str]
+ """
+ An RFC 3339-formatted timestamp that indicates when the most recent physical count or adjustment affecting
+ the estimated count is received.
+ """
+
+ is_estimated: typing_extensions.NotRequired[bool]
+ """
+ Whether the inventory count is for composed variation (TRUE) or not (FALSE). If true, the inventory count will not be present in the response of
+ any of these endpoints: [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory),
+ [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges),
+ [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts), and
+ [RetrieveInventoryChanges](api-endpoint:Inventory-RetrieveInventoryChanges).
+ """
diff --git a/src/square/requests/inventory_count_updated_event.py b/src/square/requests/inventory_count_updated_event.py
new file mode 100644
index 00000000..122b5146
--- /dev/null
+++ b/src/square/requests/inventory_count_updated_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .inventory_count_updated_event_data import InventoryCountUpdatedEventDataParams
+
+
+class InventoryCountUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when the quantity is updated for a
+ [CatalogItemVariation](entity:CatalogItemVariation).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[InventoryCountUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/inventory_count_updated_event_data.py b/src/square/requests/inventory_count_updated_event_data.py
new file mode 100644
index 00000000..3ba390dc
--- /dev/null
+++ b/src/square/requests/inventory_count_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .inventory_count_updated_event_object import InventoryCountUpdatedEventObjectParams
+
+
+class InventoryCountUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type. For this event, the value is `inventory_counts`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected object.
+ """
+
+ object: typing_extensions.NotRequired[InventoryCountUpdatedEventObjectParams]
+ """
+ An object containing fields and values relevant to the event. Is absent if affected object was deleted.
+ """
diff --git a/src/square/requests/inventory_count_updated_event_object.py b/src/square/requests/inventory_count_updated_event_object.py
new file mode 100644
index 00000000..c70c6bac
--- /dev/null
+++ b/src/square/requests/inventory_count_updated_event_object.py
@@ -0,0 +1,13 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .inventory_count import InventoryCountParams
+
+
+class InventoryCountUpdatedEventObjectParams(typing_extensions.TypedDict):
+ inventory_counts: typing_extensions.NotRequired[typing.Optional[typing.Sequence[InventoryCountParams]]]
+ """
+ The inventory counts.
+ """
diff --git a/src/square/requests/inventory_physical_count.py b/src/square/requests/inventory_physical_count.py
new file mode 100644
index 00000000..0924d87d
--- /dev/null
+++ b/src/square/requests/inventory_physical_count.py
@@ -0,0 +1,100 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.inventory_state import InventoryState
+from .source_application import SourceApplicationParams
+
+
+class InventoryPhysicalCountParams(typing_extensions.TypedDict):
+ """
+ Represents the quantity of an item variation that is physically present
+ at a specific location, verified by a seller or a seller's employee. For example,
+ a physical count might come from an employee counting the item variations on
+ hand or from syncing with an external system.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique Square-generated ID for the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount).
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional ID provided by the application to tie the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount) to an external
+ system.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the
+ [CatalogObject](entity:CatalogObject) being tracked.
+ """
+
+ catalog_object_type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.
+
+ The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
+ In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
+ """
+
+ state: typing_extensions.NotRequired[InventoryState]
+ """
+ The current [inventory state](entity:InventoryState) for the related
+ quantity of items.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the [Location](entity:Location) where the related
+ quantity of items is being tracked.
+ """
+
+ quantity: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The number of items affected by the physical count as a decimal string.
+ The number can support up to 5 digits after the decimal point.
+ """
+
+ source: typing_extensions.NotRequired[SourceApplicationParams]
+ """
+ Information about the application with which the
+ physical count is submitted.
+ """
+
+ employee_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the [Employee](entity:Employee) responsible for the
+ physical count.
+ """
+
+ team_member_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
+ physical count.
+ """
+
+ occurred_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A client-generated RFC 3339-formatted timestamp that indicates when
+ the physical count was examined. For physical count updates, the `occurred_at`
+ timestamp cannot be older than 24 hours or in the future relative to the
+ time of the request.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ An RFC 3339-formatted timestamp that indicates when the physical count is received.
+ """
+
+ adjustment_id: typing_extensions.NotRequired[str]
+ """
+ The Square-generated ID of the InventoryAdjustment that was generated by this physical count in order to
+ adjust the current stock count to reflect the re-counted quantity.
+ This field may be empty if the merchant does not have an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
diff --git a/src/square/requests/invoice.py b/src/square/requests/invoice.py
new file mode 100644
index 00000000..7fe72a16
--- /dev/null
+++ b/src/square/requests/invoice.py
@@ -0,0 +1,215 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.invoice_delivery_method import InvoiceDeliveryMethod
+from ..types.invoice_status import InvoiceStatus
+from .invoice_accepted_payment_methods import InvoiceAcceptedPaymentMethodsParams
+from .invoice_attachment import InvoiceAttachmentParams
+from .invoice_custom_field import InvoiceCustomFieldParams
+from .invoice_payment_request import InvoicePaymentRequestParams
+from .invoice_recipient import InvoiceRecipientParams
+from .money import MoneyParams
+
+
+class InvoiceParams(typing_extensions.TypedDict):
+ """
+ Stores information about an invoice. You use the Invoices API to create and manage
+ invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the invoice.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The Square-assigned version number, which is incremented each time an update is committed to the invoice.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the location that this invoice is associated with.
+
+ If specified in a `CreateInvoice` request, the value must match the `location_id` of the associated order.
+ """
+
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [order](entity:Order) for which the invoice is created.
+ This field is required when creating an invoice, and the order must be in the `OPEN` state.
+
+ To view the line items and other information for the associated order, call the
+ [RetrieveOrder](api-endpoint:Orders-RetrieveOrder) endpoint using the order ID.
+ """
+
+ primary_recipient: typing_extensions.NotRequired[InvoiceRecipientParams]
+ """
+ The customer who receives the invoice. This customer data is displayed on the invoice and used by Square to deliver the invoice.
+
+ This field is required to publish an invoice, and it must specify the `customer_id`.
+ """
+
+ payment_requests: typing_extensions.NotRequired[typing.Optional[typing.Sequence[InvoicePaymentRequestParams]]]
+ """
+ The payment schedule for the invoice, represented by one or more payment requests that
+ define payment settings, such as amount due and due date. An invoice supports the following payment request combinations:
+ - One balance
+ - One deposit with one balance
+ - 2–12 installments
+ - One deposit with 2–12 installments
+
+ This field is required when creating an invoice. It must contain at least one payment request.
+ All payment requests for the invoice must equal the total order amount. For more information, see
+ [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests).
+
+ Adding `INSTALLMENT` payment requests to an invoice requires an
+ [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
+ """
+
+ delivery_method: typing_extensions.NotRequired[InvoiceDeliveryMethod]
+ """
+ The delivery method that Square uses to send the invoice, reminders, and receipts to
+ the customer. After the invoice is published, Square processes the invoice based on the delivery
+ method and payment request settings, either immediately or on the `scheduled_at` date, if specified.
+ For example, Square might send the invoice or receipt for an automatic payment. For invoices with
+ automatic payments, this field must be set to `EMAIL`.
+
+ One of the following is required when creating an invoice:
+ - (Recommended) This `delivery_method` field. To configure an automatic payment, the
+ `automatic_payment_source` field of the payment request is also required.
+ - The deprecated `request_method` field of the payment request. Note that `invoice`
+ objects returned in responses do not include `request_method`.
+ See [InvoiceDeliveryMethod](#type-invoicedeliverymethod) for possible values
+ """
+
+ invoice_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A user-friendly invoice number that is displayed on the invoice. The value is unique within a location.
+ If not provided when creating an invoice, Square assigns a value.
+ It increments from 1 and is padded with zeros making it 7 characters long
+ (for example, 0000001 and 0000002).
+ """
+
+ title: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The title of the invoice, which is displayed on the invoice.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The description of the invoice, which is displayed on the invoice.
+ """
+
+ scheduled_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timestamp when the invoice is scheduled for processing, in RFC 3339 format.
+ After the invoice is published, Square processes the invoice on the specified date,
+ according to the delivery method and payment request settings.
+
+ If the field is not set, Square processes the invoice immediately after it is published.
+ """
+
+ public_url: typing_extensions.NotRequired[str]
+ """
+ A temporary link to the Square-hosted payment page where the customer can pay the
+ invoice. If the link expires, customers can provide the email address or phone number
+ associated with the invoice and request a new link directly from the expired payment page.
+
+ This field is added after the invoice is published and reaches the scheduled date
+ (if one is defined).
+ """
+
+ next_payment_amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The current amount due for the invoice. In addition to the
+ amount due on the next payment request, this includes any overdue payment amounts.
+ """
+
+ status: typing_extensions.NotRequired[InvoiceStatus]
+ """
+ The status of the invoice.
+ See [InvoiceStatus](#type-invoicestatus) for possible values
+ """
+
+ timezone: typing_extensions.NotRequired[str]
+ """
+ The time zone used to interpret calendar dates on the invoice, such as `due_date`.
+ When an invoice is created, this field is set to the `timezone` specified for the seller
+ location. The value cannot be changed.
+
+ For example, a payment `due_date` of 2021-03-09 with a `timezone` of America/Los\\_Angeles
+ becomes overdue at midnight on March 9 in America/Los\\_Angeles (which equals a UTC timestamp
+ of 2021-03-10T08:00:00Z).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the invoice was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the invoice was last updated, in RFC 3339 format.
+ """
+
+ accepted_payment_methods: typing_extensions.NotRequired[InvoiceAcceptedPaymentMethodsParams]
+ """
+ The payment methods that customers can use to pay the invoice on the Square-hosted
+ invoice page. This setting is independent of any automatic payment requests for the invoice.
+
+ This field is required when creating an invoice and must set at least one payment method to `true`.
+ """
+
+ custom_fields: typing_extensions.NotRequired[typing.Optional[typing.Sequence[InvoiceCustomFieldParams]]]
+ """
+ Additional seller-defined fields that are displayed on the invoice. For more information, see
+ [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields).
+
+ Adding custom fields to an invoice requires an
+ [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
+
+ Max: 2 custom fields
+ """
+
+ subscription_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [subscription](entity:Subscription) associated with the invoice.
+ This field is present only on subscription billing invoices.
+ """
+
+ sale_or_service_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The date of the sale or the date that the service is rendered, in `YYYY-MM-DD` format.
+ This field can be used to specify a past or future date which is displayed on the invoice.
+ """
+
+ payment_conditions: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ **France only.** The payment terms and conditions that are displayed on the invoice. For more information,
+ see [Payment conditions](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions).
+
+ For countries other than France, Square returns an `INVALID_REQUEST_ERROR` with a `BAD_REQUEST` code and
+ "Payment conditions are not supported for this location's country" detail if this field is included in `CreateInvoice` or `UpdateInvoice` requests.
+ """
+
+ store_payment_method_enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a
+ bank account on file. If `true`, Square displays a __Save my card on file__ or __Save my bank on file__ checkbox on the
+ invoice payment page. Stored payment information can be used for future automatic payments. The default value is `false`.
+ """
+
+ attachments: typing_extensions.NotRequired[typing.Sequence[InvoiceAttachmentParams]]
+ """
+ Metadata about the attachments on the invoice. Invoice attachments are managed using the
+ [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) and [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) endpoints.
+ """
+
+ creator_team_member_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [team member](entity:TeamMember) who created the invoice.
+ This field is present only on invoices created in the Square Dashboard or Square Invoices app by a logged-in team member.
+ """
diff --git a/src/square/requests/invoice_accepted_payment_methods.py b/src/square/requests/invoice_accepted_payment_methods.py
new file mode 100644
index 00000000..20ccfdf2
--- /dev/null
+++ b/src/square/requests/invoice_accepted_payment_methods.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class InvoiceAcceptedPaymentMethodsParams(typing_extensions.TypedDict):
+ """
+ The payment methods that customers can use to pay an [invoice](entity:Invoice) on the Square-hosted invoice payment page.
+ """
+
+ card: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether credit card or debit card payments are accepted. The default value is `false`.
+ """
+
+ square_gift_card: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether Square gift card payments are accepted. The default value is `false`.
+ """
+
+ bank_account: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether ACH bank transfer payments are accepted. The default value is `false`.
+ """
+
+ buy_now_pay_later: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether Afterpay (also known as Clearpay) payments are accepted. The default value is `false`.
+
+ This option is allowed only for invoices that have a single payment request of the `BALANCE` type. This payment method is
+ supported if the seller account accepts Afterpay payments and the seller location is in a country where Afterpay
+ invoice payments are supported. As a best practice, consider enabling an additional payment method when allowing
+ `buy_now_pay_later` payments. For more information, including detailed requirements and processing limits, see
+ [Buy Now Pay Later payments with Afterpay](https://developer.squareup.com/docs/invoices-api/overview#buy-now-pay-later).
+ """
+
+ cash_app_pay: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether Cash App payments are accepted. The default value is `false`.
+
+ This payment method is supported only for seller [locations](entity:Location) in the United States.
+ """
diff --git a/src/square/requests/invoice_attachment.py b/src/square/requests/invoice_attachment.py
new file mode 100644
index 00000000..7f4509da
--- /dev/null
+++ b/src/square/requests/invoice_attachment.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class InvoiceAttachmentParams(typing_extensions.TypedDict):
+ """
+ Represents a file attached to an [invoice](entity:Invoice).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the attachment.
+ """
+
+ filename: typing_extensions.NotRequired[str]
+ """
+ The file name of the attachment, which is displayed on the invoice.
+ """
+
+ description: typing_extensions.NotRequired[str]
+ """
+ The description of the attachment, which is displayed on the invoice.
+ This field maps to the seller-defined **Message** field.
+ """
+
+ filesize: typing_extensions.NotRequired[int]
+ """
+ The file size of the attachment in bytes.
+ """
+
+ hash: typing_extensions.NotRequired[str]
+ """
+ The MD5 hash that was generated from the file contents.
+ """
+
+ mime_type: typing_extensions.NotRequired[str]
+ """
+ The mime type of the attachment.
+ The following mime types are supported:
+ image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf.
+ """
+
+ uploaded_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the attachment was uploaded, in RFC 3339 format.
+ """
diff --git a/src/square/requests/invoice_canceled_event.py b/src/square/requests/invoice_canceled_event.py
new file mode 100644
index 00000000..ac9ef375
--- /dev/null
+++ b/src/square/requests/invoice_canceled_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_canceled_event_data import InvoiceCanceledEventDataParams
+
+
+class InvoiceCanceledEventParams(typing_extensions.TypedDict):
+ """
+ Published when an [Invoice](entity:Invoice) is canceled.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"invoice.canceled"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[InvoiceCanceledEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/invoice_canceled_event_data.py b/src/square/requests/invoice_canceled_event_data.py
new file mode 100644
index 00000000..5855e856
--- /dev/null
+++ b/src/square/requests/invoice_canceled_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_canceled_event_object import InvoiceCanceledEventObjectParams
+
+
+class InvoiceCanceledEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing_extensions.NotRequired[InvoiceCanceledEventObjectParams]
+ """
+ An object containing the canceled invoice.
+ """
diff --git a/src/square/requests/invoice_canceled_event_object.py b/src/square/requests/invoice_canceled_event_object.py
new file mode 100644
index 00000000..249e05e4
--- /dev/null
+++ b/src/square/requests/invoice_canceled_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .invoice import InvoiceParams
+
+
+class InvoiceCanceledEventObjectParams(typing_extensions.TypedDict):
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The related invoice.
+ """
diff --git a/src/square/requests/invoice_created_event.py b/src/square/requests/invoice_created_event.py
new file mode 100644
index 00000000..b340020b
--- /dev/null
+++ b/src/square/requests/invoice_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_created_event_data import InvoiceCreatedEventDataParams
+
+
+class InvoiceCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an [Invoice](entity:Invoice) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"invoice.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[InvoiceCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/invoice_created_event_data.py b/src/square/requests/invoice_created_event_data.py
new file mode 100644
index 00000000..7e91cdcb
--- /dev/null
+++ b/src/square/requests/invoice_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_created_event_object import InvoiceCreatedEventObjectParams
+
+
+class InvoiceCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing_extensions.NotRequired[InvoiceCreatedEventObjectParams]
+ """
+ An object containing the created invoice.
+ """
diff --git a/src/square/requests/invoice_created_event_object.py b/src/square/requests/invoice_created_event_object.py
new file mode 100644
index 00000000..69a52a30
--- /dev/null
+++ b/src/square/requests/invoice_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .invoice import InvoiceParams
+
+
+class InvoiceCreatedEventObjectParams(typing_extensions.TypedDict):
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The related invoice.
+ """
diff --git a/src/square/requests/invoice_custom_field.py b/src/square/requests/invoice_custom_field.py
new file mode 100644
index 00000000..40a610fe
--- /dev/null
+++ b/src/square/requests/invoice_custom_field.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.invoice_custom_field_placement import InvoiceCustomFieldPlacement
+
+
+class InvoiceCustomFieldParams(typing_extensions.TypedDict):
+ """
+ An additional seller-defined and customer-facing field to include on the invoice. For more information,
+ see [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields).
+
+ Adding custom fields to an invoice requires an
+ [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
+ """
+
+ label: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The label or title of the custom field. This field is required for a custom field.
+ """
+
+ value: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The text of the custom field. If omitted, only the label is rendered.
+ """
+
+ placement: typing_extensions.NotRequired[InvoiceCustomFieldPlacement]
+ """
+ The location of the custom field on the invoice. This field is required for a custom field.
+ See [InvoiceCustomFieldPlacement](#type-invoicecustomfieldplacement) for possible values
+ """
diff --git a/src/square/requests/invoice_deleted_event.py b/src/square/requests/invoice_deleted_event.py
new file mode 100644
index 00000000..a4c318a3
--- /dev/null
+++ b/src/square/requests/invoice_deleted_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_deleted_event_data import InvoiceDeletedEventDataParams
+
+
+class InvoiceDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a draft [Invoice](entity:Invoice) is deleted.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"invoice.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[InvoiceDeletedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/invoice_deleted_event_data.py b/src/square/requests/invoice_deleted_event_data.py
new file mode 100644
index 00000000..33036f8e
--- /dev/null
+++ b/src/square/requests/invoice_deleted_event_data.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class InvoiceDeletedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected invoice.
+ """
+
+ deleted: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates that the invoice was deleted.
+ """
diff --git a/src/square/requests/invoice_filter.py b/src/square/requests/invoice_filter.py
new file mode 100644
index 00000000..45287c98
--- /dev/null
+++ b/src/square/requests/invoice_filter.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class InvoiceFilterParams(typing_extensions.TypedDict):
+ """
+ Describes query filters to apply.
+ """
+
+ location_ids: typing.Sequence[str]
+ """
+ Limits the search to the specified locations. A location is required.
+ In the current implementation, only one location can be specified.
+ """
+
+ customer_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Limits the search to the specified customers, within the specified locations.
+ Specifying a customer is optional. In the current implementation,
+ a maximum of one customer can be specified.
+ """
diff --git a/src/square/requests/invoice_payment_made_event.py b/src/square/requests/invoice_payment_made_event.py
new file mode 100644
index 00000000..2c83f54d
--- /dev/null
+++ b/src/square/requests/invoice_payment_made_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_payment_made_event_data import InvoicePaymentMadeEventDataParams
+
+
+class InvoicePaymentMadeEventParams(typing_extensions.TypedDict):
+ """
+ Published when a payment that is associated with an [invoice](entity:Invoice) is completed.
+ For more information about invoice payments, see [Pay an invoice](https://developer.squareup.com/docs/invoices-api/pay-refund-invoices#pay-invoice).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"invoice.payment_made"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[InvoicePaymentMadeEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/invoice_payment_made_event_data.py b/src/square/requests/invoice_payment_made_event_data.py
new file mode 100644
index 00000000..61251dcb
--- /dev/null
+++ b/src/square/requests/invoice_payment_made_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_payment_made_event_object import InvoicePaymentMadeEventObjectParams
+
+
+class InvoicePaymentMadeEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing_extensions.NotRequired[InvoicePaymentMadeEventObjectParams]
+ """
+ An object containing the invoice that was paid.
+ """
diff --git a/src/square/requests/invoice_payment_made_event_object.py b/src/square/requests/invoice_payment_made_event_object.py
new file mode 100644
index 00000000..0bbb284f
--- /dev/null
+++ b/src/square/requests/invoice_payment_made_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .invoice import InvoiceParams
+
+
+class InvoicePaymentMadeEventObjectParams(typing_extensions.TypedDict):
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The related invoice.
+ """
diff --git a/src/square/requests/invoice_payment_reminder.py b/src/square/requests/invoice_payment_reminder.py
new file mode 100644
index 00000000..15dc73c1
--- /dev/null
+++ b/src/square/requests/invoice_payment_reminder.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.invoice_payment_reminder_status import InvoicePaymentReminderStatus
+
+
+class InvoicePaymentReminderParams(typing_extensions.TypedDict):
+ """
+ Describes a payment request reminder (automatic notification) that Square sends
+ to the customer. You configure a reminder relative to the payment request
+ `due_date`.
+ """
+
+ uid: typing_extensions.NotRequired[str]
+ """
+ A Square-assigned ID that uniquely identifies the reminder within the
+ `InvoicePaymentRequest`.
+ """
+
+ relative_scheduled_days: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The number of days before (a negative number) or after (a positive number)
+ the payment request `due_date` when the reminder is sent. For example, -3 indicates that
+ the reminder should be sent 3 days before the payment request `due_date`.
+ """
+
+ message: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The reminder message.
+ """
+
+ status: typing_extensions.NotRequired[InvoicePaymentReminderStatus]
+ """
+ The status of the reminder.
+ See [InvoicePaymentReminderStatus](#type-invoicepaymentreminderstatus) for possible values
+ """
+
+ sent_at: typing_extensions.NotRequired[str]
+ """
+ If sent, the timestamp when the reminder was sent, in RFC 3339 format.
+ """
diff --git a/src/square/requests/invoice_payment_request.py b/src/square/requests/invoice_payment_request.py
new file mode 100644
index 00000000..b1bdcac6
--- /dev/null
+++ b/src/square/requests/invoice_payment_request.py
@@ -0,0 +1,127 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.invoice_automatic_payment_source import InvoiceAutomaticPaymentSource
+from ..types.invoice_request_method import InvoiceRequestMethod
+from ..types.invoice_request_type import InvoiceRequestType
+from .invoice_payment_reminder import InvoicePaymentReminderParams
+from .money import MoneyParams
+
+
+class InvoicePaymentRequestParams(typing_extensions.TypedDict):
+ """
+ Represents a payment request for an [invoice](entity:Invoice). Invoices can specify a maximum
+ of 13 payment requests, with up to 12 `INSTALLMENT` request types. For more information,
+ see [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests).
+
+ Adding `INSTALLMENT` payment requests to an invoice requires an
+ [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the payment request in an [invoice](entity:Invoice).
+ """
+
+ request_method: typing_extensions.NotRequired[InvoiceRequestMethod]
+ """
+ Indicates how Square processes the payment request. DEPRECATED at version 2021-01-21. Replaced by the
+ `Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields.
+
+ One of the following is required when creating an invoice:
+ - (Recommended) The `delivery_method` field of the invoice. To configure an automatic payment, the
+ `automatic_payment_source` field of the payment request is also required.
+ - This `request_method` field. Note that `invoice` objects returned in responses do not include `request_method`.
+ See [InvoiceRequestMethod](#type-invoicerequestmethod) for possible values
+ """
+
+ request_type: typing_extensions.NotRequired[InvoiceRequestType]
+ """
+ Identifies the payment request type. This type defines how the payment request amount is determined.
+ This field is required to create a payment request.
+ See [InvoiceRequestType](#type-invoicerequesttype) for possible values
+ """
+
+ due_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The due date (in the invoice's time zone) for the payment request, in `YYYY-MM-DD` format. This field
+ is required to create a payment request. If an `automatic_payment_source` is defined for the request, Square
+ charges the payment source on this date.
+
+ After this date, the invoice becomes overdue. For example, a payment `due_date` of 2021-03-09 with a `timezone`
+ of America/Los\\_Angeles becomes overdue at midnight on March 9 in America/Los\\_Angeles (which equals a UTC
+ timestamp of 2021-03-10T08:00:00Z).
+ """
+
+ fixed_amount_requested_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ If the payment request specifies `DEPOSIT` or `INSTALLMENT` as the `request_type`,
+ this indicates the request amount.
+ You cannot specify this when `request_type` is `BALANCE` or when the
+ payment request includes the `percentage_requested` field.
+ """
+
+ percentage_requested: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Specifies the amount for the payment request in percentage:
+
+ - When the payment `request_type` is `DEPOSIT`, it is the percentage of the order's total amount.
+ - When the payment `request_type` is `INSTALLMENT`, it is the percentage of the order's total less
+ the deposit, if requested. The sum of the `percentage_requested` in all installment
+ payment requests must be equal to 100.
+
+ You cannot specify this when the payment `request_type` is `BALANCE` or when the
+ payment request specifies the `fixed_amount_requested_money` field.
+ """
+
+ tipping_enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If set to true, the Square-hosted invoice page (the `public_url` field of the invoice)
+ provides a place for the customer to pay a tip.
+
+ This field is allowed only on the final payment request
+ and the payment `request_type` must be `BALANCE` or `INSTALLMENT`.
+ """
+
+ automatic_payment_source: typing_extensions.NotRequired[InvoiceAutomaticPaymentSource]
+ """
+ The payment method for an automatic payment.
+
+ The default value is `NONE`.
+ See [InvoiceAutomaticPaymentSource](#type-invoiceautomaticpaymentsource) for possible values
+ """
+
+ card_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the credit or debit card on file to charge for the payment request. To get the cards on file for a customer,
+ call [ListCards](api-endpoint:Cards-ListCards) and include the `customer_id` of the invoice recipient.
+ """
+
+ reminders: typing_extensions.NotRequired[typing.Optional[typing.Sequence[InvoicePaymentReminderParams]]]
+ """
+ A list of one or more reminders to send for the payment request.
+ """
+
+ computed_amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of the payment request, computed using the order amount and information from the various payment
+ request fields (`request_type`, `fixed_amount_requested_money`, and `percentage_requested`).
+ """
+
+ total_completed_amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money already paid for the specific payment request.
+ This amount might include a rounding adjustment if the most recent invoice payment
+ was in cash in a currency that rounds cash payments (such as, `CAD` or `AUD`).
+ """
+
+ rounding_adjustment_included_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ If the most recent payment was a cash payment
+ in a currency that rounds cash payments (such as, `CAD` or `AUD`) and the payment
+ is rounded from `computed_amount_money` in the payment request, then this
+ field specifies the rounding adjustment applied. This amount
+ might be negative.
+ """
diff --git a/src/square/requests/invoice_published_event.py b/src/square/requests/invoice_published_event.py
new file mode 100644
index 00000000..7cc4a3b7
--- /dev/null
+++ b/src/square/requests/invoice_published_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_published_event_data import InvoicePublishedEventDataParams
+
+
+class InvoicePublishedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an [Invoice](entity:Invoice) transitions from a draft to a non-draft status.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"invoice.published"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[InvoicePublishedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/invoice_published_event_data.py b/src/square/requests/invoice_published_event_data.py
new file mode 100644
index 00000000..4c8b1903
--- /dev/null
+++ b/src/square/requests/invoice_published_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_published_event_object import InvoicePublishedEventObjectParams
+
+
+class InvoicePublishedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing_extensions.NotRequired[InvoicePublishedEventObjectParams]
+ """
+ An object containing the published invoice.
+ """
diff --git a/src/square/requests/invoice_published_event_object.py b/src/square/requests/invoice_published_event_object.py
new file mode 100644
index 00000000..e0b0986f
--- /dev/null
+++ b/src/square/requests/invoice_published_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .invoice import InvoiceParams
+
+
+class InvoicePublishedEventObjectParams(typing_extensions.TypedDict):
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The related invoice.
+ """
diff --git a/src/square/requests/invoice_query.py b/src/square/requests/invoice_query.py
new file mode 100644
index 00000000..c40f1caf
--- /dev/null
+++ b/src/square/requests/invoice_query.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .invoice_filter import InvoiceFilterParams
+from .invoice_sort import InvoiceSortParams
+
+
+class InvoiceQueryParams(typing_extensions.TypedDict):
+ """
+ Describes query criteria for searching invoices.
+ """
+
+ filter: InvoiceFilterParams
+ """
+ Query filters to apply in searching invoices.
+ For more information, see [Search for invoices](https://developer.squareup.com/docs/invoices-api/retrieve-list-search-invoices#search-invoices).
+ """
+
+ sort: typing_extensions.NotRequired[InvoiceSortParams]
+ """
+ Describes the sort order for the search result.
+ """
diff --git a/src/square/requests/invoice_recipient.py b/src/square/requests/invoice_recipient.py
new file mode 100644
index 00000000..8af24f08
--- /dev/null
+++ b/src/square/requests/invoice_recipient.py
@@ -0,0 +1,60 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .address import AddressParams
+from .invoice_recipient_tax_ids import InvoiceRecipientTaxIdsParams
+
+
+class InvoiceRecipientParams(typing_extensions.TypedDict):
+ """
+ Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice
+ and that Square uses to deliver the invoice.
+
+ When you provide a customer ID for a draft invoice, Square retrieves the associated customer profile and populates
+ the remaining `InvoiceRecipient` fields. You cannot update these fields after the invoice is published.
+ Square updates the customer ID in response to a merge operation, but does not update other fields.
+ """
+
+ customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the customer. This is the customer profile ID that
+ you provide when creating a draft invoice.
+ """
+
+ given_name: typing_extensions.NotRequired[str]
+ """
+ The recipient's given (that is, first) name.
+ """
+
+ family_name: typing_extensions.NotRequired[str]
+ """
+ The recipient's family (that is, last) name.
+ """
+
+ email_address: typing_extensions.NotRequired[str]
+ """
+ The recipient's email address.
+ """
+
+ address: typing_extensions.NotRequired[AddressParams]
+ """
+ The recipient's physical address.
+ """
+
+ phone_number: typing_extensions.NotRequired[str]
+ """
+ The recipient's phone number.
+ """
+
+ company_name: typing_extensions.NotRequired[str]
+ """
+ The name of the recipient's company.
+ """
+
+ tax_ids: typing_extensions.NotRequired[InvoiceRecipientTaxIdsParams]
+ """
+ The recipient's tax IDs. The country of the seller account determines whether this field
+ is available for the customer. For more information, see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids).
+ """
diff --git a/src/square/requests/invoice_recipient_tax_ids.py b/src/square/requests/invoice_recipient_tax_ids.py
new file mode 100644
index 00000000..f2f9707e
--- /dev/null
+++ b/src/square/requests/invoice_recipient_tax_ids.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class InvoiceRecipientTaxIdsParams(typing_extensions.TypedDict):
+ """
+ Represents the tax IDs for an invoice recipient. The country of the seller account determines
+ whether the corresponding `tax_ids` field is available for the customer. For more information,
+ see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids).
+ """
+
+ eu_vat: typing_extensions.NotRequired[str]
+ """
+ The EU VAT identification number for the invoice recipient. For example, `IE3426675K`.
+ """
diff --git a/src/square/requests/invoice_refunded_event.py b/src/square/requests/invoice_refunded_event.py
new file mode 100644
index 00000000..a48d101a
--- /dev/null
+++ b/src/square/requests/invoice_refunded_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_refunded_event_data import InvoiceRefundedEventDataParams
+
+
+class InvoiceRefundedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a refund is applied toward a payment of an [invoice](entity:Invoice).
+ For more information about invoice refunds, see [Refund an invoice](https://developer.squareup.com/docs/invoices-api/pay-refund-invoices#refund-invoice).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"invoice.refunded"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[InvoiceRefundedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/invoice_refunded_event_data.py b/src/square/requests/invoice_refunded_event_data.py
new file mode 100644
index 00000000..aca61fda
--- /dev/null
+++ b/src/square/requests/invoice_refunded_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_refunded_event_object import InvoiceRefundedEventObjectParams
+
+
+class InvoiceRefundedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing_extensions.NotRequired[InvoiceRefundedEventObjectParams]
+ """
+ An object containing the refunded invoice.
+ """
diff --git a/src/square/requests/invoice_refunded_event_object.py b/src/square/requests/invoice_refunded_event_object.py
new file mode 100644
index 00000000..cd611055
--- /dev/null
+++ b/src/square/requests/invoice_refunded_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .invoice import InvoiceParams
+
+
+class InvoiceRefundedEventObjectParams(typing_extensions.TypedDict):
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The related invoice.
+ """
diff --git a/src/square/requests/invoice_scheduled_charge_failed_event.py b/src/square/requests/invoice_scheduled_charge_failed_event.py
new file mode 100644
index 00000000..9854b765
--- /dev/null
+++ b/src/square/requests/invoice_scheduled_charge_failed_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_scheduled_charge_failed_event_data import InvoiceScheduledChargeFailedEventDataParams
+
+
+class InvoiceScheduledChargeFailedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an automatic scheduled payment for an [Invoice](entity:Invoice) has failed.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"invoice.scheduled_charge_failed"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[InvoiceScheduledChargeFailedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/invoice_scheduled_charge_failed_event_data.py b/src/square/requests/invoice_scheduled_charge_failed_event_data.py
new file mode 100644
index 00000000..0fc93c0c
--- /dev/null
+++ b/src/square/requests/invoice_scheduled_charge_failed_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_scheduled_charge_failed_event_object import InvoiceScheduledChargeFailedEventObjectParams
+
+
+class InvoiceScheduledChargeFailedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing_extensions.NotRequired[InvoiceScheduledChargeFailedEventObjectParams]
+ """
+ An object containing the invoice that experienced the failed scheduled charge.
+ """
diff --git a/src/square/requests/invoice_scheduled_charge_failed_event_object.py b/src/square/requests/invoice_scheduled_charge_failed_event_object.py
new file mode 100644
index 00000000..76e906d1
--- /dev/null
+++ b/src/square/requests/invoice_scheduled_charge_failed_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .invoice import InvoiceParams
+
+
+class InvoiceScheduledChargeFailedEventObjectParams(typing_extensions.TypedDict):
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The related invoice.
+ """
diff --git a/src/square/requests/invoice_sort.py b/src/square/requests/invoice_sort.py
new file mode 100644
index 00000000..7976a74c
--- /dev/null
+++ b/src/square/requests/invoice_sort.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.invoice_sort_field import InvoiceSortField
+from ..types.sort_order import SortOrder
+
+
+class InvoiceSortParams(typing_extensions.TypedDict):
+ """
+ Identifies the sort field and sort order.
+ """
+
+ field: InvoiceSortField
+ """
+ The field to use for sorting.
+ See [InvoiceSortField](#type-invoicesortfield) for possible values
+ """
+
+ order: typing_extensions.NotRequired[SortOrder]
+ """
+ The order to use for sorting the results.
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/invoice_updated_event.py b/src/square/requests/invoice_updated_event.py
new file mode 100644
index 00000000..b2b7d130
--- /dev/null
+++ b/src/square/requests/invoice_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_updated_event_data import InvoiceUpdatedEventDataParams
+
+
+class InvoiceUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an [Invoice](entity:Invoice) is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"invoice.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[InvoiceUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/invoice_updated_event_data.py b/src/square/requests/invoice_updated_event_data.py
new file mode 100644
index 00000000..ff7166a5
--- /dev/null
+++ b/src/square/requests/invoice_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .invoice_updated_event_object import InvoiceUpdatedEventObjectParams
+
+
+class InvoiceUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing_extensions.NotRequired[InvoiceUpdatedEventObjectParams]
+ """
+ An object containing the updated invoice.
+ """
diff --git a/src/square/requests/invoice_updated_event_object.py b/src/square/requests/invoice_updated_event_object.py
new file mode 100644
index 00000000..522ad797
--- /dev/null
+++ b/src/square/requests/invoice_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .invoice import InvoiceParams
+
+
+class InvoiceUpdatedEventObjectParams(typing_extensions.TypedDict):
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The related invoice.
+ """
diff --git a/src/square/requests/item_variation_location_overrides.py b/src/square/requests/item_variation_location_overrides.py
new file mode 100644
index 00000000..a69b4e87
--- /dev/null
+++ b/src/square/requests/item_variation_location_overrides.py
@@ -0,0 +1,70 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.catalog_pricing_type import CatalogPricingType
+from ..types.inventory_alert_type import InventoryAlertType
+from .money import MoneyParams
+
+
+class ItemVariationLocationOverridesParams(typing_extensions.TypedDict):
+ """
+ Price and inventory alerting overrides for a `CatalogItemVariation` at a specific `Location`.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the `Location`. This can include locations that are deactivated.
+ """
+
+ price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The price of the `CatalogItemVariation` at the given `Location`, or blank for variable pricing.
+ """
+
+ pricing_type: typing_extensions.NotRequired[CatalogPricingType]
+ """
+ The pricing type (fixed or variable) for the `CatalogItemVariation` at the given `Location`.
+ See [CatalogPricingType](#type-catalogpricingtype) for possible values
+ """
+
+ track_inventory: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether inventory tracking is active for the `CatalogItemVariation` at this `Location`.
+ When set, this value explicitly overrides the global `track_inventory` setting. When unset, the location
+ should use the global value. If both global and location-level values are unset, inventory tracking is disabled.
+ """
+
+ inventory_alert_type: typing_extensions.NotRequired[InventoryAlertType]
+ """
+ Indicates whether the `CatalogItemVariation` displays an alert when its inventory
+ quantity is less than or equal to its `inventory_alert_threshold`.
+ See [InventoryAlertType](#type-inventoryalerttype) for possible values
+ """
+
+ inventory_alert_threshold: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type`
+ is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard.
+
+ This value is always an integer.
+ """
+
+ sold_out: typing_extensions.NotRequired[bool]
+ """
+ Indicates whether the overridden item variation is sold out at the specified location.
+
+ When inventory tracking is enabled on the item variation either globally or at the specified location,
+ the item variation is automatically marked as sold out when its inventory count reaches zero. The seller
+ can manually set the item variation as sold out even when the inventory count is greater than zero.
+ Attempts by an application to set this attribute are ignored. Regardless how the sold-out status is set,
+ applications should treat its inventory count as zero when this attribute value is `true`.
+ """
+
+ sold_out_valid_until: typing_extensions.NotRequired[str]
+ """
+ The seller-assigned timestamp, of the RFC 3339 format, to indicate when this sold-out variation
+ becomes available again at the specified location. Attempts by an application to set this attribute are ignored.
+ When the current time is later than this attribute value, the affected item variation is no longer sold out.
+ """
diff --git a/src/square/requests/job.py b/src/square/requests/job.py
new file mode 100644
index 00000000..6abd5b58
--- /dev/null
+++ b/src/square/requests/job.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class JobParams(typing_extensions.TypedDict):
+ """
+ Represents a job that can be assigned to [team members](entity:TeamMember). This object defines the
+ job's title and tip eligibility. Compensation is defined in a [job assignment](entity:JobAssignment)
+ in a team member's wage setting.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ **Read only** The unique Square-assigned ID of the job. If you need a job ID for an API request,
+ call [ListJobs](api-endpoint:Team-ListJobs) or use the ID returned when you created the job.
+ You can also get job IDs from a team member's wage setting.
+ """
+
+ title: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The title of the job.
+ """
+
+ is_tip_eligible: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether team members can earn tips for the job.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the job was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the job was last updated, in RFC 3339 format.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ **Read only** The current version of the job. Include this field in `UpdateJob` requests to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency)
+ control and avoid overwrites from concurrent requests. Requests fail if the provided version doesn't
+ match the server version at the time of the request.
+ """
diff --git a/src/square/requests/job_assignment.py b/src/square/requests/job_assignment.py
new file mode 100644
index 00000000..be7bae27
--- /dev/null
+++ b/src/square/requests/job_assignment.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.job_assignment_pay_type import JobAssignmentPayType
+from .money import MoneyParams
+
+
+class JobAssignmentParams(typing_extensions.TypedDict):
+ """
+ Represents a job assigned to a [team member](entity:TeamMember), including the compensation the team
+ member earns for the job. Job assignments are listed in the team member's [wage setting](entity:WageSetting).
+ """
+
+ job_title: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The title of the job.
+ """
+
+ pay_type: JobAssignmentPayType
+ """
+ The current pay type for the job assignment used to
+ calculate the pay amount in a pay period.
+ See [JobAssignmentPayType](#type-jobassignmentpaytype) for possible values
+ """
+
+ hourly_rate: typing_extensions.NotRequired[MoneyParams]
+ """
+ The hourly pay rate of the job. For `SALARY` pay types, Square calculates the hourly rate based on
+ `annual_rate` and `weekly_hours`.
+ """
+
+ annual_rate: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total pay amount for a 12-month period on the job. Set if the job `PayType` is `SALARY`.
+ """
+
+ weekly_hours: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The planned hours per week for the job. Set if the job `PayType` is `SALARY`.
+ """
+
+ job_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [job](entity:Job).
+ """
diff --git a/src/square/requests/job_created_event.py b/src/square/requests/job_created_event.py
new file mode 100644
index 00000000..de43fc6d
--- /dev/null
+++ b/src/square/requests/job_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .job_created_event_data import JobCreatedEventDataParams
+
+
+class JobCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a Job is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"job.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[JobCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/job_created_event_data.py b/src/square/requests/job_created_event_data.py
new file mode 100644
index 00000000..29a3d2f1
--- /dev/null
+++ b/src/square/requests/job_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .job_created_event_object import JobCreatedEventObjectParams
+
+
+class JobCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"job"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the created job.
+ """
+
+ object: typing_extensions.NotRequired[JobCreatedEventObjectParams]
+ """
+ An object containing the created job.
+ """
diff --git a/src/square/requests/job_created_event_object.py b/src/square/requests/job_created_event_object.py
new file mode 100644
index 00000000..1f9802ae
--- /dev/null
+++ b/src/square/requests/job_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .job import JobParams
+
+
+class JobCreatedEventObjectParams(typing_extensions.TypedDict):
+ job: typing_extensions.NotRequired[JobParams]
+ """
+ The created job.
+ """
diff --git a/src/square/requests/job_updated_event.py b/src/square/requests/job_updated_event.py
new file mode 100644
index 00000000..e5e32f5f
--- /dev/null
+++ b/src/square/requests/job_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .job_updated_event_data import JobUpdatedEventDataParams
+
+
+class JobUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a Job is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"job.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[JobUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/job_updated_event_data.py b/src/square/requests/job_updated_event_data.py
new file mode 100644
index 00000000..1650ae7a
--- /dev/null
+++ b/src/square/requests/job_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .job_updated_event_object import JobUpdatedEventObjectParams
+
+
+class JobUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"job"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the updated job.
+ """
+
+ object: typing_extensions.NotRequired[JobUpdatedEventObjectParams]
+ """
+ An object containing the updated job.
+ """
diff --git a/src/square/requests/job_updated_event_object.py b/src/square/requests/job_updated_event_object.py
new file mode 100644
index 00000000..095ded6f
--- /dev/null
+++ b/src/square/requests/job_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .job import JobParams
+
+
+class JobUpdatedEventObjectParams(typing_extensions.TypedDict):
+ job: typing_extensions.NotRequired[JobParams]
+ """
+ The updated job.
+ """
diff --git a/src/square/requests/join_subquery.py b/src/square/requests/join_subquery.py
new file mode 100644
index 00000000..8d476d98
--- /dev/null
+++ b/src/square/requests/join_subquery.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+
+
+class JoinSubqueryParams(typing_extensions.TypedDict):
+ sql: str
+ on: str
+ join_type: typing_extensions.Annotated[str, FieldMetadata(alias="joinType")]
+ alias: str
diff --git a/src/square/requests/labor_scheduled_shift_created_event.py b/src/square/requests/labor_scheduled_shift_created_event.py
new file mode 100644
index 00000000..8088f179
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_created_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_scheduled_shift_created_event_data import LaborScheduledShiftCreatedEventDataParams
+
+
+class LaborScheduledShiftCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [ScheduledShift](entity:ScheduledShift) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `labor.scheduled_shift.created`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LaborScheduledShiftCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/labor_scheduled_shift_created_event_data.py b/src/square/requests/labor_scheduled_shift_created_event_data.py
new file mode 100644
index 00000000..7c7a0412
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_scheduled_shift_created_event_object import LaborScheduledShiftCreatedEventObjectParams
+
+
+class LaborScheduledShiftCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `scheduled_shift`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected `ScheduledShift`.
+ """
+
+ object: typing_extensions.NotRequired[LaborScheduledShiftCreatedEventObjectParams]
+ """
+ An object containing the affected `ScheduledShift`.
+ """
diff --git a/src/square/requests/labor_scheduled_shift_created_event_object.py b/src/square/requests/labor_scheduled_shift_created_event_object.py
new file mode 100644
index 00000000..46a4e33f
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_created_event_object.py
@@ -0,0 +1,14 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from .scheduled_shift import ScheduledShiftParams
+
+
+class LaborScheduledShiftCreatedEventObjectParams(typing_extensions.TypedDict):
+ scheduled_shift: typing_extensions.NotRequired[
+ typing_extensions.Annotated[ScheduledShiftParams, FieldMetadata(alias="ScheduledShift")]
+ ]
+ """
+ The new `ScheduledShift`.
+ """
diff --git a/src/square/requests/labor_scheduled_shift_deleted_event.py b/src/square/requests/labor_scheduled_shift_deleted_event.py
new file mode 100644
index 00000000..ed134802
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_deleted_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_scheduled_shift_deleted_event_data import LaborScheduledShiftDeletedEventDataParams
+
+
+class LaborScheduledShiftDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [ScheduledShift](entity:ScheduledShift) is deleted.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `labor.scheduled_shift.deleted`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LaborScheduledShiftDeletedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/labor_scheduled_shift_deleted_event_data.py b/src/square/requests/labor_scheduled_shift_deleted_event_data.py
new file mode 100644
index 00000000..5d051f41
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_deleted_event_data.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LaborScheduledShiftDeletedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `scheduled_shift`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected `ScheduledShift`.
+ """
+
+ deleted: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Is true if the affected object was deleted. Otherwise absent.
+ """
diff --git a/src/square/requests/labor_scheduled_shift_published_event.py b/src/square/requests/labor_scheduled_shift_published_event.py
new file mode 100644
index 00000000..e11b8520
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_published_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_scheduled_shift_published_event_data import LaborScheduledShiftPublishedEventDataParams
+
+
+class LaborScheduledShiftPublishedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [ScheduledShift](entity:ScheduledShift) is published.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `labor.scheduled_shift.published`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LaborScheduledShiftPublishedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/labor_scheduled_shift_published_event_data.py b/src/square/requests/labor_scheduled_shift_published_event_data.py
new file mode 100644
index 00000000..14fab0aa
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_published_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_scheduled_shift_published_event_object import LaborScheduledShiftPublishedEventObjectParams
+
+
+class LaborScheduledShiftPublishedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `scheduled_shift`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected `ScheduledShift`.
+ """
+
+ object: typing_extensions.NotRequired[LaborScheduledShiftPublishedEventObjectParams]
+ """
+ An object containing the affected `ScheduledShift`.
+ """
diff --git a/src/square/requests/labor_scheduled_shift_published_event_object.py b/src/square/requests/labor_scheduled_shift_published_event_object.py
new file mode 100644
index 00000000..c671db84
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_published_event_object.py
@@ -0,0 +1,14 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from .scheduled_shift import ScheduledShiftParams
+
+
+class LaborScheduledShiftPublishedEventObjectParams(typing_extensions.TypedDict):
+ scheduled_shift: typing_extensions.NotRequired[
+ typing_extensions.Annotated[ScheduledShiftParams, FieldMetadata(alias="ScheduledShift")]
+ ]
+ """
+ The published `ScheduledShift`.
+ """
diff --git a/src/square/requests/labor_scheduled_shift_updated_event.py b/src/square/requests/labor_scheduled_shift_updated_event.py
new file mode 100644
index 00000000..0c39fd1e
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_updated_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_scheduled_shift_updated_event_data import LaborScheduledShiftUpdatedEventDataParams
+
+
+class LaborScheduledShiftUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [ScheduledShift](entity:ScheduledShift) is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `labor.scheduled_shift.updated`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LaborScheduledShiftUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/labor_scheduled_shift_updated_event_data.py b/src/square/requests/labor_scheduled_shift_updated_event_data.py
new file mode 100644
index 00000000..dffa1c01
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_scheduled_shift_updated_event_object import LaborScheduledShiftUpdatedEventObjectParams
+
+
+class LaborScheduledShiftUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `scheduled_shift`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected `ScheduledShift`.
+ """
+
+ object: typing_extensions.NotRequired[LaborScheduledShiftUpdatedEventObjectParams]
+ """
+ An object containing the affected `ScheduledShift`.
+ """
diff --git a/src/square/requests/labor_scheduled_shift_updated_event_object.py b/src/square/requests/labor_scheduled_shift_updated_event_object.py
new file mode 100644
index 00000000..c14c8938
--- /dev/null
+++ b/src/square/requests/labor_scheduled_shift_updated_event_object.py
@@ -0,0 +1,14 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from .scheduled_shift import ScheduledShiftParams
+
+
+class LaborScheduledShiftUpdatedEventObjectParams(typing_extensions.TypedDict):
+ scheduled_shift: typing_extensions.NotRequired[
+ typing_extensions.Annotated[ScheduledShiftParams, FieldMetadata(alias="ScheduledShift")]
+ ]
+ """
+ The updated `ScheduledShift`.
+ """
diff --git a/src/square/requests/labor_shift_created_event.py b/src/square/requests/labor_shift_created_event.py
new file mode 100644
index 00000000..909e8edd
--- /dev/null
+++ b/src/square/requests/labor_shift_created_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_shift_created_event_data import LaborShiftCreatedEventDataParams
+
+
+class LaborShiftCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a worker starts a [Shift](entity:Shift).
+
+ Deprecated at Square API version 2025-05-21. Replaced by `labor.timecard.created`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `labor.shift.created`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LaborShiftCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/labor_shift_created_event_data.py b/src/square/requests/labor_shift_created_event_data.py
new file mode 100644
index 00000000..a0a4b9a3
--- /dev/null
+++ b/src/square/requests/labor_shift_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_shift_created_event_object import LaborShiftCreatedEventObjectParams
+
+
+class LaborShiftCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `shift`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected `Shift`.
+ """
+
+ object: typing_extensions.NotRequired[LaborShiftCreatedEventObjectParams]
+ """
+ An object containing the affected `Shift`.
+ """
diff --git a/src/square/requests/labor_shift_created_event_object.py b/src/square/requests/labor_shift_created_event_object.py
new file mode 100644
index 00000000..29817007
--- /dev/null
+++ b/src/square/requests/labor_shift_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .shift import ShiftParams
+
+
+class LaborShiftCreatedEventObjectParams(typing_extensions.TypedDict):
+ shift: typing_extensions.NotRequired[ShiftParams]
+ """
+ The new `Shift`.
+ """
diff --git a/src/square/requests/labor_shift_deleted_event.py b/src/square/requests/labor_shift_deleted_event.py
new file mode 100644
index 00000000..abc6610a
--- /dev/null
+++ b/src/square/requests/labor_shift_deleted_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_shift_deleted_event_data import LaborShiftDeletedEventDataParams
+
+
+class LaborShiftDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Shift](entity:Shift) is deleted.
+
+ Deprecated at Square API version 2025-05-21. Replaced by `labor.timecard.deleted`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `labor.shift.deleted`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LaborShiftDeletedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/labor_shift_deleted_event_data.py b/src/square/requests/labor_shift_deleted_event_data.py
new file mode 100644
index 00000000..0cd20fa6
--- /dev/null
+++ b/src/square/requests/labor_shift_deleted_event_data.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LaborShiftDeletedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `shift`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected `Shift`.
+ """
+
+ deleted: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Is true if the affected object was deleted. Otherwise absent.
+ """
diff --git a/src/square/requests/labor_shift_updated_event.py b/src/square/requests/labor_shift_updated_event.py
new file mode 100644
index 00000000..99647094
--- /dev/null
+++ b/src/square/requests/labor_shift_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_shift_updated_event_data import LaborShiftUpdatedEventDataParams
+
+
+class LaborShiftUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Shift](entity:Shift) is updated.
+
+ Deprecated at Square API version 2025-05-21. Replaced by `labor.timecard.updated`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `labor.shift.updated`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LaborShiftUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/labor_shift_updated_event_data.py b/src/square/requests/labor_shift_updated_event_data.py
new file mode 100644
index 00000000..9ca7b17d
--- /dev/null
+++ b/src/square/requests/labor_shift_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_shift_updated_event_object import LaborShiftUpdatedEventObjectParams
+
+
+class LaborShiftUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `shift`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected `Shift`.
+ """
+
+ object: typing_extensions.NotRequired[LaborShiftUpdatedEventObjectParams]
+ """
+ An object containing the affected `Shift`.
+ """
diff --git a/src/square/requests/labor_shift_updated_event_object.py b/src/square/requests/labor_shift_updated_event_object.py
new file mode 100644
index 00000000..e324d2c1
--- /dev/null
+++ b/src/square/requests/labor_shift_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .shift import ShiftParams
+
+
+class LaborShiftUpdatedEventObjectParams(typing_extensions.TypedDict):
+ shift: typing_extensions.NotRequired[ShiftParams]
+ """
+ The updated `Shift`.
+ """
diff --git a/src/square/requests/labor_timecard_created_event.py b/src/square/requests/labor_timecard_created_event.py
new file mode 100644
index 00000000..9aaf8310
--- /dev/null
+++ b/src/square/requests/labor_timecard_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_timecard_created_event_data import LaborTimecardCreatedEventDataParams
+
+
+class LaborTimecardCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a worker starts a [Timecard](entity:Timecard).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `labor.timecard.created`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LaborTimecardCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/labor_timecard_created_event_data.py b/src/square/requests/labor_timecard_created_event_data.py
new file mode 100644
index 00000000..2704d00e
--- /dev/null
+++ b/src/square/requests/labor_timecard_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_timecard_created_event_object import LaborTimecardCreatedEventObjectParams
+
+
+class LaborTimecardCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `timecard`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected `Timecard`.
+ """
+
+ object: typing_extensions.NotRequired[LaborTimecardCreatedEventObjectParams]
+ """
+ An object containing the affected `Timecard`.
+ """
diff --git a/src/square/requests/labor_timecard_created_event_object.py b/src/square/requests/labor_timecard_created_event_object.py
new file mode 100644
index 00000000..b245c355
--- /dev/null
+++ b/src/square/requests/labor_timecard_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .timecard import TimecardParams
+
+
+class LaborTimecardCreatedEventObjectParams(typing_extensions.TypedDict):
+ timecard: typing_extensions.NotRequired[TimecardParams]
+ """
+ The new `Timecard`.
+ """
diff --git a/src/square/requests/labor_timecard_deleted_event.py b/src/square/requests/labor_timecard_deleted_event.py
new file mode 100644
index 00000000..ba5c243a
--- /dev/null
+++ b/src/square/requests/labor_timecard_deleted_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_timecard_deleted_event_data import LaborTimecardDeletedEventDataParams
+
+
+class LaborTimecardDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Timecard](entity:Timecard) is deleted.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `labor.timecard.deleted`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LaborTimecardDeletedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/labor_timecard_deleted_event_data.py b/src/square/requests/labor_timecard_deleted_event_data.py
new file mode 100644
index 00000000..c821688d
--- /dev/null
+++ b/src/square/requests/labor_timecard_deleted_event_data.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LaborTimecardDeletedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `timecard`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected `Timecard`.
+ """
+
+ deleted: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Is true if the affected object was deleted. Otherwise absent.
+ """
diff --git a/src/square/requests/labor_timecard_updated_event.py b/src/square/requests/labor_timecard_updated_event.py
new file mode 100644
index 00000000..93a65fa1
--- /dev/null
+++ b/src/square/requests/labor_timecard_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_timecard_updated_event_data import LaborTimecardUpdatedEventDataParams
+
+
+class LaborTimecardUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Timecard](entity:Timecard) is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `labor.timecard.updated`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LaborTimecardUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/labor_timecard_updated_event_data.py b/src/square/requests/labor_timecard_updated_event_data.py
new file mode 100644
index 00000000..e342bf23
--- /dev/null
+++ b/src/square/requests/labor_timecard_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .labor_timecard_updated_event_object import LaborTimecardUpdatedEventObjectParams
+
+
+class LaborTimecardUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `timecard`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected `Timecard`.
+ """
+
+ object: typing_extensions.NotRequired[LaborTimecardUpdatedEventObjectParams]
+ """
+ An object containing the affected `Timecard`.
+ """
diff --git a/src/square/requests/labor_timecard_updated_event_object.py b/src/square/requests/labor_timecard_updated_event_object.py
new file mode 100644
index 00000000..44d332be
--- /dev/null
+++ b/src/square/requests/labor_timecard_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .timecard import TimecardParams
+
+
+class LaborTimecardUpdatedEventObjectParams(typing_extensions.TypedDict):
+ timecard: typing_extensions.NotRequired[TimecardParams]
+ """
+ The updated `Timecard`.
+ """
diff --git a/src/square/requests/lightning_details.py b/src/square/requests/lightning_details.py
new file mode 100644
index 00000000..f6a1d206
--- /dev/null
+++ b/src/square/requests/lightning_details.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LightningDetailsParams(typing_extensions.TypedDict):
+ """
+ Additional details about `WALLET` type payments with the `brand` of `LIGHTNING`.
+ """
+
+ payment_url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Payment URL for the lightning payment, a.k.a. the invoice.
+ """
diff --git a/src/square/requests/link_customer_to_gift_card_response.py b/src/square/requests/link_customer_to_gift_card_response.py
new file mode 100644
index 00000000..46fc1519
--- /dev/null
+++ b/src/square/requests/link_customer_to_gift_card_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .gift_card import GiftCardParams
+
+
+class LinkCustomerToGiftCardResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains the linked `GiftCard` object. If the request resulted in errors,
+ the response contains a set of `Error` objects.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing_extensions.NotRequired[GiftCardParams]
+ """
+ The gift card with the ID of the linked customer listed in the `customer_ids` field.
+ """
diff --git a/src/square/requests/link_format.py b/src/square/requests/link_format.py
new file mode 100644
index 00000000..61cc7f39
--- /dev/null
+++ b/src/square/requests/link_format.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LinkFormatParams(typing_extensions.TypedDict):
+ """
+ Link format with label and type
+ """
+
+ label: str
+ """
+ Label for the link
+ """
+
+ type: typing.Literal["link"]
+ """
+ Type of the format (must be 'link')
+ """
diff --git a/src/square/requests/list_bank_accounts_response.py b/src/square/requests/list_bank_accounts_response.py
new file mode 100644
index 00000000..af1cc875
--- /dev/null
+++ b/src/square/requests/list_bank_accounts_response.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .bank_account import BankAccountParams
+from .error import ErrorParams
+
+
+class ListBankAccountsResponseParams(typing_extensions.TypedDict):
+ """
+ Response object returned by ListBankAccounts.
+ """
+
+ bank_accounts: typing_extensions.NotRequired[typing.Sequence[BankAccountParams]]
+ """
+ List of BankAccounts associated with this account.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ When a response is truncated, it includes a cursor that you can
+ use in a subsequent request to fetch next set of bank accounts.
+ If empty, this is the final response.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
diff --git a/src/square/requests/list_booking_custom_attribute_definitions_response.py b/src/square/requests/list_booking_custom_attribute_definitions_response.py
new file mode 100644
index 00000000..fb8b1c1c
--- /dev/null
+++ b/src/square/requests/list_booking_custom_attribute_definitions_response.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class ListBookingCustomAttributeDefinitionsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [ListBookingCustomAttributeDefinitions](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributeDefinitions) response.
+ Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response.
+ If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`.
+ """
+
+ custom_attribute_definitions: typing_extensions.NotRequired[typing.Sequence[CustomAttributeDefinitionParams]]
+ """
+ The retrieved custom attribute definitions. If no custom attribute definitions are found,
+ Square returns an empty object (`{}`).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of
+ results for your original request. This field is present only if the request succeeded and
+ additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_booking_custom_attributes_response.py b/src/square/requests/list_booking_custom_attributes_response.py
new file mode 100644
index 00000000..1f9fc3b3
--- /dev/null
+++ b/src/square/requests/list_booking_custom_attributes_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class ListBookingCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [ListBookingCustomAttributes](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributes) response.
+ Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional
+ results are available, the `cursor` field is also present along with `custom_attributes`.
+ """
+
+ custom_attributes: typing_extensions.NotRequired[typing.Sequence[CustomAttributeParams]]
+ """
+ The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field of each custom attribute.
+
+ If no custom attributes are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to use in your next call to this endpoint to retrieve the next page of results
+ for your original request. This field is present only if the request succeeded and additional
+ results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_bookings_response.py b/src/square/requests/list_bookings_response.py
new file mode 100644
index 00000000..89fd0030
--- /dev/null
+++ b/src/square/requests/list_bookings_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking import BookingParams
+from .error import ErrorParams
+
+
+class ListBookingsResponseParams(typing_extensions.TypedDict):
+ bookings: typing_extensions.NotRequired[typing.Sequence[BookingParams]]
+ """
+ The list of targeted bookings.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_break_types_response.py b/src/square/requests/list_break_types_response.py
new file mode 100644
index 00000000..db67af36
--- /dev/null
+++ b/src/square/requests/list_break_types_response.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .break_type import BreakTypeParams
+from .error import ErrorParams
+
+
+class ListBreakTypesResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request for a set of `BreakType` objects. The response contains
+ the requested `BreakType` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ break_types: typing_extensions.NotRequired[typing.Sequence[BreakTypeParams]]
+ """
+ A page of `BreakType` results.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The value supplied in the subsequent request to fetch the next page
+ of `BreakType` results.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_cards_response.py b/src/square/requests/list_cards_response.py
new file mode 100644
index 00000000..98eab1cc
--- /dev/null
+++ b/src/square/requests/list_cards_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .card import CardParams
+from .error import ErrorParams
+
+
+class ListCardsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListCards](api-endpoint:Cards-ListCards) endpoint.
+
+ Note: if there are errors processing the request, the card field will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ cards: typing_extensions.NotRequired[typing.Sequence[CardParams]]
+ """
+ The requested list of `Card`s.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
diff --git a/src/square/requests/list_cash_drawer_shift_events_response.py b/src/square/requests/list_cash_drawer_shift_events_response.py
new file mode 100644
index 00000000..df551d41
--- /dev/null
+++ b/src/square/requests/list_cash_drawer_shift_events_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .cash_drawer_shift_event import CashDrawerShiftEventParams
+from .error import ErrorParams
+
+
+class ListCashDrawerShiftEventsResponseParams(typing_extensions.TypedDict):
+ cursor: typing_extensions.NotRequired[str]
+ """
+ Opaque cursor for fetching the next page. Cursor is not present in
+ the last page of results.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ cash_drawer_shift_events: typing_extensions.NotRequired[typing.Sequence[CashDrawerShiftEventParams]]
+ """
+ All of the events (payments, refunds, etc.) for a cash drawer during
+ the shift.
+ """
diff --git a/src/square/requests/list_cash_drawer_shifts_response.py b/src/square/requests/list_cash_drawer_shifts_response.py
new file mode 100644
index 00000000..b461bf74
--- /dev/null
+++ b/src/square/requests/list_cash_drawer_shifts_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .cash_drawer_shift_summary import CashDrawerShiftSummaryParams
+from .error import ErrorParams
+
+
+class ListCashDrawerShiftsResponseParams(typing_extensions.TypedDict):
+ cursor: typing_extensions.NotRequired[str]
+ """
+ Opaque cursor for fetching the next page of results. Cursor is not
+ present in the last page of results.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ cash_drawer_shifts: typing_extensions.NotRequired[typing.Sequence[CashDrawerShiftSummaryParams]]
+ """
+ A collection of CashDrawerShiftSummary objects for shifts that match
+ the query.
+ """
diff --git a/src/square/requests/list_catalog_response.py b/src/square/requests/list_catalog_response.py
new file mode 100644
index 00000000..41cffb7f
--- /dev/null
+++ b/src/square/requests/list_catalog_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_object import CatalogObjectParams
+from .error import ErrorParams
+
+
+class ListCatalogResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If unset, this is the final response.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
+
+ objects: typing_extensions.NotRequired[typing.Sequence[CatalogObjectParams]]
+ """
+ The CatalogObjects returned.
+ """
diff --git a/src/square/requests/list_channels_response.py b/src/square/requests/list_channels_response.py
new file mode 100644
index 00000000..1e3433ae
--- /dev/null
+++ b/src/square/requests/list_channels_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .channel import ChannelParams
+from .error import ErrorParams
+
+
+class ListChannelsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ channels: typing_extensions.NotRequired[typing.Sequence[ChannelParams]]
+ """
+ List of requested Channel.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The token required to retrieve the next page of results.
+ """
diff --git a/src/square/requests/list_customer_custom_attribute_definitions_response.py b/src/square/requests/list_customer_custom_attribute_definitions_response.py
new file mode 100644
index 00000000..05ad69b2
--- /dev/null
+++ b/src/square/requests/list_customer_custom_attribute_definitions_response.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class ListCustomerCustomAttributeDefinitionsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [ListCustomerCustomAttributeDefinitions](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributeDefinitions) response.
+ Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response.
+ If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`.
+ """
+
+ custom_attribute_definitions: typing_extensions.NotRequired[typing.Sequence[CustomAttributeDefinitionParams]]
+ """
+ The retrieved custom attribute definitions. If no custom attribute definitions are found,
+ Square returns an empty object (`{}`).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of
+ results for your original request. This field is present only if the request succeeded and
+ additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_customer_custom_attributes_response.py b/src/square/requests/list_customer_custom_attributes_response.py
new file mode 100644
index 00000000..9edf2342
--- /dev/null
+++ b/src/square/requests/list_customer_custom_attributes_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class ListCustomerCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [ListCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributes) response.
+ Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional
+ results are available, the `cursor` field is also present along with `custom_attributes`.
+ """
+
+ custom_attributes: typing_extensions.NotRequired[typing.Sequence[CustomAttributeParams]]
+ """
+ The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field of each custom attribute.
+
+ If no custom attributes are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to use in your next call to this endpoint to retrieve the next page of results
+ for your original request. This field is present only if the request succeeded and additional
+ results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_customer_groups_response.py b/src/square/requests/list_customer_groups_response.py
new file mode 100644
index 00000000..4c368970
--- /dev/null
+++ b/src/square/requests/list_customer_groups_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_group import CustomerGroupParams
+from .error import ErrorParams
+
+
+class ListCustomerGroupsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListCustomerGroups](api-endpoint:CustomerGroups-ListCustomerGroups) endpoint.
+
+ Either `errors` or `groups` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ groups: typing_extensions.NotRequired[typing.Sequence[CustomerGroupParams]]
+ """
+ A list of customer groups belonging to the current seller.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ A pagination cursor to retrieve the next set of results for your
+ original query to the endpoint. This value is present only if the request
+ succeeded and additional results are available.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/list_customer_segments_response.py b/src/square/requests/list_customer_segments_response.py
new file mode 100644
index 00000000..0eaf92d1
--- /dev/null
+++ b/src/square/requests/list_customer_segments_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_segment import CustomerSegmentParams
+from .error import ErrorParams
+
+
+class ListCustomerSegmentsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body for requests to the `ListCustomerSegments` endpoint.
+
+ Either `errors` or `segments` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ segments: typing_extensions.NotRequired[typing.Sequence[CustomerSegmentParams]]
+ """
+ The list of customer segments belonging to the associated Square account.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ A pagination cursor to be used in subsequent calls to `ListCustomerSegments`
+ to retrieve the next set of query results. The cursor is only present if the request succeeded and
+ additional results are available.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/list_customers_response.py b/src/square/requests/list_customers_response.py
new file mode 100644
index 00000000..ac3f6201
--- /dev/null
+++ b/src/square/requests/list_customers_response.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer import CustomerParams
+from .error import ErrorParams
+
+
+class ListCustomersResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `ListCustomers` endpoint.
+
+ Either `errors` or `customers` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ customers: typing_extensions.NotRequired[typing.Sequence[CustomerParams]]
+ """
+ The customer profiles associated with the Square account or an empty object (`{}`) if none are found.
+ Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or
+ `phone_number`) are included in the response.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ A pagination cursor to retrieve the next set of results for the
+ original query. A cursor is only present if the request succeeded and additional results
+ are available.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ count: typing_extensions.NotRequired[int]
+ """
+ The total count of customers associated with the Square account. Only customer profiles with public information
+ (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is present
+ only if `count` is set to `true` in the request.
+ """
diff --git a/src/square/requests/list_device_codes_response.py b/src/square/requests/list_device_codes_response.py
new file mode 100644
index 00000000..3c921140
--- /dev/null
+++ b/src/square/requests/list_device_codes_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .device_code import DeviceCodeParams
+from .error import ErrorParams
+
+
+class ListDeviceCodesResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ device_codes: typing_extensions.NotRequired[typing.Sequence[DeviceCodeParams]]
+ """
+ The queried DeviceCode.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ A pagination cursor to retrieve the next set of results for your
+ original query to the endpoint. This value is present only if the request
+ succeeded and additional results are available.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+ """
diff --git a/src/square/requests/list_devices_response.py b/src/square/requests/list_devices_response.py
new file mode 100644
index 00000000..25b84dc3
--- /dev/null
+++ b/src/square/requests/list_devices_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .device import DeviceParams
+from .error import ErrorParams
+
+
+class ListDevicesResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors that occurred during the request.
+ """
+
+ devices: typing_extensions.NotRequired[typing.Sequence[DeviceParams]]
+ """
+ The requested list of `Device` objects.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
diff --git a/src/square/requests/list_dispute_evidence_response.py b/src/square/requests/list_dispute_evidence_response.py
new file mode 100644
index 00000000..c640cf0b
--- /dev/null
+++ b/src/square/requests/list_dispute_evidence_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute_evidence import DisputeEvidenceParams
+from .error import ErrorParams
+
+
+class ListDisputeEvidenceResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields in a `ListDisputeEvidence` response.
+ """
+
+ evidence: typing_extensions.NotRequired[typing.Sequence[DisputeEvidenceParams]]
+ """
+ The list of evidence previously uploaded to the specified dispute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request.
+ If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/list_disputes_response.py b/src/square/requests/list_disputes_response.py
new file mode 100644
index 00000000..aa1d681e
--- /dev/null
+++ b/src/square/requests/list_disputes_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute import DisputeParams
+from .error import ErrorParams
+
+
+class ListDisputesResponseParams(typing_extensions.TypedDict):
+ """
+ Defines fields in a `ListDisputes` response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ disputes: typing_extensions.NotRequired[typing.Sequence[DisputeParams]]
+ """
+ The list of disputes.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request.
+ If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/list_employee_wages_response.py b/src/square/requests/list_employee_wages_response.py
new file mode 100644
index 00000000..0ba29709
--- /dev/null
+++ b/src/square/requests/list_employee_wages_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .employee_wage import EmployeeWageParams
+from .error import ErrorParams
+
+
+class ListEmployeeWagesResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request for a set of `EmployeeWage` objects. The response contains
+ a set of `EmployeeWage` objects.
+ """
+
+ employee_wages: typing_extensions.NotRequired[typing.Sequence[EmployeeWageParams]]
+ """
+ A page of `EmployeeWage` results.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The value supplied in the subsequent request to fetch the next page
+ of `EmployeeWage` results.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_employees_response.py b/src/square/requests/list_employees_response.py
new file mode 100644
index 00000000..0832d468
--- /dev/null
+++ b/src/square/requests/list_employees_response.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .employee import EmployeeParams
+from .error import ErrorParams
+
+
+class ListEmployeesResponseParams(typing_extensions.TypedDict):
+ employees: typing_extensions.NotRequired[typing.Sequence[EmployeeParams]]
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The token to be used to retrieve the next page of results.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_event_types_response.py b/src/square/requests/list_event_types_response.py
new file mode 100644
index 00000000..3202b6b7
--- /dev/null
+++ b/src/square/requests/list_event_types_response.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .event_type_metadata import EventTypeMetadataParams
+
+
+class ListEventTypesResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListEventTypes](api-endpoint:Events-ListEventTypes) endpoint.
+
+ Note: if there are errors processing the request, the event types field will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ event_types: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ The list of event types.
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Sequence[EventTypeMetadataParams]]
+ """
+ Contains the metadata of an event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata).
+ """
diff --git a/src/square/requests/list_gift_card_activities_response.py b/src/square/requests/list_gift_card_activities_response.py
new file mode 100644
index 00000000..89fa3c21
--- /dev/null
+++ b/src/square/requests/list_gift_card_activities_response.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .gift_card_activity import GiftCardActivityParams
+
+
+class ListGiftCardActivitiesResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains a list of `GiftCardActivity` objects. If the request resulted in errors,
+ the response contains a set of `Error` objects.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card_activities: typing_extensions.NotRequired[typing.Sequence[GiftCardActivityParams]]
+ """
+ The requested gift card activities or an empty object if none are found.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ When a response is truncated, it includes a cursor that you can use in a
+ subsequent request to retrieve the next set of activities. If a cursor is not present, this is
+ the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
diff --git a/src/square/requests/list_gift_cards_response.py b/src/square/requests/list_gift_cards_response.py
new file mode 100644
index 00000000..07a790cc
--- /dev/null
+++ b/src/square/requests/list_gift_cards_response.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .gift_card import GiftCardParams
+
+
+class ListGiftCardsResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains a list of `GiftCard` objects. If the request resulted in errors,
+ the response contains a set of `Error` objects.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_cards: typing_extensions.NotRequired[typing.Sequence[GiftCardParams]]
+ """
+ The requested gift cards or an empty object if none are found.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ When a response is truncated, it includes a cursor that you can use in a
+ subsequent request to retrieve the next set of gift cards. If a cursor is not present, this is
+ the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
diff --git a/src/square/requests/list_inventory_adjustment_reasons_response.py b/src/square/requests/list_inventory_adjustment_reasons_response.py
new file mode 100644
index 00000000..a67a96ec
--- /dev/null
+++ b/src/square/requests/list_inventory_adjustment_reasons_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class ListInventoryAdjustmentReasonsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [ListInventoryAdjustmentReasons](api-endpoint:Inventory-ListInventoryAdjustmentReasons).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reasons: typing_extensions.NotRequired[typing.Sequence[InventoryAdjustmentReasonParams]]
+ """
+ The standard, system-generated, and custom inventory adjustment
+ reasons available to the seller.
+ """
diff --git a/src/square/requests/list_invoices_response.py b/src/square/requests/list_invoices_response.py
new file mode 100644
index 00000000..08a356cb
--- /dev/null
+++ b/src/square/requests/list_invoices_response.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .invoice import InvoiceParams
+
+
+class ListInvoicesResponseParams(typing_extensions.TypedDict):
+ """
+ Describes a `ListInvoice` response.
+ """
+
+ invoices: typing_extensions.NotRequired[typing.Sequence[InvoiceParams]]
+ """
+ The invoices retrieved.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ When a response is truncated, it includes a cursor that you can use in a
+ subsequent request to retrieve the next set of invoices. If empty, this is the final
+ response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/list_jobs_response.py b/src/square/requests/list_jobs_response.py
new file mode 100644
index 00000000..dc908be0
--- /dev/null
+++ b/src/square/requests/list_jobs_response.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .job import JobParams
+
+
+class ListJobsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [ListJobs](api-endpoint:Team-ListJobs) response. Either `jobs` or `errors`
+ is present in the response. If additional results are available, the `cursor` field is also present.
+ """
+
+ jobs: typing_extensions.NotRequired[typing.Sequence[JobParams]]
+ """
+ The retrieved jobs. A single paged response contains up to 100 jobs.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ An opaque cursor used to retrieve the next page of results. This field is present only
+ if the request succeeded and additional results are available. For more information, see
+ [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_location_booking_profiles_response.py b/src/square/requests/list_location_booking_profiles_response.py
new file mode 100644
index 00000000..b83619a8
--- /dev/null
+++ b/src/square/requests/list_location_booking_profiles_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .location_booking_profile import LocationBookingProfileParams
+
+
+class ListLocationBookingProfilesResponseParams(typing_extensions.TypedDict):
+ location_booking_profiles: typing_extensions.NotRequired[typing.Sequence[LocationBookingProfileParams]]
+ """
+ The list of a seller's location booking profiles.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_location_custom_attribute_definitions_response.py b/src/square/requests/list_location_custom_attribute_definitions_response.py
new file mode 100644
index 00000000..0d2defc1
--- /dev/null
+++ b/src/square/requests/list_location_custom_attribute_definitions_response.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class ListLocationCustomAttributeDefinitionsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [ListLocationCustomAttributeDefinitions](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributeDefinitions) response.
+ Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response.
+ If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`.
+ """
+
+ custom_attribute_definitions: typing_extensions.NotRequired[typing.Sequence[CustomAttributeDefinitionParams]]
+ """
+ The retrieved custom attribute definitions. If no custom attribute definitions are found,
+ Square returns an empty object (`{}`).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of
+ results for your original request. This field is present only if the request succeeded and
+ additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_location_custom_attributes_response.py b/src/square/requests/list_location_custom_attributes_response.py
new file mode 100644
index 00000000..2a59a940
--- /dev/null
+++ b/src/square/requests/list_location_custom_attributes_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class ListLocationCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [ListLocationCustomAttributes](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributes) response.
+ Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional
+ results are available, the `cursor` field is also present along with `custom_attributes`.
+ """
+
+ custom_attributes: typing_extensions.NotRequired[typing.Sequence[CustomAttributeParams]]
+ """
+ The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field of each custom attribute.
+ If no custom attributes are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to use in your next call to this endpoint to retrieve the next page of results
+ for your original request. This field is present only if the request succeeded and additional
+ results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_locations_response.py b/src/square/requests/list_locations_response.py
new file mode 100644
index 00000000..e8aa9981
--- /dev/null
+++ b/src/square/requests/list_locations_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .location import LocationParams
+
+
+class ListLocationsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of a request
+ to the [ListLocations](api-endpoint:Locations-ListLocations) endpoint.
+
+ Either `errors` or `locations` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ locations: typing_extensions.NotRequired[typing.Sequence[LocationParams]]
+ """
+ The business locations.
+ """
diff --git a/src/square/requests/list_loyalty_programs_response.py b/src/square/requests/list_loyalty_programs_response.py
new file mode 100644
index 00000000..e9fcdc94
--- /dev/null
+++ b/src/square/requests/list_loyalty_programs_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_program import LoyaltyProgramParams
+
+
+class ListLoyaltyProgramsResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains all loyalty programs.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ programs: typing_extensions.NotRequired[typing.Sequence[LoyaltyProgramParams]]
+ """
+ A list of `LoyaltyProgram` for the merchant.
+ """
diff --git a/src/square/requests/list_loyalty_promotions_response.py b/src/square/requests/list_loyalty_promotions_response.py
new file mode 100644
index 00000000..404a45e0
--- /dev/null
+++ b/src/square/requests/list_loyalty_promotions_response.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_promotion import LoyaltyPromotionParams
+
+
+class ListLoyaltyPromotionsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) response.
+ One of `loyalty_promotions`, an empty object, or `errors` is present in the response.
+ If additional results are available, the `cursor` field is also present along with `loyalty_promotions`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_promotions: typing_extensions.NotRequired[typing.Sequence[LoyaltyPromotionParams]]
+ """
+ The retrieved loyalty promotions.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to use in your next call to this endpoint to retrieve the next page of results
+ for your original request. This field is present only if the request succeeded and additional
+ results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/list_merchant_custom_attribute_definitions_response.py b/src/square/requests/list_merchant_custom_attribute_definitions_response.py
new file mode 100644
index 00000000..fdbc943d
--- /dev/null
+++ b/src/square/requests/list_merchant_custom_attribute_definitions_response.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class ListMerchantCustomAttributeDefinitionsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [ListMerchantCustomAttributeDefinitions](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributeDefinitions) response.
+ Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response.
+ If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`.
+ """
+
+ custom_attribute_definitions: typing_extensions.NotRequired[typing.Sequence[CustomAttributeDefinitionParams]]
+ """
+ The retrieved custom attribute definitions. If no custom attribute definitions are found,
+ Square returns an empty object (`{}`).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of
+ results for your original request. This field is present only if the request succeeded and
+ additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_merchant_custom_attributes_response.py b/src/square/requests/list_merchant_custom_attributes_response.py
new file mode 100644
index 00000000..5615c36c
--- /dev/null
+++ b/src/square/requests/list_merchant_custom_attributes_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class ListMerchantCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [ListMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributes) response.
+ Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional
+ results are available, the `cursor` field is also present along with `custom_attributes`.
+ """
+
+ custom_attributes: typing_extensions.NotRequired[typing.Sequence[CustomAttributeParams]]
+ """
+ The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field of each custom attribute.
+ If no custom attributes are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to use in your next call to this endpoint to retrieve the next page of results
+ for your original request. This field is present only if the request succeeded and additional
+ results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_merchants_response.py b/src/square/requests/list_merchants_response.py
new file mode 100644
index 00000000..3816a1d2
--- /dev/null
+++ b/src/square/requests/list_merchants_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .merchant import MerchantParams
+
+
+class ListMerchantsResponseParams(typing_extensions.TypedDict):
+ """
+ The response object returned by the [ListMerchant](api-endpoint:Merchants-ListMerchants) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ merchant: typing_extensions.NotRequired[typing.Sequence[MerchantParams]]
+ """
+ The requested `Merchant` entities.
+ """
+
+ cursor: typing_extensions.NotRequired[int]
+ """
+ If the response is truncated, the cursor to use in next request to fetch next set of objects.
+ """
diff --git a/src/square/requests/list_order_custom_attribute_definitions_response.py b/src/square/requests/list_order_custom_attribute_definitions_response.py
new file mode 100644
index 00000000..075d2cbb
--- /dev/null
+++ b/src/square/requests/list_order_custom_attribute_definitions_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class ListOrderCustomAttributeDefinitionsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from listing order custom attribute definitions.
+ """
+
+ custom_attribute_definitions: typing.Sequence[CustomAttributeDefinitionParams]
+ """
+ The retrieved custom attribute definitions. If no custom attribute definitions are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request.
+ This field is present only if the request succeeded and additional results are available.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_order_custom_attributes_response.py b/src/square/requests/list_order_custom_attributes_response.py
new file mode 100644
index 00000000..60988485
--- /dev/null
+++ b/src/square/requests/list_order_custom_attributes_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class ListOrderCustomAttributesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from listing order custom attributes.
+ """
+
+ custom_attributes: typing_extensions.NotRequired[typing.Sequence[CustomAttributeParams]]
+ """
+ The retrieved custom attributes. If no custom attribute are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request.
+ This field is present only if the request succeeded and additional results are available.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_payment_links_response.py b/src/square/requests/list_payment_links_response.py
new file mode 100644
index 00000000..64b67f18
--- /dev/null
+++ b/src/square/requests/list_payment_links_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment_link import PaymentLinkParams
+
+
+class ListPaymentLinksResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
+
+ payment_links: typing_extensions.NotRequired[typing.Sequence[PaymentLinkParams]]
+ """
+ The list of payment links.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ When a response is truncated, it includes a cursor that you can use in a subsequent request
+ to retrieve the next set of gift cards. If a cursor is not present, this is the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/list_payment_refunds_response.py b/src/square/requests/list_payment_refunds_response.py
new file mode 100644
index 00000000..22faf9e3
--- /dev/null
+++ b/src/square/requests/list_payment_refunds_response.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment_refund import PaymentRefundParams
+
+
+class ListPaymentRefundsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response returned by [ListPaymentRefunds](api-endpoint:Refunds-ListPaymentRefunds).
+
+ Either `errors` or `refunds` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ refunds: typing_extensions.NotRequired[typing.Sequence[PaymentRefundParams]]
+ """
+ The list of requested refunds.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/list_payments_response.py b/src/square/requests/list_payments_response.py
new file mode 100644
index 00000000..683e0352
--- /dev/null
+++ b/src/square/requests/list_payments_response.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment import PaymentParams
+
+
+class ListPaymentsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response returned by [ListPayments](api-endpoint:Payments-ListPayments).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ payments: typing_extensions.NotRequired[typing.Sequence[PaymentParams]]
+ """
+ The requested list of payments.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/list_payout_entries_response.py b/src/square/requests/list_payout_entries_response.py
new file mode 100644
index 00000000..0ad97068
--- /dev/null
+++ b/src/square/requests/list_payout_entries_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payout_entry import PayoutEntryParams
+
+
+class ListPayoutEntriesResponseParams(typing_extensions.TypedDict):
+ """
+ The response to retrieve payout records entries.
+ """
+
+ payout_entries: typing_extensions.NotRequired[typing.Sequence[PayoutEntryParams]]
+ """
+ The requested list of payout entries, ordered with the given or default sort order.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If empty, this is the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/list_payouts_response.py b/src/square/requests/list_payouts_response.py
new file mode 100644
index 00000000..35a2f43a
--- /dev/null
+++ b/src/square/requests/list_payouts_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payout import PayoutParams
+
+
+class ListPayoutsResponseParams(typing_extensions.TypedDict):
+ """
+ The response to retrieve payout records entries.
+ """
+
+ payouts: typing_extensions.NotRequired[typing.Sequence[PayoutParams]]
+ """
+ The requested list of payouts.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If empty, this is the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/list_sites_response.py b/src/square/requests/list_sites_response.py
new file mode 100644
index 00000000..12900b54
--- /dev/null
+++ b/src/square/requests/list_sites_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .site import SiteParams
+
+
+class ListSitesResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a `ListSites` response. The response can include either `sites` or `errors`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ sites: typing_extensions.NotRequired[typing.Sequence[SiteParams]]
+ """
+ The sites that belong to the seller.
+ """
diff --git a/src/square/requests/list_subscription_events_response.py b/src/square/requests/list_subscription_events_response.py
new file mode 100644
index 00000000..df9b344c
--- /dev/null
+++ b/src/square/requests/list_subscription_events_response.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription_event import SubscriptionEventParams
+
+
+class ListSubscriptionEventsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response from the
+ [ListSubscriptionEvents](api-endpoint:Subscriptions-ListSubscriptionEvents).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscription_events: typing_extensions.NotRequired[typing.Sequence[SubscriptionEventParams]]
+ """
+ The retrieved subscription events.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ When the total number of resulting subscription events exceeds the limit of a paged response,
+ the response includes a cursor for you to use in a subsequent request to fetch the next set of events.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/list_team_member_booking_profiles_response.py b/src/square/requests/list_team_member_booking_profiles_response.py
new file mode 100644
index 00000000..38db3b98
--- /dev/null
+++ b/src/square/requests/list_team_member_booking_profiles_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .team_member_booking_profile import TeamMemberBookingProfileParams
+
+
+class ListTeamMemberBookingProfilesResponseParams(typing_extensions.TypedDict):
+ team_member_booking_profiles: typing_extensions.NotRequired[typing.Sequence[TeamMemberBookingProfileParams]]
+ """
+ The list of team member booking profiles. The results are returned in the ascending order of the time
+ when the team member booking profiles were last updated. Multiple booking profiles updated at the same time
+ are further sorted in the ascending order of their IDs.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_team_member_wages_response.py b/src/square/requests/list_team_member_wages_response.py
new file mode 100644
index 00000000..7c20cc4b
--- /dev/null
+++ b/src/square/requests/list_team_member_wages_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .team_member_wage import TeamMemberWageParams
+
+
+class ListTeamMemberWagesResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request for a set of `TeamMemberWage` objects. The response contains
+ a set of `TeamMemberWage` objects.
+ """
+
+ team_member_wages: typing_extensions.NotRequired[typing.Sequence[TeamMemberWageParams]]
+ """
+ A page of `TeamMemberWage` results.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The value supplied in the subsequent request to fetch the next page
+ of `TeamMemberWage` results.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/list_transactions_response.py b/src/square/requests/list_transactions_response.py
new file mode 100644
index 00000000..5d4dc825
--- /dev/null
+++ b/src/square/requests/list_transactions_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .transaction import TransactionParams
+
+
+class ListTransactionsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint.
+
+ One of `errors` or `transactions` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ transactions: typing_extensions.NotRequired[typing.Sequence[TransactionParams]]
+ """
+ An array of transactions that match your query.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ A pagination cursor for retrieving the next set of results,
+ if any remain. Provide this value as the `cursor` parameter in a subsequent
+ request to this endpoint.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+ """
diff --git a/src/square/requests/list_webhook_event_types_response.py b/src/square/requests/list_webhook_event_types_response.py
new file mode 100644
index 00000000..8f8788ff
--- /dev/null
+++ b/src/square/requests/list_webhook_event_types_response.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .event_type_metadata import EventTypeMetadataParams
+
+
+class ListWebhookEventTypesResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListWebhookEventTypes](api-endpoint:WebhookSubscriptions-ListWebhookEventTypes) endpoint.
+
+ Note: if there are errors processing the request, the event types field will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ event_types: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ The list of event types.
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Sequence[EventTypeMetadataParams]]
+ """
+ Contains the metadata of a webhook event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata).
+ """
diff --git a/src/square/requests/list_webhook_subscriptions_response.py b/src/square/requests/list_webhook_subscriptions_response.py
new file mode 100644
index 00000000..dd3c296e
--- /dev/null
+++ b/src/square/requests/list_webhook_subscriptions_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .webhook_subscription import WebhookSubscriptionParams
+
+
+class ListWebhookSubscriptionsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListWebhookSubscriptions](api-endpoint:WebhookSubscriptions-ListWebhookSubscriptions) endpoint.
+
+ Note: if there are errors processing the request, the subscriptions field will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ subscriptions: typing_extensions.NotRequired[typing.Sequence[WebhookSubscriptionParams]]
+ """
+ The requested list of [Subscription](entity:WebhookSubscription)s.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/list_workweek_configs_response.py b/src/square/requests/list_workweek_configs_response.py
new file mode 100644
index 00000000..b9f8e432
--- /dev/null
+++ b/src/square/requests/list_workweek_configs_response.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .workweek_config import WorkweekConfigParams
+
+
+class ListWorkweekConfigsResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request for a set of `WorkweekConfig` objects. The response contains
+ the requested `WorkweekConfig` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ workweek_configs: typing_extensions.NotRequired[typing.Sequence[WorkweekConfigParams]]
+ """
+ A page of `WorkweekConfig` results.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The value supplied in the subsequent request to fetch the next page of
+ `WorkweekConfig` results.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/load_response.py b/src/square/requests/load_response.py
new file mode 100644
index 00000000..19657042
--- /dev/null
+++ b/src/square/requests/load_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from .load_result_annotation import LoadResultAnnotationParams
+from .load_result_data import LoadResultDataParams
+
+
+class LoadResponseParams(typing_extensions.TypedDict):
+ data_source: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="dataSource")]]
+ annotation: typing_extensions.NotRequired[LoadResultAnnotationParams]
+ data: typing_extensions.NotRequired[LoadResultDataParams]
+ last_refresh_time: typing_extensions.NotRequired[
+ typing_extensions.Annotated[str, FieldMetadata(alias="lastRefreshTime")]
+ ]
+ query: typing_extensions.NotRequired[typing.Dict[str, typing.Any]]
+ slow_query: typing_extensions.NotRequired[typing_extensions.Annotated[bool, FieldMetadata(alias="slowQuery")]]
+ external: typing_extensions.NotRequired[bool]
+ db_type: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="dbType")]]
+ refresh_key_values: typing_extensions.NotRequired[
+ typing_extensions.Annotated[
+ typing.Sequence[typing.Dict[str, typing.Any]], FieldMetadata(alias="refreshKeyValues")
+ ]
+ ]
+ pivot_query: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Dict[str, typing.Any], FieldMetadata(alias="pivotQuery")]
+ ]
+ query_type: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="queryType")]]
diff --git a/src/square/requests/load_result_annotation.py b/src/square/requests/load_result_annotation.py
new file mode 100644
index 00000000..5389dd86
--- /dev/null
+++ b/src/square/requests/load_result_annotation.py
@@ -0,0 +1,13 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+
+
+class LoadResultAnnotationParams(typing_extensions.TypedDict):
+ measures: typing.Dict[str, typing.Any]
+ dimensions: typing.Dict[str, typing.Any]
+ segments: typing.Dict[str, typing.Any]
+ time_dimensions: typing_extensions.Annotated[typing.Dict[str, typing.Any], FieldMetadata(alias="timeDimensions")]
diff --git a/src/square/requests/load_result_data.py b/src/square/requests/load_result_data.py
new file mode 100644
index 00000000..98b84717
--- /dev/null
+++ b/src/square/requests/load_result_data.py
@@ -0,0 +1,9 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..types.load_result_data_row import LoadResultDataRow
+from .load_result_data_columnar import LoadResultDataColumnarParams
+from .load_result_data_compact import LoadResultDataCompactParams
+
+LoadResultDataParams = typing.Union[LoadResultDataRow, LoadResultDataCompactParams, LoadResultDataColumnarParams]
diff --git a/src/square/requests/load_result_data_columnar.py b/src/square/requests/load_result_data_columnar.py
new file mode 100644
index 00000000..f5507f95
--- /dev/null
+++ b/src/square/requests/load_result_data_columnar.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LoadResultDataColumnarParams(typing_extensions.TypedDict):
+ """
+ Columnar data format - members list paired with one primitive array per column. Returned when `responseFormat=columnar` is requested.
+ """
+
+ members: typing.Sequence[str]
+ """
+ Ordered list of member names. Element `i` of `columns` holds the values for `members[i]` across all rows.
+ """
+
+ columns: typing.Sequence[typing.Sequence[typing.Any]]
+ """
+ One array per member, in the same order as `members`. Each inner array contains the primitive value of that member for every row (null, boolean, number, string).
+ """
diff --git a/src/square/requests/load_result_data_compact.py b/src/square/requests/load_result_data_compact.py
new file mode 100644
index 00000000..1eec025e
--- /dev/null
+++ b/src/square/requests/load_result_data_compact.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LoadResultDataCompactParams(typing_extensions.TypedDict):
+ """
+ Compact data format - a single object with the members list and a dataset of primitive arrays. Returned when `responseFormat=compact` is requested.
+ """
+
+ members: typing.Sequence[str]
+ """
+ Ordered list of member names that correspond to each cell position in `dataset` rows.
+ """
+
+ dataset: typing.Sequence[typing.Sequence[typing.Any]]
+ """
+ Array of rows, where each row is an array of primitive values (null, boolean, number, string) aligned with `members`.
+ """
diff --git a/src/square/requests/location.py b/src/square/requests/location.py
new file mode 100644
index 00000000..87d42239
--- /dev/null
+++ b/src/square/requests/location.py
@@ -0,0 +1,177 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.country import Country
+from ..types.currency import Currency
+from ..types.location_capability import LocationCapability
+from ..types.location_status import LocationStatus
+from ..types.location_type import LocationType
+from .address import AddressParams
+from .business_hours import BusinessHoursParams
+from .coordinates import CoordinatesParams
+from .tax_ids import TaxIdsParams
+
+
+class LocationParams(typing_extensions.TypedDict):
+ """
+ Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A short generated string of letters and numbers that uniquely identifies this location instance.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the location.
+ This information appears in the Seller Dashboard as the nickname.
+ A location name must be unique within a seller account.
+ """
+
+ address: typing_extensions.NotRequired[AddressParams]
+ """
+ The physical address of the location.
+ """
+
+ timezone: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [IANA time zone](https://www.iana.org/time-zones) identifier for
+ the time zone of the location. For example, `America/Los_Angeles`.
+ """
+
+ capabilities: typing_extensions.NotRequired[typing.Sequence[LocationCapability]]
+ """
+ The Square features that are enabled for the location.
+ See [LocationCapability](entity:LocationCapability) for possible values.
+ See [LocationCapability](#type-locationcapability) for possible values
+ """
+
+ status: typing_extensions.NotRequired[LocationStatus]
+ """
+ The status of the location.
+ See [LocationStatus](#type-locationstatus) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The time when the location was created, in RFC 3339 format.
+ For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
+ """
+
+ merchant_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the merchant that owns the location.
+ """
+
+ country: typing_extensions.NotRequired[Country]
+ """
+ The country of the location, in the two-letter format of ISO 3166. For example, `US` or `JP`.
+
+ See [Country](entity:Country) for possible values.
+ See [Country](#type-country) for possible values
+ """
+
+ language_code: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The language associated with the location, in
+ [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A).
+ For more information, see [Language Preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences).
+ """
+
+ currency: typing_extensions.NotRequired[Currency]
+ """
+ The currency used for all transactions at this location,
+ in ISO 4217 format. For example, the currency code for US dollars is `USD`.
+ See [Currency](entity:Currency) for possible values.
+ See [Currency](#type-currency) for possible values
+ """
+
+ phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The phone number of the location. For example, `+1 855-700-6000`.
+ """
+
+ business_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the location's overall business. This name is present on receipts and other customer-facing branding, and can be changed no more than three times in a twelve-month period.
+ """
+
+ type: typing_extensions.NotRequired[LocationType]
+ """
+ The type of the location.
+ See [LocationType](#type-locationtype) for possible values
+ """
+
+ website_url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The website URL of the location. For example, `https://squareup.com`.
+ """
+
+ business_hours: typing_extensions.NotRequired[BusinessHoursParams]
+ """
+ The hours of operation for the location.
+ """
+
+ business_email: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The email address of the location. This can be unique to the location and is not always the email address for the business owner or administrator.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The description of the location. For example, `Main Street location`.
+ """
+
+ twitter_username: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Twitter username of the location without the '@' symbol. For example, `Square`.
+ """
+
+ instagram_username: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Instagram username of the location without the '@' symbol. For example, `square`.
+ """
+
+ facebook_url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`.
+ """
+
+ coordinates: typing_extensions.NotRequired[CoordinatesParams]
+ """
+ The physical coordinates (latitude and longitude) of the location.
+ """
+
+ logo_url: typing_extensions.NotRequired[str]
+ """
+ The URL of the logo image for the location. When configured in the Seller
+ Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller.
+ This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels.
+ """
+
+ pos_background_url: typing_extensions.NotRequired[str]
+ """
+ The URL of the Point of Sale background image for the location.
+ """
+
+ mcc: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A four-digit number that describes the kind of goods or services sold at the location.
+ The [merchant category code (MCC)](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) of the location as standardized by ISO 18245.
+ For example, `5045`, for a location that sells computer goods and software.
+ """
+
+ full_format_logo_url: typing_extensions.NotRequired[str]
+ """
+ The URL of a full-format logo image for the location. When configured in the Seller
+ Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller.
+ This image can be wider than it is tall and should be at least 1280x648 pixels.
+ """
+
+ tax_ids: typing_extensions.NotRequired[TaxIdsParams]
+ """
+ The tax IDs for this location.
+ """
diff --git a/src/square/requests/location_booking_profile.py b/src/square/requests/location_booking_profile.py
new file mode 100644
index 00000000..3827f59d
--- /dev/null
+++ b/src/square/requests/location_booking_profile.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LocationBookingProfileParams(typing_extensions.TypedDict):
+ """
+ The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [location](entity:Location).
+ """
+
+ booking_site_url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Url for the online booking site for this location.
+ """
+
+ online_booking_enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the location is enabled for online booking.
+ """
diff --git a/src/square/requests/location_created_event.py b/src/square/requests/location_created_event.py
new file mode 100644
index 00000000..9b00b0f0
--- /dev/null
+++ b/src/square/requests/location_created_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .location_created_event_data import LocationCreatedEventDataParams
+
+
+class LocationCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Location](entity:Location) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [Location](entity:Location) associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"location.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LocationCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/location_created_event_data.py b/src/square/requests/location_created_event_data.py
new file mode 100644
index 00000000..d0d63857
--- /dev/null
+++ b/src/square/requests/location_created_event_data.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LocationCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"location"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the updated [Location](entity:Location).
+ """
diff --git a/src/square/requests/location_custom_attribute_definition_owned_created_event.py b/src/square/requests/location_custom_attribute_definition_owned_created_event.py
new file mode 100644
index 00000000..14b43fff
--- /dev/null
+++ b/src/square/requests/location_custom_attribute_definition_owned_created_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class LocationCustomAttributeDefinitionOwnedCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ is created by the subscribing application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.owned.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/location_custom_attribute_definition_owned_deleted_event.py b/src/square/requests/location_custom_attribute_definition_owned_deleted_event.py
new file mode 100644
index 00000000..d074c49c
--- /dev/null
+++ b/src/square/requests/location_custom_attribute_definition_owned_deleted_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class LocationCustomAttributeDefinitionOwnedDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is deleted. A custom attribute definition can only be deleted by
+ the application that created it.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.owned.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/location_custom_attribute_definition_owned_updated_event.py b/src/square/requests/location_custom_attribute_definition_owned_updated_event.py
new file mode 100644
index 00000000..62d0f72e
--- /dev/null
+++ b/src/square/requests/location_custom_attribute_definition_owned_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class LocationCustomAttributeDefinitionOwnedUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is updated. A custom attribute definition can only be updated
+ by the application that created it.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.owned.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/location_custom_attribute_definition_visible_created_event.py b/src/square/requests/location_custom_attribute_definition_visible_created_event.py
new file mode 100644
index 00000000..7329bb6b
--- /dev/null
+++ b/src/square/requests/location_custom_attribute_definition_visible_created_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class LocationCustomAttributeDefinitionVisibleCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is created. A notification is sent when your application
+ creates a custom attribute definition or another application creates a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.visible.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/location_custom_attribute_definition_visible_deleted_event.py b/src/square/requests/location_custom_attribute_definition_visible_deleted_event.py
new file mode 100644
index 00000000..9cbc3db9
--- /dev/null
+++ b/src/square/requests/location_custom_attribute_definition_visible_deleted_event.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class LocationCustomAttributeDefinitionVisibleDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is deleted. A custom attribute definition can only
+ be deleted by the application that created it. A notification is sent when your application deletes
+ a custom attribute definition or when another application deletes a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.visible.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/location_custom_attribute_definition_visible_updated_event.py b/src/square/requests/location_custom_attribute_definition_visible_updated_event.py
new file mode 100644
index 00000000..3b8daac8
--- /dev/null
+++ b/src/square/requests/location_custom_attribute_definition_visible_updated_event.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class LocationCustomAttributeDefinitionVisibleUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is updated. A custom attribute definition can only be updated
+ by the application that created it. A notification is sent when your application updates a custom attribute
+ definition or when another application updates a custom attribute definition whose `visibility` is
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.visible.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/location_custom_attribute_owned_deleted_event.py b/src/square/requests/location_custom_attribute_owned_deleted_event.py
new file mode 100644
index 00000000..1cbc90d9
--- /dev/null
+++ b/src/square/requests/location_custom_attribute_owned_deleted_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class LocationCustomAttributeOwnedDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a location [custom attribute](entity:CustomAttribute)
+ owned by the subscribing application is deleted. Custom attributes are owned by the
+ application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition).
+ Custom attributes whose `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"location.custom_attribute.owned.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/location_custom_attribute_owned_updated_event.py b/src/square/requests/location_custom_attribute_owned_updated_event.py
new file mode 100644
index 00000000..4e24bc1a
--- /dev/null
+++ b/src/square/requests/location_custom_attribute_owned_updated_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class LocationCustomAttributeOwnedUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a location [custom attribute](entity:CustomAttribute) owned by the
+ subscribing application is created or updated. Custom attributes are owned by the application that created
+ the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose
+ `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"location.custom_attribute.owned.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/location_custom_attribute_visible_deleted_event.py b/src/square/requests/location_custom_attribute_visible_deleted_event.py
new file mode 100644
index 00000000..3319789c
--- /dev/null
+++ b/src/square/requests/location_custom_attribute_visible_deleted_event.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class LocationCustomAttributeVisibleDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a location [custom attribute](entity:CustomAttribute) that is visible to the
+ subscribing application is deleted. A notification is sent when:
+ - Your application deletes a custom attribute owned by your application, regardless of the `visibility` setting.
+ - Any application deletes a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY`
+ or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application, but those set to
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be deleted by the owner. Custom attributes are owned
+ by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"location.custom_attribute.visible.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/location_custom_attribute_visible_updated_event.py b/src/square/requests/location_custom_attribute_visible_updated_event.py
new file mode 100644
index 00000000..ce256338
--- /dev/null
+++ b/src/square/requests/location_custom_attribute_visible_updated_event.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class LocationCustomAttributeVisibleUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a location [custom attribute](entity:CustomAttribute) that is visible
+ to the subscribing application is created or updated. A notification is sent when:
+ - Your application creates or updates a custom attribute owned by your application, regardless of the `visibility` setting.
+ - Any application creates or updates a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY`
+ or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application, but those set to
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be created or updated by the owner. Custom attributes are owned
+ by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition).
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"location.custom_attribute.visible.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/location_settings_updated_event.py b/src/square/requests/location_settings_updated_event.py
new file mode 100644
index 00000000..693a39f4
--- /dev/null
+++ b/src/square/requests/location_settings_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .location_settings_updated_event_data import LocationSettingsUpdatedEventDataParams
+
+
+class LocationSettingsUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when online checkout location settings are updated
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"online_checkout.location_settings.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing_extensions.NotRequired[LocationSettingsUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/location_settings_updated_event_data.py b/src/square/requests/location_settings_updated_event_data.py
new file mode 100644
index 00000000..e282373c
--- /dev/null
+++ b/src/square/requests/location_settings_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .location_settings_updated_event_object import LocationSettingsUpdatedEventObjectParams
+
+
+class LocationSettingsUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the updated object’s type, `"online_checkout.location_settings"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the updated location settings.
+ """
+
+ object: typing_extensions.NotRequired[LocationSettingsUpdatedEventObjectParams]
+ """
+ An object containing the updated location settings.
+ """
diff --git a/src/square/requests/location_settings_updated_event_object.py b/src/square/requests/location_settings_updated_event_object.py
new file mode 100644
index 00000000..4a18c595
--- /dev/null
+++ b/src/square/requests/location_settings_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .checkout_location_settings import CheckoutLocationSettingsParams
+
+
+class LocationSettingsUpdatedEventObjectParams(typing_extensions.TypedDict):
+ location_settings: typing_extensions.NotRequired[CheckoutLocationSettingsParams]
+ """
+ The updated location settings.
+ """
diff --git a/src/square/requests/location_updated_event.py b/src/square/requests/location_updated_event.py
new file mode 100644
index 00000000..58dd7142
--- /dev/null
+++ b/src/square/requests/location_updated_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .location_updated_event_data import LocationUpdatedEventDataParams
+
+
+class LocationUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Location](entity:Location) is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [Location](entity:Location) associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"location.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LocationUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/location_updated_event_data.py b/src/square/requests/location_updated_event_data.py
new file mode 100644
index 00000000..1f02f996
--- /dev/null
+++ b/src/square/requests/location_updated_event_data.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LocationUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"location"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the updated [Location](entity:Location).
+ """
diff --git a/src/square/requests/loyalty_account.py b/src/square/requests/loyalty_account.py
new file mode 100644
index 00000000..5cc7fd79
--- /dev/null
+++ b/src/square/requests/loyalty_account.py
@@ -0,0 +1,81 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_account_expiring_point_deadline import LoyaltyAccountExpiringPointDeadlineParams
+from .loyalty_account_mapping import LoyaltyAccountMappingParams
+
+
+class LoyaltyAccountParams(typing_extensions.TypedDict):
+ """
+ Describes a loyalty account in a [loyalty program](entity:LoyaltyProgram). For more information, see
+ [Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the loyalty account.
+ """
+
+ program_id: str
+ """
+ The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram) to which the account belongs.
+ """
+
+ balance: typing_extensions.NotRequired[int]
+ """
+ The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the `expiring_point_deadlines` field.
+
+ Your application should be able to handle loyalty accounts that have a negative point balance (`balance` is less than 0). This might occur if a seller makes a manual adjustment or as a result of a refund or exchange.
+ """
+
+ lifetime_points: typing_extensions.NotRequired[int]
+ """
+ The total points accrued during the lifetime of the account.
+ """
+
+ customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-assigned ID of the [customer](entity:Customer) that is associated with the account.
+ """
+
+ enrolled_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timestamp when the buyer joined the loyalty program, in RFC 3339 format. This field is used to display the **Enrolled On** or **Member Since** date in first-party Square products.
+
+ If this field is not set in a `CreateLoyaltyAccount` request, Square populates it after the buyer's first action on their account
+ (when `AccumulateLoyaltyPoints` or `CreateLoyaltyReward` is called). In first-party flows, Square populates the field when the buyer agrees to the terms of service on Square Point of Sale.
+
+ If this field is set in a `CreateLoyaltyAccount` request, it is meant to be used when there is a loyalty migration from another system and into Square.
+ In that case, the timestamp can reflect when the buyer originally enrolled in the previous system. It may represent a current or past date, but cannot be set in the future.
+ Note: Setting this field in this scenario does not, by itself, impact the first-party enrollment flow on Square Point of Sale.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the loyalty account was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the loyalty account was last updated, in RFC 3339 format.
+ """
+
+ mapping: typing_extensions.NotRequired[LoyaltyAccountMappingParams]
+ """
+ The mapping that associates the loyalty account with a buyer. Currently,
+ a loyalty account can only be mapped to a buyer by phone number.
+
+ To create a loyalty account, you must specify the `mapping` field, with the buyer's phone number
+ in the `phone_number` field.
+ """
+
+ expiring_point_deadlines: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[LoyaltyAccountExpiringPointDeadlineParams]]
+ ]
+ """
+ The schedule for when points expire in the loyalty account balance. This field is present only if the account has points that are scheduled to expire.
+
+ The total number of points in this field equals the number of points in the `balance` field.
+ """
diff --git a/src/square/requests/loyalty_account_created_event.py b/src/square/requests/loyalty_account_created_event.py
new file mode 100644
index 00000000..f255e571
--- /dev/null
+++ b/src/square/requests/loyalty_account_created_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_account_created_event_data import LoyaltyAccountCreatedEventDataParams
+
+
+class LoyaltyAccountCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [loyalty account](entity:LoyaltyAccount) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `loyalty.account.created`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LoyaltyAccountCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/loyalty_account_created_event_data.py b/src/square/requests/loyalty_account_created_event_data.py
new file mode 100644
index 00000000..95cf5a48
--- /dev/null
+++ b/src/square/requests/loyalty_account_created_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_account_created_event_object import LoyaltyAccountCreatedEventObjectParams
+
+
+class LoyaltyAccountCreatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `loyalty.account.created` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_account`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected loyalty account.
+ """
+
+ object: typing_extensions.NotRequired[LoyaltyAccountCreatedEventObjectParams]
+ """
+ An object that contains the new loyalty account.
+ """
diff --git a/src/square/requests/loyalty_account_created_event_object.py b/src/square/requests/loyalty_account_created_event_object.py
new file mode 100644
index 00000000..609308cc
--- /dev/null
+++ b/src/square/requests/loyalty_account_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .loyalty_account import LoyaltyAccountParams
+
+
+class LoyaltyAccountCreatedEventObjectParams(typing_extensions.TypedDict):
+ loyalty_account: typing_extensions.NotRequired[LoyaltyAccountParams]
+ """
+ The loyalty account that was created.
+ """
diff --git a/src/square/requests/loyalty_account_deleted_event.py b/src/square/requests/loyalty_account_deleted_event.py
new file mode 100644
index 00000000..f5bc7bca
--- /dev/null
+++ b/src/square/requests/loyalty_account_deleted_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_account_deleted_event_data import LoyaltyAccountDeletedEventDataParams
+
+
+class LoyaltyAccountDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [loyalty account](entity:LoyaltyAccount) is deleted.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `loyalty.account.deleted`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LoyaltyAccountDeletedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/loyalty_account_deleted_event_data.py b/src/square/requests/loyalty_account_deleted_event_data.py
new file mode 100644
index 00000000..0cf95c8c
--- /dev/null
+++ b/src/square/requests/loyalty_account_deleted_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_account_deleted_event_object import LoyaltyAccountDeletedEventObjectParams
+
+
+class LoyaltyAccountDeletedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `loyalty.account.deleted` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_account`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected loyalty account.
+ """
+
+ object: typing_extensions.NotRequired[LoyaltyAccountDeletedEventObjectParams]
+ """
+ An object that contains the loyalty account that was deleted.
+ """
diff --git a/src/square/requests/loyalty_account_deleted_event_object.py b/src/square/requests/loyalty_account_deleted_event_object.py
new file mode 100644
index 00000000..131439fa
--- /dev/null
+++ b/src/square/requests/loyalty_account_deleted_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .loyalty_account import LoyaltyAccountParams
+
+
+class LoyaltyAccountDeletedEventObjectParams(typing_extensions.TypedDict):
+ loyalty_account: typing_extensions.NotRequired[LoyaltyAccountParams]
+ """
+ The loyalty account that was deleted.
+ """
diff --git a/src/square/requests/loyalty_account_expiring_point_deadline.py b/src/square/requests/loyalty_account_expiring_point_deadline.py
new file mode 100644
index 00000000..3dab6c8b
--- /dev/null
+++ b/src/square/requests/loyalty_account_expiring_point_deadline.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyAccountExpiringPointDeadlineParams(typing_extensions.TypedDict):
+ """
+ Represents a set of points for a loyalty account that are scheduled to expire on a specific date.
+ """
+
+ points: int
+ """
+ The number of points scheduled to expire at the `expires_at` timestamp.
+ """
+
+ expires_at: str
+ """
+ The timestamp of when the points are scheduled to expire, in RFC 3339 format.
+ """
diff --git a/src/square/requests/loyalty_account_mapping.py b/src/square/requests/loyalty_account_mapping.py
new file mode 100644
index 00000000..7278ca76
--- /dev/null
+++ b/src/square/requests/loyalty_account_mapping.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LoyaltyAccountMappingParams(typing_extensions.TypedDict):
+ """
+ Represents the mapping that associates a loyalty account with a buyer.
+
+ Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see
+ [Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the mapping.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the mapping was created, in RFC 3339 format.
+ """
+
+ phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The phone number of the buyer, in E.164 format. For example, "+14155551111".
+ """
diff --git a/src/square/requests/loyalty_account_updated_event.py b/src/square/requests/loyalty_account_updated_event.py
new file mode 100644
index 00000000..8a20658c
--- /dev/null
+++ b/src/square/requests/loyalty_account_updated_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_account_updated_event_data import LoyaltyAccountUpdatedEventDataParams
+
+
+class LoyaltyAccountUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [loyalty account](entity:LoyaltyAccount) is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `loyalty.account.updated`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LoyaltyAccountUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/loyalty_account_updated_event_data.py b/src/square/requests/loyalty_account_updated_event_data.py
new file mode 100644
index 00000000..e1060350
--- /dev/null
+++ b/src/square/requests/loyalty_account_updated_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_account_updated_event_object import LoyaltyAccountUpdatedEventObjectParams
+
+
+class LoyaltyAccountUpdatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `loyalty.account.updated` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_account`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected loyalty account.
+ """
+
+ object: typing_extensions.NotRequired[LoyaltyAccountUpdatedEventObjectParams]
+ """
+ An object that contains the loyalty account that was updated.
+ """
diff --git a/src/square/requests/loyalty_account_updated_event_object.py b/src/square/requests/loyalty_account_updated_event_object.py
new file mode 100644
index 00000000..806a5fff
--- /dev/null
+++ b/src/square/requests/loyalty_account_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .loyalty_account import LoyaltyAccountParams
+
+
+class LoyaltyAccountUpdatedEventObjectParams(typing_extensions.TypedDict):
+ loyalty_account: typing_extensions.NotRequired[LoyaltyAccountParams]
+ """
+ The loyalty account that was updated.
+ """
diff --git a/src/square/requests/loyalty_event.py b/src/square/requests/loyalty_event.py
new file mode 100644
index 00000000..0ef2fb02
--- /dev/null
+++ b/src/square/requests/loyalty_event.py
@@ -0,0 +1,92 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.loyalty_event_source import LoyaltyEventSource
+from ..types.loyalty_event_type import LoyaltyEventType
+from .loyalty_event_accumulate_points import LoyaltyEventAccumulatePointsParams
+from .loyalty_event_accumulate_promotion_points import LoyaltyEventAccumulatePromotionPointsParams
+from .loyalty_event_adjust_points import LoyaltyEventAdjustPointsParams
+from .loyalty_event_create_reward import LoyaltyEventCreateRewardParams
+from .loyalty_event_delete_reward import LoyaltyEventDeleteRewardParams
+from .loyalty_event_expire_points import LoyaltyEventExpirePointsParams
+from .loyalty_event_other import LoyaltyEventOtherParams
+from .loyalty_event_redeem_reward import LoyaltyEventRedeemRewardParams
+
+
+class LoyaltyEventParams(typing_extensions.TypedDict):
+ """
+ Provides information about a loyalty event.
+ For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the loyalty event.
+ """
+
+ type: typing_extensions.NotRequired[LoyaltyEventType]
+ """
+ The type of the loyalty event.
+ See [LoyaltyEventType](#type-loyaltyeventtype) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the event was created, in RFC 3339 format.
+ """
+
+ accumulate_points: typing_extensions.NotRequired[LoyaltyEventAccumulatePointsParams]
+ """
+ Provides metadata when the event `type` is `ACCUMULATE_POINTS`.
+ """
+
+ create_reward: typing_extensions.NotRequired[LoyaltyEventCreateRewardParams]
+ """
+ Provides metadata when the event `type` is `CREATE_REWARD`.
+ """
+
+ redeem_reward: typing_extensions.NotRequired[LoyaltyEventRedeemRewardParams]
+ """
+ Provides metadata when the event `type` is `REDEEM_REWARD`.
+ """
+
+ delete_reward: typing_extensions.NotRequired[LoyaltyEventDeleteRewardParams]
+ """
+ Provides metadata when the event `type` is `DELETE_REWARD`.
+ """
+
+ adjust_points: typing_extensions.NotRequired[LoyaltyEventAdjustPointsParams]
+ """
+ Provides metadata when the event `type` is `ADJUST_POINTS`.
+ """
+
+ loyalty_account_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [loyalty account](entity:LoyaltyAccount) associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [location](entity:Location) where the event occurred.
+ """
+
+ source: typing_extensions.NotRequired[LoyaltyEventSource]
+ """
+ Defines whether the event was generated by the Square Point of Sale.
+ See [LoyaltyEventSource](#type-loyaltyeventsource) for possible values
+ """
+
+ expire_points: typing_extensions.NotRequired[LoyaltyEventExpirePointsParams]
+ """
+ Provides metadata when the event `type` is `EXPIRE_POINTS`.
+ """
+
+ other_event: typing_extensions.NotRequired[LoyaltyEventOtherParams]
+ """
+ Provides metadata when the event `type` is `OTHER`.
+ """
+
+ accumulate_promotion_points: typing_extensions.NotRequired[LoyaltyEventAccumulatePromotionPointsParams]
+ """
+ Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`.
+ """
diff --git a/src/square/requests/loyalty_event_accumulate_points.py b/src/square/requests/loyalty_event_accumulate_points.py
new file mode 100644
index 00000000..c16bb23d
--- /dev/null
+++ b/src/square/requests/loyalty_event_accumulate_points.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LoyaltyEventAccumulatePointsParams(typing_extensions.TypedDict):
+ """
+ Provides metadata when the event `type` is `ACCUMULATE_POINTS`.
+ """
+
+ loyalty_program_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ points: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The number of points accumulated by the event.
+ """
+
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [order](entity:Order) for which the buyer accumulated the points.
+ This field is returned only if the Orders API is used to process orders.
+ """
diff --git a/src/square/requests/loyalty_event_accumulate_promotion_points.py b/src/square/requests/loyalty_event_accumulate_promotion_points.py
new file mode 100644
index 00000000..7fb6c42e
--- /dev/null
+++ b/src/square/requests/loyalty_event_accumulate_promotion_points.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyEventAccumulatePromotionPointsParams(typing_extensions.TypedDict):
+ """
+ Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`.
+ """
+
+ loyalty_program_id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ loyalty_promotion_id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the [loyalty promotion](entity:LoyaltyPromotion).
+ """
+
+ points: typing_extensions.NotRequired[int]
+ """
+ The number of points earned by the event.
+ """
+
+ order_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [order](entity:Order) for which the buyer earned the promotion points.
+ Only applications that use the Orders API to process orders can trigger this event.
+ """
diff --git a/src/square/requests/loyalty_event_adjust_points.py b/src/square/requests/loyalty_event_adjust_points.py
new file mode 100644
index 00000000..ab68bb57
--- /dev/null
+++ b/src/square/requests/loyalty_event_adjust_points.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LoyaltyEventAdjustPointsParams(typing_extensions.TypedDict):
+ """
+ Provides metadata when the event `type` is `ADJUST_POINTS`.
+ """
+
+ loyalty_program_id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ points: int
+ """
+ The number of points added or removed.
+ """
+
+ reason: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The reason for the adjustment of points.
+ """
diff --git a/src/square/requests/loyalty_event_create_reward.py b/src/square/requests/loyalty_event_create_reward.py
new file mode 100644
index 00000000..a70cce3a
--- /dev/null
+++ b/src/square/requests/loyalty_event_create_reward.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyEventCreateRewardParams(typing_extensions.TypedDict):
+ """
+ Provides metadata when the event `type` is `CREATE_REWARD`.
+ """
+
+ loyalty_program_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ reward_id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the created [loyalty reward](entity:LoyaltyReward).
+ This field is returned only if the event source is `LOYALTY_API`.
+ """
+
+ points: typing_extensions.NotRequired[int]
+ """
+ The loyalty points used to create the reward.
+ """
diff --git a/src/square/requests/loyalty_event_created_event.py b/src/square/requests/loyalty_event_created_event.py
new file mode 100644
index 00000000..48456abd
--- /dev/null
+++ b/src/square/requests/loyalty_event_created_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_event_created_event_data import LoyaltyEventCreatedEventDataParams
+
+
+class LoyaltyEventCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [loyalty event](entity:LoyaltyEvent) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `loyalty.event.created`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LoyaltyEventCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/loyalty_event_created_event_data.py b/src/square/requests/loyalty_event_created_event_data.py
new file mode 100644
index 00000000..a8ad0200
--- /dev/null
+++ b/src/square/requests/loyalty_event_created_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_event_created_event_object import LoyaltyEventCreatedEventObjectParams
+
+
+class LoyaltyEventCreatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `loyalty.event.created` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_event`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected loyalty event.
+ """
+
+ object: typing_extensions.NotRequired[LoyaltyEventCreatedEventObjectParams]
+ """
+ An object that contains the new loyalty event.
+ """
diff --git a/src/square/requests/loyalty_event_created_event_object.py b/src/square/requests/loyalty_event_created_event_object.py
new file mode 100644
index 00000000..071cca1c
--- /dev/null
+++ b/src/square/requests/loyalty_event_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .loyalty_event import LoyaltyEventParams
+
+
+class LoyaltyEventCreatedEventObjectParams(typing_extensions.TypedDict):
+ loyalty_event: typing_extensions.NotRequired[LoyaltyEventParams]
+ """
+ The loyalty event that was created.
+ """
diff --git a/src/square/requests/loyalty_event_date_time_filter.py b/src/square/requests/loyalty_event_date_time_filter.py
new file mode 100644
index 00000000..7847f79e
--- /dev/null
+++ b/src/square/requests/loyalty_event_date_time_filter.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .time_range import TimeRangeParams
+
+
+class LoyaltyEventDateTimeFilterParams(typing_extensions.TypedDict):
+ """
+ Filter events by date time range.
+ """
+
+ created_at: TimeRangeParams
+ """
+ The `created_at` date time range used to filter the result.
+ """
diff --git a/src/square/requests/loyalty_event_delete_reward.py b/src/square/requests/loyalty_event_delete_reward.py
new file mode 100644
index 00000000..04f5161b
--- /dev/null
+++ b/src/square/requests/loyalty_event_delete_reward.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyEventDeleteRewardParams(typing_extensions.TypedDict):
+ """
+ Provides metadata when the event `type` is `DELETE_REWARD`.
+ """
+
+ loyalty_program_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ reward_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the deleted [loyalty reward](entity:LoyaltyReward).
+ This field is returned only if the event source is `LOYALTY_API`.
+ """
+
+ points: typing_extensions.NotRequired[int]
+ """
+ The number of points returned to the loyalty account.
+ """
diff --git a/src/square/requests/loyalty_event_expire_points.py b/src/square/requests/loyalty_event_expire_points.py
new file mode 100644
index 00000000..5b555c59
--- /dev/null
+++ b/src/square/requests/loyalty_event_expire_points.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyEventExpirePointsParams(typing_extensions.TypedDict):
+ """
+ Provides metadata when the event `type` is `EXPIRE_POINTS`.
+ """
+
+ loyalty_program_id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ points: int
+ """
+ The number of points expired.
+ """
diff --git a/src/square/requests/loyalty_event_filter.py b/src/square/requests/loyalty_event_filter.py
new file mode 100644
index 00000000..777c0046
--- /dev/null
+++ b/src/square/requests/loyalty_event_filter.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .loyalty_event_date_time_filter import LoyaltyEventDateTimeFilterParams
+from .loyalty_event_location_filter import LoyaltyEventLocationFilterParams
+from .loyalty_event_loyalty_account_filter import LoyaltyEventLoyaltyAccountFilterParams
+from .loyalty_event_order_filter import LoyaltyEventOrderFilterParams
+from .loyalty_event_type_filter import LoyaltyEventTypeFilterParams
+
+
+class LoyaltyEventFilterParams(typing_extensions.TypedDict):
+ """
+ The filtering criteria. If the request specifies multiple filters,
+ the endpoint uses a logical AND to evaluate them.
+ """
+
+ loyalty_account_filter: typing_extensions.NotRequired[LoyaltyEventLoyaltyAccountFilterParams]
+ """
+ Filter events by loyalty account.
+ """
+
+ type_filter: typing_extensions.NotRequired[LoyaltyEventTypeFilterParams]
+ """
+ Filter events by event type.
+ """
+
+ date_time_filter: typing_extensions.NotRequired[LoyaltyEventDateTimeFilterParams]
+ """
+ Filter events by date time range.
+ For each range, the start time is inclusive and the end time
+ is exclusive.
+ """
+
+ location_filter: typing_extensions.NotRequired[LoyaltyEventLocationFilterParams]
+ """
+ Filter events by location.
+ """
+
+ order_filter: typing_extensions.NotRequired[LoyaltyEventOrderFilterParams]
+ """
+ Filter events by the order associated with the event.
+ """
diff --git a/src/square/requests/loyalty_event_location_filter.py b/src/square/requests/loyalty_event_location_filter.py
new file mode 100644
index 00000000..fd63baa4
--- /dev/null
+++ b/src/square/requests/loyalty_event_location_filter.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LoyaltyEventLocationFilterParams(typing_extensions.TypedDict):
+ """
+ Filter events by location.
+ """
+
+ location_ids: typing.Sequence[str]
+ """
+ The [location](entity:Location) IDs for loyalty events to query.
+ If multiple values are specified, the endpoint uses
+ a logical OR to combine them.
+ """
diff --git a/src/square/requests/loyalty_event_loyalty_account_filter.py b/src/square/requests/loyalty_event_loyalty_account_filter.py
new file mode 100644
index 00000000..36f356f2
--- /dev/null
+++ b/src/square/requests/loyalty_event_loyalty_account_filter.py
@@ -0,0 +1,14 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyEventLoyaltyAccountFilterParams(typing_extensions.TypedDict):
+ """
+ Filter events by loyalty account.
+ """
+
+ loyalty_account_id: str
+ """
+ The ID of the [loyalty account](entity:LoyaltyAccount) associated with loyalty events.
+ """
diff --git a/src/square/requests/loyalty_event_order_filter.py b/src/square/requests/loyalty_event_order_filter.py
new file mode 100644
index 00000000..456381d4
--- /dev/null
+++ b/src/square/requests/loyalty_event_order_filter.py
@@ -0,0 +1,14 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyEventOrderFilterParams(typing_extensions.TypedDict):
+ """
+ Filter events by the order associated with the event.
+ """
+
+ order_id: str
+ """
+ The ID of the [order](entity:Order) associated with the event.
+ """
diff --git a/src/square/requests/loyalty_event_other.py b/src/square/requests/loyalty_event_other.py
new file mode 100644
index 00000000..e4d7d7a4
--- /dev/null
+++ b/src/square/requests/loyalty_event_other.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyEventOtherParams(typing_extensions.TypedDict):
+ """
+ Provides metadata when the event `type` is `OTHER`.
+ """
+
+ loyalty_program_id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ points: int
+ """
+ The number of points added or removed.
+ """
diff --git a/src/square/requests/loyalty_event_query.py b/src/square/requests/loyalty_event_query.py
new file mode 100644
index 00000000..77e16021
--- /dev/null
+++ b/src/square/requests/loyalty_event_query.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .loyalty_event_filter import LoyaltyEventFilterParams
+
+
+class LoyaltyEventQueryParams(typing_extensions.TypedDict):
+ """
+ Represents a query used to search for loyalty events.
+ """
+
+ filter: typing_extensions.NotRequired[LoyaltyEventFilterParams]
+ """
+ The query filter criteria.
+ """
diff --git a/src/square/requests/loyalty_event_redeem_reward.py b/src/square/requests/loyalty_event_redeem_reward.py
new file mode 100644
index 00000000..af5c657c
--- /dev/null
+++ b/src/square/requests/loyalty_event_redeem_reward.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyEventRedeemRewardParams(typing_extensions.TypedDict):
+ """
+ Provides metadata when the event `type` is `REDEEM_REWARD`.
+ """
+
+ loyalty_program_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ reward_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the redeemed [loyalty reward](entity:LoyaltyReward).
+ This field is returned only if the event source is `LOYALTY_API`.
+ """
+
+ order_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [order](entity:Order) that redeemed the reward.
+ This field is returned only if the Orders API is used to process orders.
+ """
diff --git a/src/square/requests/loyalty_event_type_filter.py b/src/square/requests/loyalty_event_type_filter.py
new file mode 100644
index 00000000..918b5a8a
--- /dev/null
+++ b/src/square/requests/loyalty_event_type_filter.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.loyalty_event_type import LoyaltyEventType
+
+
+class LoyaltyEventTypeFilterParams(typing_extensions.TypedDict):
+ """
+ Filter events by event type.
+ """
+
+ types: typing.Sequence[LoyaltyEventType]
+ """
+ The loyalty event types used to filter the result.
+ If multiple values are specified, the endpoint uses a
+ logical OR to combine them.
+ See [LoyaltyEventType](#type-loyaltyeventtype) for possible values
+ """
diff --git a/src/square/requests/loyalty_program.py b/src/square/requests/loyalty_program.py
new file mode 100644
index 00000000..2f1bd7cd
--- /dev/null
+++ b/src/square/requests/loyalty_program.py
@@ -0,0 +1,67 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.loyalty_program_status import LoyaltyProgramStatus
+from .loyalty_program_accrual_rule import LoyaltyProgramAccrualRuleParams
+from .loyalty_program_expiration_policy import LoyaltyProgramExpirationPolicyParams
+from .loyalty_program_reward_tier import LoyaltyProgramRewardTierParams
+from .loyalty_program_terminology import LoyaltyProgramTerminologyParams
+
+
+class LoyaltyProgramParams(typing_extensions.TypedDict):
+ """
+ Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards.
+ Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard.
+ For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the loyalty program. Updates to
+ the loyalty program do not modify the identifier.
+ """
+
+ status: typing_extensions.NotRequired[LoyaltyProgramStatus]
+ """
+ Whether the program is currently active.
+ See [LoyaltyProgramStatus](#type-loyaltyprogramstatus) for possible values
+ """
+
+ reward_tiers: typing_extensions.NotRequired[typing.Optional[typing.Sequence[LoyaltyProgramRewardTierParams]]]
+ """
+ The list of rewards for buyers, sorted by ascending points.
+ """
+
+ expiration_policy: typing_extensions.NotRequired[LoyaltyProgramExpirationPolicyParams]
+ """
+ If present, details for how points expire.
+ """
+
+ terminology: typing_extensions.NotRequired[LoyaltyProgramTerminologyParams]
+ """
+ A cosmetic name for the “points” currency.
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The [locations](entity:Location) at which the program is active.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the program was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the reward was last updated, in RFC 3339 format.
+ """
+
+ accrual_rules: typing_extensions.NotRequired[typing.Optional[typing.Sequence[LoyaltyProgramAccrualRuleParams]]]
+ """
+ Defines how buyers can earn loyalty points from the base loyalty program.
+ To check for associated [loyalty promotions](entity:LoyaltyPromotion) that enable
+ buyers to earn extra points, call [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions).
+ """
diff --git a/src/square/requests/loyalty_program_accrual_rule.py b/src/square/requests/loyalty_program_accrual_rule.py
new file mode 100644
index 00000000..dbbc5f89
--- /dev/null
+++ b/src/square/requests/loyalty_program_accrual_rule.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.loyalty_program_accrual_rule_type import LoyaltyProgramAccrualRuleType
+from .loyalty_program_accrual_rule_category_data import LoyaltyProgramAccrualRuleCategoryDataParams
+from .loyalty_program_accrual_rule_item_variation_data import LoyaltyProgramAccrualRuleItemVariationDataParams
+from .loyalty_program_accrual_rule_spend_data import LoyaltyProgramAccrualRuleSpendDataParams
+from .loyalty_program_accrual_rule_visit_data import LoyaltyProgramAccrualRuleVisitDataParams
+
+
+class LoyaltyProgramAccrualRuleParams(typing_extensions.TypedDict):
+ """
+ Represents an accrual rule, which defines how buyers can earn points from the base [loyalty program](entity:LoyaltyProgram).
+ """
+
+ accrual_type: LoyaltyProgramAccrualRuleType
+ """
+ The type of the accrual rule that defines how buyers can earn points.
+ See [LoyaltyProgramAccrualRuleType](#type-loyaltyprogramaccrualruletype) for possible values
+ """
+
+ points: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The number of points that
+ buyers earn based on the `accrual_type`.
+ """
+
+ visit_data: typing_extensions.NotRequired[LoyaltyProgramAccrualRuleVisitDataParams]
+ """
+ Additional data for rules with the `VISIT` accrual type.
+ """
+
+ spend_data: typing_extensions.NotRequired[LoyaltyProgramAccrualRuleSpendDataParams]
+ """
+ Additional data for rules with the `SPEND` accrual type.
+ """
+
+ item_variation_data: typing_extensions.NotRequired[LoyaltyProgramAccrualRuleItemVariationDataParams]
+ """
+ Additional data for rules with the `ITEM_VARIATION` accrual type.
+ """
+
+ category_data: typing_extensions.NotRequired[LoyaltyProgramAccrualRuleCategoryDataParams]
+ """
+ Additional data for rules with the `CATEGORY` accrual type.
+ """
diff --git a/src/square/requests/loyalty_program_accrual_rule_category_data.py b/src/square/requests/loyalty_program_accrual_rule_category_data.py
new file mode 100644
index 00000000..a3caa89d
--- /dev/null
+++ b/src/square/requests/loyalty_program_accrual_rule_category_data.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyProgramAccrualRuleCategoryDataParams(typing_extensions.TypedDict):
+ """
+ Represents additional data for rules with the `CATEGORY` accrual type.
+ """
+
+ category_id: str
+ """
+ The ID of the `CATEGORY` [catalog object](entity:CatalogObject) that buyers can purchase to earn
+ points.
+ """
diff --git a/src/square/requests/loyalty_program_accrual_rule_item_variation_data.py b/src/square/requests/loyalty_program_accrual_rule_item_variation_data.py
new file mode 100644
index 00000000..2a1b2103
--- /dev/null
+++ b/src/square/requests/loyalty_program_accrual_rule_item_variation_data.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyProgramAccrualRuleItemVariationDataParams(typing_extensions.TypedDict):
+ """
+ Represents additional data for rules with the `ITEM_VARIATION` accrual type.
+ """
+
+ item_variation_id: str
+ """
+ The ID of the `ITEM_VARIATION` [catalog object](entity:CatalogObject) that buyers can purchase to earn
+ points.
+ """
diff --git a/src/square/requests/loyalty_program_accrual_rule_spend_data.py b/src/square/requests/loyalty_program_accrual_rule_spend_data.py
new file mode 100644
index 00000000..146d1d91
--- /dev/null
+++ b/src/square/requests/loyalty_program_accrual_rule_spend_data.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.loyalty_program_accrual_rule_tax_mode import LoyaltyProgramAccrualRuleTaxMode
+from .money import MoneyParams
+
+
+class LoyaltyProgramAccrualRuleSpendDataParams(typing_extensions.TypedDict):
+ """
+ Represents additional data for rules with the `SPEND` accrual type.
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount that buyers must spend to earn points.
+ For example, given an "Earn 1 point for every $10 spent" accrual rule, a buyer who spends $105 earns 10 points.
+ """
+
+ excluded_category_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of any `CATEGORY` catalog objects that are excluded from points accrual.
+
+ You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects)
+ endpoint to retrieve information about the excluded categories.
+ """
+
+ excluded_item_variation_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of any `ITEM_VARIATION` catalog objects that are excluded from points accrual.
+
+ You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects)
+ endpoint to retrieve information about the excluded item variations.
+ """
+
+ tax_mode: LoyaltyProgramAccrualRuleTaxMode
+ """
+ Indicates how taxes should be treated when calculating the purchase amount used for points accrual.
+ See [LoyaltyProgramAccrualRuleTaxMode](#type-loyaltyprogramaccrualruletaxmode) for possible values
+ """
diff --git a/src/square/requests/loyalty_program_accrual_rule_visit_data.py b/src/square/requests/loyalty_program_accrual_rule_visit_data.py
new file mode 100644
index 00000000..2d685af3
--- /dev/null
+++ b/src/square/requests/loyalty_program_accrual_rule_visit_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.loyalty_program_accrual_rule_tax_mode import LoyaltyProgramAccrualRuleTaxMode
+from .money import MoneyParams
+
+
+class LoyaltyProgramAccrualRuleVisitDataParams(typing_extensions.TypedDict):
+ """
+ Represents additional data for rules with the `VISIT` accrual type.
+ """
+
+ minimum_amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The minimum purchase required during the visit to quality for points.
+ """
+
+ tax_mode: LoyaltyProgramAccrualRuleTaxMode
+ """
+ Indicates how taxes should be treated when calculating the purchase amount to determine whether the visit qualifies for points.
+ This setting applies only if `minimum_amount_money` is specified.
+ See [LoyaltyProgramAccrualRuleTaxMode](#type-loyaltyprogramaccrualruletaxmode) for possible values
+ """
diff --git a/src/square/requests/loyalty_program_created_event.py b/src/square/requests/loyalty_program_created_event.py
new file mode 100644
index 00000000..f783a77f
--- /dev/null
+++ b/src/square/requests/loyalty_program_created_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_program_created_event_data import LoyaltyProgramCreatedEventDataParams
+
+
+class LoyaltyProgramCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [loyalty program](entity:LoyaltyProgram) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `loyalty.program.created`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LoyaltyProgramCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/loyalty_program_created_event_data.py b/src/square/requests/loyalty_program_created_event_data.py
new file mode 100644
index 00000000..132d6a59
--- /dev/null
+++ b/src/square/requests/loyalty_program_created_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_program_created_event_object import LoyaltyProgramCreatedEventObjectParams
+
+
+class LoyaltyProgramCreatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `loyalty.program.created` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_program`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the created loyalty program.
+ """
+
+ object: typing_extensions.NotRequired[LoyaltyProgramCreatedEventObjectParams]
+ """
+ An object that contains the loyalty program that was created.
+ """
diff --git a/src/square/requests/loyalty_program_created_event_object.py b/src/square/requests/loyalty_program_created_event_object.py
new file mode 100644
index 00000000..608ae5be
--- /dev/null
+++ b/src/square/requests/loyalty_program_created_event_object.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .loyalty_program import LoyaltyProgramParams
+
+
+class LoyaltyProgramCreatedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the loyalty program associated with a `loyalty.program.created` event.
+ """
+
+ loyalty_program: typing_extensions.NotRequired[LoyaltyProgramParams]
+ """
+ The loyalty program that was created.
+ """
diff --git a/src/square/requests/loyalty_program_expiration_policy.py b/src/square/requests/loyalty_program_expiration_policy.py
new file mode 100644
index 00000000..749a1b78
--- /dev/null
+++ b/src/square/requests/loyalty_program_expiration_policy.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyProgramExpirationPolicyParams(typing_extensions.TypedDict):
+ """
+ Describes when the loyalty program expires.
+ """
+
+ expiration_duration: str
+ """
+ The number of months before points expire, in `P[n]M` RFC 3339 duration format. For example, a value of `P12M` represents a duration of 12 months.
+ Points are valid through the last day of the month in which they are scheduled to expire. For example, with a `P12M` duration, points earned on July 6, 2020 expire on August 1, 2021.
+ """
diff --git a/src/square/requests/loyalty_program_reward_tier.py b/src/square/requests/loyalty_program_reward_tier.py
new file mode 100644
index 00000000..92304d14
--- /dev/null
+++ b/src/square/requests/loyalty_program_reward_tier.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .catalog_object_reference import CatalogObjectReferenceParams
+
+
+class LoyaltyProgramRewardTierParams(typing_extensions.TypedDict):
+ """
+ Represents a reward tier in a loyalty program. A reward tier defines how buyers can redeem points for a reward, such as the number of points required and the value and scope of the discount. A loyalty program can offer multiple reward tiers.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the reward tier.
+ """
+
+ points: int
+ """
+ The points exchanged for the reward tier.
+ """
+
+ name: typing_extensions.NotRequired[str]
+ """
+ The name of the reward tier.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the reward tier was created, in RFC 3339 format.
+ """
+
+ pricing_rule_reference: CatalogObjectReferenceParams
+ """
+ A reference to the specific version of a `PRICING_RULE` catalog object that contains information about the reward tier discount.
+
+ Use `object_id` and `catalog_version` with the [RetrieveCatalogObject](api-endpoint:Catalog-RetrieveCatalogObject) endpoint
+ to get discount details. Make sure to set `include_related_objects` to true in the request to retrieve all catalog objects
+ that define the discount. For more information, see [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details).
+ """
diff --git a/src/square/requests/loyalty_program_terminology.py b/src/square/requests/loyalty_program_terminology.py
new file mode 100644
index 00000000..7b238ffa
--- /dev/null
+++ b/src/square/requests/loyalty_program_terminology.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyProgramTerminologyParams(typing_extensions.TypedDict):
+ """
+ Represents the naming used for loyalty points.
+ """
+
+ one: str
+ """
+ A singular unit for a point (for example, 1 point is called 1 star).
+ """
+
+ other: str
+ """
+ A plural unit for point (for example, 10 points is called 10 stars).
+ """
diff --git a/src/square/requests/loyalty_program_updated_event.py b/src/square/requests/loyalty_program_updated_event.py
new file mode 100644
index 00000000..9376645c
--- /dev/null
+++ b/src/square/requests/loyalty_program_updated_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_program_updated_event_data import LoyaltyProgramUpdatedEventDataParams
+
+
+class LoyaltyProgramUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [loyalty program](entity:LoyaltyProgram) is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `loyalty.program.updated`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LoyaltyProgramUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/loyalty_program_updated_event_data.py b/src/square/requests/loyalty_program_updated_event_data.py
new file mode 100644
index 00000000..d437979f
--- /dev/null
+++ b/src/square/requests/loyalty_program_updated_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_program_updated_event_object import LoyaltyProgramUpdatedEventObjectParams
+
+
+class LoyaltyProgramUpdatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `loyalty.program.updated` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_program`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected loyalty program.
+ """
+
+ object: typing_extensions.NotRequired[LoyaltyProgramUpdatedEventObjectParams]
+ """
+ An object that contains the loyalty program that was updated.
+ """
diff --git a/src/square/requests/loyalty_program_updated_event_object.py b/src/square/requests/loyalty_program_updated_event_object.py
new file mode 100644
index 00000000..41d5c1cf
--- /dev/null
+++ b/src/square/requests/loyalty_program_updated_event_object.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .loyalty_program import LoyaltyProgramParams
+
+
+class LoyaltyProgramUpdatedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the loyalty program associated with a `loyalty.program.updated` event.
+ """
+
+ loyalty_program: typing_extensions.NotRequired[LoyaltyProgramParams]
+ """
+ The loyalty program that was updated.
+ """
diff --git a/src/square/requests/loyalty_promotion.py b/src/square/requests/loyalty_promotion.py
new file mode 100644
index 00000000..870b49ca
--- /dev/null
+++ b/src/square/requests/loyalty_promotion.py
@@ -0,0 +1,99 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.loyalty_promotion_status import LoyaltyPromotionStatus
+from .loyalty_promotion_available_time_data import LoyaltyPromotionAvailableTimeDataParams
+from .loyalty_promotion_incentive import LoyaltyPromotionIncentiveParams
+from .loyalty_promotion_trigger_limit import LoyaltyPromotionTriggerLimitParams
+from .money import MoneyParams
+
+
+class LoyaltyPromotionParams(typing_extensions.TypedDict):
+ """
+ Represents a promotion for a [loyalty program](entity:LoyaltyProgram). Loyalty promotions enable buyers
+ to earn extra points on top of those earned from the base program.
+
+ A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the promotion.
+ """
+
+ name: str
+ """
+ The name of the promotion.
+ """
+
+ incentive: LoyaltyPromotionIncentiveParams
+ """
+ The points incentive for the promotion. This field defines whether promotion points
+ are earned by multiplying base program points or by adding a specified number of points.
+ """
+
+ available_time: LoyaltyPromotionAvailableTimeDataParams
+ """
+ The scheduling information that defines when purchases can qualify to earn points from an `ACTIVE` promotion.
+ """
+
+ trigger_limit: typing_extensions.NotRequired[LoyaltyPromotionTriggerLimitParams]
+ """
+ The number of times a buyer can earn promotion points during a specified interval.
+ If not specified, buyers can trigger the promotion an unlimited number of times.
+ """
+
+ status: typing_extensions.NotRequired[LoyaltyPromotionStatus]
+ """
+ The current status of the promotion.
+ See [LoyaltyPromotionStatus](#type-loyaltypromotionstatus) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the promotion was created, in RFC 3339 format.
+ """
+
+ canceled_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the promotion was canceled, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the promotion was last updated, in RFC 3339 format.
+ """
+
+ loyalty_program_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [loyalty program](entity:LoyaltyProgram) associated with the promotion.
+ """
+
+ minimum_spend_amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The minimum purchase amount required to earn promotion points. If specified, this amount is positive.
+ """
+
+ qualifying_item_variation_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of any qualifying `ITEM_VARIATION` [catalog objects](entity:CatalogObject). If specified,
+ the purchase must include at least one of these items to qualify for the promotion.
+
+ This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule.
+ With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded.
+
+ You can specify `qualifying_item_variation_ids` or `qualifying_category_ids` for a given promotion, but not both.
+ """
+
+ qualifying_category_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The IDs of any qualifying `CATEGORY` [catalog objects](entity:CatalogObject). If specified,
+ the purchase must include at least one item from one of these categories to qualify for the promotion.
+
+ This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule.
+ With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded.
+
+ You can specify `qualifying_category_ids` or `qualifying_item_variation_ids` for a promotion, but not both.
+ """
diff --git a/src/square/requests/loyalty_promotion_available_time_data.py b/src/square/requests/loyalty_promotion_available_time_data.py
new file mode 100644
index 00000000..38cb0194
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_available_time_data.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LoyaltyPromotionAvailableTimeDataParams(typing_extensions.TypedDict):
+ """
+ Represents scheduling information that determines when purchases can qualify to earn points
+ from a [loyalty promotion](entity:LoyaltyPromotion).
+ """
+
+ start_date: typing_extensions.NotRequired[str]
+ """
+ The date that the promotion starts, in `YYYY-MM-DD` format. Square populates this field
+ based on the provided `time_periods`.
+ """
+
+ end_date: typing_extensions.NotRequired[str]
+ """
+ The date that the promotion ends, in `YYYY-MM-DD` format. Square populates this field
+ based on the provided `time_periods`. If an end date is not specified, an `ACTIVE` promotion
+ remains available until it is canceled.
+ """
+
+ time_periods: typing.Sequence[str]
+ """
+ A list of [iCalendar (RFC 5545) events](https://tools.ietf.org/html/rfc5545#section-3.6.1)
+ (`VEVENT`). Each event represents an available time period per day or days of the week.
+ A day can have a maximum of one available time period.
+
+ Only `DTSTART`, `DURATION`, and `RRULE` are supported. `DTSTART` and `DURATION` are required and
+ timestamps must be in local (unzoned) time format. Include `RRULE` to specify recurring promotions,
+ an end date (using the `UNTIL` keyword), or both. For more information, see
+ [Available time](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#available-time).
+
+ Note that `BEGIN:VEVENT` and `END:VEVENT` are optional in a `CreateLoyaltyPromotion` request
+ but are always included in the response.
+ """
diff --git a/src/square/requests/loyalty_promotion_created_event.py b/src/square/requests/loyalty_promotion_created_event.py
new file mode 100644
index 00000000..c9b2a639
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_created_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_promotion_created_event_data import LoyaltyPromotionCreatedEventDataParams
+
+
+class LoyaltyPromotionCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [loyalty promotion](entity:LoyaltyPromotion) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `loyalty.promotion.created`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LoyaltyPromotionCreatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/loyalty_promotion_created_event_data.py b/src/square/requests/loyalty_promotion_created_event_data.py
new file mode 100644
index 00000000..6efd8546
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_created_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_promotion_created_event_object import LoyaltyPromotionCreatedEventObjectParams
+
+
+class LoyaltyPromotionCreatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `loyalty.promotion.created` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_promotion`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected loyalty promotion.
+ """
+
+ object: typing_extensions.NotRequired[LoyaltyPromotionCreatedEventObjectParams]
+ """
+ An object that contains the loyalty promotion that was created.
+ """
diff --git a/src/square/requests/loyalty_promotion_created_event_object.py b/src/square/requests/loyalty_promotion_created_event_object.py
new file mode 100644
index 00000000..dab483ba
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_created_event_object.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .loyalty_promotion import LoyaltyPromotionParams
+
+
+class LoyaltyPromotionCreatedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the loyalty promotion associated with a `loyalty.promotion.created` event.
+ """
+
+ loyalty_promotion: typing_extensions.NotRequired[LoyaltyPromotionParams]
+ """
+ The loyalty promotion that was created.
+ """
diff --git a/src/square/requests/loyalty_promotion_incentive.py b/src/square/requests/loyalty_promotion_incentive.py
new file mode 100644
index 00000000..8fb74946
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_incentive.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.loyalty_promotion_incentive_type import LoyaltyPromotionIncentiveType
+from .loyalty_promotion_incentive_points_addition_data import LoyaltyPromotionIncentivePointsAdditionDataParams
+from .loyalty_promotion_incentive_points_multiplier_data import LoyaltyPromotionIncentivePointsMultiplierDataParams
+
+
+class LoyaltyPromotionIncentiveParams(typing_extensions.TypedDict):
+ """
+ Represents how points for a [loyalty promotion](entity:LoyaltyPromotion) are calculated,
+ either by multiplying the points earned from the base program or by adding a specified number
+ of points to the points earned from the base program.
+ """
+
+ type: LoyaltyPromotionIncentiveType
+ """
+ The type of points incentive.
+ See [LoyaltyPromotionIncentiveType](#type-loyaltypromotionincentivetype) for possible values
+ """
+
+ points_multiplier_data: typing_extensions.NotRequired[LoyaltyPromotionIncentivePointsMultiplierDataParams]
+ """
+ Additional data for a `POINTS_MULTIPLIER` incentive type.
+ """
+
+ points_addition_data: typing_extensions.NotRequired[LoyaltyPromotionIncentivePointsAdditionDataParams]
+ """
+ Additional data for a `POINTS_ADDITION` incentive type.
+ """
diff --git a/src/square/requests/loyalty_promotion_incentive_points_addition_data.py b/src/square/requests/loyalty_promotion_incentive_points_addition_data.py
new file mode 100644
index 00000000..e2362e00
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_incentive_points_addition_data.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class LoyaltyPromotionIncentivePointsAdditionDataParams(typing_extensions.TypedDict):
+ """
+ Represents the metadata for a `POINTS_ADDITION` type of [loyalty promotion incentive](entity:LoyaltyPromotionIncentive).
+ """
+
+ points_addition: int
+ """
+ The number of additional points to earn each time the promotion is triggered. For example,
+ suppose a purchase qualifies for 5 points from the base loyalty program. If the purchase also
+ qualifies for a `POINTS_ADDITION` promotion incentive with a `points_addition` of 3, the buyer
+ earns a total of 8 points (5 program points + 3 promotion points = 8 points).
+ """
diff --git a/src/square/requests/loyalty_promotion_incentive_points_multiplier_data.py b/src/square/requests/loyalty_promotion_incentive_points_multiplier_data.py
new file mode 100644
index 00000000..48323fd7
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_incentive_points_multiplier_data.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class LoyaltyPromotionIncentivePointsMultiplierDataParams(typing_extensions.TypedDict):
+ """
+ Represents the metadata for a `POINTS_MULTIPLIER` type of [loyalty promotion incentive](entity:LoyaltyPromotionIncentive).
+ """
+
+ points_multiplier: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The multiplier used to calculate the number of points earned each time the promotion
+ is triggered. For example, suppose a purchase qualifies for 5 points from the base loyalty program.
+ If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a `points_multiplier`
+ of 3, the buyer earns a total of 15 points (5 program points x 3 promotion multiplier = 15 points).
+
+ DEPRECATED at version 2023-08-16. Replaced by the `multiplier` field.
+
+ One of the following is required when specifying a points multiplier:
+ - (Recommended) The `multiplier` field.
+ - This deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier`
+ with the equivalent value.
+ """
+
+ multiplier: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The multiplier used to calculate the number of points earned each time the promotion is triggered,
+ specified as a string representation of a decimal. Square supports multipliers up to 10x, with three
+ point precision for decimal multipliers. For example, suppose a purchase qualifies for 4 points from the
+ base loyalty program. If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a
+ `multiplier` of "1.5", the buyer earns a total of 6 points (4 program points x 1.5 promotion multiplier = 6 points).
+ Fractional points are dropped.
+
+ One of the following is required when specifying a points multiplier:
+ - (Recommended) This `multiplier` field.
+ - The deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier`
+ with the equivalent value.
+ """
diff --git a/src/square/requests/loyalty_promotion_trigger_limit.py b/src/square/requests/loyalty_promotion_trigger_limit.py
new file mode 100644
index 00000000..62cff443
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_trigger_limit.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.loyalty_promotion_trigger_limit_interval import LoyaltyPromotionTriggerLimitInterval
+
+
+class LoyaltyPromotionTriggerLimitParams(typing_extensions.TypedDict):
+ """
+ Represents the number of times a buyer can earn points during a [loyalty promotion](entity:LoyaltyPromotion).
+ If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during
+ the time that the promotion is available.
+
+ A purchase that is disqualified from earning points because of this limit might qualify for another active promotion.
+ """
+
+ times: int
+ """
+ The maximum number of times a buyer can trigger the promotion during the specified `interval`.
+ """
+
+ interval: typing_extensions.NotRequired[LoyaltyPromotionTriggerLimitInterval]
+ """
+ The time period the limit applies to.
+ See [LoyaltyPromotionTriggerLimitInterval](#type-loyaltypromotiontriggerlimitinterval) for possible values
+ """
diff --git a/src/square/requests/loyalty_promotion_updated_event.py b/src/square/requests/loyalty_promotion_updated_event.py
new file mode 100644
index 00000000..01103680
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_promotion_updated_event_data import LoyaltyPromotionUpdatedEventDataParams
+
+
+class LoyaltyPromotionUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [loyalty promotion](entity:LoyaltyPromotion) is updated. This event is
+ invoked only when a loyalty promotion is canceled.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event. For this event, the value is `loyalty.promotion.updated`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[LoyaltyPromotionUpdatedEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/loyalty_promotion_updated_event_data.py b/src/square/requests/loyalty_promotion_updated_event_data.py
new file mode 100644
index 00000000..0611d57a
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_updated_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_promotion_updated_event_object import LoyaltyPromotionUpdatedEventObjectParams
+
+
+class LoyaltyPromotionUpdatedEventDataParams(typing_extensions.TypedDict):
+ """
+ The data associated with a `loyalty.promotion.updated` event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_promotion`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the affected loyalty promotion.
+ """
+
+ object: typing_extensions.NotRequired[LoyaltyPromotionUpdatedEventObjectParams]
+ """
+ An object that contains the loyalty promotion that was updated.
+ """
diff --git a/src/square/requests/loyalty_promotion_updated_event_object.py b/src/square/requests/loyalty_promotion_updated_event_object.py
new file mode 100644
index 00000000..d64cecd2
--- /dev/null
+++ b/src/square/requests/loyalty_promotion_updated_event_object.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .loyalty_promotion import LoyaltyPromotionParams
+
+
+class LoyaltyPromotionUpdatedEventObjectParams(typing_extensions.TypedDict):
+ """
+ An object that contains the loyalty promotion associated with a `loyalty.promotion.updated` event.
+ """
+
+ loyalty_promotion: typing_extensions.NotRequired[LoyaltyPromotionParams]
+ """
+ The loyalty promotion that was updated.
+ """
diff --git a/src/square/requests/loyalty_reward.py b/src/square/requests/loyalty_reward.py
new file mode 100644
index 00000000..6a2f8db8
--- /dev/null
+++ b/src/square/requests/loyalty_reward.py
@@ -0,0 +1,59 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.loyalty_reward_status import LoyaltyRewardStatus
+
+
+class LoyaltyRewardParams(typing_extensions.TypedDict):
+ """
+ Represents a contract to redeem loyalty points for a [reward tier](entity:LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state.
+ For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the loyalty reward.
+ """
+
+ status: typing_extensions.NotRequired[LoyaltyRewardStatus]
+ """
+ The status of a loyalty reward.
+ See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values
+ """
+
+ loyalty_account_id: str
+ """
+ The Square-assigned ID of the [loyalty account](entity:LoyaltyAccount) to which the reward belongs.
+ """
+
+ reward_tier_id: str
+ """
+ The Square-assigned ID of the [reward tier](entity:LoyaltyProgramRewardTier) used to create the reward.
+ """
+
+ points: typing_extensions.NotRequired[int]
+ """
+ The number of loyalty points used for the reward.
+ """
+
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-assigned ID of the [order](entity:Order) to which the reward is attached.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the reward was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the reward was last updated, in RFC 3339 format.
+ """
+
+ redeemed_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the reward was redeemed, in RFC 3339 format.
+ """
diff --git a/src/square/requests/measure.py b/src/square/requests/measure.py
new file mode 100644
index 00000000..e1fb6c1f
--- /dev/null
+++ b/src/square/requests/measure.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from .format import FormatParams
+from .format_description import FormatDescriptionParams
+
+
+class MeasureParams(typing_extensions.TypedDict):
+ name: str
+ title: typing_extensions.NotRequired[str]
+ short_title: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="shortTitle")]]
+ description: typing_extensions.NotRequired[str]
+ type: str
+ agg_type: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="aggType")]]
+ meta: typing_extensions.NotRequired[typing.Dict[str, typing.Any]]
+ format: typing_extensions.NotRequired[FormatParams]
+ format_description: typing_extensions.NotRequired[
+ typing_extensions.Annotated[FormatDescriptionParams, FieldMetadata(alias="formatDescription")]
+ ]
+ currency: typing_extensions.NotRequired[str]
+ """
+ ISO 4217 currency code in uppercase (3 characters, e.g. USD, EUR)
+ """
+
+ alias_member: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="aliasMember")]]
+ """
+ When measure is defined in View, it keeps the original path: Cube.measure
+ """
diff --git a/src/square/requests/measurement_unit.py b/src/square/requests/measurement_unit.py
new file mode 100644
index 00000000..3909e47a
--- /dev/null
+++ b/src/square/requests/measurement_unit.py
@@ -0,0 +1,67 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.measurement_unit_area import MeasurementUnitArea
+from ..types.measurement_unit_generic import MeasurementUnitGeneric
+from ..types.measurement_unit_length import MeasurementUnitLength
+from ..types.measurement_unit_time import MeasurementUnitTime
+from ..types.measurement_unit_unit_type import MeasurementUnitUnitType
+from ..types.measurement_unit_volume import MeasurementUnitVolume
+from ..types.measurement_unit_weight import MeasurementUnitWeight
+from .measurement_unit_custom import MeasurementUnitCustomParams
+
+
+class MeasurementUnitParams(typing_extensions.TypedDict):
+ """
+ Represents a unit of measurement to use with a quantity, such as ounces
+ or inches. Exactly one of the following fields are required: `custom_unit`,
+ `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`.
+ """
+
+ custom_unit: typing_extensions.NotRequired[MeasurementUnitCustomParams]
+ """
+ A custom unit of measurement defined by the seller using the Point of Sale
+ app or ad-hoc as an order line item.
+ """
+
+ area_unit: typing_extensions.NotRequired[MeasurementUnitArea]
+ """
+ Represents a standard area unit.
+ See [MeasurementUnitArea](#type-measurementunitarea) for possible values
+ """
+
+ length_unit: typing_extensions.NotRequired[MeasurementUnitLength]
+ """
+ Represents a standard length unit.
+ See [MeasurementUnitLength](#type-measurementunitlength) for possible values
+ """
+
+ volume_unit: typing_extensions.NotRequired[MeasurementUnitVolume]
+ """
+ Represents a standard volume unit.
+ See [MeasurementUnitVolume](#type-measurementunitvolume) for possible values
+ """
+
+ weight_unit: typing_extensions.NotRequired[MeasurementUnitWeight]
+ """
+ Represents a standard unit of weight or mass.
+ See [MeasurementUnitWeight](#type-measurementunitweight) for possible values
+ """
+
+ generic_unit: typing_extensions.NotRequired[MeasurementUnitGeneric]
+ """
+ Reserved for API integrations that lack the ability to specify a real measurement unit
+ See [MeasurementUnitGeneric](#type-measurementunitgeneric) for possible values
+ """
+
+ time_unit: typing_extensions.NotRequired[MeasurementUnitTime]
+ """
+ Represents a standard unit of time.
+ See [MeasurementUnitTime](#type-measurementunittime) for possible values
+ """
+
+ type: typing_extensions.NotRequired[MeasurementUnitUnitType]
+ """
+ Represents the type of the measurement unit.
+ See [MeasurementUnitUnitType](#type-measurementunitunittype) for possible values
+ """
diff --git a/src/square/requests/measurement_unit_custom.py b/src/square/requests/measurement_unit_custom.py
new file mode 100644
index 00000000..cd45f37c
--- /dev/null
+++ b/src/square/requests/measurement_unit_custom.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class MeasurementUnitCustomParams(typing_extensions.TypedDict):
+ """
+ The information needed to define a custom unit, provided by the seller.
+ """
+
+ name: str
+ """
+ The name of the custom unit, for example "bushel".
+ """
+
+ abbreviation: str
+ """
+ The abbreviation of the custom unit, such as "bsh" (bushel). This appears
+ in the cart for the Point of Sale app, and in reports.
+ """
diff --git a/src/square/requests/merchant.py b/src/square/requests/merchant.py
new file mode 100644
index 00000000..a48a58e6
--- /dev/null
+++ b/src/square/requests/merchant.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.country import Country
+from ..types.currency import Currency
+from ..types.merchant_status import MerchantStatus
+
+
+class MerchantParams(typing_extensions.TypedDict):
+ """
+ Represents a business that sells with Square.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-issued ID of the merchant.
+ """
+
+ business_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the merchant's overall business.
+ """
+
+ country: Country
+ """
+ The country code associated with the merchant, in the two-letter format of ISO 3166. For example, `US` or `JP`.
+ See [Country](#type-country) for possible values
+ """
+
+ language_code: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The code indicating the [language preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences) of the merchant, in [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). For example, `en-US` or `fr-CA`.
+ """
+
+ currency: typing_extensions.NotRequired[Currency]
+ """
+ The currency associated with the merchant, in ISO 4217 format. For example, the currency code for US dollars is `USD`.
+ See [Currency](#type-currency) for possible values
+ """
+
+ status: typing_extensions.NotRequired[MerchantStatus]
+ """
+ The merchant's status.
+ See [MerchantStatus](#type-merchantstatus) for possible values
+ """
+
+ main_location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [main `Location`](https://developer.squareup.com/docs/locations-api#about-the-main-location) for this merchant.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The time when the merchant was created, in RFC 3339 format.
+ For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
+ """
diff --git a/src/square/requests/merchant_custom_attribute_definition_owned_created_event.py b/src/square/requests/merchant_custom_attribute_definition_owned_created_event.py
new file mode 100644
index 00000000..4259ff49
--- /dev/null
+++ b/src/square/requests/merchant_custom_attribute_definition_owned_created_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class MerchantCustomAttributeDefinitionOwnedCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ is created by the subscribing application. Subscribe to this event to be notified
+ when your application creates a merchant custom attribute definition.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.owned.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/merchant_custom_attribute_definition_owned_deleted_event.py b/src/square/requests/merchant_custom_attribute_definition_owned_deleted_event.py
new file mode 100644
index 00000000..b8461c9d
--- /dev/null
+++ b/src/square/requests/merchant_custom_attribute_definition_owned_deleted_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class MerchantCustomAttributeDefinitionOwnedDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ is deleted by the subscribing application. Subscribe to this event to be notified
+ when your application deletes a merchant custom attribute definition.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.owned.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/merchant_custom_attribute_definition_owned_updated_event.py b/src/square/requests/merchant_custom_attribute_definition_owned_updated_event.py
new file mode 100644
index 00000000..26b2ae60
--- /dev/null
+++ b/src/square/requests/merchant_custom_attribute_definition_owned_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class MerchantCustomAttributeDefinitionOwnedUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ is updated by the subscribing application. Subscribe to this event to be notified
+ when your application updates a merchant custom attribute definition.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.owned.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/merchant_custom_attribute_definition_visible_created_event.py b/src/square/requests/merchant_custom_attribute_definition_visible_created_event.py
new file mode 100644
index 00000000..08f397fa
--- /dev/null
+++ b/src/square/requests/merchant_custom_attribute_definition_visible_created_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class MerchantCustomAttributeDefinitionVisibleCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is created. A notification is sent when your application
+ creates a custom attribute definition or another application creates a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.visible.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/merchant_custom_attribute_definition_visible_deleted_event.py b/src/square/requests/merchant_custom_attribute_definition_visible_deleted_event.py
new file mode 100644
index 00000000..7f66e7ab
--- /dev/null
+++ b/src/square/requests/merchant_custom_attribute_definition_visible_deleted_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class MerchantCustomAttributeDefinitionVisibleDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is deleted. A notification is sent when your application
+ deletes a custom attribute definition or another application deletes a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.visible.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/merchant_custom_attribute_definition_visible_updated_event.py b/src/square/requests/merchant_custom_attribute_definition_visible_updated_event.py
new file mode 100644
index 00000000..8b37e1fc
--- /dev/null
+++ b/src/square/requests/merchant_custom_attribute_definition_visible_updated_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class MerchantCustomAttributeDefinitionVisibleUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is updated. A notification is sent when your application
+ updates a custom attribute definition or another application updates a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.visible.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/merchant_custom_attribute_owned_deleted_event.py b/src/square/requests/merchant_custom_attribute_owned_deleted_event.py
new file mode 100644
index 00000000..9ac3d9ff
--- /dev/null
+++ b/src/square/requests/merchant_custom_attribute_owned_deleted_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class MerchantCustomAttributeOwnedDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant [custom attribute](entity:CustomAttribute)
+ associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is
+ owned by the subscribing application is deleted. Subscribe to this event to be notified
+ when your application deletes a merchant custom attribute.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"merchant.custom_attribute.owned.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/merchant_custom_attribute_owned_updated_event.py b/src/square/requests/merchant_custom_attribute_owned_updated_event.py
new file mode 100644
index 00000000..5d9d8e09
--- /dev/null
+++ b/src/square/requests/merchant_custom_attribute_owned_updated_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class MerchantCustomAttributeOwnedUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant [custom attribute](entity:CustomAttribute)
+ associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is
+ owned by the subscribing application is updated. Subscribe to this event to be notified
+ when your application updates a merchant custom attribute.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"merchant.custom_attribute.owned.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/merchant_custom_attribute_visible_deleted_event.py b/src/square/requests/merchant_custom_attribute_visible_deleted_event.py
new file mode 100644
index 00000000..02b815af
--- /dev/null
+++ b/src/square/requests/merchant_custom_attribute_visible_deleted_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class MerchantCustomAttributeVisibleDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant [custom attribute](entity:CustomAttribute) with
+ the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted.
+ An application that subscribes to this event is notified when a merchant custom attribute is deleted
+ by any application for which the subscribing application has read access to the merchant custom attribute.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"merchant.custom_attribute.visible.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/merchant_custom_attribute_visible_updated_event.py b/src/square/requests/merchant_custom_attribute_visible_updated_event.py
new file mode 100644
index 00000000..844ddf40
--- /dev/null
+++ b/src/square/requests/merchant_custom_attribute_visible_updated_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class MerchantCustomAttributeVisibleUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant [custom attribute](entity:CustomAttribute) with
+ the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated.
+ An application that subscribes to this event is notified when a merchant custom attribute is updated
+ by any application for which the subscribing application has read access to the merchant custom attribute.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"merchant.custom_attribute.visible.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event that triggered the event notification.
+ """
diff --git a/src/square/requests/merchant_settings_updated_event.py b/src/square/requests/merchant_settings_updated_event.py
new file mode 100644
index 00000000..819a3721
--- /dev/null
+++ b/src/square/requests/merchant_settings_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .merchant_settings_updated_event_data import MerchantSettingsUpdatedEventDataParams
+
+
+class MerchantSettingsUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when online checkout merchant settings are updated
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"online_checkout.merchant_settings.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing_extensions.NotRequired[MerchantSettingsUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/merchant_settings_updated_event_data.py b/src/square/requests/merchant_settings_updated_event_data.py
new file mode 100644
index 00000000..06843c90
--- /dev/null
+++ b/src/square/requests/merchant_settings_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .merchant_settings_updated_event_object import MerchantSettingsUpdatedEventObjectParams
+
+
+class MerchantSettingsUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the updated object’s type, `"online_checkout.merchant_settings"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the updated merchant settings.
+ """
+
+ object: typing_extensions.NotRequired[MerchantSettingsUpdatedEventObjectParams]
+ """
+ An object containing the updated merchant settings.
+ """
diff --git a/src/square/requests/merchant_settings_updated_event_object.py b/src/square/requests/merchant_settings_updated_event_object.py
new file mode 100644
index 00000000..65cb18ff
--- /dev/null
+++ b/src/square/requests/merchant_settings_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .checkout_merchant_settings import CheckoutMerchantSettingsParams
+
+
+class MerchantSettingsUpdatedEventObjectParams(typing_extensions.TypedDict):
+ merchant_settings: typing_extensions.NotRequired[CheckoutMerchantSettingsParams]
+ """
+ The updated merchant settings.
+ """
diff --git a/src/square/requests/metadata_response.py b/src/square/requests/metadata_response.py
new file mode 100644
index 00000000..e72e9595
--- /dev/null
+++ b/src/square/requests/metadata_response.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from .cube import CubeParams
+
+
+class MetadataResponseParams(typing_extensions.TypedDict):
+ cubes: typing_extensions.NotRequired[typing.Sequence[CubeParams]]
+ compiler_id: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="compilerId")]]
diff --git a/src/square/requests/modifier_location_overrides.py b/src/square/requests/modifier_location_overrides.py
new file mode 100644
index 00000000..e9cb0d51
--- /dev/null
+++ b/src/square/requests/modifier_location_overrides.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class ModifierLocationOverridesParams(typing_extensions.TypedDict):
+ """
+ Location-specific overrides for specified properties of a `CatalogModifier` object.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the `Location` object representing the location. This can include a deactivated location.
+ """
+
+ price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The overridden price at the specified location. If this is unspecified, the modifier price is not overridden.
+ The modifier becomes free of charge at the specified location, when this `price_money` field is set to 0.
+ """
+
+ sold_out: typing_extensions.NotRequired[bool]
+ """
+ Indicates whether the modifier is sold out at the specified location or not. As an example, for cheese (modifier) burger (item), when the modifier is sold out, it is the cheese, but not the burger, that is sold out.
+ The seller can manually set this sold out status. Attempts by an application to set this attribute are ignored.
+ """
diff --git a/src/square/requests/money.py b/src/square/requests/money.py
new file mode 100644
index 00000000..612ce8a4
--- /dev/null
+++ b/src/square/requests/money.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.currency import Currency
+
+
+class MoneyParams(typing_extensions.TypedDict):
+ """
+ Represents an amount of money. `Money` fields can be signed or unsigned.
+ Fields that do not explicitly define whether they are signed or unsigned are
+ considered unsigned and can only hold positive amounts. For signed fields, the
+ sign of the value indicates the purpose of the money transfer. See
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
+ for more information.
+ """
+
+ amount: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The amount of money, in the smallest denomination of the currency
+ indicated by `currency`. For example, when `currency` is `USD`, `amount` is
+ in cents. Monetary amounts can be positive or negative. See the specific
+ field description to determine the meaning of the sign in a particular case.
+ """
+
+ currency: typing_extensions.NotRequired[Currency]
+ """
+ The type of currency, in __ISO 4217 format__. For example, the currency
+ code for US dollars is `USD`.
+
+ See [Currency](entity:Currency) for possible values.
+ See [Currency](#type-currency) for possible values
+ """
diff --git a/src/square/requests/nested_folder.py b/src/square/requests/nested_folder.py
new file mode 100644
index 00000000..9d269c07
--- /dev/null
+++ b/src/square/requests/nested_folder.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class NestedFolderParams(typing_extensions.TypedDict):
+ name: str
+ members: typing.Sequence[str]
diff --git a/src/square/requests/oauth_authorization_revoked_event.py b/src/square/requests/oauth_authorization_revoked_event.py
new file mode 100644
index 00000000..34431685
--- /dev/null
+++ b/src/square/requests/oauth_authorization_revoked_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .oauth_authorization_revoked_event_data import OauthAuthorizationRevokedEventDataParams
+
+
+class OauthAuthorizationRevokedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a merchant/application revokes all access tokens and refresh tokens granted to an application.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"oauth.authorization.revoked"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[OauthAuthorizationRevokedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/oauth_authorization_revoked_event_data.py b/src/square/requests/oauth_authorization_revoked_event_data.py
new file mode 100644
index 00000000..52cfdf0a
--- /dev/null
+++ b/src/square/requests/oauth_authorization_revoked_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .oauth_authorization_revoked_event_object import OauthAuthorizationRevokedEventObjectParams
+
+
+class OauthAuthorizationRevokedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"revocation"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ Not applicable, revocation is not an object
+ """
+
+ object: typing_extensions.NotRequired[OauthAuthorizationRevokedEventObjectParams]
+ """
+ An object containing information about revocation event.
+ """
diff --git a/src/square/requests/oauth_authorization_revoked_event_object.py b/src/square/requests/oauth_authorization_revoked_event_object.py
new file mode 100644
index 00000000..57597233
--- /dev/null
+++ b/src/square/requests/oauth_authorization_revoked_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .oauth_authorization_revoked_event_revocation_object import OauthAuthorizationRevokedEventRevocationObjectParams
+
+
+class OauthAuthorizationRevokedEventObjectParams(typing_extensions.TypedDict):
+ revocation: typing_extensions.NotRequired[OauthAuthorizationRevokedEventRevocationObjectParams]
+ """
+ The revocation event.
+ """
diff --git a/src/square/requests/oauth_authorization_revoked_event_revocation_object.py b/src/square/requests/oauth_authorization_revoked_event_revocation_object.py
new file mode 100644
index 00000000..0d89e289
--- /dev/null
+++ b/src/square/requests/oauth_authorization_revoked_event_revocation_object.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.oauth_authorization_revoked_event_revoker_type import OauthAuthorizationRevokedEventRevokerType
+
+
+class OauthAuthorizationRevokedEventRevocationObjectParams(typing_extensions.TypedDict):
+ revoked_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Timestamp of when the revocation event occurred, in RFC 3339 format.
+ """
+
+ revoker_type: typing_extensions.NotRequired[OauthAuthorizationRevokedEventRevokerType]
+ """
+ Type of client that performed the revocation, either APPLICATION, MERCHANT, or SQUARE.
+ See [OauthAuthorizationRevokedEventRevokerType](#type-oauthauthorizationrevokedeventrevokertype) for possible values
+ """
diff --git a/src/square/requests/obtain_token_response.py b/src/square/requests/obtain_token_response.py
new file mode 100644
index 00000000..f53b6bf9
--- /dev/null
+++ b/src/square/requests/obtain_token_response.py
@@ -0,0 +1,93 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class ObtainTokenResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [ObtainToken](api-endpoint:OAuth-ObtainToken) response.
+ """
+
+ access_token: typing_extensions.NotRequired[str]
+ """
+ An OAuth access token used to authorize Square API requests on behalf of the seller.
+ Include this token as a bearer token in the `Authorization` header of your API requests.
+
+ OAuth access tokens expire in 30 days (except `short_lived` access tokens). You should call
+ `ObtainToken` and provide the returned `refresh_token` to get a new access token well before
+ the current one expires. For more information, see [OAuth API: Walkthrough](https://developer.squareup.com/docs/oauth-api/walkthrough).
+ """
+
+ token_type: typing_extensions.NotRequired[str]
+ """
+ The type of access token. This value is always `bearer`.
+ """
+
+ expires_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.
+ """
+
+ merchant_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the authorizing [merchant](entity:Merchant) (seller), which represents a business.
+ """
+
+ subscription_id: typing_extensions.NotRequired[str]
+ """
+ __LEGACY__ The ID of merchant's subscription.
+ The ID is only present if the merchant signed up for a subscription plan during authorization.
+ """
+
+ plan_id: typing_extensions.NotRequired[str]
+ """
+ __LEGACY__ The ID of the subscription plan the merchant signed
+ up for. The ID is only present if the merchant signed up for a subscription plan during
+ authorization.
+ """
+
+ id_token: typing_extensions.NotRequired[str]
+ """
+ The OpenID token that belongs to this person. This token is only present if the
+ `OPENID` scope is included in the authorization request.
+
+ Deprecated at version 2021-09-15. Square doesn't support OpenID or other single sign-on (SSO)
+ protocols on top of OAuth.
+ """
+
+ refresh_token: typing_extensions.NotRequired[str]
+ """
+ A refresh token that can be used in an `ObtainToken` request to generate a new access token.
+
+ With the code flow:
+ - For the `authorization_code` grant type, the refresh token is multi-use and never expires.
+ - For the `refresh_token` grant type, the response returns the same refresh token.
+
+ With the PKCE flow:
+ - For the `authorization_code` grant type, the refresh token is single-use and expires in 90 days.
+ - For the `refresh_token` grant type, the refresh token is a new single-use refresh token that expires in 90 days.
+
+ For more information, see [Refresh, Revoke, and Limit the Scope of OAuth Tokens](https://developer.squareup.com/docs/oauth-api/refresh-revoke-limit-scope).
+ """
+
+ short_lived: typing_extensions.NotRequired[bool]
+ """
+ Indicates whether the access_token is short lived. If `true`, the access token expires
+ in 24 hours. If `false`, the access token expires in 30 days.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ refresh_token_expires_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the `refresh_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm)
+ format.
+
+ This field is only returned for the PKCE flow.
+ """
diff --git a/src/square/requests/offline_payment_details.py b/src/square/requests/offline_payment_details.py
new file mode 100644
index 00000000..994c3552
--- /dev/null
+++ b/src/square/requests/offline_payment_details.py
@@ -0,0 +1,14 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class OfflinePaymentDetailsParams(typing_extensions.TypedDict):
+ """
+ Details specific to offline payments.
+ """
+
+ client_created_at: typing_extensions.NotRequired[str]
+ """
+ The client-side timestamp of when the offline payment was created, in RFC 3339 format.
+ """
diff --git a/src/square/requests/order.py b/src/square/requests/order.py
new file mode 100644
index 00000000..925cef02
--- /dev/null
+++ b/src/square/requests/order.py
@@ -0,0 +1,256 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_state import OrderState
+from .fulfillment import FulfillmentParams
+from .money import MoneyParams
+from .order_line_item import OrderLineItemParams
+from .order_line_item_discount import OrderLineItemDiscountParams
+from .order_line_item_tax import OrderLineItemTaxParams
+from .order_money_amounts import OrderMoneyAmountsParams
+from .order_pricing_options import OrderPricingOptionsParams
+from .order_return import OrderReturnParams
+from .order_reward import OrderRewardParams
+from .order_rounding_adjustment import OrderRoundingAdjustmentParams
+from .order_service_charge import OrderServiceChargeParams
+from .order_source import OrderSourceParams
+from .refund import RefundParams
+from .tender import TenderParams
+
+
+class OrderParams(typing_extensions.TypedDict):
+ """
+ Contains all information related to a single order to process with Square,
+ including line items that specify the products to purchase. `Order` objects also
+ include information about any associated tenders, refunds, and returns.
+
+ All Connect V2 Transactions have all been converted to Orders including all associated
+ itemization data.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The order's unique ID.
+ """
+
+ location_id: str
+ """
+ The ID of the seller location that this order is associated with.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A client-specified ID to associate an entity in another system
+ with this order.
+ """
+
+ source: typing_extensions.NotRequired[OrderSourceParams]
+ """
+ The latest source details of the order.
+
+ This field reflects the most recent source that interacted with or modified the order,
+ and may change during the order lifecycle. For example:
+ - An order created via API (source.name = "MyPOS") paid with Square Terminal may have
+ source updated to reflect the Terminal application (which uses REGISTER, like POS)
+ - An order updated or completed by a different application may have source updated
+ to reflect that application.
+
+ To preserve the original source from order creation regardless of subsequent updates,
+ use the `creation_source` field instead.
+ """
+
+ customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [customer](entity:Customer) associated with the order.
+
+ You should specify a `customer_id` on the order (or the payment) to ensure that transactions
+ are reliably linked to customers. Omitting this field might result in the creation of new
+ [instant profiles](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles).
+ """
+
+ line_items: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderLineItemParams]]]
+ """
+ The line items included in the order.
+ """
+
+ taxes: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderLineItemTaxParams]]]
+ """
+ The list of all taxes associated with the order.
+
+ Taxes can be scoped to either `ORDER` or `LINE_ITEM`. For taxes with `LINE_ITEM` scope, an
+ `OrderLineItemAppliedTax` must be added to each line item that the tax applies to. For taxes
+ with `ORDER` scope, the server generates an `OrderLineItemAppliedTax` for every line item.
+
+ On reads, each tax in the list includes the total amount of that tax applied to the order.
+
+ __IMPORTANT__: If `LINE_ITEM` scope is set on any taxes in this field, using the deprecated
+ `line_items.taxes` field results in an error. Use `line_items.applied_taxes`
+ instead.
+ """
+
+ discounts: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderLineItemDiscountParams]]]
+ """
+ The list of all discounts associated with the order.
+
+ Discounts can be scoped to either `ORDER` or `LINE_ITEM`. For discounts scoped to `LINE_ITEM`,
+ an `OrderLineItemAppliedDiscount` must be added to each line item that the discount applies to.
+ For discounts with `ORDER` scope, the server generates an `OrderLineItemAppliedDiscount`
+ for every line item.
+
+ __IMPORTANT__: If `LINE_ITEM` scope is set on any discounts in this field, using the deprecated
+ `line_items.discounts` field results in an error. Use `line_items.applied_discounts`
+ instead.
+ """
+
+ service_charges: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderServiceChargeParams]]]
+ """
+ A list of service charges applied to the order.
+ """
+
+ fulfillments: typing_extensions.NotRequired[typing.Optional[typing.Sequence[FulfillmentParams]]]
+ """
+ Details about order fulfillment.
+
+ Orders can only be created with at most one fulfillment. However, orders returned
+ by the API might contain multiple fulfillments.
+ """
+
+ returns: typing_extensions.NotRequired[typing.Sequence[OrderReturnParams]]
+ """
+ A collection of items from sale orders being returned in this one. Normally part of an
+ itemized return or exchange. There is exactly one `Return` object per sale `Order` being
+ referenced.
+ """
+
+ return_amounts: typing_extensions.NotRequired[OrderMoneyAmountsParams]
+ """
+ The rollup of the returned money amounts.
+ """
+
+ net_amounts: typing_extensions.NotRequired[OrderMoneyAmountsParams]
+ """
+ The net money amounts (sale money - return money).
+ """
+
+ rounding_adjustment: typing_extensions.NotRequired[OrderRoundingAdjustmentParams]
+ """
+ A positive rounding adjustment to the total of the order. This adjustment is commonly
+ used to apply cash rounding when the minimum unit of account is smaller than the lowest physical
+ denomination of the currency.
+ """
+
+ tenders: typing_extensions.NotRequired[typing.Sequence[TenderParams]]
+ """
+ The tenders that were used to pay for the order.
+ """
+
+ refunds: typing_extensions.NotRequired[typing.Sequence[RefundParams]]
+ """
+ The refunds that are part of this order.
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Optional[str]]]]
+ """
+ Application-defined data attached to this order. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ closed_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the order reached a terminal [state](entity:OrderState), in RFC 3339 format (for example "2016-09-04T23:59:33.123Z").
+ """
+
+ state: typing_extensions.NotRequired[OrderState]
+ """
+ The current state of the order.
+ See [OrderState](#type-orderstate) for possible values
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version number, which is incremented each time an update is committed to the order.
+ Orders not created through the API do not include a version number and
+ therefore cannot be updated.
+
+ [Read more about working with versions](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders).
+ """
+
+ total_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of money to collect for the order.
+ """
+
+ total_tax_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of tax money to collect for the order.
+ """
+
+ total_discount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of discount money to collect for the order.
+ """
+
+ total_tip_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of tip money to collect for the order.
+ """
+
+ total_service_charge_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of money collected in service charges for the order.
+
+ Note: `total_service_charge_money` is the sum of `applied_money` fields for each individual
+ service charge. Therefore, `total_service_charge_money` only includes inclusive tax amounts,
+ not additive tax amounts.
+ """
+
+ ticket_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A short-term identifier for the order (such as a customer first name,
+ table number, or auto-generated order number that resets daily).
+ """
+
+ pricing_options: typing_extensions.NotRequired[OrderPricingOptionsParams]
+ """
+ Pricing options for an order. The options affect how the order's price is calculated.
+ They can be used, for example, to apply automatic price adjustments that are based on
+ preconfigured [pricing rules](entity:CatalogPricingRule).
+ """
+
+ rewards: typing_extensions.NotRequired[typing.Sequence[OrderRewardParams]]
+ """
+ A set-like list of Rewards that have been added to the Order.
+ """
+
+ net_amount_due_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The net amount of money due on the order.
+ """
diff --git a/src/square/requests/order_created.py b/src/square/requests/order_created.py
new file mode 100644
index 00000000..9cb491f2
--- /dev/null
+++ b/src/square/requests/order_created.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_state import OrderState
+
+
+class OrderCreatedParams(typing_extensions.TypedDict):
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The order's unique ID.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version number, which is incremented each time an update is committed to the order.
+ Orders that were not created through the API do not include a version number and
+ therefore cannot be updated.
+
+ [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders)
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller location that this order is associated with.
+ """
+
+ state: typing_extensions.NotRequired[OrderState]
+ """
+ The state of the order.
+ See [OrderState](#type-orderstate) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the order was created, in RFC 3339 format.
+ """
diff --git a/src/square/requests/order_created_event.py b/src/square/requests/order_created_event.py
new file mode 100644
index 00000000..ebdfcdcb
--- /dev/null
+++ b/src/square/requests/order_created_event.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .order_created_event_data import OrderCreatedEventDataParams
+
+
+class OrderCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an [Order](entity:Order) is created. This event is
+ triggered only by the [CreateOrder](api-endpoint:Orders-CreateOrder) endpoint call.
+
+ Creating an order in the Point of Sale app will **not** publish this event.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"order.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[OrderCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/order_created_event_data.py b/src/square/requests/order_created_event_data.py
new file mode 100644
index 00000000..5e356c8c
--- /dev/null
+++ b/src/square/requests/order_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .order_created_object import OrderCreatedObjectParams
+
+
+class OrderCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"order_created"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected order.
+ """
+
+ object: typing_extensions.NotRequired[OrderCreatedObjectParams]
+ """
+ An object containing information about the created Order.
+ """
diff --git a/src/square/requests/order_created_object.py b/src/square/requests/order_created_object.py
new file mode 100644
index 00000000..17dc381e
--- /dev/null
+++ b/src/square/requests/order_created_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .order_created import OrderCreatedParams
+
+
+class OrderCreatedObjectParams(typing_extensions.TypedDict):
+ order_created: typing_extensions.NotRequired[OrderCreatedParams]
+ """
+ Information about the created order.
+ """
diff --git a/src/square/requests/order_custom_attribute_definition_owned_created_event.py b/src/square/requests/order_custom_attribute_definition_owned_created_event.py
new file mode 100644
index 00000000..f2aac260
--- /dev/null
+++ b/src/square/requests/order_custom_attribute_definition_owned_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class OrderCustomAttributeDefinitionOwnedCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.owned.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/order_custom_attribute_definition_owned_deleted_event.py b/src/square/requests/order_custom_attribute_definition_owned_deleted_event.py
new file mode 100644
index 00000000..864b86f5
--- /dev/null
+++ b/src/square/requests/order_custom_attribute_definition_owned_deleted_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class OrderCustomAttributeDefinitionOwnedDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is deleted.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.owned.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/order_custom_attribute_definition_owned_updated_event.py b/src/square/requests/order_custom_attribute_definition_owned_updated_event.py
new file mode 100644
index 00000000..3ce002b2
--- /dev/null
+++ b/src/square/requests/order_custom_attribute_definition_owned_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class OrderCustomAttributeDefinitionOwnedUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.owned.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/order_custom_attribute_definition_visible_created_event.py b/src/square/requests/order_custom_attribute_definition_visible_created_event.py
new file mode 100644
index 00000000..0b9812db
--- /dev/null
+++ b/src/square/requests/order_custom_attribute_definition_visible_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class OrderCustomAttributeDefinitionVisibleCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.visible.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/order_custom_attribute_definition_visible_deleted_event.py b/src/square/requests/order_custom_attribute_definition_visible_deleted_event.py
new file mode 100644
index 00000000..213c34bb
--- /dev/null
+++ b/src/square/requests/order_custom_attribute_definition_visible_deleted_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class OrderCustomAttributeDefinitionVisibleDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is deleted.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.visible.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/order_custom_attribute_definition_visible_updated_event.py b/src/square/requests/order_custom_attribute_definition_visible_updated_event.py
new file mode 100644
index 00000000..9ba42791
--- /dev/null
+++ b/src/square/requests/order_custom_attribute_definition_visible_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventDataParams
+
+
+class OrderCustomAttributeDefinitionVisibleUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.visible.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeDefinitionEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/order_custom_attribute_owned_deleted_event.py b/src/square/requests/order_custom_attribute_owned_deleted_event.py
new file mode 100644
index 00000000..7b1388a9
--- /dev/null
+++ b/src/square/requests/order_custom_attribute_owned_deleted_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class OrderCustomAttributeOwnedDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an order [custom attribute](entity:CustomAttribute) associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is deleted.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"order.custom_attribute.owned.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/order_custom_attribute_owned_updated_event.py b/src/square/requests/order_custom_attribute_owned_updated_event.py
new file mode 100644
index 00000000..8827f3b1
--- /dev/null
+++ b/src/square/requests/order_custom_attribute_owned_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class OrderCustomAttributeOwnedUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an order [custom attribute](entity:CustomAttribute) associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"order.custom_attribute.owned.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/order_custom_attribute_visible_deleted_event.py b/src/square/requests/order_custom_attribute_visible_deleted_event.py
new file mode 100644
index 00000000..ed93a0bf
--- /dev/null
+++ b/src/square/requests/order_custom_attribute_visible_deleted_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class OrderCustomAttributeVisibleDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an order [custom attribute](entity:CustomAttribute) that is visible to the subscribing app is deleted.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"order.custom_attribute.visible.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/order_custom_attribute_visible_updated_event.py b/src/square/requests/order_custom_attribute_visible_updated_event.py
new file mode 100644
index 00000000..42919b5a
--- /dev/null
+++ b/src/square/requests/order_custom_attribute_visible_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_event_data import CustomAttributeEventDataParams
+
+
+class OrderCustomAttributeVisibleUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an order [custom attribute](entity:CustomAttribute) that is visible to the subscribing app is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"order.custom_attribute.visible.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[CustomAttributeEventDataParams]
+ """
+ The data associated with the event.
+ """
diff --git a/src/square/requests/order_entry.py b/src/square/requests/order_entry.py
new file mode 100644
index 00000000..f98d2f51
--- /dev/null
+++ b/src/square/requests/order_entry.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class OrderEntryParams(typing_extensions.TypedDict):
+ """
+ A lightweight description of an [order](entity:Order) that is returned when
+ `returned_entries` is `true` on a [SearchOrdersRequest](api-endpoint:Orders-SearchOrders).
+ """
+
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the order.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version number, which is incremented each time an update is committed to the order.
+ Orders that were not created through the API do not include a version number and
+ therefore cannot be updated.
+
+ [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders)
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The location ID the order belongs to.
+ """
diff --git a/src/square/requests/order_fulfillment_updated.py b/src/square/requests/order_fulfillment_updated.py
new file mode 100644
index 00000000..002b2315
--- /dev/null
+++ b/src/square/requests/order_fulfillment_updated.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_state import OrderState
+from .order_fulfillment_updated_update import OrderFulfillmentUpdatedUpdateParams
+
+
+class OrderFulfillmentUpdatedParams(typing_extensions.TypedDict):
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The order's unique ID.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version number, which is incremented each time an update is committed to the order.
+ Orders that were not created through the API do not include a version number and
+ therefore cannot be updated.
+
+ [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders)
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller location that this order is associated with.
+ """
+
+ state: typing_extensions.NotRequired[OrderState]
+ """
+ The state of the order.
+ See [OrderState](#type-orderstate) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the order was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the order was last updated, in RFC 3339 format.
+ """
+
+ fulfillment_update: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[OrderFulfillmentUpdatedUpdateParams]]
+ ]
+ """
+ The fulfillments that were updated with this version change.
+ """
diff --git a/src/square/requests/order_fulfillment_updated_event.py b/src/square/requests/order_fulfillment_updated_event.py
new file mode 100644
index 00000000..5acbb141
--- /dev/null
+++ b/src/square/requests/order_fulfillment_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .order_fulfillment_updated_event_data import OrderFulfillmentUpdatedEventDataParams
+
+
+class OrderFulfillmentUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an [OrderFulfillment](entity:OrderFulfillment)
+ is created or updated. This event is triggered only by the
+ [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint call.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"order.fulfillment.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[OrderFulfillmentUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/order_fulfillment_updated_event_data.py b/src/square/requests/order_fulfillment_updated_event_data.py
new file mode 100644
index 00000000..887e886c
--- /dev/null
+++ b/src/square/requests/order_fulfillment_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .order_fulfillment_updated_object import OrderFulfillmentUpdatedObjectParams
+
+
+class OrderFulfillmentUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"order_fulfillment_updated"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected order.
+ """
+
+ object: typing_extensions.NotRequired[OrderFulfillmentUpdatedObjectParams]
+ """
+ An object containing information about the updated Order.
+ """
diff --git a/src/square/requests/order_fulfillment_updated_object.py b/src/square/requests/order_fulfillment_updated_object.py
new file mode 100644
index 00000000..94b5a27a
--- /dev/null
+++ b/src/square/requests/order_fulfillment_updated_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .order_fulfillment_updated import OrderFulfillmentUpdatedParams
+
+
+class OrderFulfillmentUpdatedObjectParams(typing_extensions.TypedDict):
+ order_fulfillment_updated: typing_extensions.NotRequired[OrderFulfillmentUpdatedParams]
+ """
+ Information about the updated order fulfillment.
+ """
diff --git a/src/square/requests/order_fulfillment_updated_update.py b/src/square/requests/order_fulfillment_updated_update.py
new file mode 100644
index 00000000..808104f3
--- /dev/null
+++ b/src/square/requests/order_fulfillment_updated_update.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.fulfillment_state import FulfillmentState
+
+
+class OrderFulfillmentUpdatedUpdateParams(typing_extensions.TypedDict):
+ """
+ Information about fulfillment updates.
+ """
+
+ fulfillment_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the fulfillment only within this order.
+ """
+
+ old_state: typing_extensions.NotRequired[FulfillmentState]
+ """
+ The state of the fulfillment before the change.
+ The state is not populated if the fulfillment is created with this new `Order` version.
+ """
+
+ new_state: typing_extensions.NotRequired[FulfillmentState]
+ """
+ The state of the fulfillment after the change. The state might be equal to `old_state` if a non-state
+ field was changed on the fulfillment (such as the tracking number).
+ """
diff --git a/src/square/requests/order_line_item.py b/src/square/requests/order_line_item.py
new file mode 100644
index 00000000..334fbaa4
--- /dev/null
+++ b/src/square/requests/order_line_item.py
@@ -0,0 +1,196 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_line_item_item_type import OrderLineItemItemType
+from .money import MoneyParams
+from .order_line_item_applied_discount import OrderLineItemAppliedDiscountParams
+from .order_line_item_applied_service_charge import OrderLineItemAppliedServiceChargeParams
+from .order_line_item_applied_tax import OrderLineItemAppliedTaxParams
+from .order_line_item_modifier import OrderLineItemModifierParams
+from .order_line_item_pricing_blocklists import OrderLineItemPricingBlocklistsParams
+from .order_quantity_unit import OrderQuantityUnitParams
+
+
+class OrderLineItemParams(typing_extensions.TypedDict):
+ """
+ Represents a line item in an order. Each line item describes a different
+ product to purchase, with its own quantity and price details.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the line item only within this order.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the line item.
+ """
+
+ quantity: str
+ """
+ The count, or measurement, of a line item being purchased:
+
+ If `quantity` is a whole number, and `quantity_unit` is not specified, then `quantity` denotes an item count. For example: `3` apples.
+
+ If `quantity` is a whole or decimal number, and `quantity_unit` is also specified, then `quantity` denotes a measurement. For example: `2.25` pounds of broccoli.
+
+ For more information, see [Specify item quantity and measurement unit](https://developer.squareup.com/docs/orders-api/create-orders#specify-item-quantity-and-measurement-unit).
+
+ Line items with a quantity of `0` are automatically removed
+ when paying for or otherwise completing the order.
+ """
+
+ quantity_unit: typing_extensions.NotRequired[OrderQuantityUnitParams]
+ """
+ The measurement unit and decimal precision that this line item's quantity is measured in.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional note associated with the line item.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this line item.
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this line item references.
+ """
+
+ variation_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the variation applied to this line item.
+ """
+
+ item_type: typing_extensions.NotRequired[OrderLineItemItemType]
+ """
+ The type of line item: an itemized sale, a non-itemized sale (custom amount), or the
+ activation or reloading of a gift card.
+ See [OrderLineItemItemType](#type-orderlineitemitemtype) for possible values
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Optional[str]]]]
+ """
+ Application-defined data attached to this line item. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ modifiers: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderLineItemModifierParams]]]
+ """
+ The [CatalogModifier](entity:CatalogModifier)s applied to this line item.
+ """
+
+ applied_taxes: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderLineItemAppliedTaxParams]]]
+ """
+ The list of references to taxes applied to this line item. Each
+ `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a
+ top-level `OrderLineItemTax` applied to the line item. On reads, the
+ amount applied is populated.
+
+ An `OrderLineItemAppliedTax` is automatically created on every line
+ item for all `ORDER` scoped taxes added to the order. `OrderLineItemAppliedTax`
+ records for `LINE_ITEM` scoped taxes must be added in requests for the tax
+ to apply to any line items.
+
+ To change the amount of a tax, modify the referenced top-level tax.
+ """
+
+ applied_discounts: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[OrderLineItemAppliedDiscountParams]]
+ ]
+ """
+ The list of references to discounts applied to this line item. Each
+ `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level
+ `OrderLineItemDiscounts` applied to the line item. On reads, the amount
+ applied is populated.
+
+ An `OrderLineItemAppliedDiscount` is automatically created on every line item for all
+ `ORDER` scoped discounts that are added to the order. `OrderLineItemAppliedDiscount` records
+ for `LINE_ITEM` scoped discounts must be added in requests for the discount to apply to any
+ line items.
+
+ To change the amount of a discount, modify the referenced top-level discount.
+ """
+
+ applied_service_charges: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[OrderLineItemAppliedServiceChargeParams]]
+ ]
+ """
+ The list of references to service charges applied to this line item. Each
+ `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a
+ top-level `OrderServiceCharge` applied to the line item. On reads, the amount applied is
+ populated.
+
+ To change the amount of a service charge, modify the referenced top-level service charge.
+ """
+
+ base_price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The base price for a single unit of the line item. Note - If inclusive tax is set on
+ this item it will be included in this value.
+ """
+
+ variation_total_price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total price of all item variations sold in this line item.
+ The price is calculated as `base_price_money` multiplied by `quantity`.
+ It does not include modifiers. Note - If inclusive tax is set on
+ this item it will be included in this value.
+ """
+
+ gross_sales_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money made in gross sales for this line item.
+ The amount is calculated as the sum of the variation's total price and each modifier's total price.
+ For inclusive tax items in the US, Canada, and Japan, tax is deducted from `gross_sales_money`. For Europe and
+ Australia, inclusive tax remains as part of the gross sale calculation.
+ """
+
+ total_tax_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of tax money to collect for the line item.
+ """
+
+ total_discount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of discount money to collect for the line item.
+ """
+
+ total_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of money to collect for this line item.
+ """
+
+ pricing_blocklists: typing_extensions.NotRequired[OrderLineItemPricingBlocklistsParams]
+ """
+ Describes pricing adjustments that are blocked from automatic
+ application to a line item. For more information, see
+ [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts).
+ """
+
+ total_service_charge_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of apportioned service charge money to collect for the line item.
+ """
diff --git a/src/square/requests/order_line_item_applied_discount.py b/src/square/requests/order_line_item_applied_discount.py
new file mode 100644
index 00000000..01f68225
--- /dev/null
+++ b/src/square/requests/order_line_item_applied_discount.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class OrderLineItemAppliedDiscountParams(typing_extensions.TypedDict):
+ """
+ Represents an applied portion of a discount to a line item in an order.
+
+ Order scoped discounts have automatically applied discounts present for each line item.
+ Line-item scoped discounts must have applied discounts added manually for any applicable line
+ items. The corresponding applied money is automatically computed based on participating
+ line items.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the applied discount only within this order.
+ """
+
+ discount_uid: str
+ """
+ The `uid` of the discount that the applied discount represents. It must
+ reference a discount present in the `order.discounts` field.
+
+ This field is immutable. To change which discounts apply to a line item,
+ you must delete the discount and re-add it as a new `OrderLineItemAppliedDiscount`.
+ """
+
+ applied_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money applied by the discount to the line item.
+ """
diff --git a/src/square/requests/order_line_item_applied_service_charge.py b/src/square/requests/order_line_item_applied_service_charge.py
new file mode 100644
index 00000000..110c2e15
--- /dev/null
+++ b/src/square/requests/order_line_item_applied_service_charge.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class OrderLineItemAppliedServiceChargeParams(typing_extensions.TypedDict):
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the applied service charge only within this order.
+ """
+
+ service_charge_uid: str
+ """
+ The `uid` of the service charge that the applied service charge represents. It must
+ reference a service charge present in the `order.service_charges` field.
+
+ This field is immutable. To change which service charges apply to a line item,
+ delete and add a new `OrderLineItemAppliedServiceCharge`.
+ """
+
+ applied_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money applied by the service charge to the line item.
+ """
diff --git a/src/square/requests/order_line_item_applied_tax.py b/src/square/requests/order_line_item_applied_tax.py
new file mode 100644
index 00000000..6e4a64e9
--- /dev/null
+++ b/src/square/requests/order_line_item_applied_tax.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class OrderLineItemAppliedTaxParams(typing_extensions.TypedDict):
+ """
+ Represents an applied portion of a tax to a line item in an order.
+
+ Order-scoped taxes automatically include the applied taxes in each line item.
+ Line item taxes must be referenced from any applicable line items.
+ The corresponding applied money is automatically computed, based on the
+ set of participating line items.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the applied tax only within this order.
+ """
+
+ tax_uid: str
+ """
+ The `uid` of the tax for which this applied tax represents. It must reference
+ a tax present in the `order.taxes` field.
+
+ This field is immutable. To change which taxes apply to a line item, delete and add a new
+ `OrderLineItemAppliedTax`.
+ """
+
+ applied_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money applied by the tax to the line item.
+ """
+
+ auto_applied: typing_extensions.NotRequired[bool]
+ """
+ Indicates whether the tax was automatically applied to the order based on
+ the catalog configuration. For an example, see
+ [Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes).
+ """
diff --git a/src/square/requests/order_line_item_discount.py b/src/square/requests/order_line_item_discount.py
new file mode 100644
index 00000000..efdd4291
--- /dev/null
+++ b/src/square/requests/order_line_item_discount.py
@@ -0,0 +1,124 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_line_item_discount_scope import OrderLineItemDiscountScope
+from ..types.order_line_item_discount_type import OrderLineItemDiscountType
+from .money import MoneyParams
+
+
+class OrderLineItemDiscountParams(typing_extensions.TypedDict):
+ """
+ Represents a discount that applies to one or more line items in an
+ order.
+
+ Fixed-amount, order-scoped discounts are distributed across all non-zero line item totals.
+ The amount distributed to each line item is relative to the
+ amount contributed by the item to the order subtotal.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the discount only within this order.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount).
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this discount references.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The discount's name.
+ """
+
+ type: typing_extensions.NotRequired[OrderLineItemDiscountType]
+ """
+ The type of the discount.
+
+ Discounts that do not reference a catalog object ID must have a type of
+ `FIXED_PERCENTAGE` or `FIXED_AMOUNT`.
+ See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values
+ """
+
+ percentage: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The percentage of the discount, as a string representation of a decimal number.
+ A value of `7.25` corresponds to a percentage of 7.25%.
+
+ `percentage` is not set for amount-based discounts.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total declared monetary amount of the discount.
+
+ `amount_money` is not set for percentage-based discounts.
+ """
+
+ applied_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of discount actually applied to the line item.
+
+ The amount represents the amount of money applied as a line-item scoped discount.
+ When an amount-based discount is scoped to the entire order, the value
+ of `applied_money` is different than `amount_money` because the total
+ amount of the discount is distributed across all line items.
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Optional[str]]]]
+ """
+ Application-defined data attached to this discount. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ scope: typing_extensions.NotRequired[OrderLineItemDiscountScope]
+ """
+ Indicates the level at which the discount applies. For `ORDER` scoped discounts,
+ Square generates references in `applied_discounts` on all order line items that do
+ not have them. For `LINE_ITEM` scoped discounts, the discount only applies to line items
+ with a discount reference in their `applied_discounts` field.
+
+ This field is immutable. To change the scope of a discount, you must delete
+ the discount and re-add it as a new discount.
+ See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values
+ """
+
+ reward_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ The reward IDs corresponding to this discount. The application and
+ specification of discounts that have `reward_ids` are completely controlled by the backing
+ criteria corresponding to the reward tiers of the rewards that are added to the order
+ through the Loyalty API. To manually unapply discounts that are the result of added rewards,
+ the rewards must be removed from the order through the Loyalty API.
+ """
+
+ pricing_rule_id: typing_extensions.NotRequired[str]
+ """
+ The object ID of a [pricing rule](entity:CatalogPricingRule) to be applied
+ automatically to this discount. The specification and application of the discounts, to
+ which a `pricing_rule_id` is assigned, are completely controlled by the corresponding
+ pricing rule.
+ """
diff --git a/src/square/requests/order_line_item_modifier.py b/src/square/requests/order_line_item_modifier.py
new file mode 100644
index 00000000..780aa930
--- /dev/null
+++ b/src/square/requests/order_line_item_modifier.py
@@ -0,0 +1,85 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class OrderLineItemModifierParams(typing_extensions.TypedDict):
+ """
+ A [CatalogModifier](entity:CatalogModifier).
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the modifier only within this order.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The catalog object ID referencing [CatalogModifier](entity:CatalogModifier).
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this modifier references.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the item modifier.
+ """
+
+ quantity: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The quantity of the line item modifier. The modifier quantity can be 0 or more.
+ For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders
+ this item, the restaurant records the purchase by creating an `Order` object with a line item
+ for a burger. The line item includes a line item modifier: the name is cheese and the quantity
+ is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses
+ the extra cheese option, the modifier quantity increases to 2. If the buyer does not want
+ any cheese, the modifier quantity is set to 0.
+ """
+
+ base_price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The base price for the modifier.
+
+ `base_price_money` is required for ad hoc modifiers.
+ If both `catalog_object_id` and `base_price_money` are set, `base_price_money` will
+ override the predefined [CatalogModifier](entity:CatalogModifier) price.
+ """
+
+ total_price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total price of the item modifier for its line item.
+ This is the modifier's `base_price_money` multiplied by the line item's quantity.
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Optional[str]]]]
+ """
+ Application-defined data attached to this order. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ parent_modifier_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `uid` of the parent modifier, if this modifier is nested under another modifier.
+ """
diff --git a/src/square/requests/order_line_item_pricing_blocklists.py b/src/square/requests/order_line_item_pricing_blocklists.py
new file mode 100644
index 00000000..9a30044d
--- /dev/null
+++ b/src/square/requests/order_line_item_pricing_blocklists.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .order_line_item_pricing_blocklists_blocked_discount import OrderLineItemPricingBlocklistsBlockedDiscountParams
+from .order_line_item_pricing_blocklists_blocked_service_charge import (
+ OrderLineItemPricingBlocklistsBlockedServiceChargeParams,
+)
+from .order_line_item_pricing_blocklists_blocked_tax import OrderLineItemPricingBlocklistsBlockedTaxParams
+
+
+class OrderLineItemPricingBlocklistsParams(typing_extensions.TypedDict):
+ """
+ Describes pricing adjustments that are blocked from automatic
+ application to a line item. For more information, see
+ [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts).
+ """
+
+ blocked_discounts: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[OrderLineItemPricingBlocklistsBlockedDiscountParams]]
+ ]
+ """
+ A list of discounts blocked from applying to the line item.
+ Discounts can be blocked by the `discount_uid` (for ad hoc discounts) or
+ the `discount_catalog_object_id` (for catalog discounts).
+ """
+
+ blocked_taxes: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[OrderLineItemPricingBlocklistsBlockedTaxParams]]
+ ]
+ """
+ A list of taxes blocked from applying to the line item.
+ Taxes can be blocked by the `tax_uid` (for ad hoc taxes) or
+ the `tax_catalog_object_id` (for catalog taxes).
+ """
+
+ blocked_service_charges: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[OrderLineItemPricingBlocklistsBlockedServiceChargeParams]]
+ ]
+ """
+ A list of service charges blocked from applying to the line item.
+ Service charges can be blocked by the `service_charge_uid` (for ad hoc
+ service charges) or the `service_charge_catalog_object_id` (for catalog
+ service charges).
+ """
diff --git a/src/square/requests/order_line_item_pricing_blocklists_blocked_discount.py b/src/square/requests/order_line_item_pricing_blocklists_blocked_discount.py
new file mode 100644
index 00000000..b3cac7d6
--- /dev/null
+++ b/src/square/requests/order_line_item_pricing_blocklists_blocked_discount.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class OrderLineItemPricingBlocklistsBlockedDiscountParams(typing_extensions.TypedDict):
+ """
+ A discount to block from applying to a line item. The discount must be
+ identified by either `discount_uid` or `discount_catalog_object_id`, but not both.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID of the `BlockedDiscount` within the order.
+ """
+
+ discount_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `uid` of the discount that should be blocked. Use this field to block
+ ad hoc discounts. For catalog discounts, use the `discount_catalog_object_id` field.
+ """
+
+ discount_catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `catalog_object_id` of the discount that should be blocked.
+ Use this field to block catalog discounts. For ad hoc discounts, use the
+ `discount_uid` field.
+ """
diff --git a/src/square/requests/order_line_item_pricing_blocklists_blocked_service_charge.py b/src/square/requests/order_line_item_pricing_blocklists_blocked_service_charge.py
new file mode 100644
index 00000000..36a6875c
--- /dev/null
+++ b/src/square/requests/order_line_item_pricing_blocklists_blocked_service_charge.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class OrderLineItemPricingBlocklistsBlockedServiceChargeParams(typing_extensions.TypedDict):
+ """
+ A service charge to block from applying to a line item. The service charge
+ must be identified by either `service_charge_uid` or
+ `service_charge_catalog_object_id`, but not both.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID of the `BlockedServiceCharge` within the order.
+ """
+
+ service_charge_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `uid` of the service charge that should be blocked. Use this field to
+ block ad hoc service charges. For catalog service charges, use the
+ `service_charge_catalog_object_id` field.
+ """
+
+ service_charge_catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `catalog_object_id` of the service charge that should be blocked.
+ Use this field to block catalog service charges. For ad hoc service charges,
+ use the `service_charge_uid` field.
+ """
diff --git a/src/square/requests/order_line_item_pricing_blocklists_blocked_tax.py b/src/square/requests/order_line_item_pricing_blocklists_blocked_tax.py
new file mode 100644
index 00000000..c5124e67
--- /dev/null
+++ b/src/square/requests/order_line_item_pricing_blocklists_blocked_tax.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class OrderLineItemPricingBlocklistsBlockedTaxParams(typing_extensions.TypedDict):
+ """
+ A tax to block from applying to a line item. The tax must be
+ identified by either `tax_uid` or `tax_catalog_object_id`, but not both.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID of the `BlockedTax` within the order.
+ """
+
+ tax_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `uid` of the tax that should be blocked. Use this field to block
+ ad hoc taxes. For catalog, taxes use the `tax_catalog_object_id` field.
+ """
+
+ tax_catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `catalog_object_id` of the tax that should be blocked.
+ Use this field to block catalog taxes. For ad hoc taxes, use the
+ `tax_uid` field.
+ """
diff --git a/src/square/requests/order_line_item_tax.py b/src/square/requests/order_line_item_tax.py
new file mode 100644
index 00000000..0fe1fba8
--- /dev/null
+++ b/src/square/requests/order_line_item_tax.py
@@ -0,0 +1,100 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_line_item_tax_scope import OrderLineItemTaxScope
+from ..types.order_line_item_tax_type import OrderLineItemTaxType
+from .money import MoneyParams
+
+
+class OrderLineItemTaxParams(typing_extensions.TypedDict):
+ """
+ Represents a tax that applies to one or more line item in the order.
+
+ Fixed-amount, order-scoped taxes are distributed across all non-zero line item totals.
+ The amount distributed to each line item is relative to the amount the item
+ contributes to the order subtotal.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the tax only within this order.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The catalog object ID referencing [CatalogTax](entity:CatalogTax).
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this tax references.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The tax's name.
+ """
+
+ type: typing_extensions.NotRequired[OrderLineItemTaxType]
+ """
+ Indicates the calculation method used to apply the tax.
+ See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values
+ """
+
+ percentage: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The percentage of the tax, as a string representation of a decimal
+ number. For example, a value of `"7.25"` corresponds to a percentage of
+ 7.25%.
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Optional[str]]]]
+ """
+ Application-defined data attached to this tax. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ applied_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money applied to the order by the tax.
+
+ - For percentage-based taxes, `applied_money` is the money
+ calculated using the percentage.
+ """
+
+ scope: typing_extensions.NotRequired[OrderLineItemTaxScope]
+ """
+ Indicates the level at which the tax applies. For `ORDER` scoped taxes,
+ Square generates references in `applied_taxes` on all order line items that do
+ not have them. For `LINE_ITEM` scoped taxes, the tax only applies to line items
+ with references in their `applied_taxes` field.
+
+ This field is immutable. To change the scope, you must delete the tax and
+ re-add it as a new tax.
+ See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values
+ """
+
+ auto_applied: typing_extensions.NotRequired[bool]
+ """
+ Determines whether the tax was automatically applied to the order based on
+ the catalog configuration. For an example, see
+ [Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes).
+ """
diff --git a/src/square/requests/order_money_amounts.py b/src/square/requests/order_money_amounts.py
new file mode 100644
index 00000000..1861406f
--- /dev/null
+++ b/src/square/requests/order_money_amounts.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class OrderMoneyAmountsParams(typing_extensions.TypedDict):
+ """
+ A collection of various money amounts.
+ """
+
+ total_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total money.
+ """
+
+ tax_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The money associated with taxes.
+ """
+
+ discount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The money associated with discounts.
+ """
+
+ tip_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The money associated with tips.
+ """
+
+ service_charge_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The money associated with service charges.
+ """
diff --git a/src/square/requests/order_pricing_options.py b/src/square/requests/order_pricing_options.py
new file mode 100644
index 00000000..9b0a67d1
--- /dev/null
+++ b/src/square/requests/order_pricing_options.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class OrderPricingOptionsParams(typing_extensions.TypedDict):
+ """
+ Pricing options for an order. The options affect how the order's price is calculated.
+ They can be used, for example, to apply automatic price adjustments that are based on preconfigured
+ [pricing rules](entity:CatalogPricingRule).
+ """
+
+ auto_apply_discounts: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ The option to determine whether pricing rule-based
+ discounts are automatically applied to an order.
+ """
+
+ auto_apply_taxes: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ The option to determine whether rule-based taxes are automatically
+ applied to an order when the criteria of the corresponding rules are met.
+ """
diff --git a/src/square/requests/order_quantity_unit.py b/src/square/requests/order_quantity_unit.py
new file mode 100644
index 00000000..e64f2c30
--- /dev/null
+++ b/src/square/requests/order_quantity_unit.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .measurement_unit import MeasurementUnitParams
+
+
+class OrderQuantityUnitParams(typing_extensions.TypedDict):
+ """
+ Contains the measurement unit for a quantity and a precision that
+ specifies the number of digits after the decimal point for decimal quantities.
+ """
+
+ measurement_unit: typing_extensions.NotRequired[MeasurementUnitParams]
+ """
+ A [MeasurementUnit](entity:MeasurementUnit) that represents the
+ unit of measure for the quantity.
+ """
+
+ precision: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ For non-integer quantities, represents the number of digits after the decimal point that are
+ recorded for this quantity.
+
+ For example, a precision of 1 allows quantities such as `"1.0"` and `"1.1"`, but not `"1.01"`.
+
+ Min: 0. Max: 5.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The catalog object ID referencing the
+ [CatalogMeasurementUnit](entity:CatalogMeasurementUnit).
+
+ This field is set when this is a catalog-backed measurement unit.
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this measurement unit references.
+
+ This field is set when this is a catalog-backed measurement unit.
+ """
diff --git a/src/square/requests/order_return.py b/src/square/requests/order_return.py
new file mode 100644
index 00000000..3cad710a
--- /dev/null
+++ b/src/square/requests/order_return.py
@@ -0,0 +1,72 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .order_money_amounts import OrderMoneyAmountsParams
+from .order_return_discount import OrderReturnDiscountParams
+from .order_return_line_item import OrderReturnLineItemParams
+from .order_return_service_charge import OrderReturnServiceChargeParams
+from .order_return_tax import OrderReturnTaxParams
+from .order_return_tip import OrderReturnTipParams
+from .order_rounding_adjustment import OrderRoundingAdjustmentParams
+
+
+class OrderReturnParams(typing_extensions.TypedDict):
+ """
+ The set of line items, service charges, taxes, discounts, tips, and other items being returned in an order.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the return only within this order.
+ """
+
+ source_order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An order that contains the original sale of these return line items. This is unset
+ for unlinked returns.
+ """
+
+ return_line_items: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderReturnLineItemParams]]]
+ """
+ A collection of line items that are being returned.
+ """
+
+ return_service_charges: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[OrderReturnServiceChargeParams]]
+ ]
+ """
+ A collection of service charges that are being returned.
+ """
+
+ return_taxes: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderReturnTaxParams]]]
+ """
+ A collection of references to taxes being returned for an order, including the total
+ applied tax amount to be returned. The taxes must reference a top-level tax ID from the source
+ order.
+ """
+
+ return_discounts: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderReturnDiscountParams]]]
+ """
+ A collection of references to discounts being returned for an order, including the total
+ applied discount amount to be returned. The discounts must reference a top-level discount ID
+ from the source order.
+ """
+
+ return_tips: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderReturnTipParams]]]
+ """
+ A collection of references to tips being returned for an order.
+ """
+
+ rounding_adjustment: typing_extensions.NotRequired[OrderRoundingAdjustmentParams]
+ """
+ A positive or negative rounding adjustment to the total value being returned. Adjustments are commonly
+ used to apply cash rounding when the minimum unit of the account is smaller than the lowest
+ physical denomination of the currency.
+ """
+
+ return_amounts: typing_extensions.NotRequired[OrderMoneyAmountsParams]
+ """
+ An aggregate monetary value being returned by this return entry.
+ """
diff --git a/src/square/requests/order_return_discount.py b/src/square/requests/order_return_discount.py
new file mode 100644
index 00000000..f9687933
--- /dev/null
+++ b/src/square/requests/order_return_discount.py
@@ -0,0 +1,84 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_line_item_discount_scope import OrderLineItemDiscountScope
+from ..types.order_line_item_discount_type import OrderLineItemDiscountType
+from .money import MoneyParams
+
+
+class OrderReturnDiscountParams(typing_extensions.TypedDict):
+ """
+ Represents a discount being returned that applies to one or more return line items in an
+ order.
+
+ Fixed-amount, order-scoped discounts are distributed across all non-zero return line item totals.
+ The amount distributed to each return line item is relative to that item’s contribution to the
+ order subtotal.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the returned discount only within this order.
+ """
+
+ source_discount_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The discount `uid` from the order that contains the original application of this discount.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount).
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this discount references.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The discount's name.
+ """
+
+ type: typing_extensions.NotRequired[OrderLineItemDiscountType]
+ """
+ The type of the discount. If it is created by the API, it is `FIXED_PERCENTAGE` or `FIXED_AMOUNT`.
+
+ Discounts that do not reference a catalog object ID must have a type of
+ `FIXED_PERCENTAGE` or `FIXED_AMOUNT`.
+ See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values
+ """
+
+ percentage: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The percentage of the tax, as a string representation of a decimal number.
+ A value of `"7.25"` corresponds to a percentage of 7.25%.
+
+ `percentage` is not set for amount-based discounts.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total declared monetary amount of the discount.
+
+ `amount_money` is not set for percentage-based discounts.
+ """
+
+ applied_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of discount actually applied to this line item. When an amount-based
+ discount is at the order level, this value is different from `amount_money` because the discount
+ is distributed across the line items.
+ """
+
+ scope: typing_extensions.NotRequired[OrderLineItemDiscountScope]
+ """
+ Indicates the level at which the `OrderReturnDiscount` applies. For `ORDER` scoped
+ discounts, the server generates references in `applied_discounts` on all
+ `OrderReturnLineItem`s. For `LINE_ITEM` scoped discounts, the discount is only applied to
+ `OrderReturnLineItem`s with references in their `applied_discounts` field.
+ See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values
+ """
diff --git a/src/square/requests/order_return_line_item.py b/src/square/requests/order_return_line_item.py
new file mode 100644
index 00000000..3159ae67
--- /dev/null
+++ b/src/square/requests/order_return_line_item.py
@@ -0,0 +1,144 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_line_item_item_type import OrderLineItemItemType
+from .money import MoneyParams
+from .order_line_item_applied_discount import OrderLineItemAppliedDiscountParams
+from .order_line_item_applied_service_charge import OrderLineItemAppliedServiceChargeParams
+from .order_line_item_applied_tax import OrderLineItemAppliedTaxParams
+from .order_quantity_unit import OrderQuantityUnitParams
+from .order_return_line_item_modifier import OrderReturnLineItemModifierParams
+
+
+class OrderReturnLineItemParams(typing_extensions.TypedDict):
+ """
+ The line item being returned in an order.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for this return line-item entry.
+ """
+
+ source_line_item_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `uid` of the line item in the original sale order.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the line item.
+ """
+
+ quantity: str
+ """
+ The quantity returned, formatted as a decimal number.
+ For example, `"3"`.
+
+ Line items with a `quantity_unit` can have non-integer quantities.
+ For example, `"1.70000"`.
+ """
+
+ quantity_unit: typing_extensions.NotRequired[OrderQuantityUnitParams]
+ """
+ The unit and precision that this return line item's quantity is measured in.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The note of the return line item.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this return line item.
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this line item references.
+ """
+
+ variation_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the variation applied to this return line item.
+ """
+
+ item_type: typing_extensions.NotRequired[OrderLineItemItemType]
+ """
+ The type of line item: an itemized return, a non-itemized return (custom amount),
+ or the return of an unactivated gift card sale.
+ See [OrderLineItemItemType](#type-orderlineitemitemtype) for possible values
+ """
+
+ return_modifiers: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderReturnLineItemModifierParams]]]
+ """
+ The [CatalogModifier](entity:CatalogModifier)s applied to this line item.
+ """
+
+ applied_taxes: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderLineItemAppliedTaxParams]]]
+ """
+ The list of references to `OrderReturnTax` entities applied to the return line item. Each
+ `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level
+ `OrderReturnTax` applied to the return line item. On reads, the applied amount
+ is populated.
+ """
+
+ applied_discounts: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[OrderLineItemAppliedDiscountParams]]
+ ]
+ """
+ The list of references to `OrderReturnDiscount` entities applied to the return line item. Each
+ `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level
+ `OrderReturnDiscount` applied to the return line item. On reads, the applied amount
+ is populated.
+ """
+
+ base_price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The base price for a single unit of the line item.
+ """
+
+ variation_total_price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total price of all item variations returned in this line item.
+ The price is calculated as `base_price_money` multiplied by `quantity` and
+ does not include modifiers.
+ """
+
+ gross_return_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The gross return amount of money calculated as (item base price + modifiers price) * quantity.
+ """
+
+ total_tax_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of tax money to return for the line item.
+ """
+
+ total_discount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of discount money to return for the line item.
+ """
+
+ total_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of money to return for this line item.
+ """
+
+ applied_service_charges: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[OrderLineItemAppliedServiceChargeParams]]
+ ]
+ """
+ The list of references to `OrderReturnServiceCharge` entities applied to the return
+ line item. Each `OrderLineItemAppliedServiceCharge` has a `service_charge_uid` that
+ references the `uid` of a top-level `OrderReturnServiceCharge` applied to the return line
+ item. On reads, the applied amount is populated.
+ """
+
+ total_service_charge_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of apportioned service charge money to return for the line item.
+ """
diff --git a/src/square/requests/order_return_line_item_modifier.py b/src/square/requests/order_return_line_item_modifier.py
new file mode 100644
index 00000000..663a207e
--- /dev/null
+++ b/src/square/requests/order_return_line_item_modifier.py
@@ -0,0 +1,63 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class OrderReturnLineItemModifierParams(typing_extensions.TypedDict):
+ """
+ A line item modifier being returned.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the return modifier only within this order.
+ """
+
+ source_modifier_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The modifier `uid` from the order's line item that contains the
+ original sale of this line item modifier.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The catalog object ID referencing [CatalogModifier](entity:CatalogModifier).
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this line item modifier references.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the item modifier.
+ """
+
+ base_price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The base price for the modifier.
+
+ `base_price_money` is required for ad hoc modifiers.
+ If both `catalog_object_id` and `base_price_money` are set, `base_price_money` overrides the predefined [CatalogModifier](entity:CatalogModifier) price.
+ """
+
+ total_price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total price of the item modifier for its line item.
+ This is the modifier's `base_price_money` multiplied by the line item's quantity.
+ """
+
+ quantity: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The quantity of the line item modifier. The modifier quantity can be 0 or more.
+ For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders
+ this item, the restaurant records the purchase by creating an `Order` object with a line item
+ for a burger. The line item includes a line item modifier: the name is cheese and the quantity
+ is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses
+ the extra cheese option, the modifier quantity increases to 2. If the buyer does not want
+ any cheese, the modifier quantity is set to 0.
+ """
diff --git a/src/square/requests/order_return_service_charge.py b/src/square/requests/order_return_service_charge.py
new file mode 100644
index 00000000..69c9ea05
--- /dev/null
+++ b/src/square/requests/order_return_service_charge.py
@@ -0,0 +1,129 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_service_charge_calculation_phase import OrderServiceChargeCalculationPhase
+from ..types.order_service_charge_scope import OrderServiceChargeScope
+from ..types.order_service_charge_treatment_type import OrderServiceChargeTreatmentType
+from ..types.order_service_charge_type import OrderServiceChargeType
+from .money import MoneyParams
+from .order_line_item_applied_tax import OrderLineItemAppliedTaxParams
+
+
+class OrderReturnServiceChargeParams(typing_extensions.TypedDict):
+ """
+ Represents the service charge applied to the original order.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the return service charge only within this order.
+ """
+
+ source_service_charge_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The service charge `uid` from the order containing the original
+ service charge. `source_service_charge_uid` is `null` for
+ unlinked returns.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the service charge.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The catalog object ID of the associated [OrderServiceCharge](entity:OrderServiceCharge).
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this service charge references.
+ """
+
+ percentage: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The percentage of the service charge, as a string representation of
+ a decimal number. For example, a value of `"7.25"` corresponds to a
+ percentage of 7.25%.
+
+ Either `percentage` or `amount_money` should be set, but not both.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of a non-percentage-based service charge.
+
+ Either `percentage` or `amount_money` should be set, but not both.
+ """
+
+ applied_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money applied to the order by the service charge, including
+ any inclusive tax amounts, as calculated by Square.
+
+ - For fixed-amount service charges, `applied_money` is equal to `amount_money`.
+ - For percentage-based service charges, `applied_money` is the money calculated using the percentage.
+ """
+
+ total_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of money to collect for the service charge.
+
+ __NOTE__: If an inclusive tax is applied to the service charge, `total_money`
+ does not equal `applied_money` plus `total_tax_money` because the inclusive
+ tax amount is already included in both `applied_money` and `total_tax_money`.
+ """
+
+ total_tax_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of tax money to collect for the service charge.
+ """
+
+ calculation_phase: typing_extensions.NotRequired[OrderServiceChargeCalculationPhase]
+ """
+ The calculation phase after which to apply the service charge.
+ See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values
+ """
+
+ taxable: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the surcharge can be taxed. Service charges
+ calculated in the `TOTAL_PHASE` cannot be marked as taxable.
+ """
+
+ applied_taxes: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderLineItemAppliedTaxParams]]]
+ """
+ The list of references to `OrderReturnTax` entities applied to the
+ `OrderReturnServiceCharge`. Each `OrderLineItemAppliedTax` has a `tax_uid`
+ that references the `uid` of a top-level `OrderReturnTax` that is being
+ applied to the `OrderReturnServiceCharge`. On reads, the applied amount is
+ populated.
+ """
+
+ treatment_type: typing_extensions.NotRequired[OrderServiceChargeTreatmentType]
+ """
+ Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item.
+ See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values
+ """
+
+ scope: typing_extensions.NotRequired[OrderServiceChargeScope]
+ """
+ Indicates the level at which the apportioned service charge applies. For `ORDER`
+ scoped service charges, Square generates references in `applied_service_charges` on
+ all order line items that do not have them. For `LINE_ITEM` scoped service charges,
+ the service charge only applies to line items with a service charge reference in their
+ `applied_service_charges` field.
+
+ This field is immutable. To change the scope of an apportioned service charge, you must delete
+ the apportioned service charge and re-add it as a new apportioned service charge.
+ See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values
+ """
+
+ type: typing_extensions.NotRequired[OrderServiceChargeType]
+ """
+ The type of the service charge.
+ See [OrderServiceChargeType](#type-orderservicechargetype) for possible values
+ """
diff --git a/src/square/requests/order_return_tax.py b/src/square/requests/order_return_tax.py
new file mode 100644
index 00000000..563f4567
--- /dev/null
+++ b/src/square/requests/order_return_tax.py
@@ -0,0 +1,69 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_line_item_tax_scope import OrderLineItemTaxScope
+from ..types.order_line_item_tax_type import OrderLineItemTaxType
+from .money import MoneyParams
+
+
+class OrderReturnTaxParams(typing_extensions.TypedDict):
+ """
+ Represents a tax being returned that applies to one or more return line items in an order.
+
+ Fixed-amount, order-scoped taxes are distributed across all non-zero return line item totals.
+ The amount distributed to each return line item is relative to that item’s contribution to the
+ order subtotal.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the returned tax only within this order.
+ """
+
+ source_tax_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The tax `uid` from the order that contains the original tax charge.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The catalog object ID referencing [CatalogTax](entity:CatalogTax).
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this tax references.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The tax's name.
+ """
+
+ type: typing_extensions.NotRequired[OrderLineItemTaxType]
+ """
+ Indicates the calculation method used to apply the tax.
+ See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values
+ """
+
+ percentage: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The percentage of the tax, as a string representation of a decimal number.
+ For example, a value of `"7.25"` corresponds to a percentage of 7.25%.
+ """
+
+ applied_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money applied by the tax in an order.
+ """
+
+ scope: typing_extensions.NotRequired[OrderLineItemTaxScope]
+ """
+ Indicates the level at which the `OrderReturnTax` applies. For `ORDER` scoped
+ taxes, Square generates references in `applied_taxes` on all
+ `OrderReturnLineItem`s. For `LINE_ITEM` scoped taxes, the tax is only applied to
+ `OrderReturnLineItem`s with references in their `applied_discounts` field.
+ See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values
+ """
diff --git a/src/square/requests/order_return_tip.py b/src/square/requests/order_return_tip.py
new file mode 100644
index 00000000..66332d23
--- /dev/null
+++ b/src/square/requests/order_return_tip.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class OrderReturnTipParams(typing_extensions.TypedDict):
+ """
+ A tip being returned.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the tip only within this order.
+ """
+
+ applied_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of tip being returned
+ --
+ """
+
+ source_tender_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The tender `uid` from the order that contains the original application of this tip.
+ """
+
+ source_tender_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The tender `id` from the order that contains the original application of this tip.
+ """
diff --git a/src/square/requests/order_reward.py b/src/square/requests/order_reward.py
new file mode 100644
index 00000000..3c07f390
--- /dev/null
+++ b/src/square/requests/order_reward.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class OrderRewardParams(typing_extensions.TypedDict):
+ """
+ Represents a reward that can be applied to an order if the necessary
+ reward tier criteria are met. Rewards are created through the Loyalty API.
+ """
+
+ id: str
+ """
+ The identifier of the reward.
+ """
+
+ reward_tier_id: str
+ """
+ The identifier of the reward tier corresponding to this reward.
+ """
diff --git a/src/square/requests/order_rounding_adjustment.py b/src/square/requests/order_rounding_adjustment.py
new file mode 100644
index 00000000..e1ef6558
--- /dev/null
+++ b/src/square/requests/order_rounding_adjustment.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class OrderRoundingAdjustmentParams(typing_extensions.TypedDict):
+ """
+ A rounding adjustment of the money being returned. Commonly used to apply cash rounding
+ when the minimum unit of the account is smaller than the lowest physical denomination of the currency.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the rounding adjustment only within this order.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the rounding adjustment from the original sale order.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The actual rounding adjustment amount.
+ """
diff --git a/src/square/requests/order_service_charge.py b/src/square/requests/order_service_charge.py
new file mode 100644
index 00000000..0e7aee12
--- /dev/null
+++ b/src/square/requests/order_service_charge.py
@@ -0,0 +1,153 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_service_charge_calculation_phase import OrderServiceChargeCalculationPhase
+from ..types.order_service_charge_scope import OrderServiceChargeScope
+from ..types.order_service_charge_treatment_type import OrderServiceChargeTreatmentType
+from ..types.order_service_charge_type import OrderServiceChargeType
+from .money import MoneyParams
+from .order_line_item_applied_tax import OrderLineItemAppliedTaxParams
+
+
+class OrderServiceChargeParams(typing_extensions.TypedDict):
+ """
+ Represents a service charge applied to an order.
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID that identifies the service charge only within this order.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the service charge. This is unused and null for AUTO_GRATUITY to match the behavior on Bills.
+ """
+
+ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The catalog object ID referencing the service charge [CatalogObject](entity:CatalogObject).
+ """
+
+ catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The version of the catalog object that this service charge references.
+ """
+
+ percentage: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The service charge percentage as a string representation of a
+ decimal number. For example, `"7.25"` indicates a service charge of 7.25%.
+
+ Exactly 1 of `percentage` or `amount_money` should be set.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of a non-percentage-based service charge.
+
+ Exactly one of `percentage` or `amount_money` should be set.
+ """
+
+ applied_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money applied to the order by the service charge,
+ including any inclusive tax amounts, as calculated by Square.
+
+ - For fixed-amount service charges, `applied_money` is equal to `amount_money`.
+ - For percentage-based service charges, `applied_money` is the money
+ calculated using the percentage.
+ """
+
+ total_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of money to collect for the service charge.
+
+ __Note__: If an inclusive tax is applied to the service charge,
+ `total_money` does not equal `applied_money` plus `total_tax_money`
+ because the inclusive tax amount is already included in both
+ `applied_money` and `total_tax_money`.
+ """
+
+ total_tax_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of tax money to collect for the service charge.
+ """
+
+ calculation_phase: typing_extensions.NotRequired[OrderServiceChargeCalculationPhase]
+ """
+ The calculation phase at which to apply the service charge.
+ See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values
+ """
+
+ taxable: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the service charge can be taxed. If set to `true`,
+ order-level taxes automatically apply to the service charge. Note that
+ service charges calculated in the `TOTAL_PHASE` cannot be marked as taxable.
+ """
+
+ applied_taxes: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderLineItemAppliedTaxParams]]]
+ """
+ The list of references to the taxes applied to this service charge. Each
+ `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level
+ `OrderLineItemTax` that is being applied to this service charge. On reads, the amount applied
+ is populated.
+
+ An `OrderLineItemAppliedTax` is automatically created on every taxable service charge
+ for all `ORDER` scoped taxes that are added to the order. `OrderLineItemAppliedTax` records
+ for `LINE_ITEM` scoped taxes must be added in requests for the tax to apply to any taxable
+ service charge. Taxable service charges have the `taxable` field set to `true` and calculated
+ in the `SUBTOTAL_PHASE`.
+
+ To change the amount of a tax, modify the referenced top-level tax.
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Optional[str]]]]
+ """
+ Application-defined data attached to this service charge. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ type: typing_extensions.NotRequired[OrderServiceChargeType]
+ """
+ The type of the service charge.
+ See [OrderServiceChargeType](#type-orderservicechargetype) for possible values
+ """
+
+ treatment_type: typing_extensions.NotRequired[OrderServiceChargeTreatmentType]
+ """
+ Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item.
+ See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values
+ """
+
+ scope: typing_extensions.NotRequired[OrderServiceChargeScope]
+ """
+ Indicates the level at which the apportioned service charge applies. For `ORDER`
+ scoped service charges, Square generates references in `applied_service_charges` on
+ all order line items that do not have them. For `LINE_ITEM` scoped service charges,
+ the service charge only applies to line items with a service charge reference in their
+ `applied_service_charges` field.
+
+ This field is immutable. To change the scope of an apportioned service charge, you must delete
+ the apportioned service charge and re-add it as a new apportioned service charge.
+ See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values
+ """
diff --git a/src/square/requests/order_source.py b/src/square/requests/order_source.py
new file mode 100644
index 00000000..85509e53
--- /dev/null
+++ b/src/square/requests/order_source.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class OrderSourceParams(typing_extensions.TypedDict):
+ """
+ Represents the origination details of an order.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name used to identify the place (physical or digital) that an order originates.
+ If unset, the name defaults to the name of the application that created the order.
+ """
diff --git a/src/square/requests/order_updated.py b/src/square/requests/order_updated.py
new file mode 100644
index 00000000..d999a84c
--- /dev/null
+++ b/src/square/requests/order_updated.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_state import OrderState
+
+
+class OrderUpdatedParams(typing_extensions.TypedDict):
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The order's unique ID.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version number, which is incremented each time an update is committed to the order.
+ Orders that were not created through the API do not include a version number and
+ therefore cannot be updated.
+
+ [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders)
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the seller location that this order is associated with.
+ """
+
+ state: typing_extensions.NotRequired[OrderState]
+ """
+ The state of the order.
+ See [OrderState](#type-orderstate) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the order was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the order was last updated, in RFC 3339 format.
+ """
diff --git a/src/square/requests/order_updated_event.py b/src/square/requests/order_updated_event.py
new file mode 100644
index 00000000..50e3f125
--- /dev/null
+++ b/src/square/requests/order_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .order_updated_event_data import OrderUpdatedEventDataParams
+
+
+class OrderUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when an [Order](entity:Order) is updated. This
+ event is triggered by the [UpdateOrder](api-endpoint:Orders-UpdateOrder)
+ endpoint call, Order Manager, or the Square Dashboard.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"order.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[OrderUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/order_updated_event_data.py b/src/square/requests/order_updated_event_data.py
new file mode 100644
index 00000000..0a55ffc9
--- /dev/null
+++ b/src/square/requests/order_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .order_updated_object import OrderUpdatedObjectParams
+
+
+class OrderUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"order_updated"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected order.
+ """
+
+ object: typing_extensions.NotRequired[OrderUpdatedObjectParams]
+ """
+ An object containing information about the updated Order.
+ """
diff --git a/src/square/requests/order_updated_object.py b/src/square/requests/order_updated_object.py
new file mode 100644
index 00000000..91d3be8c
--- /dev/null
+++ b/src/square/requests/order_updated_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .order_updated import OrderUpdatedParams
+
+
+class OrderUpdatedObjectParams(typing_extensions.TypedDict):
+ order_updated: typing_extensions.NotRequired[OrderUpdatedParams]
+ """
+ Information about the updated order.
+ """
diff --git a/src/square/requests/pause_subscription_response.py b/src/square/requests/pause_subscription_response.py
new file mode 100644
index 00000000..5a0ed6ad
--- /dev/null
+++ b/src/square/requests/pause_subscription_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription import SubscriptionParams
+from .subscription_action import SubscriptionActionParams
+
+
+class PauseSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response from the
+ [PauseSubscription](api-endpoint:Subscriptions-PauseSubscription) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The subscription to be paused by the scheduled `PAUSE` action.
+ """
+
+ actions: typing_extensions.NotRequired[typing.Sequence[SubscriptionActionParams]]
+ """
+ The list of a `PAUSE` action and a possible `RESUME` action created by the request.
+ """
diff --git a/src/square/requests/pay_order_response.py b/src/square/requests/pay_order_response.py
new file mode 100644
index 00000000..a02cbe52
--- /dev/null
+++ b/src/square/requests/pay_order_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .order import OrderParams
+
+
+class PayOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of a request to the
+ [PayOrder](api-endpoint:Orders-PayOrder) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ order: typing_extensions.NotRequired[OrderParams]
+ """
+ The paid, updated [order](entity:Order).
+ """
diff --git a/src/square/requests/payment.py b/src/square/requests/payment.py
new file mode 100644
index 00000000..c41ef4ce
--- /dev/null
+++ b/src/square/requests/payment.py
@@ -0,0 +1,341 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .address import AddressParams
+from .application_details import ApplicationDetailsParams
+from .bank_account_payment_details import BankAccountPaymentDetailsParams
+from .buy_now_pay_later_details import BuyNowPayLaterDetailsParams
+from .card_payment_details import CardPaymentDetailsParams
+from .cash_payment_details import CashPaymentDetailsParams
+from .device_details import DeviceDetailsParams
+from .digital_wallet_details import DigitalWalletDetailsParams
+from .electronic_money_details import ElectronicMoneyDetailsParams
+from .external_payment_details import ExternalPaymentDetailsParams
+from .money import MoneyParams
+from .offline_payment_details import OfflinePaymentDetailsParams
+from .processing_fee import ProcessingFeeParams
+from .risk_evaluation import RiskEvaluationParams
+from .square_account_details import SquareAccountDetailsParams
+
+
+class PaymentParams(typing_extensions.TypedDict):
+ """
+ Represents a payment processed by the Square API.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique ID for the payment.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the payment was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the payment was last updated, in RFC 3339 format.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount processed for this payment, not including `tip_money`.
+
+ The amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+ """
+
+ tip_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount designated as a tip for the seller's staff.
+
+ Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.
+
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+ """
+
+ total_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount for the payment, including `amount_money` and `tip_money`.
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+ """
+
+ app_fee_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount the developer is taking as a fee for facilitating the payment on behalf
+ of the seller. This amount is specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information,
+ see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ The amount cannot be more than 90% of the `total_money` value.
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
+ For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+ """
+
+ app_fee_allocations: typing_extensions.NotRequired[typing.Optional[typing.Sequence[typing.Any]]]
+ """
+ Details pertaining to recipients of the application fee.
+ """
+
+ approved_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money approved for this payment. This value may change if Square chooses to
+ obtain reauthorization as part of a call to [UpdatePayment](api-endpoint:Payments-UpdatePayment).
+ """
+
+ processing_fee: typing_extensions.NotRequired[typing.Sequence[ProcessingFeeParams]]
+ """
+ The processing fees and fee adjustments assessed by Square for this payment.
+ """
+
+ refunded_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of the payment refunded to date.
+
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents).
+ """
+
+ status: typing_extensions.NotRequired[str]
+ """
+ Indicates whether the payment is APPROVED, PENDING, COMPLETED, CANCELED, or FAILED.
+ """
+
+ delay_duration: typing_extensions.NotRequired[str]
+ """
+ The duration of time after the payment's creation when Square automatically applies the
+ `delay_action` to the payment. This automatic `delay_action` applies only to payments that
+ do not reach a terminal state (COMPLETED, CANCELED, or FAILED) before the `delay_duration`
+ time period.
+
+ This field is specified as a time duration, in RFC 3339 format.
+
+ Notes:
+ This feature is only supported for card payments.
+
+ Default:
+
+ - Card-present payments: "PT36H" (36 hours) from the creation time.
+ - Card-not-present payments: "P7D" (7 days) from the creation time.
+ """
+
+ delay_action: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The action to be applied to the payment when the `delay_duration` has elapsed.
+
+ Current values include `CANCEL` and `COMPLETE`.
+ """
+
+ delayed_until: typing_extensions.NotRequired[str]
+ """
+ The read-only timestamp of when the `delay_action` is automatically applied,
+ in RFC 3339 format.
+
+ Note that this field is calculated by summing the payment's `delay_duration` and `created_at`
+ fields. The `created_at` field is generated by Square and might not exactly match the
+ time on your local machine.
+ """
+
+ source_type: typing_extensions.NotRequired[str]
+ """
+ The source type for this payment.
+
+ Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `SQUARE_ACCOUNT`,
+ `CASH` and `EXTERNAL`. For information about these payment source types,
+ see [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
+ """
+
+ card_details: typing_extensions.NotRequired[CardPaymentDetailsParams]
+ """
+ Details about a card payment. These details are only populated if the source_type is `CARD`.
+ """
+
+ cash_details: typing_extensions.NotRequired[CashPaymentDetailsParams]
+ """
+ Details about a cash payment. These details are only populated if the source_type is `CASH`.
+ """
+
+ bank_account_details: typing_extensions.NotRequired[BankAccountPaymentDetailsParams]
+ """
+ Details about a bank account payment. These details are only populated if the source_type is `BANK_ACCOUNT`.
+ """
+
+ electronic_money_details: typing_extensions.NotRequired[ElectronicMoneyDetailsParams]
+ """
+ Details specific to electronic money payments.
+ """
+
+ external_details: typing_extensions.NotRequired[ExternalPaymentDetailsParams]
+ """
+ Details about an external payment. The details are only populated
+ if the `source_type` is `EXTERNAL`.
+ """
+
+ wallet_details: typing_extensions.NotRequired[DigitalWalletDetailsParams]
+ """
+ Details about an wallet payment. The details are only populated
+ if the `source_type` is `WALLET`.
+ """
+
+ buy_now_pay_later_details: typing_extensions.NotRequired[BuyNowPayLaterDetailsParams]
+ """
+ Details about a Buy Now Pay Later payment. The details are only populated
+ if the `source_type` is `BUY_NOW_PAY_LATER`. For more information, see
+ [Afterpay Payments](https://developer.squareup.com/docs/payments-api/take-payments/afterpay-payments).
+ """
+
+ square_account_details: typing_extensions.NotRequired[SquareAccountDetailsParams]
+ """
+ Details about a Square Account payment. The details are only populated
+ if the `source_type` is `SQUARE_ACCOUNT`.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the location associated with the payment.
+ """
+
+ order_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the order associated with the payment.
+ """
+
+ reference_id: typing_extensions.NotRequired[str]
+ """
+ An optional ID that associates the payment with an entity in
+ another system.
+ """
+
+ customer_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the customer associated with the payment. If the ID is
+ not provided in the `CreatePayment` request that was used to create the `Payment`,
+ Square may use information in the request
+ (such as the billing and shipping address, email address, and payment source)
+ to identify a matching customer profile in the Customer Directory.
+ If found, the profile ID is used. If a profile is not found, the
+ API attempts to create an
+ [instant profile](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles).
+ If the API cannot create an
+ instant profile (either because the seller has disabled it or the
+ seller's region prevents creating it), this field remains unset. Note that
+ this process is asynchronous and it may take some time before a
+ customer ID is added to the payment.
+ """
+
+ employee_id: typing_extensions.NotRequired[str]
+ """
+ __Deprecated__: Use `Payment.team_member_id` instead.
+
+ An optional ID of the employee associated with taking the payment.
+ """
+
+ team_member_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional ID of the [TeamMember](entity:TeamMember) associated with taking the payment.
+ """
+
+ refund_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ A list of `refund_id`s identifying refunds for the payment.
+ """
+
+ risk_evaluation: typing_extensions.NotRequired[RiskEvaluationParams]
+ """
+ Provides information about the risk associated with the payment, as determined by Square.
+ This field is present for payments to sellers that have opted in to receive risk
+ evaluations.
+ """
+
+ terminal_checkout_id: typing_extensions.NotRequired[str]
+ """
+ An optional ID for a Terminal checkout that is associated with the payment.
+ """
+
+ buyer_email_address: typing_extensions.NotRequired[str]
+ """
+ The buyer's email address.
+ """
+
+ billing_address: typing_extensions.NotRequired[AddressParams]
+ """
+ The buyer's billing address.
+ """
+
+ shipping_address: typing_extensions.NotRequired[AddressParams]
+ """
+ The buyer's shipping address.
+ """
+
+ note: typing_extensions.NotRequired[str]
+ """
+ An optional note to include when creating a payment.
+ """
+
+ statement_description_identifier: typing_extensions.NotRequired[str]
+ """
+ Additional payment information that gets added to the customer's card statement
+ as part of the statement description.
+
+ Note that the `statement_description_identifier` might get truncated on the statement description
+ to fit the required information including the Square identifier (SQ *) and the name of the
+ seller taking the payment.
+ """
+
+ capabilities: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ Actions that can be performed on this payment:
+ - `EDIT_AMOUNT_UP` - The payment amount can be edited up.
+ - `EDIT_AMOUNT_DOWN` - The payment amount can be edited down.
+ - `EDIT_TIP_AMOUNT_UP` - The tip amount can be edited up.
+ - `EDIT_TIP_AMOUNT_DOWN` - The tip amount can be edited down.
+ - `EDIT_DELAY_ACTION` - The delay_action can be edited.
+ """
+
+ receipt_number: typing_extensions.NotRequired[str]
+ """
+ The payment's receipt number.
+ The field is missing if a payment is canceled.
+ """
+
+ receipt_url: typing_extensions.NotRequired[str]
+ """
+ The URL for the payment's receipt.
+ The field is only populated for COMPLETED payments.
+ """
+
+ device_details: typing_extensions.NotRequired[DeviceDetailsParams]
+ """
+ Details about the device that took the payment.
+ """
+
+ application_details: typing_extensions.NotRequired[ApplicationDetailsParams]
+ """
+ Details about the application that took the payment.
+ """
+
+ buyer_currency_exchange: typing_extensions.NotRequired[typing.Any]
+ is_offline_payment: typing_extensions.NotRequired[bool]
+ """
+ Whether or not this payment was taken offline.
+ """
+
+ offline_payment_details: typing_extensions.NotRequired[OfflinePaymentDetailsParams]
+ """
+ Additional information about the payment if it was taken offline.
+ """
+
+ version_token: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Used for optimistic concurrency. This opaque token identifies a specific version of the
+ `Payment` object.
+ """
diff --git a/src/square/requests/payment_balance_activity_app_fee_refund_detail.py b/src/square/requests/payment_balance_activity_app_fee_refund_detail.py
new file mode 100644
index 00000000..c67b8f9c
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_app_fee_refund_detail.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityAppFeeRefundDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ refund_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the refund associated with this activity.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the location of the merchant associated with the payment refund activity
+ """
diff --git a/src/square/requests/payment_balance_activity_app_fee_revenue_detail.py b/src/square/requests/payment_balance_activity_app_fee_revenue_detail.py
new file mode 100644
index 00000000..8e38d6d4
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_app_fee_revenue_detail.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityAppFeeRevenueDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the location of the merchant associated with the payment activity
+ """
diff --git a/src/square/requests/payment_balance_activity_automatic_savings_detail.py b/src/square/requests/payment_balance_activity_automatic_savings_detail.py
new file mode 100644
index 00000000..270d71de
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_automatic_savings_detail.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityAutomaticSavingsDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ payout_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payout associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_automatic_savings_reversed_detail.py b/src/square/requests/payment_balance_activity_automatic_savings_reversed_detail.py
new file mode 100644
index 00000000..e4b6e479
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_automatic_savings_reversed_detail.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityAutomaticSavingsReversedDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ payout_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payout associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_charge_detail.py b/src/square/requests/payment_balance_activity_charge_detail.py
new file mode 100644
index 00000000..b25f3a33
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_charge_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityChargeDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_deposit_fee_detail.py b/src/square/requests/payment_balance_activity_deposit_fee_detail.py
new file mode 100644
index 00000000..e432bedc
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_deposit_fee_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityDepositFeeDetailParams(typing_extensions.TypedDict):
+ payout_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payout that triggered this deposit fee activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_deposit_fee_reversed_detail.py b/src/square/requests/payment_balance_activity_deposit_fee_reversed_detail.py
new file mode 100644
index 00000000..9d7aec6d
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_deposit_fee_reversed_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityDepositFeeReversedDetailParams(typing_extensions.TypedDict):
+ payout_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payout that triggered this deposit fee activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_dispute_detail.py b/src/square/requests/payment_balance_activity_dispute_detail.py
new file mode 100644
index 00000000..2c3cee7a
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_dispute_detail.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityDisputeDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ dispute_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the dispute associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_fee_detail.py b/src/square/requests/payment_balance_activity_fee_detail.py
new file mode 100644
index 00000000..bc480d9f
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_fee_detail.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityFeeDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity
+ This will only be populated when a principal LedgerEntryToken is also populated.
+ If the fee is independent (there is no principal LedgerEntryToken) then this will likely not
+ be populated.
+ """
diff --git a/src/square/requests/payment_balance_activity_free_processing_detail.py b/src/square/requests/payment_balance_activity_free_processing_detail.py
new file mode 100644
index 00000000..f2e0fef4
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_free_processing_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityFreeProcessingDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_hold_adjustment_detail.py b/src/square/requests/payment_balance_activity_hold_adjustment_detail.py
new file mode 100644
index 00000000..876e69a0
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_hold_adjustment_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityHoldAdjustmentDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_open_dispute_detail.py b/src/square/requests/payment_balance_activity_open_dispute_detail.py
new file mode 100644
index 00000000..b33929f3
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_open_dispute_detail.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityOpenDisputeDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ dispute_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the dispute associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_other_adjustment_detail.py b/src/square/requests/payment_balance_activity_other_adjustment_detail.py
new file mode 100644
index 00000000..9ab0e5cb
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_other_adjustment_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityOtherAdjustmentDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_other_detail.py b/src/square/requests/payment_balance_activity_other_detail.py
new file mode 100644
index 00000000..acefe170
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_other_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityOtherDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_refund_detail.py b/src/square/requests/payment_balance_activity_refund_detail.py
new file mode 100644
index 00000000..e19ad8c0
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_refund_detail.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityRefundDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ refund_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the refund associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_release_adjustment_detail.py b/src/square/requests/payment_balance_activity_release_adjustment_detail.py
new file mode 100644
index 00000000..ed4539d7
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_release_adjustment_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityReleaseAdjustmentDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_reserve_hold_detail.py b/src/square/requests/payment_balance_activity_reserve_hold_detail.py
new file mode 100644
index 00000000..06090799
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_reserve_hold_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityReserveHoldDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_reserve_release_detail.py b/src/square/requests/payment_balance_activity_reserve_release_detail.py
new file mode 100644
index 00000000..b856a48e
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_reserve_release_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityReserveReleaseDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_square_capital_payment_detail.py b/src/square/requests/payment_balance_activity_square_capital_payment_detail.py
new file mode 100644
index 00000000..56e0c8b4
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_square_capital_payment_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivitySquareCapitalPaymentDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_square_capital_reversed_payment_detail.py b/src/square/requests/payment_balance_activity_square_capital_reversed_payment_detail.py
new file mode 100644
index 00000000..c5a39613
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_square_capital_reversed_payment_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivitySquareCapitalReversedPaymentDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_square_payroll_transfer_detail.py b/src/square/requests/payment_balance_activity_square_payroll_transfer_detail.py
new file mode 100644
index 00000000..3c23689d
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_square_payroll_transfer_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivitySquarePayrollTransferDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_square_payroll_transfer_reversed_detail.py b/src/square/requests/payment_balance_activity_square_payroll_transfer_reversed_detail.py
new file mode 100644
index 00000000..3c06a6d7
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_square_payroll_transfer_reversed_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivitySquarePayrollTransferReversedDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_tax_on_fee_detail.py b/src/square/requests/payment_balance_activity_tax_on_fee_detail.py
new file mode 100644
index 00000000..2736da5b
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_tax_on_fee_detail.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityTaxOnFeeDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ tax_rate_description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The description of the tax rate being applied. For example: "GST", "HST".
+ """
diff --git a/src/square/requests/payment_balance_activity_third_party_fee_detail.py b/src/square/requests/payment_balance_activity_third_party_fee_detail.py
new file mode 100644
index 00000000..521fe12b
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_third_party_fee_detail.py
@@ -0,0 +1,12 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityThirdPartyFeeDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
diff --git a/src/square/requests/payment_balance_activity_third_party_fee_refund_detail.py b/src/square/requests/payment_balance_activity_third_party_fee_refund_detail.py
new file mode 100644
index 00000000..a2ff74f1
--- /dev/null
+++ b/src/square/requests/payment_balance_activity_third_party_fee_refund_detail.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PaymentBalanceActivityThirdPartyFeeRefundDetailParams(typing_extensions.TypedDict):
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ refund_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The public refund id associated with this activity.
+ """
diff --git a/src/square/requests/payment_created_event.py b/src/square/requests/payment_created_event.py
new file mode 100644
index 00000000..86af90ba
--- /dev/null
+++ b/src/square/requests/payment_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .payment_created_event_data import PaymentCreatedEventDataParams
+
+
+class PaymentCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Payment](entity:Payment) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"payment.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[PaymentCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/payment_created_event_data.py b/src/square/requests/payment_created_event_data.py
new file mode 100644
index 00000000..d3ca19ad
--- /dev/null
+++ b/src/square/requests/payment_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .payment_created_event_object import PaymentCreatedEventObjectParams
+
+
+class PaymentCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"payment"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected payment.
+ """
+
+ object: typing_extensions.NotRequired[PaymentCreatedEventObjectParams]
+ """
+ An object containing the created payment.
+ """
diff --git a/src/square/requests/payment_created_event_object.py b/src/square/requests/payment_created_event_object.py
new file mode 100644
index 00000000..9bfa8c55
--- /dev/null
+++ b/src/square/requests/payment_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .payment import PaymentParams
+
+
+class PaymentCreatedEventObjectParams(typing_extensions.TypedDict):
+ payment: typing_extensions.NotRequired[PaymentParams]
+ """
+ The created payment.
+ """
diff --git a/src/square/requests/payment_link.py b/src/square/requests/payment_link.py
new file mode 100644
index 00000000..c01de1f1
--- /dev/null
+++ b/src/square/requests/payment_link.py
@@ -0,0 +1,68 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .checkout_options import CheckoutOptionsParams
+from .pre_populated_data import PrePopulatedDataParams
+
+
+class PaymentLinkParams(typing_extensions.TypedDict):
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the payment link.
+ """
+
+ version: int
+ """
+ The Square-assigned version number, which is incremented each time an update is committed to the payment link.
+ """
+
+ description: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The optional description of the `payment_link` object.
+ It is primarily for use by your application and is not used anywhere.
+ """
+
+ order_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the order associated with the payment link.
+ """
+
+ checkout_options: typing_extensions.NotRequired[CheckoutOptionsParams]
+ """
+ The checkout options configured for the payment link.
+ For more information, see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations).
+ """
+
+ pre_populated_data: typing_extensions.NotRequired[PrePopulatedDataParams]
+ """
+ Describes buyer data to prepopulate
+ on the checkout page.
+ """
+
+ url: typing_extensions.NotRequired[str]
+ """
+ The shortened URL of the payment link.
+ """
+
+ long_url: typing_extensions.NotRequired[str]
+ """
+ The long URL of the payment link.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the payment link was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the payment link was last updated, in RFC 3339 format.
+ """
+
+ payment_note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional note. After Square processes the payment, this note is added to the
+ resulting `Payment`.
+ """
diff --git a/src/square/requests/payment_link_related_resources.py b/src/square/requests/payment_link_related_resources.py
new file mode 100644
index 00000000..c56ef728
--- /dev/null
+++ b/src/square/requests/payment_link_related_resources.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_object import CatalogObjectParams
+from .order import OrderParams
+
+
+class PaymentLinkRelatedResourcesParams(typing_extensions.TypedDict):
+ orders: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderParams]]]
+ """
+ The order associated with the payment link.
+ """
+
+ subscription_plans: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CatalogObjectParams]]]
+ """
+ The subscription plan associated with the payment link.
+ """
diff --git a/src/square/requests/payment_options.py b/src/square/requests/payment_options.py
new file mode 100644
index 00000000..cb119bd7
--- /dev/null
+++ b/src/square/requests/payment_options.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.payment_options_delay_action import PaymentOptionsDelayAction
+
+
+class PaymentOptionsParams(typing_extensions.TypedDict):
+ autocomplete: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the `Payment` objects created from this `TerminalCheckout` are
+ automatically `COMPLETED` or left in an `APPROVED` state for later modification.
+
+ Default: true
+ """
+
+ delay_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The duration of time after the payment's creation when Square automatically resolves the
+ payment. This automatic resolution applies only to payments that do not reach a terminal state
+ (`COMPLETED` or `CANCELED`) before the `delay_duration` time period.
+
+ This parameter should be specified as a time duration, in RFC 3339 format, with a minimum value
+ of 1 minute and a maximum value of 36 hours. This feature is only supported for card payments,
+ and all payments will be considered card-present.
+
+ This parameter can only be set for a delayed capture payment (`autocomplete=false`). For more
+ information, see [Delayed Capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ Default: "PT36H" (36 hours) from the creation time
+ """
+
+ accept_partial_authorization: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ If set to `true` and charging a Square Gift Card, a payment might be returned with
+ `amount_money` equal to less than what was requested. For example, a request for $20 when charging
+ a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose
+ to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card
+ payment.
+
+ This parameter can only be set for a delayed capture payment (`autocomplete=false`).
+
+ For more information, see [Take Partial Payments](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/partial-payments-with-gift-cards).
+
+ Default: false
+ """
+
+ delay_action: typing_extensions.NotRequired[PaymentOptionsDelayAction]
+ """
+ The action to be applied to the `Payment` when the delay_duration has elapsed.
+ The action must be CANCEL or COMPLETE.
+
+ The action cannot be set to COMPLETE if an `order_id` is present on the TerminalCheckout.
+
+ This parameter can only be set for a delayed capture payment (`autocomplete=false`). For more
+ information, see [Delayed Capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ Default: CANCEL
+ See [DelayAction](#type-delayaction) for possible values
+ """
diff --git a/src/square/requests/payment_refund.py b/src/square/requests/payment_refund.py
new file mode 100644
index 00000000..9251ae2f
--- /dev/null
+++ b/src/square/requests/payment_refund.py
@@ -0,0 +1,112 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .destination_details import DestinationDetailsParams
+from .money import MoneyParams
+from .processing_fee import ProcessingFeeParams
+
+
+class PaymentRefundParams(typing_extensions.TypedDict):
+ """
+ Represents a refund of a payment made using Square. Contains information about
+ the original payment and the amount of money refunded.
+ """
+
+ id: str
+ """
+ The unique ID for this refund, generated by Square.
+ """
+
+ status: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The refund's status:
+ - `PENDING` - Awaiting approval.
+ - `COMPLETED` - Successfully completed.
+ - `REJECTED` - The refund was rejected.
+ - `FAILED` - An error occurred.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The location ID associated with the payment this refund is attached to.
+ """
+
+ unlinked: typing_extensions.NotRequired[bool]
+ """
+ Flag indicating whether or not the refund is linked to an existing payment in Square.
+ """
+
+ destination_type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The destination type for this refund.
+
+ Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`,
+ `EXTERNAL`, and `SQUARE_ACCOUNT`.
+ """
+
+ destination_details: typing_extensions.NotRequired[DestinationDetailsParams]
+ """
+ Contains information about the refund destination. This field is populated only if
+ `destination_id` is defined in the `RefundPayment` request.
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount of money refunded. This amount is specified in the smallest denomination
+ of the applicable currency (for example, US dollar amounts are specified in cents).
+ """
+
+ app_fee_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money the application developer contributed to help cover the refunded amount.
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+ """
+
+ app_fee_allocations: typing_extensions.NotRequired[typing.Sequence[typing.Any]]
+ """
+ Details pertaining to contributors to the refund of the application fee.
+ """
+
+ processing_fee: typing_extensions.NotRequired[typing.Optional[typing.Sequence[ProcessingFeeParams]]]
+ """
+ Processing fees and fee adjustments assessed by Square for this refund.
+ """
+
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the payment associated with this refund.
+ """
+
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the order associated with the refund.
+ """
+
+ reason: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The reason for the refund.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the refund was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the refund was last updated, in RFC 3339 format.
+ """
+
+ team_member_id: typing_extensions.NotRequired[str]
+ """
+ An optional ID of the team member associated with taking the payment.
+ """
+
+ terminal_refund_id: typing_extensions.NotRequired[str]
+ """
+ An optional ID for a Terminal refund.
+ """
diff --git a/src/square/requests/payment_updated_event.py b/src/square/requests/payment_updated_event.py
new file mode 100644
index 00000000..4ab820fb
--- /dev/null
+++ b/src/square/requests/payment_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .payment_updated_event_data import PaymentUpdatedEventDataParams
+
+
+class PaymentUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Payment](entity:Payment) is updated.
+ Typically the `payment.status`, or `card_details.status` fields are updated
+ as a payment is canceled, authorized, or completed.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"payment.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[PaymentUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/payment_updated_event_data.py b/src/square/requests/payment_updated_event_data.py
new file mode 100644
index 00000000..c43d5136
--- /dev/null
+++ b/src/square/requests/payment_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .payment_updated_event_object import PaymentUpdatedEventObjectParams
+
+
+class PaymentUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"payment"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected payment.
+ """
+
+ object: typing_extensions.NotRequired[PaymentUpdatedEventObjectParams]
+ """
+ An object containing the updated payment.
+ """
diff --git a/src/square/requests/payment_updated_event_object.py b/src/square/requests/payment_updated_event_object.py
new file mode 100644
index 00000000..8351e9bd
--- /dev/null
+++ b/src/square/requests/payment_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .payment import PaymentParams
+
+
+class PaymentUpdatedEventObjectParams(typing_extensions.TypedDict):
+ payment: typing_extensions.NotRequired[PaymentParams]
+ """
+ The updated payment.
+ """
diff --git a/src/square/requests/payout.py b/src/square/requests/payout.py
new file mode 100644
index 00000000..901d1504
--- /dev/null
+++ b/src/square/requests/payout.py
@@ -0,0 +1,81 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.payout_status import PayoutStatus
+from ..types.payout_type import PayoutType
+from .destination import DestinationParams
+from .money import MoneyParams
+from .payout_fee import PayoutFeeParams
+
+
+class PayoutParams(typing_extensions.TypedDict):
+ """
+ An accounting of the amount owed the seller and record of the actual transfer to their
+ external bank account or to the Square balance.
+ """
+
+ id: str
+ """
+ A unique ID for the payout.
+ """
+
+ status: typing_extensions.NotRequired[PayoutStatus]
+ """
+ Indicates the payout status.
+ See [PayoutStatus](#type-payoutstatus) for possible values
+ """
+
+ location_id: str
+ """
+ The ID of the location associated with the payout.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the payout was created and submitted for deposit to the seller's banking destination, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the payout was last updated, in RFC 3339 format.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money involved in the payout. A positive amount indicates a deposit, and a negative amount indicates a withdrawal. This amount is never zero.
+ """
+
+ destination: typing_extensions.NotRequired[DestinationParams]
+ """
+ Information about the banking destination (such as a bank account, Square checking account, or debit card)
+ against which the payout was made.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version number, which is incremented each time an update is made to this payout record.
+ The version number helps developers receive event notifications or feeds out of order.
+ """
+
+ type: typing_extensions.NotRequired[PayoutType]
+ """
+ Indicates the payout type.
+ See [PayoutType](#type-payouttype) for possible values
+ """
+
+ payout_fee: typing_extensions.NotRequired[typing.Optional[typing.Sequence[PayoutFeeParams]]]
+ """
+ A list of transfer fees and any taxes on the fees assessed by Square for this payout.
+ """
+
+ arrival_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s banking destination.
+ """
+
+ end_to_end_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for each `Payout` object that might also appear on the seller’s bank statement. You can use this ID to automate the process of reconciling each payout with the corresponding line item on the bank statement.
+ """
diff --git a/src/square/requests/payout_entry.py b/src/square/requests/payout_entry.py
new file mode 100644
index 00000000..1acb9fa9
--- /dev/null
+++ b/src/square/requests/payout_entry.py
@@ -0,0 +1,226 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.activity_type import ActivityType
+from .money import MoneyParams
+from .payment_balance_activity_app_fee_refund_detail import PaymentBalanceActivityAppFeeRefundDetailParams
+from .payment_balance_activity_app_fee_revenue_detail import PaymentBalanceActivityAppFeeRevenueDetailParams
+from .payment_balance_activity_automatic_savings_detail import PaymentBalanceActivityAutomaticSavingsDetailParams
+from .payment_balance_activity_automatic_savings_reversed_detail import (
+ PaymentBalanceActivityAutomaticSavingsReversedDetailParams,
+)
+from .payment_balance_activity_charge_detail import PaymentBalanceActivityChargeDetailParams
+from .payment_balance_activity_deposit_fee_detail import PaymentBalanceActivityDepositFeeDetailParams
+from .payment_balance_activity_deposit_fee_reversed_detail import PaymentBalanceActivityDepositFeeReversedDetailParams
+from .payment_balance_activity_dispute_detail import PaymentBalanceActivityDisputeDetailParams
+from .payment_balance_activity_fee_detail import PaymentBalanceActivityFeeDetailParams
+from .payment_balance_activity_free_processing_detail import PaymentBalanceActivityFreeProcessingDetailParams
+from .payment_balance_activity_hold_adjustment_detail import PaymentBalanceActivityHoldAdjustmentDetailParams
+from .payment_balance_activity_open_dispute_detail import PaymentBalanceActivityOpenDisputeDetailParams
+from .payment_balance_activity_other_adjustment_detail import PaymentBalanceActivityOtherAdjustmentDetailParams
+from .payment_balance_activity_other_detail import PaymentBalanceActivityOtherDetailParams
+from .payment_balance_activity_refund_detail import PaymentBalanceActivityRefundDetailParams
+from .payment_balance_activity_release_adjustment_detail import PaymentBalanceActivityReleaseAdjustmentDetailParams
+from .payment_balance_activity_reserve_hold_detail import PaymentBalanceActivityReserveHoldDetailParams
+from .payment_balance_activity_reserve_release_detail import PaymentBalanceActivityReserveReleaseDetailParams
+from .payment_balance_activity_square_capital_payment_detail import (
+ PaymentBalanceActivitySquareCapitalPaymentDetailParams,
+)
+from .payment_balance_activity_square_capital_reversed_payment_detail import (
+ PaymentBalanceActivitySquareCapitalReversedPaymentDetailParams,
+)
+from .payment_balance_activity_square_payroll_transfer_detail import (
+ PaymentBalanceActivitySquarePayrollTransferDetailParams,
+)
+from .payment_balance_activity_square_payroll_transfer_reversed_detail import (
+ PaymentBalanceActivitySquarePayrollTransferReversedDetailParams,
+)
+from .payment_balance_activity_tax_on_fee_detail import PaymentBalanceActivityTaxOnFeeDetailParams
+from .payment_balance_activity_third_party_fee_detail import PaymentBalanceActivityThirdPartyFeeDetailParams
+from .payment_balance_activity_third_party_fee_refund_detail import (
+ PaymentBalanceActivityThirdPartyFeeRefundDetailParams,
+)
+
+
+class PayoutEntryParams(typing_extensions.TypedDict):
+ """
+ One or more PayoutEntries that make up a Payout. Each one has a date, amount, and type of activity.
+ The total amount of the payout will equal the sum of the payout entries for a batch payout
+ """
+
+ id: str
+ """
+ A unique ID for the payout entry.
+ """
+
+ payout_id: str
+ """
+ The ID of the payout entries’ associated payout.
+ """
+
+ effective_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timestamp of when the payout entry affected the balance, in RFC 3339 format.
+ """
+
+ type: typing_extensions.NotRequired[ActivityType]
+ """
+ The type of activity associated with this payout entry.
+ See [ActivityType](#type-activitytype) for possible values
+ """
+
+ gross_amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of money involved in this payout entry.
+ """
+
+ fee_amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of Square fees associated with this payout entry.
+ """
+
+ net_amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The net proceeds from this transaction after any fees.
+ """
+
+ type_app_fee_revenue_details: typing_extensions.NotRequired[PaymentBalanceActivityAppFeeRevenueDetailParams]
+ """
+ Details of any developer app fee revenue generated on a payment.
+ """
+
+ type_app_fee_refund_details: typing_extensions.NotRequired[PaymentBalanceActivityAppFeeRefundDetailParams]
+ """
+ Details of a refund for an app fee on a payment.
+ """
+
+ type_automatic_savings_details: typing_extensions.NotRequired[PaymentBalanceActivityAutomaticSavingsDetailParams]
+ """
+ Details of any automatic transfer from the payment processing balance to the Square Savings account. These are, generally, proportional to the merchant's sales.
+ """
+
+ type_automatic_savings_reversed_details: typing_extensions.NotRequired[
+ PaymentBalanceActivityAutomaticSavingsReversedDetailParams
+ ]
+ """
+ Details of any automatic transfer from the Square Savings account back to the processing balance. These are, generally, proportional to the merchant's refunds.
+ """
+
+ type_charge_details: typing_extensions.NotRequired[PaymentBalanceActivityChargeDetailParams]
+ """
+ Details of credit card payment captures.
+ """
+
+ type_deposit_fee_details: typing_extensions.NotRequired[PaymentBalanceActivityDepositFeeDetailParams]
+ """
+ Details of any fees involved with deposits such as for instant deposits.
+ """
+
+ type_deposit_fee_reversed_details: typing_extensions.NotRequired[
+ PaymentBalanceActivityDepositFeeReversedDetailParams
+ ]
+ """
+ Details of any reversal or refund of fees involved with deposits such as for instant deposits.
+ """
+
+ type_dispute_details: typing_extensions.NotRequired[PaymentBalanceActivityDisputeDetailParams]
+ """
+ Details of any balance change due to a dispute event.
+ """
+
+ type_fee_details: typing_extensions.NotRequired[PaymentBalanceActivityFeeDetailParams]
+ """
+ Details of adjustments due to the Square processing fee.
+ """
+
+ type_free_processing_details: typing_extensions.NotRequired[PaymentBalanceActivityFreeProcessingDetailParams]
+ """
+ Square offers Free Payments Processing for a variety of business scenarios including seller referral or when Square wants to apologize for a bug, customer service, repricing complication, and so on. This entry represents details of any credit to the merchant for the purposes of Free Processing.
+ """
+
+ type_hold_adjustment_details: typing_extensions.NotRequired[PaymentBalanceActivityHoldAdjustmentDetailParams]
+ """
+ Details of any adjustment made by Square related to the holding or releasing of a payment.
+ """
+
+ type_open_dispute_details: typing_extensions.NotRequired[PaymentBalanceActivityOpenDisputeDetailParams]
+ """
+ Details of any open disputes.
+ """
+
+ type_other_details: typing_extensions.NotRequired[PaymentBalanceActivityOtherDetailParams]
+ """
+ Details of any other type that does not belong in the rest of the types.
+ """
+
+ type_other_adjustment_details: typing_extensions.NotRequired[PaymentBalanceActivityOtherAdjustmentDetailParams]
+ """
+ Details of any other type of adjustments that don't fall under existing types.
+ """
+
+ type_refund_details: typing_extensions.NotRequired[PaymentBalanceActivityRefundDetailParams]
+ """
+ Details of a refund for an existing card payment.
+ """
+
+ type_release_adjustment_details: typing_extensions.NotRequired[PaymentBalanceActivityReleaseAdjustmentDetailParams]
+ """
+ Details of fees released for adjustments.
+ """
+
+ type_reserve_hold_details: typing_extensions.NotRequired[PaymentBalanceActivityReserveHoldDetailParams]
+ """
+ Details of fees paid for funding risk reserve.
+ """
+
+ type_reserve_release_details: typing_extensions.NotRequired[PaymentBalanceActivityReserveReleaseDetailParams]
+ """
+ Details of fees released from risk reserve.
+ """
+
+ type_square_capital_payment_details: typing_extensions.NotRequired[
+ PaymentBalanceActivitySquareCapitalPaymentDetailParams
+ ]
+ """
+ Details of capital merchant cash advance (MCA) assessments. These are, generally, proportional to the merchant's sales but may be issued for other reasons related to the MCA.
+ """
+
+ type_square_capital_reversed_payment_details: typing_extensions.NotRequired[
+ PaymentBalanceActivitySquareCapitalReversedPaymentDetailParams
+ ]
+ """
+ Details of capital merchant cash advance (MCA) assessment refunds. These are, generally, proportional to the merchant's refunds but may be issued for other reasons related to the MCA.
+ """
+
+ type_tax_on_fee_details: typing_extensions.NotRequired[PaymentBalanceActivityTaxOnFeeDetailParams]
+ """
+ Details of tax paid on fee amounts.
+ """
+
+ type_third_party_fee_details: typing_extensions.NotRequired[PaymentBalanceActivityThirdPartyFeeDetailParams]
+ """
+ Details of fees collected by a 3rd party platform.
+ """
+
+ type_third_party_fee_refund_details: typing_extensions.NotRequired[
+ PaymentBalanceActivityThirdPartyFeeRefundDetailParams
+ ]
+ """
+ Details of refunded fees from a 3rd party platform.
+ """
+
+ type_square_payroll_transfer_details: typing_extensions.NotRequired[
+ PaymentBalanceActivitySquarePayrollTransferDetailParams
+ ]
+ """
+ Details of a payroll payment that was transferred to a team member’s bank account.
+ """
+
+ type_square_payroll_transfer_reversed_details: typing_extensions.NotRequired[
+ PaymentBalanceActivitySquarePayrollTransferReversedDetailParams
+ ]
+ """
+ Details of a payroll payment to a team member’s bank account that was deposited back to the seller’s account by Square.
+ """
diff --git a/src/square/requests/payout_failed_event.py b/src/square/requests/payout_failed_event.py
new file mode 100644
index 00000000..115e590e
--- /dev/null
+++ b/src/square/requests/payout_failed_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .payout_failed_event_data import PayoutFailedEventDataParams
+
+
+class PayoutFailedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Payout](entity:Payout) has failed.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event that this represents, `payout.failed`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the event was verified, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[PayoutFailedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/payout_failed_event_data.py b/src/square/requests/payout_failed_event_data.py
new file mode 100644
index 00000000..23c47547
--- /dev/null
+++ b/src/square/requests/payout_failed_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .payout_failed_event_object import PayoutFailedEventObjectParams
+
+
+class PayoutFailedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the affected object's type, `payout`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the failed payout.
+ """
+
+ object: typing_extensions.NotRequired[PayoutFailedEventObjectParams]
+ """
+ An object containing the failed payout.
+ """
diff --git a/src/square/requests/payout_failed_event_object.py b/src/square/requests/payout_failed_event_object.py
new file mode 100644
index 00000000..3d792a28
--- /dev/null
+++ b/src/square/requests/payout_failed_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .payout import PayoutParams
+
+
+class PayoutFailedEventObjectParams(typing_extensions.TypedDict):
+ payout: typing_extensions.NotRequired[PayoutParams]
+ """
+ The payout that failed.
+ """
diff --git a/src/square/requests/payout_fee.py b/src/square/requests/payout_fee.py
new file mode 100644
index 00000000..3c7acc4e
--- /dev/null
+++ b/src/square/requests/payout_fee.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.payout_fee_type import PayoutFeeType
+from .money import MoneyParams
+
+
+class PayoutFeeParams(typing_extensions.TypedDict):
+ """
+ Represents a payout fee that can incur as part of a payout.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The money amount of the payout fee.
+ """
+
+ effective_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timestamp of when the fee takes effect, in RFC 3339 format.
+ """
+
+ type: typing_extensions.NotRequired[PayoutFeeType]
+ """
+ The type of fee assessed as part of the payout.
+ See [PayoutFeeType](#type-payoutfeetype) for possible values
+ """
diff --git a/src/square/requests/payout_paid_event.py b/src/square/requests/payout_paid_event.py
new file mode 100644
index 00000000..9ab52c4e
--- /dev/null
+++ b/src/square/requests/payout_paid_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .payout_paid_event_data import PayoutPaidEventDataParams
+
+
+class PayoutPaidEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Payout](entity:Payout) is complete.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"payout.paid"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was verified, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[PayoutPaidEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/payout_paid_event_data.py b/src/square/requests/payout_paid_event_data.py
new file mode 100644
index 00000000..d459d6c5
--- /dev/null
+++ b/src/square/requests/payout_paid_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .payout_paid_event_object import PayoutPaidEventObjectParams
+
+
+class PayoutPaidEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"payout"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the completed payout.
+ """
+
+ object: typing_extensions.NotRequired[PayoutPaidEventObjectParams]
+ """
+ An object containing the completed payout.
+ """
diff --git a/src/square/requests/payout_paid_event_object.py b/src/square/requests/payout_paid_event_object.py
new file mode 100644
index 00000000..92e4d2d9
--- /dev/null
+++ b/src/square/requests/payout_paid_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .payout import PayoutParams
+
+
+class PayoutPaidEventObjectParams(typing_extensions.TypedDict):
+ payout: typing_extensions.NotRequired[PayoutParams]
+ """
+ The payout that has completed.
+ """
diff --git a/src/square/requests/payout_sent_event.py b/src/square/requests/payout_sent_event.py
new file mode 100644
index 00000000..fe2e96c1
--- /dev/null
+++ b/src/square/requests/payout_sent_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .payout_sent_event_data import PayoutSentEventDataParams
+
+
+class PayoutSentEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Payout](entity:Payout) is sent.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"payout.sent"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was verified, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[PayoutSentEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/payout_sent_event_data.py b/src/square/requests/payout_sent_event_data.py
new file mode 100644
index 00000000..0a5cd8a1
--- /dev/null
+++ b/src/square/requests/payout_sent_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .payout_sent_event_object import PayoutSentEventObjectParams
+
+
+class PayoutSentEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"payout"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the sent payout.
+ """
+
+ object: typing_extensions.NotRequired[PayoutSentEventObjectParams]
+ """
+ An object containing the sent payout.
+ """
diff --git a/src/square/requests/payout_sent_event_object.py b/src/square/requests/payout_sent_event_object.py
new file mode 100644
index 00000000..a711be55
--- /dev/null
+++ b/src/square/requests/payout_sent_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .payout import PayoutParams
+
+
+class PayoutSentEventObjectParams(typing_extensions.TypedDict):
+ payout: typing_extensions.NotRequired[PayoutParams]
+ """
+ The payout that was sent.
+ """
diff --git a/src/square/requests/phase.py b/src/square/requests/phase.py
new file mode 100644
index 00000000..72d15cb9
--- /dev/null
+++ b/src/square/requests/phase.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PhaseParams(typing_extensions.TypedDict):
+ """
+ Represents a phase, which can override subscription phases as defined by plan_id
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ id of subscription phase
+ """
+
+ ordinal: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ index of phase in total subscription plan
+ """
+
+ order_template_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ id of order to be used in billing
+ """
+
+ plan_phase_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ the uid from the plan's phase in catalog
+ """
diff --git a/src/square/requests/phase_input.py b/src/square/requests/phase_input.py
new file mode 100644
index 00000000..6ee11a09
--- /dev/null
+++ b/src/square/requests/phase_input.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class PhaseInputParams(typing_extensions.TypedDict):
+ """
+ Represents the arguments used to construct a new phase.
+ """
+
+ ordinal: int
+ """
+ index of phase in total subscription plan
+ """
+
+ order_template_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ id of order to be used in billing
+ """
diff --git a/src/square/requests/pre_populated_data.py b/src/square/requests/pre_populated_data.py
new file mode 100644
index 00000000..74ae95ae
--- /dev/null
+++ b/src/square/requests/pre_populated_data.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .address import AddressParams
+
+
+class PrePopulatedDataParams(typing_extensions.TypedDict):
+ """
+ Describes buyer data to prepopulate in the payment form.
+ For more information,
+ see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations).
+ """
+
+ buyer_email: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The buyer email to prepopulate in the payment form.
+ """
+
+ buyer_phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The buyer phone number to prepopulate in the payment form.
+ """
+
+ buyer_address: typing_extensions.NotRequired[AddressParams]
+ """
+ The buyer address to prepopulate in the payment form.
+ """
diff --git a/src/square/requests/processing_fee.py b/src/square/requests/processing_fee.py
new file mode 100644
index 00000000..6e6a0be5
--- /dev/null
+++ b/src/square/requests/processing_fee.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class ProcessingFeeParams(typing_extensions.TypedDict):
+ """
+ Represents the Square processing fee.
+ """
+
+ effective_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timestamp of when the fee takes effect, in RFC 3339 format.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of fee assessed or adjusted. The fee type can be `INITIAL` or `ADJUSTMENT`.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The fee amount, which might be negative, that is assessed or adjusted by Square.
+
+ Positive values represent funds being assessed, while negative values represent
+ funds being returned.
+ """
diff --git a/src/square/requests/publish_invoice_response.py b/src/square/requests/publish_invoice_response.py
new file mode 100644
index 00000000..61ba6fae
--- /dev/null
+++ b/src/square/requests/publish_invoice_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .invoice import InvoiceParams
+
+
+class PublishInvoiceResponseParams(typing_extensions.TypedDict):
+ """
+ Describes a `PublishInvoice` response.
+ """
+
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The published invoice.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/publish_scheduled_shift_response.py b/src/square/requests/publish_scheduled_shift_response.py
new file mode 100644
index 00000000..d8e6fd77
--- /dev/null
+++ b/src/square/requests/publish_scheduled_shift_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .scheduled_shift import ScheduledShiftParams
+
+
+class PublishScheduledShiftResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) response.
+ Either `scheduled_shift` or `errors` is present in the response.
+ """
+
+ scheduled_shift: typing_extensions.NotRequired[ScheduledShiftParams]
+ """
+ The published scheduled shift.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/qr_code_options.py b/src/square/requests/qr_code_options.py
new file mode 100644
index 00000000..10331dab
--- /dev/null
+++ b/src/square/requests/qr_code_options.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class QrCodeOptionsParams(typing_extensions.TypedDict):
+ """
+ Fields to describe the action that displays QR-Codes.
+ """
+
+ title: str
+ """
+ The title text to display in the QR code flow on the Terminal.
+ """
+
+ body: str
+ """
+ The body text to display in the QR code flow on the Terminal.
+ """
+
+ barcode_contents: str
+ """
+ The text representation of the data to show in the QR code
+ as UTF8-encoded data.
+ """
diff --git a/src/square/requests/query.py b/src/square/requests/query.py
new file mode 100644
index 00000000..5b5530b7
--- /dev/null
+++ b/src/square/requests/query.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from ..types.join_hint import JoinHint
+from .join_subquery import JoinSubqueryParams
+from .query_filter import QueryFilterParams
+from .time_dimension import TimeDimensionParams
+
+
+class QueryParams(typing_extensions.TypedDict):
+ measures: typing_extensions.NotRequired[typing.Sequence[str]]
+ dimensions: typing_extensions.NotRequired[typing.Sequence[str]]
+ segments: typing_extensions.NotRequired[typing.Sequence[str]]
+ time_dimensions: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[TimeDimensionParams], FieldMetadata(alias="timeDimensions")]
+ ]
+ order: typing_extensions.NotRequired[typing.Sequence[typing.Sequence[str]]]
+ limit: typing_extensions.NotRequired[int]
+ offset: typing_extensions.NotRequired[int]
+ filters: typing_extensions.NotRequired[typing.Sequence[QueryFilterParams]]
+ ungrouped: typing_extensions.NotRequired[bool]
+ subquery_joins: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[JoinSubqueryParams], FieldMetadata(alias="subqueryJoins")]
+ ]
+ join_hints: typing_extensions.NotRequired[
+ typing_extensions.Annotated[typing.Sequence[JoinHint], FieldMetadata(alias="joinHints")]
+ ]
+ timezone: typing_extensions.NotRequired[str]
diff --git a/src/square/requests/query_filter.py b/src/square/requests/query_filter.py
new file mode 100644
index 00000000..39f89f0f
--- /dev/null
+++ b/src/square/requests/query_filter.py
@@ -0,0 +1,9 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .query_filter_and import QueryFilterAndParams
+from .query_filter_condition import QueryFilterConditionParams
+from .query_filter_or import QueryFilterOrParams
+
+QueryFilterParams = typing.Union[QueryFilterConditionParams, QueryFilterOrParams, QueryFilterAndParams]
diff --git a/src/square/requests/query_filter_and.py b/src/square/requests/query_filter_and.py
new file mode 100644
index 00000000..902756a1
--- /dev/null
+++ b/src/square/requests/query_filter_and.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+
+
+class QueryFilterAndParams(typing_extensions.TypedDict):
+ and_: typing_extensions.Annotated[typing.Sequence[typing.Dict[str, typing.Any]], FieldMetadata(alias="and")]
diff --git a/src/square/requests/query_filter_condition.py b/src/square/requests/query_filter_condition.py
new file mode 100644
index 00000000..0fcc6741
--- /dev/null
+++ b/src/square/requests/query_filter_condition.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class QueryFilterConditionParams(typing_extensions.TypedDict):
+ member: str
+ operator: str
+ values: typing_extensions.NotRequired[typing.Sequence[str]]
diff --git a/src/square/requests/query_filter_or.py b/src/square/requests/query_filter_or.py
new file mode 100644
index 00000000..89909da2
--- /dev/null
+++ b/src/square/requests/query_filter_or.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+
+
+class QueryFilterOrParams(typing_extensions.TypedDict):
+ or_: typing_extensions.Annotated[typing.Sequence[typing.Dict[str, typing.Any]], FieldMetadata(alias="or")]
diff --git a/src/square/requests/quick_pay.py b/src/square/requests/quick_pay.py
new file mode 100644
index 00000000..712635c4
--- /dev/null
+++ b/src/square/requests/quick_pay.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class QuickPayParams(typing_extensions.TypedDict):
+ """
+ Describes an ad hoc item and price to generate a quick pay checkout link.
+ For more information,
+ see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout).
+ """
+
+ name: str
+ """
+ The ad hoc item name. In the resulting `Order`, this name appears as the line item name.
+ """
+
+ price_money: MoneyParams
+ """
+ The price of the item.
+ """
+
+ location_id: str
+ """
+ The ID of the business location the checkout is associated with.
+ """
diff --git a/src/square/requests/range.py b/src/square/requests/range.py
new file mode 100644
index 00000000..b84e5a01
--- /dev/null
+++ b/src/square/requests/range.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class RangeParams(typing_extensions.TypedDict):
+ """
+ The range of a number value between the specified lower and upper bounds.
+ """
+
+ min: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The lower bound of the number range. At least one of `min` or `max` must be specified.
+ If unspecified, the results will have no minimum value.
+ """
+
+ max: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The upper bound of the number range. At least one of `min` or `max` must be specified.
+ If unspecified, the results will have no maximum value.
+ """
diff --git a/src/square/requests/receipt_options.py b/src/square/requests/receipt_options.py
new file mode 100644
index 00000000..7392b861
--- /dev/null
+++ b/src/square/requests/receipt_options.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class ReceiptOptionsParams(typing_extensions.TypedDict):
+ """
+ Describes receipt action fields.
+ """
+
+ payment_id: str
+ """
+ The reference to the Square payment ID for the receipt.
+ """
+
+ print_only: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Instructs the device to print the receipt without displaying the receipt selection screen.
+ Requires `printer_enabled` set to true.
+ Defaults to false.
+ """
+
+ is_duplicate: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Identify the receipt as a reprint rather than an original receipt.
+ Defaults to false.
+ """
diff --git a/src/square/requests/receive_transfer_order_response.py b/src/square/requests/receive_transfer_order_response.py
new file mode 100644
index 00000000..2415cca1
--- /dev/null
+++ b/src/square/requests/receive_transfer_order_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .transfer_order import TransferOrderParams
+
+
+class ReceiveTransferOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Response for receiving items for a transfer order
+ """
+
+ transfer_order: typing_extensions.NotRequired[TransferOrderParams]
+ """
+ The updated transfer order
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request
+ """
diff --git a/src/square/requests/redeem_loyalty_reward_response.py b/src/square/requests/redeem_loyalty_reward_response.py
new file mode 100644
index 00000000..8ec9b795
--- /dev/null
+++ b/src/square/requests/redeem_loyalty_reward_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_event import LoyaltyEventParams
+
+
+class RedeemLoyaltyRewardResponseParams(typing_extensions.TypedDict):
+ """
+ A response that includes the `LoyaltyEvent` published for redeeming the reward.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ event: typing_extensions.NotRequired[LoyaltyEventParams]
+ """
+ The `LoyaltyEvent` for redeeming the reward.
+ """
diff --git a/src/square/requests/reference.py b/src/square/requests/reference.py
new file mode 100644
index 00000000..aec6d062
--- /dev/null
+++ b/src/square/requests/reference.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.reference_type import ReferenceType
+
+
+class ReferenceParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[ReferenceType]
+ """
+ The type of entity a channel is associated with.
+ See [Type](#type-type) for possible values
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The id of the entity a channel is associated with.
+ """
diff --git a/src/square/requests/refund.py b/src/square/requests/refund.py
new file mode 100644
index 00000000..8a87f027
--- /dev/null
+++ b/src/square/requests/refund.py
@@ -0,0 +1,67 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.refund_status import RefundStatus
+from .additional_recipient import AdditionalRecipientParams
+from .money import MoneyParams
+
+
+class RefundParams(typing_extensions.TypedDict):
+ """
+ Represents a refund processed for a Square transaction.
+ """
+
+ id: str
+ """
+ The refund's unique ID.
+ """
+
+ location_id: str
+ """
+ The ID of the refund's associated location.
+ """
+
+ transaction_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the transaction that the refunded tender is part of.
+ """
+
+ tender_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the refunded tender.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the refund was created, in RFC 3339 format.
+ """
+
+ reason: str
+ """
+ The reason for the refund being issued.
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount of money refunded to the buyer.
+ """
+
+ status: RefundStatus
+ """
+ The current status of the refund (`PENDING`, `APPROVED`, `REJECTED`,
+ or `FAILED`).
+ See [RefundStatus](#type-refundstatus) for possible values
+ """
+
+ processing_fee_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of Square processing fee money refunded to the *merchant*.
+ """
+
+ additional_recipients: typing_extensions.NotRequired[typing.Optional[typing.Sequence[AdditionalRecipientParams]]]
+ """
+ Additional recipients (other than the merchant) receiving a portion of this refund.
+ For example, fees assessed on a refund of a purchase by a third party integration.
+ """
diff --git a/src/square/requests/refund_created_event.py b/src/square/requests/refund_created_event.py
new file mode 100644
index 00000000..a0314a21
--- /dev/null
+++ b/src/square/requests/refund_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .refund_created_event_data import RefundCreatedEventDataParams
+
+
+class RefundCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Refund](entity:PaymentRefund) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"refund.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[RefundCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/refund_created_event_data.py b/src/square/requests/refund_created_event_data.py
new file mode 100644
index 00000000..d3e457bc
--- /dev/null
+++ b/src/square/requests/refund_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .refund_created_event_object import RefundCreatedEventObjectParams
+
+
+class RefundCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"refund"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected refund.
+ """
+
+ object: typing_extensions.NotRequired[RefundCreatedEventObjectParams]
+ """
+ An object containing the created refund.
+ """
diff --git a/src/square/requests/refund_created_event_object.py b/src/square/requests/refund_created_event_object.py
new file mode 100644
index 00000000..4c322bbf
--- /dev/null
+++ b/src/square/requests/refund_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .payment_refund import PaymentRefundParams
+
+
+class RefundCreatedEventObjectParams(typing_extensions.TypedDict):
+ refund: typing_extensions.NotRequired[PaymentRefundParams]
+ """
+ The created refund.
+ """
diff --git a/src/square/requests/refund_payment_response.py b/src/square/requests/refund_payment_response.py
new file mode 100644
index 00000000..ad7c43d8
--- /dev/null
+++ b/src/square/requests/refund_payment_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment_refund import PaymentRefundParams
+
+
+class RefundPaymentResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response returned by
+ [RefundPayment](api-endpoint:Refunds-RefundPayment).
+
+ If there are errors processing the request, the `refund` field might not be
+ present, or it might be present with a status of `FAILED`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ refund: typing_extensions.NotRequired[PaymentRefundParams]
+ """
+ The successfully created `PaymentRefund`.
+ """
diff --git a/src/square/requests/refund_updated_event.py b/src/square/requests/refund_updated_event.py
new file mode 100644
index 00000000..6710266b
--- /dev/null
+++ b/src/square/requests/refund_updated_event.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .refund_updated_event_data import RefundUpdatedEventDataParams
+
+
+class RefundUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Refund](entity:PaymentRefund) is updated.
+ Typically the `refund.status` changes when a refund is completed.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"refund.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[RefundUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/refund_updated_event_data.py b/src/square/requests/refund_updated_event_data.py
new file mode 100644
index 00000000..895cd4ac
--- /dev/null
+++ b/src/square/requests/refund_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .refund_updated_event_object import RefundUpdatedEventObjectParams
+
+
+class RefundUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"refund"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected refund.
+ """
+
+ object: typing_extensions.NotRequired[RefundUpdatedEventObjectParams]
+ """
+ An object containing the updated refund.
+ """
diff --git a/src/square/requests/refund_updated_event_object.py b/src/square/requests/refund_updated_event_object.py
new file mode 100644
index 00000000..3e613f77
--- /dev/null
+++ b/src/square/requests/refund_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .payment_refund import PaymentRefundParams
+
+
+class RefundUpdatedEventObjectParams(typing_extensions.TypedDict):
+ refund: typing_extensions.NotRequired[PaymentRefundParams]
+ """
+ The updated refund.
+ """
diff --git a/src/square/requests/register_domain_response.py b/src/square/requests/register_domain_response.py
new file mode 100644
index 00000000..44dd2885
--- /dev/null
+++ b/src/square/requests/register_domain_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.register_domain_response_status import RegisterDomainResponseStatus
+from .error import ErrorParams
+
+
+class RegisterDomainResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RegisterDomain](api-endpoint:ApplePay-RegisterDomain) endpoint.
+
+ Either `errors` or `status` are present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ status: typing_extensions.NotRequired[RegisterDomainResponseStatus]
+ """
+ The status of the domain registration.
+
+ See [RegisterDomainResponseStatus](entity:RegisterDomainResponseStatus) for possible values.
+ See [RegisterDomainResponseStatus](#type-registerdomainresponsestatus) for possible values
+ """
diff --git a/src/square/requests/remove_group_from_customer_response.py b/src/square/requests/remove_group_from_customer_response.py
new file mode 100644
index 00000000..9f0a7b82
--- /dev/null
+++ b/src/square/requests/remove_group_from_customer_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class RemoveGroupFromCustomerResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RemoveGroupFromCustomer](api-endpoint:Customers-RemoveGroupFromCustomer)
+ endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/reporting_error.py b/src/square/requests/reporting_error.py
new file mode 100644
index 00000000..bc987547
--- /dev/null
+++ b/src/square/requests/reporting_error.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class ReportingErrorParams(typing_extensions.TypedDict):
+ """
+ Error envelope returned by the Reporting API. Note: a 200 response whose body is `{ "error": "Continue wait" }` is not a failure — it signals that a long-running query is still processing and the request should be retried.
+ """
+
+ error: str
diff --git a/src/square/requests/restore_inventory_adjustment_reason_response.py b/src/square/requests/restore_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..36d160d8
--- /dev/null
+++ b/src/square/requests/restore_inventory_adjustment_reason_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class RestoreInventoryAdjustmentReasonResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing_extensions.NotRequired[InventoryAdjustmentReasonParams]
+ """
+ The successfully restored inventory adjustment reason.
+ """
diff --git a/src/square/requests/resume_subscription_response.py b/src/square/requests/resume_subscription_response.py
new file mode 100644
index 00000000..fb8b9ee7
--- /dev/null
+++ b/src/square/requests/resume_subscription_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription import SubscriptionParams
+from .subscription_action import SubscriptionActionParams
+
+
+class ResumeSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response from the
+ [ResumeSubscription](api-endpoint:Subscriptions-ResumeSubscription) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The resumed subscription.
+ """
+
+ actions: typing_extensions.NotRequired[typing.Sequence[SubscriptionActionParams]]
+ """
+ A list of `RESUME` actions created by the request and scheduled for the subscription.
+ """
diff --git a/src/square/requests/retrieve_booking_custom_attribute_definition_response.py b/src/square/requests/retrieve_booking_custom_attribute_definition_response.py
new file mode 100644
index 00000000..04a77de9
--- /dev/null
+++ b/src/square/requests/retrieve_booking_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class RetrieveBookingCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The retrieved custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_booking_custom_attribute_response.py b/src/square/requests/retrieve_booking_custom_attribute_response.py
new file mode 100644
index 00000000..c15fd4b6
--- /dev/null
+++ b/src/square/requests/retrieve_booking_custom_attribute_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class RetrieveBookingCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveBookingCustomAttribute](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The retrieved custom attribute. If `with_definition` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_channel_response.py b/src/square/requests/retrieve_channel_response.py
new file mode 100644
index 00000000..9ca6156a
--- /dev/null
+++ b/src/square/requests/retrieve_channel_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .channel import ChannelParams
+from .error import ErrorParams
+
+
+class RetrieveChannelResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ channel: typing_extensions.NotRequired[ChannelParams]
+ """
+ The requested Channel.
+ """
diff --git a/src/square/requests/retrieve_inventory_adjustment_reason_response.py b/src/square/requests/retrieve_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..fafd47cd
--- /dev/null
+++ b/src/square/requests/retrieve_inventory_adjustment_reason_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class RetrieveInventoryAdjustmentReasonResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [RetrieveInventoryAdjustmentReason](api-endpoint:Inventory-RetrieveInventoryAdjustmentReason).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing_extensions.NotRequired[InventoryAdjustmentReasonParams]
+ """
+ The successfully retrieved inventory adjustment reason. Deleted custom
+ reasons can be retrieved by ID and have `is_deleted` set to `true`.
+ """
diff --git a/src/square/requests/retrieve_job_response.py b/src/square/requests/retrieve_job_response.py
new file mode 100644
index 00000000..284cf04c
--- /dev/null
+++ b/src/square/requests/retrieve_job_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .job import JobParams
+
+
+class RetrieveJobResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveJob](api-endpoint:Team-RetrieveJob) response. Either `job` or `errors`
+ is present in the response.
+ """
+
+ job: typing_extensions.NotRequired[JobParams]
+ """
+ The retrieved job.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_location_booking_profile_response.py b/src/square/requests/retrieve_location_booking_profile_response.py
new file mode 100644
index 00000000..40341b18
--- /dev/null
+++ b/src/square/requests/retrieve_location_booking_profile_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .location_booking_profile import LocationBookingProfileParams
+
+
+class RetrieveLocationBookingProfileResponseParams(typing_extensions.TypedDict):
+ location_booking_profile: typing_extensions.NotRequired[LocationBookingProfileParams]
+ """
+ The requested location booking profile.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_location_custom_attribute_definition_response.py b/src/square/requests/retrieve_location_custom_attribute_definition_response.py
new file mode 100644
index 00000000..24768a4c
--- /dev/null
+++ b/src/square/requests/retrieve_location_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class RetrieveLocationCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The retrieved custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_location_custom_attribute_response.py b/src/square/requests/retrieve_location_custom_attribute_response.py
new file mode 100644
index 00000000..ed221409
--- /dev/null
+++ b/src/square/requests/retrieve_location_custom_attribute_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class RetrieveLocationCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveLocationCustomAttribute](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The retrieved custom attribute. If `with_definition` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_location_settings_response.py b/src/square/requests/retrieve_location_settings_response.py
new file mode 100644
index 00000000..0761eb98
--- /dev/null
+++ b/src/square/requests/retrieve_location_settings_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .checkout_location_settings import CheckoutLocationSettingsParams
+from .error import ErrorParams
+
+
+class RetrieveLocationSettingsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ location_settings: typing_extensions.NotRequired[CheckoutLocationSettingsParams]
+ """
+ The location settings.
+ """
diff --git a/src/square/requests/retrieve_merchant_custom_attribute_definition_response.py b/src/square/requests/retrieve_merchant_custom_attribute_definition_response.py
new file mode 100644
index 00000000..9ce65497
--- /dev/null
+++ b/src/square/requests/retrieve_merchant_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class RetrieveMerchantCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The retrieved custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_merchant_custom_attribute_response.py b/src/square/requests/retrieve_merchant_custom_attribute_response.py
new file mode 100644
index 00000000..c908acd9
--- /dev/null
+++ b/src/square/requests/retrieve_merchant_custom_attribute_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class RetrieveMerchantCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The retrieved custom attribute. If `with_definition` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_merchant_settings_response.py b/src/square/requests/retrieve_merchant_settings_response.py
new file mode 100644
index 00000000..28d9f52f
--- /dev/null
+++ b/src/square/requests/retrieve_merchant_settings_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .checkout_merchant_settings import CheckoutMerchantSettingsParams
+from .error import ErrorParams
+
+
+class RetrieveMerchantSettingsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ merchant_settings: typing_extensions.NotRequired[CheckoutMerchantSettingsParams]
+ """
+ The merchant settings.
+ """
diff --git a/src/square/requests/retrieve_order_custom_attribute_definition_response.py b/src/square/requests/retrieve_order_custom_attribute_definition_response.py
new file mode 100644
index 00000000..5f40e98f
--- /dev/null
+++ b/src/square/requests/retrieve_order_custom_attribute_definition_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class RetrieveOrderCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from getting an order custom attribute definition.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The retrieved custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_order_custom_attribute_response.py b/src/square/requests/retrieve_order_custom_attribute_response.py
new file mode 100644
index 00000000..c9c5f48c
--- /dev/null
+++ b/src/square/requests/retrieve_order_custom_attribute_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class RetrieveOrderCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from getting an order custom attribute.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The retrieved custom attribute. If `with_definition` was set to `true` in the request, the custom attribute definition is returned in the `definition field.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_scheduled_shift_response.py b/src/square/requests/retrieve_scheduled_shift_response.py
new file mode 100644
index 00000000..680fb0ac
--- /dev/null
+++ b/src/square/requests/retrieve_scheduled_shift_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .scheduled_shift import ScheduledShiftParams
+
+
+class RetrieveScheduledShiftResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [RetrieveScheduledShift](api-endpoint:Labor-RetrieveScheduledShift) response.
+ Either `scheduled_shift` or `errors` is present in the response.
+ """
+
+ scheduled_shift: typing_extensions.NotRequired[ScheduledShiftParams]
+ """
+ The requested scheduled shift.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_timecard_response.py b/src/square/requests/retrieve_timecard_response.py
new file mode 100644
index 00000000..4386b02d
--- /dev/null
+++ b/src/square/requests/retrieve_timecard_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .timecard import TimecardParams
+
+
+class RetrieveTimecardResponseParams(typing_extensions.TypedDict):
+ """
+ A response to a request to get a `Timecard`. The response contains
+ the requested `Timecard` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ timecard: typing_extensions.NotRequired[TimecardParams]
+ """
+ The requested `Timecard`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_token_status_response.py b/src/square/requests/retrieve_token_status_response.py
new file mode 100644
index 00000000..65beb01f
--- /dev/null
+++ b/src/square/requests/retrieve_token_status_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class RetrieveTokenStatusResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `RetrieveTokenStatus` endpoint.
+ """
+
+ scopes: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ The list of scopes associated with an access token.
+ """
+
+ expires_at: typing_extensions.NotRequired[str]
+ """
+ The date and time when the `access_token` expires, in RFC 3339 format. Empty if the token never expires.
+ """
+
+ client_id: typing_extensions.NotRequired[str]
+ """
+ The Square-issued application ID associated with the access token. This is the same application ID used to obtain the token.
+ """
+
+ merchant_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the authorizing merchant's business.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/retrieve_transfer_order_response.py b/src/square/requests/retrieve_transfer_order_response.py
new file mode 100644
index 00000000..0eefb44e
--- /dev/null
+++ b/src/square/requests/retrieve_transfer_order_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .transfer_order import TransferOrderParams
+
+
+class RetrieveTransferOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Response containing the requested transfer order
+ """
+
+ transfer_order: typing_extensions.NotRequired[TransferOrderParams]
+ """
+ The requested transfer order
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request
+ """
diff --git a/src/square/requests/revoke_token_response.py b/src/square/requests/revoke_token_response.py
new file mode 100644
index 00000000..35238e40
--- /dev/null
+++ b/src/square/requests/revoke_token_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class RevokeTokenResponseParams(typing_extensions.TypedDict):
+ success: typing_extensions.NotRequired[bool]
+ """
+ If the request is successful, this is `true`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/risk_evaluation.py b/src/square/requests/risk_evaluation.py
new file mode 100644
index 00000000..b6a4dcc5
--- /dev/null
+++ b/src/square/requests/risk_evaluation.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.risk_evaluation_risk_level import RiskEvaluationRiskLevel
+
+
+class RiskEvaluationParams(typing_extensions.TypedDict):
+ """
+ Represents fraud risk information for the associated payment.
+
+ When you take a payment through Square's Payments API (using the `CreatePayment`
+ endpoint), Square evaluates it and assigns a risk level to the payment. Sellers
+ can use this information to determine the course of action (for example,
+ provide the goods/services or refund the payment).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when payment risk was evaluated, in RFC 3339 format.
+ """
+
+ risk_level: typing_extensions.NotRequired[RiskEvaluationRiskLevel]
+ """
+ The risk level associated with the payment
+ See [RiskEvaluationRiskLevel](#type-riskevaluationrisklevel) for possible values
+ """
diff --git a/src/square/requests/save_card_options.py b/src/square/requests/save_card_options.py
new file mode 100644
index 00000000..8d538494
--- /dev/null
+++ b/src/square/requests/save_card_options.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class SaveCardOptionsParams(typing_extensions.TypedDict):
+ """
+ Describes save-card action fields.
+ """
+
+ customer_id: str
+ """
+ The square-assigned ID of the customer linked to the saved card.
+ """
+
+ card_id: typing_extensions.NotRequired[str]
+ """
+ The id of the created card-on-file.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional user-defined reference ID that can be used to associate
+ this `Card` to another entity in an external system. For example, a customer
+ ID generated by a third-party system.
+ """
diff --git a/src/square/requests/scheduled_shift.py b/src/square/requests/scheduled_shift.py
new file mode 100644
index 00000000..f8d8f3a4
--- /dev/null
+++ b/src/square/requests/scheduled_shift.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .scheduled_shift_details import ScheduledShiftDetailsParams
+
+
+class ScheduledShiftParams(typing_extensions.TypedDict):
+ """
+ Represents a specific time slot in a work schedule. This object is used to manage the
+ lifecycle of a scheduled shift from the draft to published state. A scheduled shift contains
+ the latest draft shift details and current published shift details.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ **Read only** The Square-issued ID of the scheduled shift.
+ """
+
+ draft_shift_details: typing_extensions.NotRequired[ScheduledShiftDetailsParams]
+ """
+ The latest draft shift details for the scheduled shift. Draft shift details are used to
+ stage and manage shifts before publishing. This field is always present.
+ """
+
+ published_shift_details: typing_extensions.NotRequired[ScheduledShiftDetailsParams]
+ """
+ The current published (public) shift details for the scheduled shift. This field is
+ present only if the shift was published.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ **Read only** The current version of the scheduled shift, which is incremented with each update.
+ This field is used for [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control to ensure that requests don't overwrite data from another request.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the scheduled shift was created, in RFC 3339 format presented as UTC.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the scheduled shift was last updated, in RFC 3339 format presented as UTC.
+ """
diff --git a/src/square/requests/scheduled_shift_details.py b/src/square/requests/scheduled_shift_details.py
new file mode 100644
index 00000000..d57bcf4b
--- /dev/null
+++ b/src/square/requests/scheduled_shift_details.py
@@ -0,0 +1,59 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class ScheduledShiftDetailsParams(typing_extensions.TypedDict):
+ """
+ Represents shift details for draft and published versions of a [scheduled shift](entity:ScheduledShift),
+ such as job ID, team member assignment, and start and end times.
+ """
+
+ team_member_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [team member](entity:TeamMember) scheduled for the shift.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [location](entity:Location) the shift is scheduled for.
+ """
+
+ job_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [job](entity:Job) the shift is scheduled for.
+ """
+
+ start_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The start time of the shift, in RFC 3339 format in the time zone +
+ offset of the shift location specified in `location_id`. Precision up to the minute
+ is respected; seconds are truncated.
+ """
+
+ end_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The end time for the shift, in RFC 3339 format in the time zone +
+ offset of the shift location specified in `location_id`. Precision up to the minute
+ is respected; seconds are truncated.
+ """
+
+ notes: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Optional notes for the shift.
+ """
+
+ is_deleted: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the draft shift version is deleted. If set to `true` when the shift
+ is published, the entire scheduled shift (including the published shift) is deleted and
+ cannot be accessed using any endpoint.
+ """
+
+ timezone: typing_extensions.NotRequired[str]
+ """
+ The time zone of the shift location, calculated based on the `location_id`. This field
+ is provided for convenience.
+ """
diff --git a/src/square/requests/scheduled_shift_filter.py b/src/square/requests/scheduled_shift_filter.py
new file mode 100644
index 00000000..0e86e606
--- /dev/null
+++ b/src/square/requests/scheduled_shift_filter.py
@@ -0,0 +1,73 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.scheduled_shift_filter_assignment_status import ScheduledShiftFilterAssignmentStatus
+from ..types.scheduled_shift_filter_scheduled_shift_status import ScheduledShiftFilterScheduledShiftStatus
+from .scheduled_shift_workday import ScheduledShiftWorkdayParams
+from .time_range import TimeRangeParams
+
+
+class ScheduledShiftFilterParams(typing_extensions.TypedDict):
+ """
+ Defines filter criteria for a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts)
+ request. Multiple filters in a query are combined as an `AND` operation.
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Return shifts for the specified locations. When omitted, shifts for all
+ locations are returned. If needed, call [ListLocations](api-endpoint:Locations-ListLocations)
+ to get location IDs.
+ """
+
+ start: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ Return shifts whose `start_at` time is within the specified
+ time range (inclusive).
+ """
+
+ end: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ Return shifts whose `end_at` time is within the specified
+ time range (inclusive).
+ """
+
+ workday: typing_extensions.NotRequired[ScheduledShiftWorkdayParams]
+ """
+ Return shifts based on a workday date range.
+ """
+
+ team_member_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Return shifts assigned to specified team members. If needed, call
+ [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) to get team member IDs.
+
+ To return only the shifts assigned to the specified team members, include the
+ `assignment_status` filter in the query. Otherwise, all unassigned shifts are
+ returned along with shifts assigned to the specified team members.
+ """
+
+ assignment_status: typing_extensions.NotRequired[ScheduledShiftFilterAssignmentStatus]
+ """
+ Return shifts based on whether a team member is assigned. A shift is
+ assigned if the `team_member_id` field is populated in the `draft_shift_details`
+ or `published_shift details` field of the shift.
+
+ To return only draft or published shifts, include the `scheduled_shift_statuses`
+ filter in the query.
+ See [ScheduledShiftFilterAssignmentStatus](#type-scheduledshiftfilterassignmentstatus) for possible values
+ """
+
+ scheduled_shift_statuses: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[ScheduledShiftFilterScheduledShiftStatus]]
+ ]
+ """
+ Return shifts based on the draft or published status of the shift.
+ A shift is published if the `published_shift_details` field is present.
+
+ Note that shifts with `draft_shift_details.is_deleted` set to `true` are ignored
+ with the `DRAFT` filter.
+ See [ScheduledShiftFilterScheduledShiftStatus](#type-scheduledshiftfilterscheduledshiftstatus) for possible values
+ """
diff --git a/src/square/requests/scheduled_shift_query.py b/src/square/requests/scheduled_shift_query.py
new file mode 100644
index 00000000..3ee16b27
--- /dev/null
+++ b/src/square/requests/scheduled_shift_query.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .scheduled_shift_filter import ScheduledShiftFilterParams
+from .scheduled_shift_sort import ScheduledShiftSortParams
+
+
+class ScheduledShiftQueryParams(typing_extensions.TypedDict):
+ """
+ Represents filter and sort criteria for the `query` field in a
+ [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request.
+ """
+
+ filter: typing_extensions.NotRequired[ScheduledShiftFilterParams]
+ """
+ Filtering options for the query.
+ """
+
+ sort: typing_extensions.NotRequired[ScheduledShiftSortParams]
+ """
+ Sorting options for the query.
+ """
diff --git a/src/square/requests/scheduled_shift_sort.py b/src/square/requests/scheduled_shift_sort.py
new file mode 100644
index 00000000..ba67fc8b
--- /dev/null
+++ b/src/square/requests/scheduled_shift_sort.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.scheduled_shift_sort_field import ScheduledShiftSortField
+from ..types.sort_order import SortOrder
+
+
+class ScheduledShiftSortParams(typing_extensions.TypedDict):
+ """
+ Defines sort criteria for a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts)
+ request.
+ """
+
+ field: typing_extensions.NotRequired[ScheduledShiftSortField]
+ """
+ The field to sort on. The default value is `START_AT`.
+ See [ScheduledShiftSortField](#type-scheduledshiftsortfield) for possible values
+ """
+
+ order: typing_extensions.NotRequired[SortOrder]
+ """
+ The order in which results are returned. The default value is `ASC`.
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/scheduled_shift_workday.py b/src/square/requests/scheduled_shift_workday.py
new file mode 100644
index 00000000..30b0abce
--- /dev/null
+++ b/src/square/requests/scheduled_shift_workday.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.scheduled_shift_workday_matcher import ScheduledShiftWorkdayMatcher
+from .date_range import DateRangeParams
+
+
+class ScheduledShiftWorkdayParams(typing_extensions.TypedDict):
+ """
+ A `ScheduledShift` search query filter parameter that sets a range of days that
+ a `Shift` must start or end in before passing the filter condition.
+ """
+
+ date_range: typing_extensions.NotRequired[DateRangeParams]
+ """
+ Dates for fetching the scheduled shifts.
+ """
+
+ match_scheduled_shifts_by: typing_extensions.NotRequired[ScheduledShiftWorkdayMatcher]
+ """
+ The strategy on which the dates are applied.
+ See [ScheduledShiftWorkdayMatcher](#type-scheduledshiftworkdaymatcher) for possible values
+ """
+
+ default_timezone: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Location-specific timezones convert workdays to datetime filters.
+ Every location included in the query must have a timezone or this field
+ must be provided as a fallback. Format: the IANA timezone database
+ identifier for the relevant timezone.
+ """
diff --git a/src/square/requests/search_availability_filter.py b/src/square/requests/search_availability_filter.py
new file mode 100644
index 00000000..cedaa176
--- /dev/null
+++ b/src/square/requests/search_availability_filter.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .segment_filter import SegmentFilterParams
+from .time_range import TimeRangeParams
+
+
+class SearchAvailabilityFilterParams(typing_extensions.TypedDict):
+ """
+ A query filter to search for buyer-accessible availabilities by.
+ """
+
+ start_at_range: TimeRangeParams
+ """
+ The query expression to search for buy-accessible availabilities with their starting times falling within the specified time range.
+ The time range must be at least 24 hours and at most 32 days long.
+ For waitlist availabilities, the time range can be 0 or more up to 367 days long.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The query expression to search for buyer-accessible availabilities with their location IDs matching the specified location ID.
+ This query expression cannot be set if `booking_id` is set.
+ """
+
+ segment_filters: typing_extensions.NotRequired[typing.Optional[typing.Sequence[SegmentFilterParams]]]
+ """
+ The query expression to search for buyer-accessible availabilities matching the specified list of segment filters.
+ If the size of the `segment_filters` list is `n`, the search returns availabilities with `n` segments per availability.
+
+ This query expression cannot be set if `booking_id` is set.
+ """
+
+ booking_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The query expression to search for buyer-accessible availabilities for an existing booking by matching the specified `booking_id` value.
+ This is commonly used to reschedule an appointment.
+ If this expression is set, the `location_id` and `segment_filters` expressions cannot be set.
+ """
diff --git a/src/square/requests/search_availability_query.py b/src/square/requests/search_availability_query.py
new file mode 100644
index 00000000..5e703e33
--- /dev/null
+++ b/src/square/requests/search_availability_query.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .search_availability_filter import SearchAvailabilityFilterParams
+
+
+class SearchAvailabilityQueryParams(typing_extensions.TypedDict):
+ """
+ The query used to search for buyer-accessible availabilities of bookings.
+ """
+
+ filter: SearchAvailabilityFilterParams
+ """
+ The query filter to search for buyer-accessible availabilities of existing bookings.
+ """
diff --git a/src/square/requests/search_availability_response.py b/src/square/requests/search_availability_response.py
new file mode 100644
index 00000000..f33663dd
--- /dev/null
+++ b/src/square/requests/search_availability_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .availability import AvailabilityParams
+from .error import ErrorParams
+
+
+class SearchAvailabilityResponseParams(typing_extensions.TypedDict):
+ availabilities: typing_extensions.NotRequired[typing.Sequence[AvailabilityParams]]
+ """
+ List of appointment slots available for booking.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/search_catalog_items_response.py b/src/square/requests/search_catalog_items_response.py
new file mode 100644
index 00000000..3134597b
--- /dev/null
+++ b/src/square/requests/search_catalog_items_response.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_object import CatalogObjectParams
+from .error import ErrorParams
+
+
+class SearchCatalogItemsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response body returned from the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ items: typing_extensions.NotRequired[typing.Sequence[CatalogObjectParams]]
+ """
+ Returned items matching the specified query expressions.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ Pagination token used in the next request to return more of the search result.
+ """
+
+ matched_variation_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ Ids of returned item variations matching the specified query expression.
+ """
diff --git a/src/square/requests/search_catalog_objects_response.py b/src/square/requests/search_catalog_objects_response.py
new file mode 100644
index 00000000..d63b322a
--- /dev/null
+++ b/src/square/requests/search_catalog_objects_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_object import CatalogObjectParams
+from .error import ErrorParams
+
+
+class SearchCatalogObjectsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If unset, this is the final response.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
+
+ objects: typing_extensions.NotRequired[typing.Sequence[CatalogObjectParams]]
+ """
+ The CatalogObjects returned.
+ """
+
+ related_objects: typing_extensions.NotRequired[typing.Sequence[CatalogObjectParams]]
+ """
+ A list of CatalogObjects referenced by the objects in the `objects` field.
+ """
+
+ latest_time: typing_extensions.NotRequired[str]
+ """
+ When the associated product catalog was last updated. Will
+ match the value for `end_time` or `cursor` if either field is included in the `SearchCatalog` request.
+ """
diff --git a/src/square/requests/search_customers_response.py b/src/square/requests/search_customers_response.py
new file mode 100644
index 00000000..57bca295
--- /dev/null
+++ b/src/square/requests/search_customers_response.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer import CustomerParams
+from .error import ErrorParams
+
+
+class SearchCustomersResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `SearchCustomers` endpoint.
+
+ Either `errors` or `customers` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ customers: typing_extensions.NotRequired[typing.Sequence[CustomerParams]]
+ """
+ The customer profiles that match the search query. If any search condition is not met, the result is an empty object (`{}`).
+ Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`)
+ are included in the response.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ A pagination cursor that can be used during subsequent calls
+ to `SearchCustomers` to retrieve the next set of results associated
+ with the original query. Pagination cursors are only present when
+ a request succeeds and additional results are available.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ count: typing_extensions.NotRequired[int]
+ """
+ The total count of customers associated with the Square account that match the search query. Only customer profiles with
+ public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is
+ present only if `count` is set to `true` in the request.
+ """
diff --git a/src/square/requests/search_events_filter.py b/src/square/requests/search_events_filter.py
new file mode 100644
index 00000000..7e84967e
--- /dev/null
+++ b/src/square/requests/search_events_filter.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .time_range import TimeRangeParams
+
+
+class SearchEventsFilterParams(typing_extensions.TypedDict):
+ """
+ Criteria to filter events by.
+ """
+
+ event_types: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Filter events by event types.
+ """
+
+ merchant_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Filter events by merchant.
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Filter events by location.
+ """
+
+ created_at: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ Filter events by when they were created.
+ """
diff --git a/src/square/requests/search_events_query.py b/src/square/requests/search_events_query.py
new file mode 100644
index 00000000..0fb0d526
--- /dev/null
+++ b/src/square/requests/search_events_query.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .search_events_filter import SearchEventsFilterParams
+from .search_events_sort import SearchEventsSortParams
+
+
+class SearchEventsQueryParams(typing_extensions.TypedDict):
+ """
+ Contains query criteria for the search.
+ """
+
+ filter: typing_extensions.NotRequired[SearchEventsFilterParams]
+ """
+ Criteria to filter events by.
+ """
+
+ sort: typing_extensions.NotRequired[SearchEventsSortParams]
+ """
+ Criteria to sort events by.
+ """
diff --git a/src/square/requests/search_events_response.py b/src/square/requests/search_events_response.py
new file mode 100644
index 00000000..e2842fde
--- /dev/null
+++ b/src/square/requests/search_events_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .event import EventParams
+from .event_metadata import EventMetadataParams
+
+
+class SearchEventsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [SearchEvents](api-endpoint:Events-SearchEvents) endpoint.
+
+ Note: if there are errors processing the request, the events field will not be
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ events: typing_extensions.NotRequired[typing.Sequence[EventParams]]
+ """
+ The list of [Event](entity:Event)s returned by the search.
+ """
+
+ metadata: typing_extensions.NotRequired[typing.Sequence[EventMetadataParams]]
+ """
+ Contains the metadata of an event. For more information, see [Event](entity:Event).
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ When a response is truncated, it includes a cursor that you can use in a subsequent request to fetch the next set of events. If empty, this is the final response.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/search_events_sort.py b/src/square/requests/search_events_sort.py
new file mode 100644
index 00000000..54702851
--- /dev/null
+++ b/src/square/requests/search_events_sort.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.search_events_sort_field import SearchEventsSortField
+from ..types.sort_order import SortOrder
+
+
+class SearchEventsSortParams(typing_extensions.TypedDict):
+ """
+ Criteria to sort events by.
+ """
+
+ field: typing_extensions.NotRequired[SearchEventsSortField]
+ """
+ Sort events by event types.
+ See [SearchEventsSortField](#type-searcheventssortfield) for possible values
+ """
+
+ order: typing_extensions.NotRequired[SortOrder]
+ """
+ The order to use for sorting the events.
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/search_invoices_response.py b/src/square/requests/search_invoices_response.py
new file mode 100644
index 00000000..58f3da2f
--- /dev/null
+++ b/src/square/requests/search_invoices_response.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .invoice import InvoiceParams
+
+
+class SearchInvoicesResponseParams(typing_extensions.TypedDict):
+ """
+ Describes a `SearchInvoices` response.
+ """
+
+ invoices: typing_extensions.NotRequired[typing.Sequence[InvoiceParams]]
+ """
+ The list of invoices returned by the search.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ When a response is truncated, it includes a cursor that you can use in a
+ subsequent request to fetch the next set of invoices. If empty, this is the final
+ response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/search_loyalty_accounts_request_loyalty_account_query.py b/src/square/requests/search_loyalty_accounts_request_loyalty_account_query.py
new file mode 100644
index 00000000..519ac8f4
--- /dev/null
+++ b/src/square/requests/search_loyalty_accounts_request_loyalty_account_query.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .loyalty_account_mapping import LoyaltyAccountMappingParams
+
+
+class SearchLoyaltyAccountsRequestLoyaltyAccountQueryParams(typing_extensions.TypedDict):
+ """
+ The search criteria for the loyalty accounts.
+ """
+
+ mappings: typing_extensions.NotRequired[typing.Optional[typing.Sequence[LoyaltyAccountMappingParams]]]
+ """
+ The set of mappings to use in the loyalty account search.
+
+ This cannot be combined with `customer_ids`.
+
+ Max: 30 mappings
+ """
+
+ customer_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The set of customer IDs to use in the loyalty account search.
+
+ This cannot be combined with `mappings`.
+
+ Max: 30 customer IDs
+ """
diff --git a/src/square/requests/search_loyalty_accounts_response.py b/src/square/requests/search_loyalty_accounts_response.py
new file mode 100644
index 00000000..f1ce95b8
--- /dev/null
+++ b/src/square/requests/search_loyalty_accounts_response.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_account import LoyaltyAccountParams
+
+
+class SearchLoyaltyAccountsResponseParams(typing_extensions.TypedDict):
+ """
+ A response that includes loyalty accounts that satisfy the search criteria.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_accounts: typing_extensions.NotRequired[typing.Sequence[LoyaltyAccountParams]]
+ """
+ The loyalty accounts that met the search criteria,
+ in order of creation date.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to use in a subsequent
+ request. If empty, this is the final response.
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/search_loyalty_events_response.py b/src/square/requests/search_loyalty_events_response.py
new file mode 100644
index 00000000..c9b0d376
--- /dev/null
+++ b/src/square/requests/search_loyalty_events_response.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_event import LoyaltyEventParams
+
+
+class SearchLoyaltyEventsResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains loyalty events that satisfy the search
+ criteria, in order by the `created_at` date.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ events: typing_extensions.NotRequired[typing.Sequence[LoyaltyEventParams]]
+ """
+ The loyalty events that satisfy the search criteria.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent
+ request. If empty, this is the final response.
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/search_loyalty_rewards_request_loyalty_reward_query.py b/src/square/requests/search_loyalty_rewards_request_loyalty_reward_query.py
new file mode 100644
index 00000000..7a9600ff
--- /dev/null
+++ b/src/square/requests/search_loyalty_rewards_request_loyalty_reward_query.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.loyalty_reward_status import LoyaltyRewardStatus
+
+
+class SearchLoyaltyRewardsRequestLoyaltyRewardQueryParams(typing_extensions.TypedDict):
+ """
+ The set of search requirements.
+ """
+
+ loyalty_account_id: str
+ """
+ The ID of the [loyalty account](entity:LoyaltyAccount) to which the loyalty reward belongs.
+ """
+
+ status: typing_extensions.NotRequired[LoyaltyRewardStatus]
+ """
+ The status of the loyalty reward.
+ See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values
+ """
diff --git a/src/square/requests/search_loyalty_rewards_response.py b/src/square/requests/search_loyalty_rewards_response.py
new file mode 100644
index 00000000..ae5654f9
--- /dev/null
+++ b/src/square/requests/search_loyalty_rewards_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .loyalty_reward import LoyaltyRewardParams
+
+
+class SearchLoyaltyRewardsResponseParams(typing_extensions.TypedDict):
+ """
+ A response that includes the loyalty rewards satisfying the search criteria.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ rewards: typing_extensions.NotRequired[typing.Sequence[LoyaltyRewardParams]]
+ """
+ The loyalty rewards that satisfy the search criteria.
+ These are returned in descending order by `updated_at`.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent
+ request. If empty, this is the final response.
+ """
diff --git a/src/square/requests/search_orders_customer_filter.py b/src/square/requests/search_orders_customer_filter.py
new file mode 100644
index 00000000..fa8c17e9
--- /dev/null
+++ b/src/square/requests/search_orders_customer_filter.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class SearchOrdersCustomerFilterParams(typing_extensions.TypedDict):
+ """
+ A filter based on the order `customer_id` and any tender `customer_id`
+ associated with the order. It does not filter based on the
+ [FulfillmentRecipient](entity:FulfillmentRecipient) `customer_id`.
+ """
+
+ customer_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A list of customer IDs to filter by.
+
+ Max: 10 customer ids.
+ """
diff --git a/src/square/requests/search_orders_date_time_filter.py b/src/square/requests/search_orders_date_time_filter.py
new file mode 100644
index 00000000..1d05dd0d
--- /dev/null
+++ b/src/square/requests/search_orders_date_time_filter.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .time_range import TimeRangeParams
+
+
+class SearchOrdersDateTimeFilterParams(typing_extensions.TypedDict):
+ """
+ Filter for `Order` objects based on whether their `CREATED_AT`,
+ `CLOSED_AT`, or `UPDATED_AT` timestamps fall within a specified time range.
+ You can specify the time range and which timestamp to filter for. You can filter
+ for only one time range at a time.
+
+ For each time range, the start time and end time are inclusive. If the end time
+ is absent, it defaults to the time of the first request for the cursor.
+
+ __Important:__ If you use the `DateTimeFilter` in a `SearchOrders` query,
+ you must set the `sort_field` in [OrdersSort](entity:SearchOrdersSort)
+ to the same field you filter for. For example, if you set the `CLOSED_AT` field
+ in `DateTimeFilter`, you must set the `sort_field` in `SearchOrdersSort` to
+ `CLOSED_AT`. Otherwise, `SearchOrders` throws an error.
+ [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range)
+ """
+
+ created_at: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ The time range for filtering on the `created_at` timestamp. If you use this
+ value, you must set the `sort_field` in the `OrdersSearchSort` object to
+ `CREATED_AT`.
+ """
+
+ updated_at: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ The time range for filtering on the `updated_at` timestamp. If you use this
+ value, you must set the `sort_field` in the `OrdersSearchSort` object to
+ `UPDATED_AT`.
+ """
+
+ closed_at: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ The time range for filtering on the `closed_at` timestamp. If you use this
+ value, you must set the `sort_field` in the `OrdersSearchSort` object to
+ `CLOSED_AT`.
+ """
diff --git a/src/square/requests/search_orders_filter.py b/src/square/requests/search_orders_filter.py
new file mode 100644
index 00000000..cfecf6bb
--- /dev/null
+++ b/src/square/requests/search_orders_filter.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .search_orders_customer_filter import SearchOrdersCustomerFilterParams
+from .search_orders_date_time_filter import SearchOrdersDateTimeFilterParams
+from .search_orders_fulfillment_filter import SearchOrdersFulfillmentFilterParams
+from .search_orders_source_filter import SearchOrdersSourceFilterParams
+from .search_orders_state_filter import SearchOrdersStateFilterParams
+
+
+class SearchOrdersFilterParams(typing_extensions.TypedDict):
+ """
+ Filtering criteria to use for a `SearchOrders` request. Multiple filters
+ are ANDed together.
+ """
+
+ state_filter: typing_extensions.NotRequired[SearchOrdersStateFilterParams]
+ """
+ Filter by [OrderState](entity:OrderState).
+ """
+
+ date_time_filter: typing_extensions.NotRequired[SearchOrdersDateTimeFilterParams]
+ """
+ Filter for results within a time range.
+
+ __Important:__ If you filter for orders by time range, you must set `SearchOrdersSort`
+ to sort by the same field.
+ [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range)
+ """
+
+ fulfillment_filter: typing_extensions.NotRequired[SearchOrdersFulfillmentFilterParams]
+ """
+ Filter by the fulfillment type or state.
+ """
+
+ source_filter: typing_extensions.NotRequired[SearchOrdersSourceFilterParams]
+ """
+ Filter by the source of the order.
+ """
+
+ customer_filter: typing_extensions.NotRequired[SearchOrdersCustomerFilterParams]
+ """
+ Filter by customers associated with the order.
+ """
diff --git a/src/square/requests/search_orders_fulfillment_filter.py b/src/square/requests/search_orders_fulfillment_filter.py
new file mode 100644
index 00000000..9507c5ed
--- /dev/null
+++ b/src/square/requests/search_orders_fulfillment_filter.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.fulfillment_state import FulfillmentState
+from ..types.fulfillment_type import FulfillmentType
+
+
+class SearchOrdersFulfillmentFilterParams(typing_extensions.TypedDict):
+ """
+ Filter based on [order fulfillment](entity:Fulfillment) information.
+ """
+
+ fulfillment_types: typing_extensions.NotRequired[typing.Optional[typing.Sequence[FulfillmentType]]]
+ """
+ A list of [fulfillment types](entity:FulfillmentType) to filter
+ for. The list returns orders if any of its fulfillments match any of the fulfillment types
+ listed in this field.
+ See [FulfillmentType](#type-fulfillmenttype) for possible values
+ """
+
+ fulfillment_states: typing_extensions.NotRequired[typing.Optional[typing.Sequence[FulfillmentState]]]
+ """
+ A list of [fulfillment states](entity:FulfillmentState) to filter
+ for. The list returns orders if any of its fulfillments match any of the
+ fulfillment states listed in this field.
+ See [FulfillmentState](#type-fulfillmentstate) for possible values
+ """
diff --git a/src/square/requests/search_orders_query.py b/src/square/requests/search_orders_query.py
new file mode 100644
index 00000000..0c494a44
--- /dev/null
+++ b/src/square/requests/search_orders_query.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .search_orders_filter import SearchOrdersFilterParams
+from .search_orders_sort import SearchOrdersSortParams
+
+
+class SearchOrdersQueryParams(typing_extensions.TypedDict):
+ """
+ Contains query criteria for the search.
+ """
+
+ filter: typing_extensions.NotRequired[SearchOrdersFilterParams]
+ """
+ Criteria to filter results by.
+ """
+
+ sort: typing_extensions.NotRequired[SearchOrdersSortParams]
+ """
+ Criteria to sort results by.
+ """
diff --git a/src/square/requests/search_orders_response.py b/src/square/requests/search_orders_response.py
new file mode 100644
index 00000000..f015c711
--- /dev/null
+++ b/src/square/requests/search_orders_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .order import OrderParams
+from .order_entry import OrderEntryParams
+
+
+class SearchOrdersResponseParams(typing_extensions.TypedDict):
+ """
+ Either the `order_entries` or `orders` field is set, depending on whether
+ `return_entries` is set on the [SearchOrdersRequest](api-endpoint:Orders-SearchOrders).
+ """
+
+ order_entries: typing_extensions.NotRequired[typing.Sequence[OrderEntryParams]]
+ """
+ A list of [OrderEntries](entity:OrderEntry) that fit the query
+ conditions. The list is populated only if `return_entries` is set to `true` in the request.
+ """
+
+ orders: typing_extensions.NotRequired[typing.Sequence[OrderParams]]
+ """
+ A list of
+ [Order](entity:Order) objects that match the query conditions. The list is populated only if
+ `return_entries` is set to `false` in the request.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ [Errors](entity:Error) encountered during the search.
+ """
diff --git a/src/square/requests/search_orders_sort.py b/src/square/requests/search_orders_sort.py
new file mode 100644
index 00000000..91ac512e
--- /dev/null
+++ b/src/square/requests/search_orders_sort.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.search_orders_sort_field import SearchOrdersSortField
+from ..types.sort_order import SortOrder
+
+
+class SearchOrdersSortParams(typing_extensions.TypedDict):
+ """
+ Sorting criteria for a `SearchOrders` request. Results can only be sorted
+ by a timestamp field.
+ """
+
+ sort_field: SearchOrdersSortField
+ """
+ The field to sort by.
+
+ __Important:__ When using a [DateTimeFilter](entity:SearchOrdersFilter),
+ `sort_field` must match the timestamp field that the `DateTimeFilter` uses to
+ filter. For example, if you set your `sort_field` to `CLOSED_AT` and you use a
+ `DateTimeFilter`, your `DateTimeFilter` must filter for orders by their `CLOSED_AT` date.
+ If this field does not match the timestamp field in `DateTimeFilter`,
+ `SearchOrders` returns an error.
+
+ Default: `CREATED_AT`.
+ See [SearchOrdersSortField](#type-searchorderssortfield) for possible values
+ """
+
+ sort_order: typing_extensions.NotRequired[SortOrder]
+ """
+ The chronological order in which results are returned. Defaults to `DESC`.
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/search_orders_source_filter.py b/src/square/requests/search_orders_source_filter.py
new file mode 100644
index 00000000..673d6535
--- /dev/null
+++ b/src/square/requests/search_orders_source_filter.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class SearchOrdersSourceFilterParams(typing_extensions.TypedDict):
+ """
+ A filter based on order `source` information.
+ """
+
+ source_names: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Filters by the [Source](entity:OrderSource) `name`. The filter returns any orders
+ with a `source.name` that matches any of the listed source names.
+
+ Max: 10 source names.
+ """
diff --git a/src/square/requests/search_orders_state_filter.py b/src/square/requests/search_orders_state_filter.py
new file mode 100644
index 00000000..914fd36f
--- /dev/null
+++ b/src/square/requests/search_orders_state_filter.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.order_state import OrderState
+
+
+class SearchOrdersStateFilterParams(typing_extensions.TypedDict):
+ """
+ Filter by the current order `state`.
+ """
+
+ states: typing.Sequence[OrderState]
+ """
+ States to filter for.
+ See [OrderState](#type-orderstate) for possible values
+ """
diff --git a/src/square/requests/search_scheduled_shifts_response.py b/src/square/requests/search_scheduled_shifts_response.py
new file mode 100644
index 00000000..ff375f33
--- /dev/null
+++ b/src/square/requests/search_scheduled_shifts_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .scheduled_shift import ScheduledShiftParams
+
+
+class SearchScheduledShiftsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) response.
+ Either `scheduled_shifts` or `errors` is present in the response.
+ """
+
+ scheduled_shifts: typing_extensions.NotRequired[typing.Sequence[ScheduledShiftParams]]
+ """
+ A paginated list of scheduled shifts that match the query conditions.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor used to retrieve the next page of results. This field is present
+ only if additional results are available.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/search_shifts_response.py b/src/square/requests/search_shifts_response.py
new file mode 100644
index 00000000..846709cc
--- /dev/null
+++ b/src/square/requests/search_shifts_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .shift import ShiftParams
+
+
+class SearchShiftsResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request for `Shift` objects. The response contains
+ the requested `Shift` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ shifts: typing_extensions.NotRequired[typing.Sequence[ShiftParams]]
+ """
+ Shifts.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ An opaque cursor for fetching the next page.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/search_subscriptions_filter.py b/src/square/requests/search_subscriptions_filter.py
new file mode 100644
index 00000000..03019c96
--- /dev/null
+++ b/src/square/requests/search_subscriptions_filter.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class SearchSubscriptionsFilterParams(typing_extensions.TypedDict):
+ """
+ Represents a set of query expressions (filters) to narrow the scope of targeted subscriptions returned by
+ the [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) endpoint.
+ """
+
+ customer_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A filter to select subscriptions based on the subscribing customer IDs.
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A filter to select subscriptions based on the location.
+ """
+
+ source_names: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ A filter to select subscriptions based on the source application.
+ """
diff --git a/src/square/requests/search_subscriptions_query.py b/src/square/requests/search_subscriptions_query.py
new file mode 100644
index 00000000..67fd6978
--- /dev/null
+++ b/src/square/requests/search_subscriptions_query.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .search_subscriptions_filter import SearchSubscriptionsFilterParams
+
+
+class SearchSubscriptionsQueryParams(typing_extensions.TypedDict):
+ """
+ Represents a query, consisting of specified query expressions, used to search for subscriptions.
+ """
+
+ filter: typing_extensions.NotRequired[SearchSubscriptionsFilterParams]
+ """
+ A list of query expressions.
+ """
diff --git a/src/square/requests/search_subscriptions_response.py b/src/square/requests/search_subscriptions_response.py
new file mode 100644
index 00000000..1ec4ca52
--- /dev/null
+++ b/src/square/requests/search_subscriptions_response.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription import SubscriptionParams
+
+
+class SearchSubscriptionsResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response from the
+ [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscriptions: typing_extensions.NotRequired[typing.Sequence[SubscriptionParams]]
+ """
+ The subscriptions matching the specified query expressions.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ When the total number of resulting subscription exceeds the limit of a paged response,
+ the response includes a cursor for you to use in a subsequent request to fetch the next set of results.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
diff --git a/src/square/requests/search_team_members_filter.py b/src/square/requests/search_team_members_filter.py
new file mode 100644
index 00000000..8b3303f0
--- /dev/null
+++ b/src/square/requests/search_team_members_filter.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.team_member_status import TeamMemberStatus
+
+
+class SearchTeamMembersFilterParams(typing_extensions.TypedDict):
+ """
+ Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied
+ between the individual fields, and `OR` logic is applied within list-based fields.
+ For example, setting this filter value:
+ ```
+ filter = (locations_ids = ["A", "B"], status = ACTIVE)
+ ```
+ returns only active team members assigned to either location "A" or "B".
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ When present, filters by team members assigned to the specified locations.
+ When empty, includes team members assigned to any location.
+ """
+
+ status: typing_extensions.NotRequired[TeamMemberStatus]
+ """
+ When present, filters by team members who match the given status.
+ When empty, includes team members of all statuses.
+ See [TeamMemberStatus](#type-teammemberstatus) for possible values
+ """
+
+ is_owner: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ When present and set to true, returns the team member who is the owner of the Square account.
+ """
diff --git a/src/square/requests/search_team_members_query.py b/src/square/requests/search_team_members_query.py
new file mode 100644
index 00000000..04c65f8b
--- /dev/null
+++ b/src/square/requests/search_team_members_query.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .search_team_members_filter import SearchTeamMembersFilterParams
+
+
+class SearchTeamMembersQueryParams(typing_extensions.TypedDict):
+ """
+ Represents the parameters in a search for `TeamMember` objects.
+ """
+
+ filter: typing_extensions.NotRequired[SearchTeamMembersFilterParams]
+ """
+ The options to filter by.
+ """
diff --git a/src/square/requests/search_team_members_response.py b/src/square/requests/search_team_members_response.py
new file mode 100644
index 00000000..fba98de6
--- /dev/null
+++ b/src/square/requests/search_team_members_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .team_member import TeamMemberParams
+
+
+class SearchTeamMembersResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from a search request containing a filtered list of `TeamMember` objects.
+ """
+
+ team_members: typing_extensions.NotRequired[typing.Sequence[TeamMemberParams]]
+ """
+ The filtered list of `TeamMember` objects.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The opaque cursor for fetching the next page. For more information, see
+ [pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/search_terminal_actions_response.py b/src/square/requests/search_terminal_actions_response.py
new file mode 100644
index 00000000..fab186d7
--- /dev/null
+++ b/src/square/requests/search_terminal_actions_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_action import TerminalActionParams
+
+
+class SearchTerminalActionsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ action: typing_extensions.NotRequired[typing.Sequence[TerminalActionParams]]
+ """
+ The requested search result of `TerminalAction`s.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more
+ information.
+ """
diff --git a/src/square/requests/search_terminal_checkouts_response.py b/src/square/requests/search_terminal_checkouts_response.py
new file mode 100644
index 00000000..b256c4f0
--- /dev/null
+++ b/src/square/requests/search_terminal_checkouts_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_checkout import TerminalCheckoutParams
+
+
+class SearchTerminalCheckoutsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ checkouts: typing_extensions.NotRequired[typing.Sequence[TerminalCheckoutParams]]
+ """
+ The requested search result of `TerminalCheckout` objects.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
diff --git a/src/square/requests/search_terminal_refunds_response.py b/src/square/requests/search_terminal_refunds_response.py
new file mode 100644
index 00000000..294976fa
--- /dev/null
+++ b/src/square/requests/search_terminal_refunds_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .terminal_refund import TerminalRefundParams
+
+
+class SearchTerminalRefundsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ refunds: typing_extensions.NotRequired[typing.Sequence[TerminalRefundParams]]
+ """
+ The requested search result of `TerminalRefund` objects.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
diff --git a/src/square/requests/search_timecards_response.py b/src/square/requests/search_timecards_response.py
new file mode 100644
index 00000000..d5905093
--- /dev/null
+++ b/src/square/requests/search_timecards_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .timecard import TimecardParams
+
+
+class SearchTimecardsResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request for `Timecard` objects. The response contains
+ the requested `Timecard` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ timecards: typing_extensions.NotRequired[typing.Sequence[TimecardParams]]
+ """
+ Timecards.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ An opaque cursor for fetching the next page.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/search_transfer_orders_response.py b/src/square/requests/search_transfer_orders_response.py
new file mode 100644
index 00000000..09440ec6
--- /dev/null
+++ b/src/square/requests/search_transfer_orders_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .transfer_order import TransferOrderParams
+
+
+class SearchTransferOrdersResponseParams(typing_extensions.TypedDict):
+ """
+ Response for searching transfer orders
+ """
+
+ transfer_orders: typing_extensions.NotRequired[typing.Sequence[TransferOrderParams]]
+ """
+ List of transfer orders matching the search criteria
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ Pagination cursor for fetching the next page of results
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request
+ """
diff --git a/src/square/requests/search_vendors_request_filter.py b/src/square/requests/search_vendors_request_filter.py
new file mode 100644
index 00000000..18bb6c48
--- /dev/null
+++ b/src/square/requests/search_vendors_request_filter.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.vendor_status import VendorStatus
+
+
+class SearchVendorsRequestFilterParams(typing_extensions.TypedDict):
+ """
+ Defines supported query expressions to search for vendors by.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The names of the [Vendor](entity:Vendor) objects to retrieve.
+ """
+
+ status: typing_extensions.NotRequired[typing.Optional[typing.Sequence[VendorStatus]]]
+ """
+ The statuses of the [Vendor](entity:Vendor) objects to retrieve.
+ See [VendorStatus](#type-vendorstatus) for possible values
+ """
diff --git a/src/square/requests/search_vendors_request_sort.py b/src/square/requests/search_vendors_request_sort.py
new file mode 100644
index 00000000..fdbc5ab9
--- /dev/null
+++ b/src/square/requests/search_vendors_request_sort.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.search_vendors_request_sort_field import SearchVendorsRequestSortField
+from ..types.sort_order import SortOrder
+
+
+class SearchVendorsRequestSortParams(typing_extensions.TypedDict):
+ """
+ Defines a sorter used to sort results from [SearchVendors](api-endpoint:Vendors-SearchVendors).
+ """
+
+ field: typing_extensions.NotRequired[SearchVendorsRequestSortField]
+ """
+ Specifies the sort key to sort the returned vendors.
+ See [Field](#type-field) for possible values
+ """
+
+ order: typing_extensions.NotRequired[SortOrder]
+ """
+ Specifies the sort order for the returned vendors.
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/search_vendors_response.py b/src/square/requests/search_vendors_response.py
new file mode 100644
index 00000000..1869dec9
--- /dev/null
+++ b/src/square/requests/search_vendors_response.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .vendor import VendorParams
+
+
+class SearchVendorsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [SearchVendors](api-endpoint:Vendors-SearchVendors).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ vendors: typing_extensions.NotRequired[typing.Sequence[VendorParams]]
+ """
+ The [Vendor](entity:Vendor) objects matching the specified search filter.
+ """
+
+ cursor: typing_extensions.NotRequired[str]
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
diff --git a/src/square/requests/segment.py b/src/square/requests/segment.py
new file mode 100644
index 00000000..a2f143f4
--- /dev/null
+++ b/src/square/requests/segment.py
@@ -0,0 +1,14 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+
+
+class SegmentParams(typing_extensions.TypedDict):
+ name: str
+ title: str
+ description: typing_extensions.NotRequired[str]
+ short_title: typing_extensions.Annotated[str, FieldMetadata(alias="shortTitle")]
+ meta: typing_extensions.NotRequired[typing.Dict[str, typing.Any]]
diff --git a/src/square/requests/segment_filter.py b/src/square/requests/segment_filter.py
new file mode 100644
index 00000000..8cc08b52
--- /dev/null
+++ b/src/square/requests/segment_filter.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .filter_value import FilterValueParams
+
+
+class SegmentFilterParams(typing_extensions.TypedDict):
+ """
+ A query filter to search for buyer-accessible appointment segments by.
+ """
+
+ service_variation_id: str
+ """
+ The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment.
+ """
+
+ team_member_id_filter: typing_extensions.NotRequired[FilterValueParams]
+ """
+ A query filter to search for buyer-accessible appointment segments with service-providing team members matching the specified list of team member IDs. Supported query expressions are
+ - `ANY`: return the appointment segments with team members whose IDs match any member in this list.
+ - `NONE`: return the appointment segments with team members whose IDs are not in this list.
+ - `ALL`: not supported.
+
+ When no expression is specified, any service-providing team member is eligible to fulfill the Booking.
+ """
diff --git a/src/square/requests/select_option.py b/src/square/requests/select_option.py
new file mode 100644
index 00000000..e7cedd64
--- /dev/null
+++ b/src/square/requests/select_option.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class SelectOptionParams(typing_extensions.TypedDict):
+ reference_id: str
+ """
+ The reference id for the option.
+ """
+
+ title: str
+ """
+ The title text that displays in the select option button.
+ """
diff --git a/src/square/requests/select_options.py b/src/square/requests/select_options.py
new file mode 100644
index 00000000..facb038b
--- /dev/null
+++ b/src/square/requests/select_options.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .select_option import SelectOptionParams
+
+
+class SelectOptionsParams(typing_extensions.TypedDict):
+ title: str
+ """
+ The title text to display in the select flow on the Terminal.
+ """
+
+ body: str
+ """
+ The body text to display in the select flow on the Terminal.
+ """
+
+ options: typing.Sequence[SelectOptionParams]
+ """
+ Represents the buttons/options that should be displayed in the select flow on the Terminal.
+ """
+
+ selected_option: typing_extensions.NotRequired[SelectOptionParams]
+ """
+ The buyer’s selected option.
+ """
diff --git a/src/square/requests/shift.py b/src/square/requests/shift.py
new file mode 100644
index 00000000..fbcb1412
--- /dev/null
+++ b/src/square/requests/shift.py
@@ -0,0 +1,101 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.shift_status import ShiftStatus
+from .break_ import BreakParams
+from .money import MoneyParams
+from .shift_wage import ShiftWageParams
+
+
+class ShiftParams(typing_extensions.TypedDict):
+ """
+ A record of the hourly rate, start, and end times for a single work shift
+ for an employee. This might include a record of the start and end times for breaks
+ taken during the shift.
+
+ Deprecated at Square API version 2025-05-21. Replaced by [Timecard](entity:Timecard).
+ See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The UUID for this object.
+ """
+
+ employee_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id` instead.
+ """
+
+ location_id: str
+ """
+ The ID of the location this shift occurred at. The location should be based on
+ where the employee clocked in.
+ """
+
+ timezone: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The read-only convenience value that is calculated from the location based
+ on the `location_id`. Format: the IANA timezone database identifier for the
+ location timezone.
+ """
+
+ start_at: str
+ """
+ RFC 3339; shifted to the location timezone + offset. Precision up to the
+ minute is respected; seconds are truncated.
+ """
+
+ end_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ RFC 3339; shifted to the timezone + offset. Precision up to the minute is
+ respected; seconds are truncated.
+ """
+
+ wage: typing_extensions.NotRequired[ShiftWageParams]
+ """
+ Job and pay related information. If the wage is not set on create, it defaults to a wage
+ of zero. If the title is not set on create, it defaults to the name of the role the employee
+ is assigned to, if any.
+ """
+
+ breaks: typing_extensions.NotRequired[typing.Optional[typing.Sequence[BreakParams]]]
+ """
+ A list of all the paid or unpaid breaks that were taken during this shift.
+ """
+
+ status: typing_extensions.NotRequired[ShiftStatus]
+ """
+ Describes the working state of the current `Shift`.
+ See [ShiftStatus](#type-shiftstatus) for possible values
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ Used for resolving concurrency issues. The request fails if the version
+ provided does not match the server version at the time of the request. If not provided,
+ Square executes a blind write; potentially overwriting data from another
+ write.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ A read-only timestamp in RFC 3339 format; presented in UTC.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ A read-only timestamp in RFC 3339 format; presented in UTC.
+ """
+
+ team_member_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26".
+ """
+
+ declared_cash_tip_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The tips declared by the team member for the shift.
+ """
diff --git a/src/square/requests/shift_filter.py b/src/square/requests/shift_filter.py
new file mode 100644
index 00000000..3d7c3f32
--- /dev/null
+++ b/src/square/requests/shift_filter.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.shift_filter_status import ShiftFilterStatus
+from .shift_workday import ShiftWorkdayParams
+from .time_range import TimeRangeParams
+
+
+class ShiftFilterParams(typing_extensions.TypedDict):
+ """
+ Defines a filter used in a search for `Shift` records. `AND` logic is
+ used by Square's servers to apply each filter property specified.
+
+ Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Fetch shifts for the specified location.
+ """
+
+ employee_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Fetch shifts for the specified employees. DEPRECATED at version 2020-08-26. Use `team_member_ids` instead.
+ """
+
+ status: typing_extensions.NotRequired[ShiftFilterStatus]
+ """
+ Fetch a `Shift` instance by `Shift.status`.
+ See [ShiftFilterStatus](#type-shiftfilterstatus) for possible values
+ """
+
+ start: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ Fetch `Shift` instances that start in the time range - Inclusive.
+ """
+
+ end: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ Fetch the `Shift` instances that end in the time range - Inclusive.
+ """
+
+ workday: typing_extensions.NotRequired[ShiftWorkdayParams]
+ """
+ Fetch the `Shift` instances based on the workday date range.
+ """
+
+ team_member_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Fetch shifts for the specified team members. Replaced `employee_ids` at version "2020-08-26".
+ """
diff --git a/src/square/requests/shift_query.py b/src/square/requests/shift_query.py
new file mode 100644
index 00000000..40437bbb
--- /dev/null
+++ b/src/square/requests/shift_query.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .shift_filter import ShiftFilterParams
+from .shift_sort import ShiftSortParams
+
+
+class ShiftQueryParams(typing_extensions.TypedDict):
+ """
+ The parameters of a `Shift` search query, which includes filter and sort options.
+
+ Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ filter: typing_extensions.NotRequired[ShiftFilterParams]
+ """
+ Query filter options.
+ """
+
+ sort: typing_extensions.NotRequired[ShiftSortParams]
+ """
+ Sort order details.
+ """
diff --git a/src/square/requests/shift_sort.py b/src/square/requests/shift_sort.py
new file mode 100644
index 00000000..c2d5554f
--- /dev/null
+++ b/src/square/requests/shift_sort.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.shift_sort_field import ShiftSortField
+from ..types.sort_order import SortOrder
+
+
+class ShiftSortParams(typing_extensions.TypedDict):
+ """
+ Sets the sort order of search results.
+
+ Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ field: typing_extensions.NotRequired[ShiftSortField]
+ """
+ The field to sort on.
+ See [ShiftSortField](#type-shiftsortfield) for possible values
+ """
+
+ order: typing_extensions.NotRequired[SortOrder]
+ """
+ The order in which results are returned. Defaults to DESC.
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/shift_wage.py b/src/square/requests/shift_wage.py
new file mode 100644
index 00000000..b73c05c3
--- /dev/null
+++ b/src/square/requests/shift_wage.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class ShiftWageParams(typing_extensions.TypedDict):
+ """
+ The hourly wage rate used to compensate an employee for this shift.
+
+ Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ title: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the job performed during this shift.
+ """
+
+ hourly_rate: typing_extensions.NotRequired[MoneyParams]
+ """
+ Can be a custom-set hourly wage or the calculated effective hourly
+ wage based on the annual wage and hours worked per week.
+ """
+
+ job_id: typing_extensions.NotRequired[str]
+ """
+ The id of the job performed during this shift. Square
+ labor-reporting UIs might group shifts together by id.
+ """
+
+ tip_eligible: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether team members are eligible for tips when working this job.
+ """
diff --git a/src/square/requests/shift_workday.py b/src/square/requests/shift_workday.py
new file mode 100644
index 00000000..88b06829
--- /dev/null
+++ b/src/square/requests/shift_workday.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.shift_workday_matcher import ShiftWorkdayMatcher
+from .date_range import DateRangeParams
+
+
+class ShiftWorkdayParams(typing_extensions.TypedDict):
+ """
+ A `Shift` search query filter parameter that sets a range of days that
+ a `Shift` must start or end in before passing the filter condition.
+
+ Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ date_range: typing_extensions.NotRequired[DateRangeParams]
+ """
+ Dates for fetching the shifts.
+ """
+
+ match_shifts_by: typing_extensions.NotRequired[ShiftWorkdayMatcher]
+ """
+ The strategy on which the dates are applied.
+ See [ShiftWorkdayMatcher](#type-shiftworkdaymatcher) for possible values
+ """
+
+ default_timezone: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Location-specific timezones convert workdays to datetime filters.
+ Every location included in the query must have a timezone or this field
+ must be provided as a fallback. Format: the IANA timezone database
+ identifier for the relevant timezone.
+ """
diff --git a/src/square/requests/shipping_fee.py b/src/square/requests/shipping_fee.py
new file mode 100644
index 00000000..7a4c86c3
--- /dev/null
+++ b/src/square/requests/shipping_fee.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class ShippingFeeParams(typing_extensions.TypedDict):
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name for the shipping fee.
+ """
+
+ charge: MoneyParams
+ """
+ The amount and currency for the shipping fee.
+ """
diff --git a/src/square/requests/signature_image.py b/src/square/requests/signature_image.py
new file mode 100644
index 00000000..9d4e6b28
--- /dev/null
+++ b/src/square/requests/signature_image.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class SignatureImageParams(typing_extensions.TypedDict):
+ image_type: typing_extensions.NotRequired[str]
+ """
+ The mime/type of the image data.
+ Use `image/png;base64` for png.
+ """
+
+ data: typing_extensions.NotRequired[str]
+ """
+ The base64 representation of the image.
+ """
diff --git a/src/square/requests/signature_options.py b/src/square/requests/signature_options.py
new file mode 100644
index 00000000..3db0f39c
--- /dev/null
+++ b/src/square/requests/signature_options.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .signature_image import SignatureImageParams
+
+
+class SignatureOptionsParams(typing_extensions.TypedDict):
+ title: str
+ """
+ The title text to display in the signature capture flow on the Terminal.
+ """
+
+ body: str
+ """
+ The body text to display in the signature capture flow on the Terminal.
+ """
+
+ signature: typing_extensions.NotRequired[typing.Sequence[SignatureImageParams]]
+ """
+ An image representation of the collected signature.
+ """
diff --git a/src/square/requests/site.py b/src/square/requests/site.py
new file mode 100644
index 00000000..4ac251f5
--- /dev/null
+++ b/src/square/requests/site.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class SiteParams(typing_extensions.TypedDict):
+ """
+ Represents a Square Online site, which is an online store for a Square seller.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the site.
+ """
+
+ site_title: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The title of the site.
+ """
+
+ domain: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The domain of the site (without the protocol). For example, `mysite1.square.site`.
+ """
+
+ is_published: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the site is published.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the site was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the site was last updated, in RFC 3339 format.
+ """
diff --git a/src/square/requests/snippet.py b/src/square/requests/snippet.py
new file mode 100644
index 00000000..343d4539
--- /dev/null
+++ b/src/square/requests/snippet.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class SnippetParams(typing_extensions.TypedDict):
+ """
+ Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID for the snippet.
+ """
+
+ site_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the site that contains the snippet.
+ """
+
+ content: str
+ """
+ The snippet code, which can contain valid HTML, JavaScript, or both.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the snippet was initially added to the site, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the snippet was last updated on the site, in RFC 3339 format.
+ """
diff --git a/src/square/requests/source_application.py b/src/square/requests/source_application.py
new file mode 100644
index 00000000..2c9daeb6
--- /dev/null
+++ b/src/square/requests/source_application.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.product import Product
+
+
+class SourceApplicationParams(typing_extensions.TypedDict):
+ """
+ Represents information about the application used to generate a change.
+ """
+
+ product: typing_extensions.NotRequired[Product]
+ """
+ __Read only__ The [product](entity:Product) type of the application.
+ See [Product](#type-product) for possible values
+ """
+
+ application_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ __Read only__ The Square-assigned ID of the application. This field is used only if the
+ [product](entity:Product) type is `EXTERNAL_API`.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ __Read only__ The display name of the application
+ (for example, `"Custom Application"` or `"Square POS 4.74 for Android"`).
+ """
diff --git a/src/square/requests/square_account_details.py b/src/square/requests/square_account_details.py
new file mode 100644
index 00000000..6df3dd4e
--- /dev/null
+++ b/src/square/requests/square_account_details.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class SquareAccountDetailsParams(typing_extensions.TypedDict):
+ """
+ Additional details about Square Account payments.
+ """
+
+ payment_source_token: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Unique identifier for the payment source used for this payment.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Optional[typing.Sequence[ErrorParams]]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/standard_unit_description.py b/src/square/requests/standard_unit_description.py
new file mode 100644
index 00000000..30f253e0
--- /dev/null
+++ b/src/square/requests/standard_unit_description.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .measurement_unit import MeasurementUnitParams
+
+
+class StandardUnitDescriptionParams(typing_extensions.TypedDict):
+ """
+ Contains the name and abbreviation for standard measurement unit.
+ """
+
+ unit: typing_extensions.NotRequired[MeasurementUnitParams]
+ """
+ Identifies the measurement unit being described.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ UI display name of the measurement unit. For example, 'Pound'.
+ """
+
+ abbreviation: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ UI display abbreviation for the measurement unit. For example, 'lb'.
+ """
diff --git a/src/square/requests/standard_unit_description_group.py b/src/square/requests/standard_unit_description_group.py
new file mode 100644
index 00000000..fd807948
--- /dev/null
+++ b/src/square/requests/standard_unit_description_group.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .standard_unit_description import StandardUnitDescriptionParams
+
+
+class StandardUnitDescriptionGroupParams(typing_extensions.TypedDict):
+ """
+ Group of standard measurement units.
+ """
+
+ standard_unit_descriptions: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[StandardUnitDescriptionParams]]
+ ]
+ """
+ List of standard (non-custom) measurement units in this description group.
+ """
+
+ language_code: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ IETF language tag.
+ """
diff --git a/src/square/requests/start_transfer_order_response.py b/src/square/requests/start_transfer_order_response.py
new file mode 100644
index 00000000..0bc49ade
--- /dev/null
+++ b/src/square/requests/start_transfer_order_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .transfer_order import TransferOrderParams
+
+
+class StartTransferOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Response for starting a transfer order.
+ """
+
+ transfer_order: typing_extensions.NotRequired[TransferOrderParams]
+ """
+ The updated transfer order with status changed to STARTED
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request
+ """
diff --git a/src/square/requests/submit_evidence_response.py b/src/square/requests/submit_evidence_response.py
new file mode 100644
index 00000000..6e90c99a
--- /dev/null
+++ b/src/square/requests/submit_evidence_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .dispute import DisputeParams
+from .error import ErrorParams
+
+
+class SubmitEvidenceResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields in a `SubmitEvidence` response.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ dispute: typing_extensions.NotRequired[DisputeParams]
+ """
+ The `Dispute` for which evidence was submitted.
+ """
diff --git a/src/square/requests/subscription.py b/src/square/requests/subscription.py
new file mode 100644
index 00000000..4bf1b778
--- /dev/null
+++ b/src/square/requests/subscription.py
@@ -0,0 +1,149 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.subscription_status import SubscriptionStatus
+from .money import MoneyParams
+from .phase import PhaseParams
+from .subscription_action import SubscriptionActionParams
+from .subscription_source import SubscriptionSourceParams
+
+
+class SubscriptionParams(typing_extensions.TypedDict):
+ """
+ Represents a subscription purchased by a customer.
+
+ For more information, see
+ [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The Square-assigned ID of the subscription.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the location associated with the subscription.
+ """
+
+ plan_variation_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the subscribed-to [subscription plan variation](entity:CatalogSubscriptionPlanVariation).
+ """
+
+ customer_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the subscribing [customer](entity:Customer) profile.
+ """
+
+ start_date: typing_extensions.NotRequired[str]
+ """
+ The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to start the subscription.
+ """
+
+ canceled_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to cancel the subscription,
+ when the subscription status changes to `CANCELED` and the subscription billing stops.
+
+ If this field is not set, the subscription ends according its subscription plan.
+
+ This field cannot be updated, other than being cleared.
+ """
+
+ charged_through_date: typing_extensions.NotRequired[str]
+ """
+ The `YYYY-MM-DD`-formatted date up to when the subscriber is invoiced for the
+ subscription.
+
+ After the invoice is sent for a given billing period,
+ this date will be the last day of the billing period.
+ For example,
+ suppose for the month of May a subscriber gets an invoice
+ (or charged the card) on May 1. For the monthly billing scenario,
+ this date is then set to May 31.
+ """
+
+ status: typing_extensions.NotRequired[SubscriptionStatus]
+ """
+ The current status of the subscription.
+ See [SubscriptionStatus](#type-subscriptionstatus) for possible values
+ """
+
+ tax_percentage: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The tax amount applied when billing the subscription. The
+ percentage is expressed in decimal form, using a `'.'` as the decimal
+ separator and without a `'%'` sign. For example, a value of `7.5`
+ corresponds to 7.5%.
+ """
+
+ invoice_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ The IDs of the [invoices](entity:Invoice) created for the
+ subscription, listed in order when the invoices were created
+ (newest invoices appear first).
+ """
+
+ price_override_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing.
+ This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead,
+ you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates).
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version of the object. When updating an object, the version
+ supplied must match the version in the database, otherwise the write will
+ be rejected as conflicting.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the subscription was created, in RFC 3339 format.
+ """
+
+ card_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [subscriber's](entity:Customer) [card](entity:Card)
+ used to charge for the subscription.
+ """
+
+ timezone: typing_extensions.NotRequired[str]
+ """
+ Timezone that will be used in date calculations for the subscription.
+ Defaults to the timezone of the location based on `location_id`.
+ Format: the IANA Timezone Database identifier for the location timezone (for example, `America/Los_Angeles`).
+ """
+
+ source: typing_extensions.NotRequired[SubscriptionSourceParams]
+ """
+ The origination details of the subscription.
+ """
+
+ actions: typing_extensions.NotRequired[typing.Optional[typing.Sequence[SubscriptionActionParams]]]
+ """
+ The list of scheduled actions on this subscription. It is set only in the response from
+ [RetrieveSubscription](api-endpoint:Subscriptions-RetrieveSubscription) with the query parameter
+ of `include=actions` or from
+ [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) with the input parameter
+ of `include:["actions"]`.
+ """
+
+ monthly_billing_anchor_date: typing_extensions.NotRequired[int]
+ """
+ The day of the month on which the subscription will issue invoices and publish orders.
+ """
+
+ phases: typing_extensions.NotRequired[typing.Sequence[PhaseParams]]
+ """
+ array of phases for this subscription
+ """
+
+ completed_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `YYYY-MM-DD`-formatted date when the subscription enters a terminal state.
+ """
diff --git a/src/square/requests/subscription_action.py b/src/square/requests/subscription_action.py
new file mode 100644
index 00000000..e438a19f
--- /dev/null
+++ b/src/square/requests/subscription_action.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.subscription_action_type import SubscriptionActionType
+from .phase import PhaseParams
+
+
+class SubscriptionActionParams(typing_extensions.TypedDict):
+ """
+ Represents an action as a pending change to a subscription.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of an action scoped to a subscription.
+ """
+
+ type: typing_extensions.NotRequired[SubscriptionActionType]
+ """
+ The type of the action.
+ See [SubscriptionActionType](#type-subscriptionactiontype) for possible values
+ """
+
+ effective_date: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `YYYY-MM-DD`-formatted date when the action occurs on the subscription.
+ """
+
+ monthly_billing_anchor_date: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action.
+ """
+
+ phases: typing_extensions.NotRequired[typing.Optional[typing.Sequence[PhaseParams]]]
+ """
+ A list of Phases, to pass phase-specific information used in the swap.
+ """
+
+ new_plan_variation_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The target subscription plan variation that a subscription switches to, for a `SWAP_PLAN` action.
+ """
diff --git a/src/square/requests/subscription_created_event.py b/src/square/requests/subscription_created_event.py
new file mode 100644
index 00000000..9e9d1cda
--- /dev/null
+++ b/src/square/requests/subscription_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .subscription_created_event_data import SubscriptionCreatedEventDataParams
+
+
+class SubscriptionCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Subscription](entity:Subscription) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"subscription.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[SubscriptionCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/subscription_created_event_data.py b/src/square/requests/subscription_created_event_data.py
new file mode 100644
index 00000000..5b871c25
--- /dev/null
+++ b/src/square/requests/subscription_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .subscription_created_event_object import SubscriptionCreatedEventObjectParams
+
+
+class SubscriptionCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"subscription"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected subscription.
+ """
+
+ object: typing_extensions.NotRequired[SubscriptionCreatedEventObjectParams]
+ """
+ An object containing the created subscription.
+ """
diff --git a/src/square/requests/subscription_created_event_object.py b/src/square/requests/subscription_created_event_object.py
new file mode 100644
index 00000000..99137a37
--- /dev/null
+++ b/src/square/requests/subscription_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .subscription import SubscriptionParams
+
+
+class SubscriptionCreatedEventObjectParams(typing_extensions.TypedDict):
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The created subscription.
+ """
diff --git a/src/square/requests/subscription_event.py b/src/square/requests/subscription_event.py
new file mode 100644
index 00000000..b0965c53
--- /dev/null
+++ b/src/square/requests/subscription_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.subscription_event_subscription_event_type import SubscriptionEventSubscriptionEventType
+from .phase import PhaseParams
+from .subscription_event_info import SubscriptionEventInfoParams
+
+
+class SubscriptionEventParams(typing_extensions.TypedDict):
+ """
+ Describes changes to a subscription and the subscription status.
+ """
+
+ id: str
+ """
+ The ID of the subscription event.
+ """
+
+ subscription_event_type: SubscriptionEventSubscriptionEventType
+ """
+ Type of the subscription event.
+ See [SubscriptionEventSubscriptionEventType](#type-subscriptioneventsubscriptioneventtype) for possible values
+ """
+
+ effective_date: str
+ """
+ The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred.
+ """
+
+ monthly_billing_anchor_date: typing_extensions.NotRequired[int]
+ """
+ The day-of-the-month the billing anchor date was changed to, if applicable.
+ """
+
+ info: typing_extensions.NotRequired[SubscriptionEventInfoParams]
+ """
+ Additional information about the subscription event.
+ """
+
+ phases: typing_extensions.NotRequired[typing.Optional[typing.Sequence[PhaseParams]]]
+ """
+ A list of Phases, to pass phase-specific information used in the swap.
+ """
+
+ plan_variation_id: str
+ """
+ The ID of the subscription plan variation associated with the subscription.
+ """
diff --git a/src/square/requests/subscription_event_info.py b/src/square/requests/subscription_event_info.py
new file mode 100644
index 00000000..dd17061f
--- /dev/null
+++ b/src/square/requests/subscription_event_info.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.subscription_event_info_code import SubscriptionEventInfoCode
+
+
+class SubscriptionEventInfoParams(typing_extensions.TypedDict):
+ """
+ Provides information about the subscription event.
+ """
+
+ detail: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A human-readable explanation for the event.
+ """
+
+ code: typing_extensions.NotRequired[SubscriptionEventInfoCode]
+ """
+ An info code indicating the subscription event that occurred.
+ See [InfoCode](#type-infocode) for possible values
+ """
diff --git a/src/square/requests/subscription_phase.py b/src/square/requests/subscription_phase.py
new file mode 100644
index 00000000..398746d0
--- /dev/null
+++ b/src/square/requests/subscription_phase.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.subscription_cadence import SubscriptionCadence
+from .money import MoneyParams
+from .subscription_pricing import SubscriptionPricingParams
+
+
+class SubscriptionPhaseParams(typing_extensions.TypedDict):
+ """
+ Describes a phase in a subscription plan variation. For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations).
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-assigned ID of the subscription phase. This field cannot be changed after a `SubscriptionPhase` is created.
+ """
+
+ cadence: SubscriptionCadence
+ """
+ The billing cadence of the phase. For example, weekly or monthly. This field cannot be changed after a `SubscriptionPhase` is created.
+ See [SubscriptionCadence](#type-subscriptioncadence) for possible values
+ """
+
+ periods: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The number of `cadence`s the phase lasts. If not set, the phase never ends. Only the last phase can be indefinite. This field cannot be changed after a `SubscriptionPhase` is created.
+ """
+
+ recurring_price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount to bill for each `cadence`. Failure to specify this field results in a `MISSING_REQUIRED_PARAMETER` error at runtime.
+ """
+
+ ordinal: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The position this phase appears in the sequence of phases defined for the plan, indexed from 0. This field cannot be changed after a `SubscriptionPhase` is created.
+ """
+
+ pricing: typing_extensions.NotRequired[SubscriptionPricingParams]
+ """
+ The subscription pricing.
+ """
diff --git a/src/square/requests/subscription_pricing.py b/src/square/requests/subscription_pricing.py
new file mode 100644
index 00000000..746474a1
--- /dev/null
+++ b/src/square/requests/subscription_pricing.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.subscription_pricing_type import SubscriptionPricingType
+from .money import MoneyParams
+
+
+class SubscriptionPricingParams(typing_extensions.TypedDict):
+ """
+ Describes the pricing for the subscription.
+ """
+
+ type: typing_extensions.NotRequired[SubscriptionPricingType]
+ """
+ RELATIVE or STATIC
+ See [SubscriptionPricingType](#type-subscriptionpricingtype) for possible values
+ """
+
+ discount_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The ids of the discount catalog objects
+ """
+
+ price_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The price of the subscription, if STATIC
+ """
diff --git a/src/square/requests/subscription_source.py b/src/square/requests/subscription_source.py
new file mode 100644
index 00000000..affd05ee
--- /dev/null
+++ b/src/square/requests/subscription_source.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class SubscriptionSourceParams(typing_extensions.TypedDict):
+ """
+ The origination details of the subscription.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name used to identify the place (physical or digital) that
+ a subscription originates. If unset, the name defaults to the name
+ of the application that created the subscription.
+ """
diff --git a/src/square/requests/subscription_test_result.py b/src/square/requests/subscription_test_result.py
new file mode 100644
index 00000000..5c4a0d16
--- /dev/null
+++ b/src/square/requests/subscription_test_result.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class SubscriptionTestResultParams(typing_extensions.TypedDict):
+ """
+ Represents the result of testing a webhook subscription. Note: The actual API returns these fields at the root level of TestWebhookSubscriptionResponse, not nested under this object.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A Square-generated unique ID for the subscription test result.
+ """
+
+ status_code: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The HTTP status code returned by the notification URL.
+ """
+
+ payload: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Any]]]
+ """
+ The payload that was sent in the test notification.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the subscription was created, in RFC 3339 format.
+ For example, "2016-09-04T23:59:33.123Z".
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the subscription was updated, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z".
+ Because a subscription test result is unique, this field is the same as the `created_at` field.
+ """
+
+ notification_url: typing_extensions.NotRequired[str]
+ """
+ The URL that was used for the webhook notification test.
+ """
+
+ passes_filter: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether the notification passed any configured filters.
+ """
diff --git a/src/square/requests/subscription_updated_event.py b/src/square/requests/subscription_updated_event.py
new file mode 100644
index 00000000..f26b4bb2
--- /dev/null
+++ b/src/square/requests/subscription_updated_event.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .subscription_updated_event_data import SubscriptionUpdatedEventDataParams
+
+
+class SubscriptionUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Subscription](entity:Subscription) is updated.
+ Typically the `subscription.status` is updated as subscriptions become active
+ or cancelled.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"subscription.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[SubscriptionUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/subscription_updated_event_data.py b/src/square/requests/subscription_updated_event_data.py
new file mode 100644
index 00000000..c13941dc
--- /dev/null
+++ b/src/square/requests/subscription_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .subscription_updated_event_object import SubscriptionUpdatedEventObjectParams
+
+
+class SubscriptionUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"subscription"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected subscription.
+ """
+
+ object: typing_extensions.NotRequired[SubscriptionUpdatedEventObjectParams]
+ """
+ An object containing the updated subscription.
+ """
diff --git a/src/square/requests/subscription_updated_event_object.py b/src/square/requests/subscription_updated_event_object.py
new file mode 100644
index 00000000..5553893a
--- /dev/null
+++ b/src/square/requests/subscription_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .subscription import SubscriptionParams
+
+
+class SubscriptionUpdatedEventObjectParams(typing_extensions.TypedDict):
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The updated subscription.
+ """
diff --git a/src/square/requests/swap_plan_response.py b/src/square/requests/swap_plan_response.py
new file mode 100644
index 00000000..4d37006b
--- /dev/null
+++ b/src/square/requests/swap_plan_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription import SubscriptionParams
+from .subscription_action import SubscriptionActionParams
+
+
+class SwapPlanResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response of the
+ [SwapPlan](api-endpoint:Subscriptions-SwapPlan) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The subscription with the updated subscription plan.
+ """
+
+ actions: typing_extensions.NotRequired[typing.Sequence[SubscriptionActionParams]]
+ """
+ A list of a `SWAP_PLAN` action created by the request.
+ """
diff --git a/src/square/requests/tax_ids.py b/src/square/requests/tax_ids.py
new file mode 100644
index 00000000..14d02b6b
--- /dev/null
+++ b/src/square/requests/tax_ids.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class TaxIdsParams(typing_extensions.TypedDict):
+ """
+ Identifiers for the location used by various governments for tax purposes.
+ """
+
+ eu_vat: typing_extensions.NotRequired[str]
+ """
+ The EU VAT number for this location. For example, `IE3426675K`.
+ If the EU VAT number is present, it is well-formed and has been
+ validated with VIES, the VAT Information Exchange System.
+ """
+
+ fr_siret: typing_extensions.NotRequired[str]
+ """
+ The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements)
+ number is a 14-digit code issued by the French INSEE. For example, `39922799000021`.
+ """
+
+ fr_naf: typing_extensions.NotRequired[str]
+ """
+ The French government uses the NAF (Nomenclature des Activités Françaises) to display and
+ track economic statistical data. This is also called the APE (Activite Principale de l’Entreprise) code.
+ For example, `6910Z`.
+ """
+
+ es_nif: typing_extensions.NotRequired[str]
+ """
+ The NIF (Numero de Identificacion Fiscal) number is a nine-character tax identifier used in Spain.
+ If it is present, it has been validated. For example, `73628495A`.
+ """
+
+ jp_qii: typing_extensions.NotRequired[str]
+ """
+ The QII (Qualified Invoice Issuer) number is a 14-character tax identifier used in Japan.
+ For example, `T1234567890123`.
+ """
diff --git a/src/square/requests/team_member.py b/src/square/requests/team_member.py
new file mode 100644
index 00000000..e4578990
--- /dev/null
+++ b/src/square/requests/team_member.py
@@ -0,0 +1,78 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.team_member_status import TeamMemberStatus
+from .team_member_assigned_locations import TeamMemberAssignedLocationsParams
+from .wage_setting import WageSettingParams
+
+
+class TeamMemberParams(typing_extensions.TypedDict):
+ """
+ A record representing an individual team member for a business.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The unique ID for the team member.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A second ID used to associate the team member with an entity in another system.
+ """
+
+ is_owner: typing_extensions.NotRequired[bool]
+ """
+ Whether the team member is the owner of the Square account.
+ """
+
+ status: typing_extensions.NotRequired[TeamMemberStatus]
+ """
+ Describes the status of the team member.
+ See [TeamMemberStatus](#type-teammemberstatus) for possible values
+ """
+
+ given_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The given name (that is, the first name) associated with the team member.
+ """
+
+ family_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The family name (that is, the last name) associated with the team member.
+ """
+
+ email_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The email address associated with the team member. After accepting the invitation
+ from Square, only the team member can change this value.
+ """
+
+ phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The team member's phone number, in E.164 format. For example:
+ +14155552671 - the country code is 1 for US
+ +551155256325 - the country code is 55 for BR
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the team member was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the team member was last updated, in RFC 3339 format.
+ """
+
+ assigned_locations: typing_extensions.NotRequired[TeamMemberAssignedLocationsParams]
+ """
+ Describes the team member's assigned locations.
+ """
+
+ wage_setting: typing_extensions.NotRequired[WageSettingParams]
+ """
+ Information about the team member's overtime exemption status, job assignments, and compensation.
+ """
diff --git a/src/square/requests/team_member_assigned_locations.py b/src/square/requests/team_member_assigned_locations.py
new file mode 100644
index 00000000..77aeb850
--- /dev/null
+++ b/src/square/requests/team_member_assigned_locations.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.team_member_assigned_locations_assignment_type import TeamMemberAssignedLocationsAssignmentType
+
+
+class TeamMemberAssignedLocationsParams(typing_extensions.TypedDict):
+ """
+ An object that represents a team member's assignment to locations.
+ """
+
+ assignment_type: typing_extensions.NotRequired[TeamMemberAssignedLocationsAssignmentType]
+ """
+ The current assignment type of the team member.
+ See [TeamMemberAssignedLocationsAssignmentType](#type-teammemberassignedlocationsassignmenttype) for possible values
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The explicit locations that the team member is assigned to.
+ """
diff --git a/src/square/requests/team_member_booking_profile.py b/src/square/requests/team_member_booking_profile.py
new file mode 100644
index 00000000..55ef8dad
--- /dev/null
+++ b/src/square/requests/team_member_booking_profile.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class TeamMemberBookingProfileParams(typing_extensions.TypedDict):
+ """
+ The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider.
+ """
+
+ team_member_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [TeamMember](entity:TeamMember) object for the team member associated with the booking profile.
+ """
+
+ description: typing_extensions.NotRequired[str]
+ """
+ The description of the team member.
+ """
+
+ display_name: typing_extensions.NotRequired[str]
+ """
+ The display name of the team member.
+ """
+
+ is_bookable: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the team member can be booked through the Bookings API or the seller's online booking channel or site (`true`) or not (`false`).
+ """
+
+ profile_image_url: typing_extensions.NotRequired[str]
+ """
+ The URL of the team member's image for the bookings profile.
+ """
diff --git a/src/square/requests/team_member_created_event.py b/src/square/requests/team_member_created_event.py
new file mode 100644
index 00000000..dddbbb8e
--- /dev/null
+++ b/src/square/requests/team_member_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .team_member_created_event_data import TeamMemberCreatedEventDataParams
+
+
+class TeamMemberCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a Team Member is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"team_member.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[TeamMemberCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/team_member_created_event_data.py b/src/square/requests/team_member_created_event_data.py
new file mode 100644
index 00000000..0e251405
--- /dev/null
+++ b/src/square/requests/team_member_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .team_member_created_event_object import TeamMemberCreatedEventObjectParams
+
+
+class TeamMemberCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"team_member"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the created team member.
+ """
+
+ object: typing_extensions.NotRequired[TeamMemberCreatedEventObjectParams]
+ """
+ An object containing the created team member.
+ """
diff --git a/src/square/requests/team_member_created_event_object.py b/src/square/requests/team_member_created_event_object.py
new file mode 100644
index 00000000..d1edb904
--- /dev/null
+++ b/src/square/requests/team_member_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .team_member import TeamMemberParams
+
+
+class TeamMemberCreatedEventObjectParams(typing_extensions.TypedDict):
+ team_member: typing_extensions.NotRequired[TeamMemberParams]
+ """
+ The created team member.
+ """
diff --git a/src/square/requests/team_member_updated_event.py b/src/square/requests/team_member_updated_event.py
new file mode 100644
index 00000000..f63392ed
--- /dev/null
+++ b/src/square/requests/team_member_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .team_member_updated_event_data import TeamMemberUpdatedEventDataParams
+
+
+class TeamMemberUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a Team Member is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"team_member.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[TeamMemberUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/team_member_updated_event_data.py b/src/square/requests/team_member_updated_event_data.py
new file mode 100644
index 00000000..08398360
--- /dev/null
+++ b/src/square/requests/team_member_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .team_member_updated_event_object import TeamMemberUpdatedEventObjectParams
+
+
+class TeamMemberUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"team_member"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected team member.
+ """
+
+ object: typing_extensions.NotRequired[TeamMemberUpdatedEventObjectParams]
+ """
+ An object containing the updated team member.
+ """
diff --git a/src/square/requests/team_member_updated_event_object.py b/src/square/requests/team_member_updated_event_object.py
new file mode 100644
index 00000000..d95b587c
--- /dev/null
+++ b/src/square/requests/team_member_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .team_member import TeamMemberParams
+
+
+class TeamMemberUpdatedEventObjectParams(typing_extensions.TypedDict):
+ team_member: typing_extensions.NotRequired[TeamMemberParams]
+ """
+ The updated team member.
+ """
diff --git a/src/square/requests/team_member_wage.py b/src/square/requests/team_member_wage.py
new file mode 100644
index 00000000..2d2a947d
--- /dev/null
+++ b/src/square/requests/team_member_wage.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class TeamMemberWageParams(typing_extensions.TypedDict):
+ """
+ Job and wage information for a [team member](entity:TeamMember).
+ This convenience object provides details needed to specify the `wage`
+ field for a [timecard](entity:Timecard).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The UUID for this object.
+ """
+
+ team_member_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `TeamMember` that this wage is assigned to.
+ """
+
+ title: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The job title that this wage relates to.
+ """
+
+ hourly_rate: typing_extensions.NotRequired[MoneyParams]
+ """
+ Can be a custom-set hourly wage or the calculated effective hourly
+ wage based on the annual wage and hours worked per week.
+ """
+
+ job_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An identifier for the [job](entity:Job) that this wage relates to.
+ """
+
+ tip_eligible: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether team members are eligible for tips when working this job.
+ """
diff --git a/src/square/requests/team_member_wage_setting_updated_event.py b/src/square/requests/team_member_wage_setting_updated_event.py
new file mode 100644
index 00000000..f43b6719
--- /dev/null
+++ b/src/square/requests/team_member_wage_setting_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .team_member_wage_setting_updated_event_data import TeamMemberWageSettingUpdatedEventDataParams
+
+
+class TeamMemberWageSettingUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a Wage Setting is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"team_member.wage_setting.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[TeamMemberWageSettingUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/team_member_wage_setting_updated_event_data.py b/src/square/requests/team_member_wage_setting_updated_event_data.py
new file mode 100644
index 00000000..aeb5e64d
--- /dev/null
+++ b/src/square/requests/team_member_wage_setting_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .team_member_wage_setting_updated_event_object import TeamMemberWageSettingUpdatedEventObjectParams
+
+
+class TeamMemberWageSettingUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"wage_setting"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the updated team member wage setting.
+ """
+
+ object: typing_extensions.NotRequired[TeamMemberWageSettingUpdatedEventObjectParams]
+ """
+ An object containing the updated team member wage setting.
+ """
diff --git a/src/square/requests/team_member_wage_setting_updated_event_object.py b/src/square/requests/team_member_wage_setting_updated_event_object.py
new file mode 100644
index 00000000..4470c4bc
--- /dev/null
+++ b/src/square/requests/team_member_wage_setting_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .wage_setting import WageSettingParams
+
+
+class TeamMemberWageSettingUpdatedEventObjectParams(typing_extensions.TypedDict):
+ wage_setting: typing_extensions.NotRequired[WageSettingParams]
+ """
+ The updated team member wage setting.
+ """
diff --git a/src/square/requests/tender.py b/src/square/requests/tender.py
new file mode 100644
index 00000000..c85d0d50
--- /dev/null
+++ b/src/square/requests/tender.py
@@ -0,0 +1,123 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.tender_type import TenderType
+from .additional_recipient import AdditionalRecipientParams
+from .money import MoneyParams
+from .tender_bank_account_details import TenderBankAccountDetailsParams
+from .tender_buy_now_pay_later_details import TenderBuyNowPayLaterDetailsParams
+from .tender_card_details import TenderCardDetailsParams
+from .tender_cash_details import TenderCashDetailsParams
+from .tender_square_account_details import TenderSquareAccountDetailsParams
+
+
+class TenderParams(typing_extensions.TypedDict):
+ """
+ Represents a tender (i.e., a method of payment) used in a Square transaction.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The tender's unique ID. It is the associated payment ID.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the transaction's associated location.
+ """
+
+ transaction_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the tender's associated transaction.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the tender was created, in RFC 3339 format.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional note associated with the tender at the time of payment.
+ """
+
+ amount_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of the tender, including `tip_money`. If the tender has a `payment_id`,
+ the `total_money` of the corresponding [Payment](entity:Payment) will be equal to the
+ `amount_money` of the tender.
+ """
+
+ tip_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The tip's amount of the tender.
+ """
+
+ processing_fee_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of any Square processing fees applied to the tender.
+
+ This field is not immediately populated when a new transaction is created.
+ It is usually available after about ten seconds.
+ """
+
+ customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ If the tender is associated with a customer or represents a customer's card on file,
+ this is the ID of the associated customer.
+ """
+
+ type: TenderType
+ """
+ The type of tender, such as `CARD` or `CASH`.
+ See [TenderType](#type-tendertype) for possible values
+ """
+
+ card_details: typing_extensions.NotRequired[TenderCardDetailsParams]
+ """
+ The details of the card tender.
+
+ This value is present only if the value of `type` is `CARD`.
+ """
+
+ cash_details: typing_extensions.NotRequired[TenderCashDetailsParams]
+ """
+ The details of the cash tender.
+
+ This value is present only if the value of `type` is `CASH`.
+ """
+
+ bank_account_details: typing_extensions.NotRequired[TenderBankAccountDetailsParams]
+ """
+ The details of the bank account tender.
+
+ This value is present only if the value of `type` is `BANK_ACCOUNT`.
+ """
+
+ buy_now_pay_later_details: typing_extensions.NotRequired[TenderBuyNowPayLaterDetailsParams]
+ """
+ The details of a Buy Now Pay Later tender.
+
+ This value is present only if the value of `type` is `BUY_NOW_PAY_LATER`.
+ """
+
+ square_account_details: typing_extensions.NotRequired[TenderSquareAccountDetailsParams]
+ """
+ The details of a Square Account tender.
+
+ This value is present only if the value of `type` is `SQUARE_ACCOUNT`.
+ """
+
+ additional_recipients: typing_extensions.NotRequired[typing.Optional[typing.Sequence[AdditionalRecipientParams]]]
+ """
+ Additional recipients (other than the merchant) receiving a portion of this tender.
+ For example, fees assessed on the purchase by a third party integration.
+ """
+
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the [Payment](entity:Payment) that corresponds to this tender.
+ This value is only present for payments created with the v2 Payments API.
+ """
diff --git a/src/square/requests/tender_bank_account_details.py b/src/square/requests/tender_bank_account_details.py
new file mode 100644
index 00000000..3e5124f7
--- /dev/null
+++ b/src/square/requests/tender_bank_account_details.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.tender_bank_account_details_status import TenderBankAccountDetailsStatus
+
+
+class TenderBankAccountDetailsParams(typing_extensions.TypedDict):
+ """
+ Represents the details of a tender with `type` `BANK_ACCOUNT`.
+
+ See [BankAccountPaymentDetails](entity:BankAccountPaymentDetails)
+ for more exposed details of a bank account payment.
+ """
+
+ status: typing_extensions.NotRequired[TenderBankAccountDetailsStatus]
+ """
+ The bank account payment's current state.
+
+ See [TenderBankAccountPaymentDetailsStatus](entity:TenderBankAccountDetailsStatus) for possible values.
+ See [TenderBankAccountDetailsStatus](#type-tenderbankaccountdetailsstatus) for possible values
+ """
diff --git a/src/square/requests/tender_buy_now_pay_later_details.py b/src/square/requests/tender_buy_now_pay_later_details.py
new file mode 100644
index 00000000..c68f9615
--- /dev/null
+++ b/src/square/requests/tender_buy_now_pay_later_details.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.tender_buy_now_pay_later_details_brand import TenderBuyNowPayLaterDetailsBrand
+from ..types.tender_buy_now_pay_later_details_status import TenderBuyNowPayLaterDetailsStatus
+
+
+class TenderBuyNowPayLaterDetailsParams(typing_extensions.TypedDict):
+ """
+ Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`.
+ """
+
+ buy_now_pay_later_brand: typing_extensions.NotRequired[TenderBuyNowPayLaterDetailsBrand]
+ """
+ The Buy Now Pay Later brand.
+ See [Brand](#type-brand) for possible values
+ """
+
+ status: typing_extensions.NotRequired[TenderBuyNowPayLaterDetailsStatus]
+ """
+ The buy now pay later payment's current state (such as `AUTHORIZED` or
+ `CAPTURED`). See [TenderBuyNowPayLaterDetailsStatus](entity:TenderBuyNowPayLaterDetailsStatus)
+ for possible values.
+ See [Status](#type-status) for possible values
+ """
diff --git a/src/square/requests/tender_card_details.py b/src/square/requests/tender_card_details.py
new file mode 100644
index 00000000..5ad38675
--- /dev/null
+++ b/src/square/requests/tender_card_details.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.tender_card_details_entry_method import TenderCardDetailsEntryMethod
+from ..types.tender_card_details_status import TenderCardDetailsStatus
+from .card import CardParams
+
+
+class TenderCardDetailsParams(typing_extensions.TypedDict):
+ """
+ Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD`
+ """
+
+ status: typing_extensions.NotRequired[TenderCardDetailsStatus]
+ """
+ The credit card payment's current state (such as `AUTHORIZED` or
+ `CAPTURED`). See [TenderCardDetailsStatus](entity:TenderCardDetailsStatus)
+ for possible values.
+ See [TenderCardDetailsStatus](#type-tendercarddetailsstatus) for possible values
+ """
+
+ card: typing_extensions.NotRequired[CardParams]
+ """
+ The credit card's non-confidential details.
+ """
+
+ entry_method: typing_extensions.NotRequired[TenderCardDetailsEntryMethod]
+ """
+ The method used to enter the card's details for the transaction.
+ See [TenderCardDetailsEntryMethod](#type-tendercarddetailsentrymethod) for possible values
+ """
diff --git a/src/square/requests/tender_cash_details.py b/src/square/requests/tender_cash_details.py
new file mode 100644
index 00000000..a1ef03b1
--- /dev/null
+++ b/src/square/requests/tender_cash_details.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class TenderCashDetailsParams(typing_extensions.TypedDict):
+ """
+ Represents the details of a tender with `type` `CASH`.
+ """
+
+ buyer_tendered_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount of cash provided by the buyer, before change is given.
+ """
+
+ change_back_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount of change returned to the buyer.
+ """
diff --git a/src/square/requests/tender_square_account_details.py b/src/square/requests/tender_square_account_details.py
new file mode 100644
index 00000000..16110945
--- /dev/null
+++ b/src/square/requests/tender_square_account_details.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.tender_square_account_details_status import TenderSquareAccountDetailsStatus
+
+
+class TenderSquareAccountDetailsParams(typing_extensions.TypedDict):
+ """
+ Represents the details of a tender with `type` `SQUARE_ACCOUNT`.
+ """
+
+ status: typing_extensions.NotRequired[TenderSquareAccountDetailsStatus]
+ """
+ The Square Account payment's current state (such as `AUTHORIZED` or
+ `CAPTURED`). See [TenderSquareAccountDetailsStatus](entity:TenderSquareAccountDetailsStatus)
+ for possible values.
+ See [Status](#type-status) for possible values
+ """
diff --git a/src/square/requests/terminal_action.py b/src/square/requests/terminal_action.py
new file mode 100644
index 00000000..139ba41b
--- /dev/null
+++ b/src/square/requests/terminal_action.py
@@ -0,0 +1,142 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.action_cancel_reason import ActionCancelReason
+from ..types.terminal_action_action_type import TerminalActionActionType
+from .confirmation_options import ConfirmationOptionsParams
+from .data_collection_options import DataCollectionOptionsParams
+from .device_metadata import DeviceMetadataParams
+from .qr_code_options import QrCodeOptionsParams
+from .receipt_options import ReceiptOptionsParams
+from .save_card_options import SaveCardOptionsParams
+from .select_options import SelectOptionsParams
+from .signature_options import SignatureOptionsParams
+
+
+class TerminalActionParams(typing_extensions.TypedDict):
+ """
+ Represents an action processed by the Square Terminal.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique ID for this `TerminalAction`.
+ """
+
+ device_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique Id of the device intended for this `TerminalAction`.
+ The Id can be retrieved from /v2/devices api.
+ """
+
+ deadline_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The duration as an RFC 3339 duration, after which the action will be automatically canceled.
+ TerminalActions that are `PENDING` will be automatically `CANCELED` and have a cancellation reason
+ of `TIMED_OUT`
+
+ Default: 5 minutes from creation
+
+ Maximum: 5 minutes
+ """
+
+ status: typing_extensions.NotRequired[str]
+ """
+ The status of the `TerminalAction`.
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED`
+ """
+
+ cancel_reason: typing_extensions.NotRequired[ActionCancelReason]
+ """
+ The reason why `TerminalAction` is canceled. Present if the status is `CANCELED`.
+ See [ActionCancelReason](#type-actioncancelreason) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The time when the `TerminalAction` was created as an RFC 3339 timestamp.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The time when the `TerminalAction` was last updated as an RFC 3339 timestamp.
+ """
+
+ app_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the application that created the action.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The location id the action is attached to, if a link can be made.
+ """
+
+ type: typing_extensions.NotRequired[TerminalActionActionType]
+ """
+ Represents the type of the action.
+ See [ActionType](#type-actiontype) for possible values
+ """
+
+ qr_code_options: typing_extensions.NotRequired[QrCodeOptionsParams]
+ """
+ Describes configuration for the QR code action. Requires `QR_CODE` type.
+ """
+
+ save_card_options: typing_extensions.NotRequired[SaveCardOptionsParams]
+ """
+ Describes configuration for the save-card action. Requires `SAVE_CARD` type.
+ """
+
+ signature_options: typing_extensions.NotRequired[SignatureOptionsParams]
+ """
+ Describes configuration for the signature capture action. Requires `SIGNATURE` type.
+ """
+
+ confirmation_options: typing_extensions.NotRequired[ConfirmationOptionsParams]
+ """
+ Describes configuration for the confirmation action. Requires `CONFIRMATION` type.
+ """
+
+ receipt_options: typing_extensions.NotRequired[ReceiptOptionsParams]
+ """
+ Describes configuration for the receipt action. Requires `RECEIPT` type.
+ """
+
+ data_collection_options: typing_extensions.NotRequired[DataCollectionOptionsParams]
+ """
+ Describes configuration for the data collection action. Requires `DATA_COLLECTION` type.
+ """
+
+ select_options: typing_extensions.NotRequired[SelectOptionsParams]
+ """
+ Describes configuration for the select action. Requires `SELECT` type.
+ """
+
+ device_metadata: typing_extensions.NotRequired[DeviceMetadataParams]
+ """
+ Details about the Terminal that received the action request (such as battery level,
+ operating system version, and network connection settings).
+
+ Only available for `PING` action type.
+ """
+
+ await_next_action: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates the action will be linked to another action and requires a waiting dialog to be
+ displayed instead of returning to the idle screen on completion of the action.
+
+ Only supported on SIGNATURE, CONFIRMATION, DATA_COLLECTION, and SELECT types.
+ """
+
+ await_next_action_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The timeout duration of the waiting dialog as an RFC 3339 duration, after which the
+ waiting dialog will no longer be displayed and the Terminal will return to the idle screen.
+
+ Default: 5 minutes from when the waiting dialog is displayed
+
+ Maximum: 5 minutes
+ """
diff --git a/src/square/requests/terminal_action_created_event.py b/src/square/requests/terminal_action_created_event.py
new file mode 100644
index 00000000..02e35f0c
--- /dev/null
+++ b/src/square/requests/terminal_action_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_action_created_event_data import TerminalActionCreatedEventDataParams
+
+
+class TerminalActionCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a TerminalAction is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"terminal.action.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing_extensions.NotRequired[TerminalActionCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/terminal_action_created_event_data.py b/src/square/requests/terminal_action_created_event_data.py
new file mode 100644
index 00000000..aca2ffca
--- /dev/null
+++ b/src/square/requests/terminal_action_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_action_created_event_object import TerminalActionCreatedEventObjectParams
+
+
+class TerminalActionCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the created object’s type, `"action"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the created terminal action.
+ """
+
+ object: typing_extensions.NotRequired[TerminalActionCreatedEventObjectParams]
+ """
+ An object containing the created terminal action.
+ """
diff --git a/src/square/requests/terminal_action_created_event_object.py b/src/square/requests/terminal_action_created_event_object.py
new file mode 100644
index 00000000..b73c0f7b
--- /dev/null
+++ b/src/square/requests/terminal_action_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .terminal_action import TerminalActionParams
+
+
+class TerminalActionCreatedEventObjectParams(typing_extensions.TypedDict):
+ action: typing_extensions.NotRequired[TerminalActionParams]
+ """
+ The created terminal action.
+ """
diff --git a/src/square/requests/terminal_action_query.py b/src/square/requests/terminal_action_query.py
new file mode 100644
index 00000000..400853ec
--- /dev/null
+++ b/src/square/requests/terminal_action_query.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .terminal_action_query_filter import TerminalActionQueryFilterParams
+from .terminal_action_query_sort import TerminalActionQuerySortParams
+
+
+class TerminalActionQueryParams(typing_extensions.TypedDict):
+ filter: typing_extensions.NotRequired[TerminalActionQueryFilterParams]
+ """
+ Options for filtering returned `TerminalAction`s
+ """
+
+ sort: typing_extensions.NotRequired[TerminalActionQuerySortParams]
+ """
+ Option for sorting returned `TerminalAction` objects.
+ """
diff --git a/src/square/requests/terminal_action_query_filter.py b/src/square/requests/terminal_action_query_filter.py
new file mode 100644
index 00000000..bcc1f38a
--- /dev/null
+++ b/src/square/requests/terminal_action_query_filter.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.terminal_action_action_type import TerminalActionActionType
+from .time_range import TimeRangeParams
+
+
+class TerminalActionQueryFilterParams(typing_extensions.TypedDict):
+ device_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ `TerminalAction`s associated with a specific device. If no device is specified then all
+ `TerminalAction`s for the merchant will be displayed.
+ """
+
+ created_at: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ Time range for the beginning of the reporting period. Inclusive.
+ Default value: The current time minus one day.
+ Note that `TerminalAction`s are available for 30 days after creation.
+ """
+
+ status: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Filter results with the desired status of the `TerminalAction`
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED`
+ """
+
+ type: typing_extensions.NotRequired[TerminalActionActionType]
+ """
+ Filter results with the requested ActionType.
+ See [TerminalActionActionType](#type-terminalactionactiontype) for possible values
+ """
diff --git a/src/square/requests/terminal_action_query_sort.py b/src/square/requests/terminal_action_query_sort.py
new file mode 100644
index 00000000..b507783b
--- /dev/null
+++ b/src/square/requests/terminal_action_query_sort.py
@@ -0,0 +1,14 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.sort_order import SortOrder
+
+
+class TerminalActionQuerySortParams(typing_extensions.TypedDict):
+ sort_order: typing_extensions.NotRequired[SortOrder]
+ """
+ The order in which results are listed.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/terminal_action_updated_event.py b/src/square/requests/terminal_action_updated_event.py
new file mode 100644
index 00000000..b581ca15
--- /dev/null
+++ b/src/square/requests/terminal_action_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_action_updated_event_data import TerminalActionUpdatedEventDataParams
+
+
+class TerminalActionUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a TerminalAction is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"terminal.action.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing_extensions.NotRequired[TerminalActionUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/terminal_action_updated_event_data.py b/src/square/requests/terminal_action_updated_event_data.py
new file mode 100644
index 00000000..71e90dea
--- /dev/null
+++ b/src/square/requests/terminal_action_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_action_updated_event_object import TerminalActionUpdatedEventObjectParams
+
+
+class TerminalActionUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the updated object’s type, `"action"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the updated terminal action.
+ """
+
+ object: typing_extensions.NotRequired[TerminalActionUpdatedEventObjectParams]
+ """
+ An object containing the updated terminal action.
+ """
diff --git a/src/square/requests/terminal_action_updated_event_object.py b/src/square/requests/terminal_action_updated_event_object.py
new file mode 100644
index 00000000..12e8cc0b
--- /dev/null
+++ b/src/square/requests/terminal_action_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .terminal_action import TerminalActionParams
+
+
+class TerminalActionUpdatedEventObjectParams(typing_extensions.TypedDict):
+ action: typing_extensions.NotRequired[TerminalActionParams]
+ """
+ The updated terminal action.
+ """
diff --git a/src/square/requests/terminal_checkout.py b/src/square/requests/terminal_checkout.py
new file mode 100644
index 00000000..95a5ad93
--- /dev/null
+++ b/src/square/requests/terminal_checkout.py
@@ -0,0 +1,148 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.action_cancel_reason import ActionCancelReason
+from ..types.checkout_options_payment_type import CheckoutOptionsPaymentType
+from .device_checkout_options import DeviceCheckoutOptionsParams
+from .money import MoneyParams
+from .payment_options import PaymentOptionsParams
+
+
+class TerminalCheckoutParams(typing_extensions.TypedDict):
+ """
+ Represents a checkout processed by the Square Terminal.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique ID for this `TerminalCheckout`.
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount of money (including the tax amount) that the Square Terminal device should try to collect.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional user-defined reference ID that can be used to associate
+ this `TerminalCheckout` to another entity in an external system. For example, an order
+ ID generated by a third-party shopping cart. The ID is also associated with any payments
+ used to complete the checkout.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional note to associate with the checkout, as well as with any payments used to complete the checkout.
+ Note: maximum 500 characters
+ """
+
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The reference to the Square order ID for the checkout request.
+ """
+
+ payment_options: typing_extensions.NotRequired[PaymentOptionsParams]
+ """
+ Payment-specific options for the checkout request.
+ """
+
+ device_options: DeviceCheckoutOptionsParams
+ """
+ Options to control the display and behavior of the Square Terminal device.
+ """
+
+ deadline_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An RFC 3339 duration, after which the checkout is automatically canceled.
+ A `TerminalCheckout` that is `PENDING` is automatically `CANCELED` and has a cancellation reason
+ of `TIMED_OUT`.
+
+ Default: 5 minutes from creation
+
+ Maximum: 5 minutes
+ """
+
+ status: typing_extensions.NotRequired[str]
+ """
+ The status of the `TerminalCheckout`.
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED`
+ """
+
+ cancel_reason: typing_extensions.NotRequired[ActionCancelReason]
+ """
+ The reason why `TerminalCheckout` is canceled. Present if the status is `CANCELED`.
+ See [ActionCancelReason](#type-actioncancelreason) for possible values
+ """
+
+ payment_ids: typing_extensions.NotRequired[typing.Sequence[str]]
+ """
+ A list of IDs for payments created by this `TerminalCheckout`.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The time when the `TerminalCheckout` was created, as an RFC 3339 timestamp.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The time when the `TerminalCheckout` was last updated, as an RFC 3339 timestamp.
+ """
+
+ app_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the application that created the checkout.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The location of the device where the `TerminalCheckout` was directed.
+ """
+
+ payment_type: typing_extensions.NotRequired[CheckoutOptionsPaymentType]
+ """
+ The type of payment the terminal should attempt to capture from. Defaults to `CARD_PRESENT`.
+ See [CheckoutOptionsPaymentType](#type-checkoutoptionspaymenttype) for possible values
+ """
+
+ team_member_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional ID of the team member associated with creating the checkout.
+ """
+
+ customer_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ An optional ID of the customer associated with the checkout.
+ """
+
+ app_fee_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount the developer is taking as a fee for facilitating the payment on behalf
+ of the seller.
+
+ The amount cannot be more than 90% of the total amount of the payment.
+
+ The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller.
+
+ For more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+ """
+
+ statement_description_identifier: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Optional additional payment information to include on the customer's card statement as
+ part of the statement description. This can be, for example, an invoice number, ticket number,
+ or short description that uniquely identifies the purchase.
+ """
+
+ tip_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The amount designated as a tip, in addition to `amount_money`. This may only be set for a
+ checkout that has tipping disabled (`tip_settings.allow_tipping` is `false`).
+ """
diff --git a/src/square/requests/terminal_checkout_created_event.py b/src/square/requests/terminal_checkout_created_event.py
new file mode 100644
index 00000000..7d81a356
--- /dev/null
+++ b/src/square/requests/terminal_checkout_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_checkout_created_event_data import TerminalCheckoutCreatedEventDataParams
+
+
+class TerminalCheckoutCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [TerminalCheckout](entity:TerminalCheckout) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"terminal.checkout.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing_extensions.NotRequired[TerminalCheckoutCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/terminal_checkout_created_event_data.py b/src/square/requests/terminal_checkout_created_event_data.py
new file mode 100644
index 00000000..643728ff
--- /dev/null
+++ b/src/square/requests/terminal_checkout_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_checkout_created_event_object import TerminalCheckoutCreatedEventObjectParams
+
+
+class TerminalCheckoutCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the created object’s type, `"checkout"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the created terminal checkout.
+ """
+
+ object: typing_extensions.NotRequired[TerminalCheckoutCreatedEventObjectParams]
+ """
+ An object containing the created terminal checkout
+ """
diff --git a/src/square/requests/terminal_checkout_created_event_object.py b/src/square/requests/terminal_checkout_created_event_object.py
new file mode 100644
index 00000000..e013ab03
--- /dev/null
+++ b/src/square/requests/terminal_checkout_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .terminal_checkout import TerminalCheckoutParams
+
+
+class TerminalCheckoutCreatedEventObjectParams(typing_extensions.TypedDict):
+ checkout: typing_extensions.NotRequired[TerminalCheckoutParams]
+ """
+ The created terminal checkout
+ """
diff --git a/src/square/requests/terminal_checkout_query.py b/src/square/requests/terminal_checkout_query.py
new file mode 100644
index 00000000..a6cfdeca
--- /dev/null
+++ b/src/square/requests/terminal_checkout_query.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .terminal_checkout_query_filter import TerminalCheckoutQueryFilterParams
+from .terminal_checkout_query_sort import TerminalCheckoutQuerySortParams
+
+
+class TerminalCheckoutQueryParams(typing_extensions.TypedDict):
+ filter: typing_extensions.NotRequired[TerminalCheckoutQueryFilterParams]
+ """
+ Options for filtering returned `TerminalCheckout` objects.
+ """
+
+ sort: typing_extensions.NotRequired[TerminalCheckoutQuerySortParams]
+ """
+ Option for sorting returned `TerminalCheckout` objects.
+ """
diff --git a/src/square/requests/terminal_checkout_query_filter.py b/src/square/requests/terminal_checkout_query_filter.py
new file mode 100644
index 00000000..5261f298
--- /dev/null
+++ b/src/square/requests/terminal_checkout_query_filter.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .time_range import TimeRangeParams
+
+
+class TerminalCheckoutQueryFilterParams(typing_extensions.TypedDict):
+ device_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `TerminalCheckout` objects associated with a specific device. If no device is specified, then all
+ `TerminalCheckout` objects for the merchant are displayed.
+ """
+
+ created_at: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ The time range for the beginning of the reporting period, which is inclusive.
+ Default value: The current time minus one day.
+ Note that `TerminalCheckout`s are available for 30 days after creation.
+ """
+
+ status: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Filtered results with the desired status of the `TerminalCheckout`.
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED`
+ """
diff --git a/src/square/requests/terminal_checkout_query_sort.py b/src/square/requests/terminal_checkout_query_sort.py
new file mode 100644
index 00000000..cc80f534
--- /dev/null
+++ b/src/square/requests/terminal_checkout_query_sort.py
@@ -0,0 +1,13 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.sort_order import SortOrder
+
+
+class TerminalCheckoutQuerySortParams(typing_extensions.TypedDict):
+ sort_order: typing_extensions.NotRequired[SortOrder]
+ """
+ The order in which results are listed.
+ Default: `DESC`
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/terminal_checkout_updated_event.py b/src/square/requests/terminal_checkout_updated_event.py
new file mode 100644
index 00000000..f8835ca8
--- /dev/null
+++ b/src/square/requests/terminal_checkout_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_checkout_updated_event_data import TerminalCheckoutUpdatedEventDataParams
+
+
+class TerminalCheckoutUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [TerminalCheckout](entity:TerminalCheckout) is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"terminal.checkout.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing_extensions.NotRequired[TerminalCheckoutUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/terminal_checkout_updated_event_data.py b/src/square/requests/terminal_checkout_updated_event_data.py
new file mode 100644
index 00000000..71fbb0d0
--- /dev/null
+++ b/src/square/requests/terminal_checkout_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_checkout_updated_event_object import TerminalCheckoutUpdatedEventObjectParams
+
+
+class TerminalCheckoutUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the updated object’s type, `"checkout"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the updated terminal checkout.
+ """
+
+ object: typing_extensions.NotRequired[TerminalCheckoutUpdatedEventObjectParams]
+ """
+ An object containing the updated terminal checkout
+ """
diff --git a/src/square/requests/terminal_checkout_updated_event_object.py b/src/square/requests/terminal_checkout_updated_event_object.py
new file mode 100644
index 00000000..d17cd956
--- /dev/null
+++ b/src/square/requests/terminal_checkout_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .terminal_checkout import TerminalCheckoutParams
+
+
+class TerminalCheckoutUpdatedEventObjectParams(typing_extensions.TypedDict):
+ checkout: typing_extensions.NotRequired[TerminalCheckoutParams]
+ """
+ The updated terminal checkout
+ """
diff --git a/src/square/requests/terminal_refund.py b/src/square/requests/terminal_refund.py
new file mode 100644
index 00000000..919bb414
--- /dev/null
+++ b/src/square/requests/terminal_refund.py
@@ -0,0 +1,94 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.action_cancel_reason import ActionCancelReason
+from .money import MoneyParams
+
+
+class TerminalRefundParams(typing_extensions.TypedDict):
+ """
+ Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique ID for this `TerminalRefund`.
+ """
+
+ refund_id: typing_extensions.NotRequired[str]
+ """
+ The reference to the payment refund created by completing this `TerminalRefund`.
+ """
+
+ payment_id: str
+ """
+ The unique ID of the payment being refunded.
+ """
+
+ order_id: typing_extensions.NotRequired[str]
+ """
+ The reference to the Square order ID for the payment identified by the `payment_id`.
+ """
+
+ amount_money: MoneyParams
+ """
+ The amount of money, inclusive of `tax_money`, that the `TerminalRefund` should return.
+ This value is limited to the amount taken in the original payment minus any completed or
+ pending refunds.
+ """
+
+ reason: str
+ """
+ A description of the reason for the refund.
+ """
+
+ device_id: str
+ """
+ The unique ID of the device intended for this `TerminalRefund`.
+ The Id can be retrieved from /v2/devices api.
+ """
+
+ deadline_duration: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The RFC 3339 duration, after which the refund is automatically canceled.
+ A `TerminalRefund` that is `PENDING` is automatically `CANCELED` and has a cancellation reason
+ of `TIMED_OUT`.
+
+ Default: 5 minutes from creation.
+
+ Maximum: 5 minutes
+ """
+
+ status: typing_extensions.NotRequired[str]
+ """
+ The status of the `TerminalRefund`.
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`.
+ """
+
+ cancel_reason: typing_extensions.NotRequired[ActionCancelReason]
+ """
+ Present if the status is `CANCELED`.
+ See [ActionCancelReason](#type-actioncancelreason) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The time when the `TerminalRefund` was created, as an RFC 3339 timestamp.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The time when the `TerminalRefund` was last updated, as an RFC 3339 timestamp.
+ """
+
+ app_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the application that created the refund.
+ """
+
+ location_id: typing_extensions.NotRequired[str]
+ """
+ The location of the device where the `TerminalRefund` was directed.
+ """
diff --git a/src/square/requests/terminal_refund_created_event.py b/src/square/requests/terminal_refund_created_event.py
new file mode 100644
index 00000000..6da7689e
--- /dev/null
+++ b/src/square/requests/terminal_refund_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_refund_created_event_data import TerminalRefundCreatedEventDataParams
+
+
+class TerminalRefundCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a Terminal API refund is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"terminal.refund.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing_extensions.NotRequired[TerminalRefundCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/terminal_refund_created_event_data.py b/src/square/requests/terminal_refund_created_event_data.py
new file mode 100644
index 00000000..7fd127de
--- /dev/null
+++ b/src/square/requests/terminal_refund_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_refund_created_event_object import TerminalRefundCreatedEventObjectParams
+
+
+class TerminalRefundCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the created object’s type, `"refund"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the created terminal refund.
+ """
+
+ object: typing_extensions.NotRequired[TerminalRefundCreatedEventObjectParams]
+ """
+ An object containing the created terminal refund.
+ """
diff --git a/src/square/requests/terminal_refund_created_event_object.py b/src/square/requests/terminal_refund_created_event_object.py
new file mode 100644
index 00000000..1ea59baa
--- /dev/null
+++ b/src/square/requests/terminal_refund_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .terminal_refund import TerminalRefundParams
+
+
+class TerminalRefundCreatedEventObjectParams(typing_extensions.TypedDict):
+ refund: typing_extensions.NotRequired[TerminalRefundParams]
+ """
+ The created terminal refund.
+ """
diff --git a/src/square/requests/terminal_refund_query.py b/src/square/requests/terminal_refund_query.py
new file mode 100644
index 00000000..9ebe3b65
--- /dev/null
+++ b/src/square/requests/terminal_refund_query.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .terminal_refund_query_filter import TerminalRefundQueryFilterParams
+from .terminal_refund_query_sort import TerminalRefundQuerySortParams
+
+
+class TerminalRefundQueryParams(typing_extensions.TypedDict):
+ filter: typing_extensions.NotRequired[TerminalRefundQueryFilterParams]
+ """
+ The filter for the Terminal refund query.
+ """
+
+ sort: typing_extensions.NotRequired[TerminalRefundQuerySortParams]
+ """
+ The sort order for the Terminal refund query.
+ """
diff --git a/src/square/requests/terminal_refund_query_filter.py b/src/square/requests/terminal_refund_query_filter.py
new file mode 100644
index 00000000..496d531b
--- /dev/null
+++ b/src/square/requests/terminal_refund_query_filter.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .time_range import TimeRangeParams
+
+
+class TerminalRefundQueryFilterParams(typing_extensions.TypedDict):
+ device_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ `TerminalRefund` objects associated with a specific device. If no device is specified, then all
+ `TerminalRefund` objects for the signed-in account are displayed.
+ """
+
+ created_at: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ The timestamp for the beginning of the reporting period, in RFC 3339 format. Inclusive.
+ Default value: The current time minus one day.
+ Note that `TerminalRefund`s are available for 30 days after creation.
+ """
+
+ status: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Filtered results with the desired status of the `TerminalRefund`.
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`.
+ """
diff --git a/src/square/requests/terminal_refund_query_sort.py b/src/square/requests/terminal_refund_query_sort.py
new file mode 100644
index 00000000..0e70d903
--- /dev/null
+++ b/src/square/requests/terminal_refund_query_sort.py
@@ -0,0 +1,14 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class TerminalRefundQuerySortParams(typing_extensions.TypedDict):
+ sort_order: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The order in which results are listed.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+ """
diff --git a/src/square/requests/terminal_refund_updated_event.py b/src/square/requests/terminal_refund_updated_event.py
new file mode 100644
index 00000000..662a1f0f
--- /dev/null
+++ b/src/square/requests/terminal_refund_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_refund_updated_event_data import TerminalRefundUpdatedEventDataParams
+
+
+class TerminalRefundUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a Terminal API refund is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"terminal.refund.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing_extensions.NotRequired[TerminalRefundUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/terminal_refund_updated_event_data.py b/src/square/requests/terminal_refund_updated_event_data.py
new file mode 100644
index 00000000..8f9dc5b6
--- /dev/null
+++ b/src/square/requests/terminal_refund_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .terminal_refund_updated_event_object import TerminalRefundUpdatedEventObjectParams
+
+
+class TerminalRefundUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the updated object’s type, `"refund"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the updated terminal refund.
+ """
+
+ object: typing_extensions.NotRequired[TerminalRefundUpdatedEventObjectParams]
+ """
+ An object containing the updated terminal refund.
+ """
diff --git a/src/square/requests/terminal_refund_updated_event_object.py b/src/square/requests/terminal_refund_updated_event_object.py
new file mode 100644
index 00000000..e90ca1ba
--- /dev/null
+++ b/src/square/requests/terminal_refund_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .terminal_refund import TerminalRefundParams
+
+
+class TerminalRefundUpdatedEventObjectParams(typing_extensions.TypedDict):
+ refund: typing_extensions.NotRequired[TerminalRefundParams]
+ """
+ The updated terminal refund.
+ """
diff --git a/src/square/requests/test_webhook_subscription_response.py b/src/square/requests/test_webhook_subscription_response.py
new file mode 100644
index 00000000..6ecffec2
--- /dev/null
+++ b/src/square/requests/test_webhook_subscription_response.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription_test_result import SubscriptionTestResultParams
+
+
+class TestWebhookSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of a request to the TestWebhookSubscription endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ subscription_test_result: typing_extensions.NotRequired[SubscriptionTestResultParams]
+ """
+ The [SubscriptionTestResult](entity:SubscriptionTestResult).
+ """
+
+ notification_url: typing_extensions.NotRequired[str]
+ """
+ The URL that was used for the webhook notification test.
+ """
+
+ status_code: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ The HTTP status code returned by the notification URL.
+ """
+
+ passes_filter: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether the notification passed any configured filters.
+ """
+
+ payload: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Any]]]
+ """
+ The payload that was sent in the test notification.
+ """
diff --git a/src/square/requests/time_dimension.py b/src/square/requests/time_dimension.py
new file mode 100644
index 00000000..ca880bd3
--- /dev/null
+++ b/src/square/requests/time_dimension.py
@@ -0,0 +1,13 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..core.serialization import FieldMetadata
+from .time_dimension_date_range import TimeDimensionDateRangeParams
+
+
+class TimeDimensionParams(typing_extensions.TypedDict):
+ dimension: str
+ granularity: typing_extensions.NotRequired[str]
+ date_range: typing_extensions.NotRequired[
+ typing_extensions.Annotated[TimeDimensionDateRangeParams, FieldMetadata(alias="dateRange")]
+ ]
diff --git a/src/square/requests/time_dimension_date_range.py b/src/square/requests/time_dimension_date_range.py
new file mode 100644
index 00000000..a4e2a498
--- /dev/null
+++ b/src/square/requests/time_dimension_date_range.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TimeDimensionDateRangeParams = typing.Union[str, typing.Sequence[str], typing.Dict[str, typing.Any]]
diff --git a/src/square/requests/time_range.py b/src/square/requests/time_range.py
new file mode 100644
index 00000000..571e51d0
--- /dev/null
+++ b/src/square/requests/time_range.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class TimeRangeParams(typing_extensions.TypedDict):
+ """
+ Represents a generic time range. The start and end values are
+ represented in RFC 3339 format. Time ranges are customized to be
+ inclusive or exclusive based on the needs of a particular endpoint.
+ Refer to the relevant endpoint-specific documentation to determine
+ how time ranges are handled.
+ """
+
+ start_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A datetime value in RFC 3339 format indicating when the time range
+ starts.
+ """
+
+ end_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A datetime value in RFC 3339 format indicating when the time range
+ ends.
+ """
diff --git a/src/square/requests/timecard.py b/src/square/requests/timecard.py
new file mode 100644
index 00000000..eff6a27a
--- /dev/null
+++ b/src/square/requests/timecard.py
@@ -0,0 +1,92 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.timecard_status import TimecardStatus
+from .break_ import BreakParams
+from .money import MoneyParams
+from .timecard_wage import TimecardWageParams
+
+
+class TimecardParams(typing_extensions.TypedDict):
+ """
+ A record of the hourly rate, start time, and end time of a single timecard (shift)
+ for a team member. This might include a record of the start and end times of breaks
+ taken during the shift.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ **Read only** The Square-issued UUID for this object.
+ """
+
+ location_id: str
+ """
+ The ID of the [location](entity:Location) for this timecard. The location should be based on
+ where the team member clocked in.
+ """
+
+ timezone: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ **Read only** The time zone calculated from the location based on the `location_id`,
+ provided as a convenience value. Format: the IANA time zone database identifier for the
+ location time zone.
+ """
+
+ start_at: str
+ """
+ The start time of the timecard, in RFC 3339 format and shifted to the location
+ timezone + offset. Precision up to the minute is respected; seconds are truncated.
+ """
+
+ end_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The end time of the timecard, in RFC 3339 format and shifted to the location
+ timezone + offset. Precision up to the minute is respected; seconds are truncated.
+ """
+
+ wage: typing_extensions.NotRequired[TimecardWageParams]
+ """
+ Job and pay related information. If the wage is not set on create, it defaults to a wage
+ of zero. If the title is not set on create, it defaults to the name of the role the team member
+ is assigned to, if any.
+ """
+
+ breaks: typing_extensions.NotRequired[typing.Optional[typing.Sequence[BreakParams]]]
+ """
+ A list of all the paid or unpaid breaks that were taken during this timecard.
+ """
+
+ status: typing_extensions.NotRequired[TimecardStatus]
+ """
+ Describes the working state of the timecard.
+ See [TimecardStatus](#type-timecardstatus) for possible values
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ **Read only** The current version of the timecard, which is incremented with each update.
+ This field is used for [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control to ensure that requests don't overwrite data from another request.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the timecard was created, in RFC 3339 format presented as UTC.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the timecard was last updated, in RFC 3339 format presented as UTC.
+ """
+
+ team_member_id: str
+ """
+ The ID of the [team member](entity:TeamMember) this timecard belongs to.
+ """
+
+ declared_cash_tip_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The cash tips declared by the team member for this timecard.
+ """
diff --git a/src/square/requests/timecard_filter.py b/src/square/requests/timecard_filter.py
new file mode 100644
index 00000000..5e9fe2fb
--- /dev/null
+++ b/src/square/requests/timecard_filter.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.timecard_filter_status import TimecardFilterStatus
+from .time_range import TimeRangeParams
+from .timecard_workday import TimecardWorkdayParams
+
+
+class TimecardFilterParams(typing_extensions.TypedDict):
+ """
+ Defines a filter used in a search for `Timecard` records. `AND` logic is
+ used by Square's servers to apply each filter property specified.
+ """
+
+ location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Fetch timecards for the specified location.
+ """
+
+ status: typing_extensions.NotRequired[TimecardFilterStatus]
+ """
+ Fetch a `Timecard` instance by `Timecard.status`.
+ See [TimecardFilterStatus](#type-timecardfilterstatus) for possible values
+ """
+
+ start: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ Fetch `Timecard` instances that start in the time range - Inclusive.
+ """
+
+ end: typing_extensions.NotRequired[TimeRangeParams]
+ """
+ Fetch the `Timecard` instances that end in the time range - Inclusive.
+ """
+
+ workday: typing_extensions.NotRequired[TimecardWorkdayParams]
+ """
+ Fetch the `Timecard` instances based on the workday date range.
+ """
+
+ team_member_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Fetch timecards for the specified team members.
+ """
diff --git a/src/square/requests/timecard_query.py b/src/square/requests/timecard_query.py
new file mode 100644
index 00000000..b4f4ae40
--- /dev/null
+++ b/src/square/requests/timecard_query.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .timecard_filter import TimecardFilterParams
+from .timecard_sort import TimecardSortParams
+
+
+class TimecardQueryParams(typing_extensions.TypedDict):
+ """
+ The parameters of a `Timecard` search query, which includes filter and sort options.
+ """
+
+ filter: typing_extensions.NotRequired[TimecardFilterParams]
+ """
+ Query filter options.
+ """
+
+ sort: typing_extensions.NotRequired[TimecardSortParams]
+ """
+ Sort order details.
+ """
diff --git a/src/square/requests/timecard_sort.py b/src/square/requests/timecard_sort.py
new file mode 100644
index 00000000..7b1760d0
--- /dev/null
+++ b/src/square/requests/timecard_sort.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.sort_order import SortOrder
+from ..types.timecard_sort_field import TimecardSortField
+
+
+class TimecardSortParams(typing_extensions.TypedDict):
+ """
+ Sets the sort order of search results.
+ """
+
+ field: typing_extensions.NotRequired[TimecardSortField]
+ """
+ The field to sort on.
+ See [TimecardSortField](#type-timecardsortfield) for possible values
+ """
+
+ order: typing_extensions.NotRequired[SortOrder]
+ """
+ The order in which results are returned. Defaults to DESC.
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/timecard_wage.py b/src/square/requests/timecard_wage.py
new file mode 100644
index 00000000..366b04bd
--- /dev/null
+++ b/src/square/requests/timecard_wage.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class TimecardWageParams(typing_extensions.TypedDict):
+ """
+ The hourly wage rate used to compensate a team member for a [timecard](entity:Timecard).
+ """
+
+ title: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the job performed during this timecard.
+ """
+
+ hourly_rate: typing_extensions.NotRequired[MoneyParams]
+ """
+ Can be a custom-set hourly wage or the calculated effective hourly
+ wage based on the annual wage and hours worked per week.
+ """
+
+ job_id: typing_extensions.NotRequired[str]
+ """
+ The ID of the [job](entity:Job) performed for this timecard. Square
+ labor-reporting UIs might group timecards together by ID.
+ """
+
+ tip_eligible: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether team members are eligible for tips when working this job.
+ """
diff --git a/src/square/requests/timecard_workday.py b/src/square/requests/timecard_workday.py
new file mode 100644
index 00000000..81399569
--- /dev/null
+++ b/src/square/requests/timecard_workday.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.timecard_workday_matcher import TimecardWorkdayMatcher
+from .date_range import DateRangeParams
+
+
+class TimecardWorkdayParams(typing_extensions.TypedDict):
+ """
+ A `Timecard` search query filter parameter that sets a range of days that
+ a `Timecard` must start or end in before passing the filter condition.
+ """
+
+ date_range: typing_extensions.NotRequired[DateRangeParams]
+ """
+ Dates for fetching the timecards.
+ """
+
+ match_timecards_by: typing_extensions.NotRequired[TimecardWorkdayMatcher]
+ """
+ The strategy on which the dates are applied.
+ See [TimecardWorkdayMatcher](#type-timecardworkdaymatcher) for possible values
+ """
+
+ default_timezone: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Location-specific timezones convert workdays to datetime filters.
+ Every location included in the query must have a timezone or this field
+ must be provided as a fallback. Format: the IANA timezone database
+ identifier for the relevant timezone.
+ """
diff --git a/src/square/requests/tip_settings.py b/src/square/requests/tip_settings.py
new file mode 100644
index 00000000..1f858881
--- /dev/null
+++ b/src/square/requests/tip_settings.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class TipSettingsParams(typing_extensions.TypedDict):
+ allow_tipping: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether tipping is enabled for this checkout. Defaults to false.
+ """
+
+ separate_tip_screen: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether tip options should be presented on the screen before presenting
+ the signature screen during card payment. Defaults to false.
+ """
+
+ custom_tip_field: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether custom tip amounts are allowed during the checkout flow. Defaults to false.
+ """
+
+ tip_percentages: typing_extensions.NotRequired[typing.Optional[typing.Sequence[int]]]
+ """
+ A list of tip percentages that should be presented during the checkout flow, specified as
+ up to 3 non-negative integers from 0 to 100 (inclusive). Defaults to 15, 20, and 25.
+ """
+
+ smart_tipping: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Enables the "Smart Tip Amounts" behavior.
+ Exact tipping options depend on the region in which the Square seller is active.
+
+ For payments under 10.00, in the Australia, Canada, Ireland, United Kingdom, and United States, tipping options are presented as no tip, .50, 1.00 or 2.00.
+
+ For payment amounts of 10.00 or greater, tipping options are presented as the following percentages: 0%, 5%, 10%, 15%.
+
+ If set to true, the `tip_percentages` settings is ignored.
+ Defaults to false.
+
+ To learn more about smart tipping, see [Accept Tips with the Square App](https://squareup.com/help/us/en/article/5069-accept-tips-with-the-square-app).
+ """
diff --git a/src/square/requests/transaction.py b/src/square/requests/transaction.py
new file mode 100644
index 00000000..a851a4b1
--- /dev/null
+++ b/src/square/requests/transaction.py
@@ -0,0 +1,81 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.transaction_product import TransactionProduct
+from .address import AddressParams
+from .refund import RefundParams
+from .tender import TenderParams
+
+
+class TransactionParams(typing_extensions.TypedDict):
+ """
+ Represents a transaction processed with Square, either with the
+ Connect API or with Square Point of Sale.
+
+ The `tenders` field of this object lists all methods of payment used to pay in
+ the transaction.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The transaction's unique ID, issued by Square payments servers.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the transaction's associated location.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp for when the transaction was created, in RFC 3339 format.
+ """
+
+ tenders: typing_extensions.NotRequired[typing.Optional[typing.Sequence[TenderParams]]]
+ """
+ The tenders used to pay in the transaction.
+ """
+
+ refunds: typing_extensions.NotRequired[typing.Optional[typing.Sequence[RefundParams]]]
+ """
+ Refunds that have been applied to any tender in the transaction.
+ """
+
+ reference_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ If the transaction was created with the [Charge](api-endpoint:Transactions-Charge)
+ endpoint, this value is the same as the value provided for the `reference_id`
+ parameter in the request to that endpoint. Otherwise, it is not set.
+ """
+
+ product: typing_extensions.NotRequired[TransactionProduct]
+ """
+ The Square product that processed the transaction.
+ See [TransactionProduct](#type-transactionproduct) for possible values
+ """
+
+ client_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ If the transaction was created in the Square Point of Sale app, this value
+ is the ID generated for the transaction by Square Point of Sale.
+
+ This ID has no relationship to the transaction's canonical `id`, which is
+ generated by Square's backend servers. This value is generated for bookkeeping
+ purposes, in case the transaction cannot immediately be completed (for example,
+ if the transaction is processed in offline mode).
+
+ It is not currently possible with the Connect API to perform a transaction
+ lookup by this value.
+ """
+
+ shipping_address: typing_extensions.NotRequired[AddressParams]
+ """
+ The shipping address provided in the request, if any.
+ """
+
+ order_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The order_id is an identifier for the order associated with this transaction, if any.
+ """
diff --git a/src/square/requests/transfer_order.py b/src/square/requests/transfer_order.py
new file mode 100644
index 00000000..1f216f5c
--- /dev/null
+++ b/src/square/requests/transfer_order.py
@@ -0,0 +1,131 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.transfer_order_status import TransferOrderStatus
+from .transfer_order_line import TransferOrderLineParams
+
+
+class TransferOrderParams(typing_extensions.TypedDict):
+ """
+ Represents a transfer order for moving [CatalogItemVariation](entity:CatalogItemVariation)s
+ between [Location](entity:Location)s. Transfer orders track the entire lifecycle of an inventory
+ transfer, including:
+ - What items and quantities are being moved
+ - Source and destination locations
+ - Current [TransferOrderStatus](entity:TransferOrderStatus)
+ - Shipping information and tracking
+ - Which [TeamMember](entity:TeamMember) initiated the transfer
+
+ This object is commonly used to:
+ - Track [CatalogItemVariation](entity:CatalogItemVariation) movements between [Location](entity:Location)s
+ - Reconcile expected vs received quantities
+ - Monitor transfer progress and shipping status
+ - Audit inventory movement history
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ Unique system-generated identifier for this transfer order. Use this ID for:
+ - Retrieving transfer order details
+ - Tracking status changes via webhooks
+ - Linking transfers in external systems
+ """
+
+ source_location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The source [Location](entity:Location) sending the [CatalogItemVariation](entity:CatalogItemVariation)s.
+ This location must:
+ - Be active in your Square organization
+ - Have sufficient inventory for the items being transferred
+ - Not be the same as the destination location
+
+ This field is not updatable.
+ """
+
+ destination_location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The destination [Location](entity:Location) receiving the [CatalogItemVariation](entity:CatalogItemVariation)s.
+ This location must:
+ - Be active in your Square organization
+ - Not be the same as the source location
+
+ This field is not updatable.
+ """
+
+ status: typing_extensions.NotRequired[TransferOrderStatus]
+ """
+ Current [TransferOrderStatus](entity:TransferOrderStatus) indicating where the order is in its lifecycle.
+ Status transitions follow this progression:
+ 1. [DRAFT](entity:TransferOrderStatus) -> [STARTED](entity:TransferOrderStatus) via [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder)
+ 2. [STARTED](entity:TransferOrderStatus) -> [PARTIALLY_RECEIVED](entity:TransferOrderStatus) via [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder)
+ 3. [PARTIALLY_RECEIVED](entity:TransferOrderStatus) -> [COMPLETED](entity:TransferOrderStatus) after all items received
+
+ Orders can be [CANCELED](entity:TransferOrderStatus) from [STARTED](entity:TransferOrderStatus) or
+ [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status.
+
+ This field is read-only and reflects the current state of the transfer order, and cannot be updated directly. Use the appropriate
+ endpoints (e.g. [StartPurchaseOrder](api-endpoint:TransferOrders-StartTransferOrder), to change the status.
+ See [TransferOrderStatus](#type-transferorderstatus) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp when the transfer order was created, in RFC 3339 format.
+ Used for:
+ - Auditing transfer history
+ - Tracking order age
+ - Reporting and analytics
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp when the transfer order was last updated, in RFC 3339 format.
+ Updated when:
+ - Order status changes
+ - Items are received
+ - Notes or metadata are modified
+ """
+
+ expected_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Expected transfer completion date, in RFC 3339 format.
+ Used for:
+ - Planning inventory availability
+ - Scheduling receiving staff
+ - Monitoring transfer timeliness
+ """
+
+ completed_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp when the transfer order was completed or canceled, in RFC 3339 format (e.g. "2023-10-01T12:00:00Z").
+ """
+
+ notes: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Optional notes about the transfer.
+ """
+
+ tracking_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Shipment tracking number for monitoring transfer progress.
+ """
+
+ created_by_team_member_id: typing_extensions.NotRequired[str]
+ """
+ ID of the [TeamMember](entity:TeamMember) who created this transfer order. This field is not writeable by the Connect V2 API.
+ """
+
+ line_items: typing_extensions.NotRequired[typing.Optional[typing.Sequence[TransferOrderLineParams]]]
+ """
+ List of [CatalogItemVariation](entity:CatalogItemVariation)s being transferred.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ Version for optimistic concurrency control. This is a monotonically increasing integer
+ that changes whenever the transfer order is modified. Use this when calling
+ [UpdateTransferOrder](api-endpoint:TransferOrders-UpdateTransferOrder) and other endpoints to ensure you're
+ not overwriting concurrent changes.
+ """
diff --git a/src/square/requests/transfer_order_created_event.py b/src/square/requests/transfer_order_created_event.py
new file mode 100644
index 00000000..93dbb581
--- /dev/null
+++ b/src/square/requests/transfer_order_created_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .transfer_order_created_event_data import TransferOrderCreatedEventDataParams
+
+
+class TransferOrderCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a transfer_order is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"transfer_order.created"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[TransferOrderCreatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/transfer_order_created_event_data.py b/src/square/requests/transfer_order_created_event_data.py
new file mode 100644
index 00000000..88a23bcc
--- /dev/null
+++ b/src/square/requests/transfer_order_created_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .transfer_order_created_event_object import TransferOrderCreatedEventObjectParams
+
+
+class TransferOrderCreatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"transfer_order"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected transfer_order.
+ """
+
+ object: typing_extensions.NotRequired[TransferOrderCreatedEventObjectParams]
+ """
+ An object containing the created transfer_order.
+ """
diff --git a/src/square/requests/transfer_order_created_event_object.py b/src/square/requests/transfer_order_created_event_object.py
new file mode 100644
index 00000000..e0bf87f9
--- /dev/null
+++ b/src/square/requests/transfer_order_created_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .transfer_order import TransferOrderParams
+
+
+class TransferOrderCreatedEventObjectParams(typing_extensions.TypedDict):
+ transfer_order: typing_extensions.NotRequired[TransferOrderParams]
+ """
+ The created transfer_order.
+ """
diff --git a/src/square/requests/transfer_order_deleted_event.py b/src/square/requests/transfer_order_deleted_event.py
new file mode 100644
index 00000000..674de288
--- /dev/null
+++ b/src/square/requests/transfer_order_deleted_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .transfer_order_deleted_event_data import TransferOrderDeletedEventDataParams
+
+
+class TransferOrderDeletedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a transfer_order is deleted.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"transfer_order.deleted"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[TransferOrderDeletedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/transfer_order_deleted_event_data.py b/src/square/requests/transfer_order_deleted_event_data.py
new file mode 100644
index 00000000..7d278943
--- /dev/null
+++ b/src/square/requests/transfer_order_deleted_event_data.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class TransferOrderDeletedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"transfer_order"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected transfer_order.
+ """
+
+ deleted: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Is true if the affected object was deleted. Otherwise absent.
+ """
diff --git a/src/square/requests/transfer_order_filter.py b/src/square/requests/transfer_order_filter.py
new file mode 100644
index 00000000..74f68275
--- /dev/null
+++ b/src/square/requests/transfer_order_filter.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.transfer_order_status import TransferOrderStatus
+
+
+class TransferOrderFilterParams(typing_extensions.TypedDict):
+ """
+ Filter criteria for searching transfer orders
+ """
+
+ source_location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Filter by source location IDs
+ """
+
+ destination_location_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ Filter by destination location IDs
+ """
+
+ statuses: typing_extensions.NotRequired[typing.Optional[typing.Sequence[TransferOrderStatus]]]
+ """
+ Filter by order statuses
+ See [TransferOrderStatus](#type-transferorderstatus) for possible values
+ """
diff --git a/src/square/requests/transfer_order_goods_receipt.py b/src/square/requests/transfer_order_goods_receipt.py
new file mode 100644
index 00000000..5bd410cb
--- /dev/null
+++ b/src/square/requests/transfer_order_goods_receipt.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .transfer_order_goods_receipt_line_item import TransferOrderGoodsReceiptLineItemParams
+
+
+class TransferOrderGoodsReceiptParams(typing_extensions.TypedDict):
+ """
+ The goods receipt details for a transfer order. This object represents a single receipt
+ of goods against a transfer order, tracking:
+
+ - Which [CatalogItemVariation](entity:CatalogItemVariation)s were received
+ - Quantities received in good condition
+ - Quantities damaged during transit/handling
+ - Quantities canceled during receipt
+
+ Multiple goods receipts can be created for a single transfer order to handle:
+ - Partial deliveries
+ - Multiple shipments
+ - Split receipts across different dates
+ - Cancellations of specific quantities
+
+ Each receipt automatically:
+ - Updates the transfer order status
+ - Adjusts received quantities
+ - Updates inventory levels at both source and destination [Location](entity:Location)s
+ """
+
+ line_items: typing_extensions.NotRequired[typing.Optional[typing.Sequence[TransferOrderGoodsReceiptLineItemParams]]]
+ """
+ Line items being received. Each line item specifies:
+ - The item being received
+ - Quantity received in good condition
+ - Quantity received damaged
+ - Quantity canceled
+
+ Constraints:
+ - Must include at least one line item
+ - Maximum of 1000 line items per receipt
+ - Each line item must reference a valid item from the transfer order
+ - Total of received, damaged, and canceled quantities cannot exceed ordered quantity
+ """
diff --git a/src/square/requests/transfer_order_goods_receipt_line_item.py b/src/square/requests/transfer_order_goods_receipt_line_item.py
new file mode 100644
index 00000000..cb621d00
--- /dev/null
+++ b/src/square/requests/transfer_order_goods_receipt_line_item.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class TransferOrderGoodsReceiptLineItemParams(typing_extensions.TypedDict):
+ """
+ A simplified line item for goods receipts in transfer orders
+ """
+
+ transfer_order_line_uid: str
+ """
+ The unique identifier of the Transfer Order line being received
+ """
+
+ quantity_received: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The quantity received for this line item as a decimal string (e.g. "10.5").
+ These items will be added to the destination [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of IN_STOCK.
+ """
+
+ quantity_damaged: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The quantity that was damaged during shipping/handling as a decimal string (e.g. "1.5").
+ These items will be added to the destination [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of WASTE.
+ """
+
+ quantity_canceled: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The quantity that was canceled during shipping/handling as a decimal string (e.g. "1.5"). These will be immediately added to inventory in the source location.
+ """
diff --git a/src/square/requests/transfer_order_line.py b/src/square/requests/transfer_order_line.py
new file mode 100644
index 00000000..ef1b26f4
--- /dev/null
+++ b/src/square/requests/transfer_order_line.py
@@ -0,0 +1,57 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class TransferOrderLineParams(typing_extensions.TypedDict):
+ """
+ Represents a line item in a transfer order. Each line item tracks a specific
+ [CatalogItemVariation](entity:CatalogItemVariation) being transferred, including ordered quantities
+ and receipt status.
+ """
+
+ uid: typing_extensions.NotRequired[str]
+ """
+ Unique system-generated identifier for the line item. Provide when updating/removing a line via [UpdateTransferOrder](api-endpoint:TransferOrders-UpdateTransferOrder).
+ """
+
+ item_variation_id: str
+ """
+ The required identifier of the [CatalogItemVariation](entity:CatalogItemVariation) being transferred. Must reference
+ a valid catalog item variation that exists in the [Catalog](api:Catalog).
+ """
+
+ quantity_ordered: str
+ """
+ Total quantity ordered, formatted as a decimal string (e.g. "10 or 10.0000"). Required to be a positive number.
+
+ To remove a line item, set `remove` to `true` in [UpdateTransferOrder](api-endpoint:TransferOrders-UpdateTransferOrder).
+ """
+
+ quantity_pending: typing_extensions.NotRequired[str]
+ """
+ Calculated quantity of this line item's yet to be received stock. This is the difference between the total quantity ordered and the sum of quantities received, canceled, and damaged.
+ """
+
+ quantity_received: typing_extensions.NotRequired[str]
+ """
+ Quantity received at destination. These items are added to the destination
+ [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of IN_STOCK.
+
+ This field cannot be updated directly in Create/Update operations, instead use [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder).
+ """
+
+ quantity_damaged: typing_extensions.NotRequired[str]
+ """
+ Quantity received in damaged condition. These items are added to the destination
+ [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of WASTE.
+
+ This field cannot be updated directly in Create/Update operations, instead use [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder).
+ """
+
+ quantity_canceled: typing_extensions.NotRequired[str]
+ """
+ Quantity that was canceled. These items will be immediately added to inventory in the source location.
+
+ This field cannot be updated directly in Create/Update operations, instead use [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder) or [CancelTransferOrder](api-endpoint:TransferOrders-CancelTransferOrder).
+ """
diff --git a/src/square/requests/transfer_order_query.py b/src/square/requests/transfer_order_query.py
new file mode 100644
index 00000000..6a2dca84
--- /dev/null
+++ b/src/square/requests/transfer_order_query.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .transfer_order_filter import TransferOrderFilterParams
+from .transfer_order_sort import TransferOrderSortParams
+
+
+class TransferOrderQueryParams(typing_extensions.TypedDict):
+ """
+ Query parameters for searching transfer orders
+ """
+
+ filter: typing_extensions.NotRequired[TransferOrderFilterParams]
+ """
+ Filter criteria
+ """
+
+ sort: typing_extensions.NotRequired[TransferOrderSortParams]
+ """
+ Sort configuration
+ """
diff --git a/src/square/requests/transfer_order_sort.py b/src/square/requests/transfer_order_sort.py
new file mode 100644
index 00000000..8d5b5f37
--- /dev/null
+++ b/src/square/requests/transfer_order_sort.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.sort_order import SortOrder
+from ..types.transfer_order_sort_field import TransferOrderSortField
+
+
+class TransferOrderSortParams(typing_extensions.TypedDict):
+ """
+ Sort configuration for search results
+ """
+
+ field: typing_extensions.NotRequired[TransferOrderSortField]
+ """
+ Field to sort by
+ See [TransferOrderSortField](#type-transferordersortfield) for possible values
+ """
+
+ order: typing_extensions.NotRequired[SortOrder]
+ """
+ Sort order direction
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/transfer_order_updated_event.py b/src/square/requests/transfer_order_updated_event.py
new file mode 100644
index 00000000..b292c136
--- /dev/null
+++ b/src/square/requests/transfer_order_updated_event.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .transfer_order_updated_event_data import TransferOrderUpdatedEventDataParams
+
+
+class TransferOrderUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a transfer_order is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of event this represents, `"transfer_order.updated"`.
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing_extensions.NotRequired[TransferOrderUpdatedEventDataParams]
+ """
+ Data associated with the event.
+ """
diff --git a/src/square/requests/transfer_order_updated_event_data.py b/src/square/requests/transfer_order_updated_event_data.py
new file mode 100644
index 00000000..f28a8488
--- /dev/null
+++ b/src/square/requests/transfer_order_updated_event_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .transfer_order_updated_event_object import TransferOrderUpdatedEventObjectParams
+
+
+class TransferOrderUpdatedEventDataParams(typing_extensions.TypedDict):
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Name of the affected object’s type, `"transfer_order"`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ ID of the affected transfer_order.
+ """
+
+ object: typing_extensions.NotRequired[TransferOrderUpdatedEventObjectParams]
+ """
+ An object containing the updated transfer_order.
+ """
diff --git a/src/square/requests/transfer_order_updated_event_object.py b/src/square/requests/transfer_order_updated_event_object.py
new file mode 100644
index 00000000..e64de1f3
--- /dev/null
+++ b/src/square/requests/transfer_order_updated_event_object.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .transfer_order import TransferOrderParams
+
+
+class TransferOrderUpdatedEventObjectParams(typing_extensions.TypedDict):
+ transfer_order: typing_extensions.NotRequired[TransferOrderParams]
+ """
+ The updated transfer_order.
+ """
diff --git a/src/square/requests/unlink_customer_from_gift_card_response.py b/src/square/requests/unlink_customer_from_gift_card_response.py
new file mode 100644
index 00000000..b5b547a1
--- /dev/null
+++ b/src/square/requests/unlink_customer_from_gift_card_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .gift_card import GiftCardParams
+
+
+class UnlinkCustomerFromGiftCardResponseParams(typing_extensions.TypedDict):
+ """
+ A response that contains the unlinked `GiftCard` object. If the request resulted in errors,
+ the response contains a set of `Error` objects.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing_extensions.NotRequired[GiftCardParams]
+ """
+ The gift card with the ID of the unlinked customer removed from the `customer_ids` field.
+ If no other customers are linked, the `customer_ids` field is also removed.
+ """
diff --git a/src/square/requests/update_booking_custom_attribute_definition_response.py b/src/square/requests/update_booking_custom_attribute_definition_response.py
new file mode 100644
index 00000000..fcbf489b
--- /dev/null
+++ b/src/square/requests/update_booking_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class UpdateBookingCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [UpdateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-UpdateBookingCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The updated custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_booking_response.py b/src/square/requests/update_booking_response.py
new file mode 100644
index 00000000..6bc6b64c
--- /dev/null
+++ b/src/square/requests/update_booking_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .booking import BookingParams
+from .error import ErrorParams
+
+
+class UpdateBookingResponseParams(typing_extensions.TypedDict):
+ booking: typing_extensions.NotRequired[BookingParams]
+ """
+ The booking that was updated.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_break_type_response.py b/src/square/requests/update_break_type_response.py
new file mode 100644
index 00000000..b0469bf6
--- /dev/null
+++ b/src/square/requests/update_break_type_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .break_type import BreakTypeParams
+from .error import ErrorParams
+
+
+class UpdateBreakTypeResponseParams(typing_extensions.TypedDict):
+ """
+ A response to a request to update a `BreakType`. The response contains
+ the requested `BreakType` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ break_type: typing_extensions.NotRequired[BreakTypeParams]
+ """
+ The response object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_catalog_image_request.py b/src/square/requests/update_catalog_image_request.py
new file mode 100644
index 00000000..22452dc4
--- /dev/null
+++ b/src/square/requests/update_catalog_image_request.py
@@ -0,0 +1,13 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class UpdateCatalogImageRequestParams(typing_extensions.TypedDict):
+ idempotency_key: str
+ """
+ A unique string that identifies this UpdateCatalogImage request.
+ Keys can be any valid string but must be unique for every UpdateCatalogImage request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+ """
diff --git a/src/square/requests/update_catalog_image_response.py b/src/square/requests/update_catalog_image_response.py
new file mode 100644
index 00000000..12e4512f
--- /dev/null
+++ b/src/square/requests/update_catalog_image_response.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_object import CatalogObjectParams
+from .error import ErrorParams
+
+
+class UpdateCatalogImageResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ image: typing_extensions.NotRequired[CatalogObjectParams]
+ """
+ The newly updated `CatalogImage` including a Square-generated
+ URL for the encapsulated image file.
+ """
diff --git a/src/square/requests/update_customer_custom_attribute_definition_response.py b/src/square/requests/update_customer_custom_attribute_definition_response.py
new file mode 100644
index 00000000..166bbeba
--- /dev/null
+++ b/src/square/requests/update_customer_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class UpdateCustomerCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [UpdateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-UpdateCustomerCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The updated custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_customer_group_response.py b/src/square/requests/update_customer_group_response.py
new file mode 100644
index 00000000..536d4ee8
--- /dev/null
+++ b/src/square/requests/update_customer_group_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer_group import CustomerGroupParams
+from .error import ErrorParams
+
+
+class UpdateCustomerGroupResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [UpdateCustomerGroup](api-endpoint:CustomerGroups-UpdateCustomerGroup) endpoint.
+
+ Either `errors` or `group` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ group: typing_extensions.NotRequired[CustomerGroupParams]
+ """
+ The successfully updated customer group.
+ """
diff --git a/src/square/requests/update_customer_response.py b/src/square/requests/update_customer_response.py
new file mode 100644
index 00000000..327a31f6
--- /dev/null
+++ b/src/square/requests/update_customer_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .customer import CustomerParams
+from .error import ErrorParams
+
+
+class UpdateCustomerResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [UpdateCustomer](api-endpoint:Customers-UpdateCustomer) or
+ [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) endpoint.
+
+ Either `errors` or `customer` is present in a given response (never both).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ customer: typing_extensions.NotRequired[CustomerParams]
+ """
+ The updated customer.
+ """
diff --git a/src/square/requests/update_inventory_adjustment_reason_response.py b/src/square/requests/update_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..77a7fcb8
--- /dev/null
+++ b/src/square/requests/update_inventory_adjustment_reason_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class UpdateInventoryAdjustmentReasonResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [UpdateInventoryAdjustmentReason](api-endpoint:Inventory-UpdateInventoryAdjustmentReason).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing_extensions.NotRequired[InventoryAdjustmentReasonParams]
+ """
+ The successfully updated inventory adjustment reason.
+ """
diff --git a/src/square/requests/update_inventory_adjustment_response.py b/src/square/requests/update_inventory_adjustment_response.py
new file mode 100644
index 00000000..33e41bb7
--- /dev/null
+++ b/src/square/requests/update_inventory_adjustment_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment import InventoryAdjustmentParams
+
+
+class UpdateInventoryAdjustmentResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ adjustment: typing_extensions.NotRequired[InventoryAdjustmentParams]
+ """
+ The newly updated adjustment.
+ """
diff --git a/src/square/requests/update_invoice_response.py b/src/square/requests/update_invoice_response.py
new file mode 100644
index 00000000..1a1b0a46
--- /dev/null
+++ b/src/square/requests/update_invoice_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .invoice import InvoiceParams
+
+
+class UpdateInvoiceResponseParams(typing_extensions.TypedDict):
+ """
+ Describes a `UpdateInvoice` response.
+ """
+
+ invoice: typing_extensions.NotRequired[InvoiceParams]
+ """
+ The updated invoice.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
diff --git a/src/square/requests/update_item_modifier_lists_response.py b/src/square/requests/update_item_modifier_lists_response.py
new file mode 100644
index 00000000..483bd155
--- /dev/null
+++ b/src/square/requests/update_item_modifier_lists_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class UpdateItemModifierListsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The database [timestamp](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`.
+ """
diff --git a/src/square/requests/update_item_taxes_response.py b/src/square/requests/update_item_taxes_response.py
new file mode 100644
index 00000000..68f30735
--- /dev/null
+++ b/src/square/requests/update_item_taxes_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class UpdateItemTaxesResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`.
+ """
diff --git a/src/square/requests/update_job_response.py b/src/square/requests/update_job_response.py
new file mode 100644
index 00000000..0ed8f5a7
--- /dev/null
+++ b/src/square/requests/update_job_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .job import JobParams
+
+
+class UpdateJobResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [UpdateJob](api-endpoint:Team-UpdateJob) response. Either `job` or `errors`
+ is present in the response.
+ """
+
+ job: typing_extensions.NotRequired[JobParams]
+ """
+ The updated job.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_location_custom_attribute_definition_response.py b/src/square/requests/update_location_custom_attribute_definition_response.py
new file mode 100644
index 00000000..d048dafc
--- /dev/null
+++ b/src/square/requests/update_location_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class UpdateLocationCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [UpdateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-UpdateLocationCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The updated custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_location_response.py b/src/square/requests/update_location_response.py
new file mode 100644
index 00000000..39ea07e2
--- /dev/null
+++ b/src/square/requests/update_location_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .location import LocationParams
+
+
+class UpdateLocationResponseParams(typing_extensions.TypedDict):
+ """
+ The response object returned by the [UpdateLocation](api-endpoint:Locations-UpdateLocation) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information about errors encountered during the request.
+ """
+
+ location: typing_extensions.NotRequired[LocationParams]
+ """
+ The updated `Location` object.
+ """
diff --git a/src/square/requests/update_location_settings_response.py b/src/square/requests/update_location_settings_response.py
new file mode 100644
index 00000000..1baec76f
--- /dev/null
+++ b/src/square/requests/update_location_settings_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .checkout_location_settings import CheckoutLocationSettingsParams
+from .error import ErrorParams
+
+
+class UpdateLocationSettingsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred when updating the location settings.
+ """
+
+ location_settings: typing_extensions.NotRequired[CheckoutLocationSettingsParams]
+ """
+ The updated location settings.
+ """
diff --git a/src/square/requests/update_merchant_custom_attribute_definition_response.py b/src/square/requests/update_merchant_custom_attribute_definition_response.py
new file mode 100644
index 00000000..2496b814
--- /dev/null
+++ b/src/square/requests/update_merchant_custom_attribute_definition_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class UpdateMerchantCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [UpdateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-UpdateMerchantCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The updated custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_merchant_settings_response.py b/src/square/requests/update_merchant_settings_response.py
new file mode 100644
index 00000000..c01e2473
--- /dev/null
+++ b/src/square/requests/update_merchant_settings_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .checkout_merchant_settings import CheckoutMerchantSettingsParams
+from .error import ErrorParams
+
+
+class UpdateMerchantSettingsResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred when updating the merchant settings.
+ """
+
+ merchant_settings: typing_extensions.NotRequired[CheckoutMerchantSettingsParams]
+ """
+ The updated merchant settings.
+ """
diff --git a/src/square/requests/update_order_custom_attribute_definition_response.py b/src/square/requests/update_order_custom_attribute_definition_response.py
new file mode 100644
index 00000000..4f017ce9
--- /dev/null
+++ b/src/square/requests/update_order_custom_attribute_definition_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute_definition import CustomAttributeDefinitionParams
+from .error import ErrorParams
+
+
+class UpdateOrderCustomAttributeDefinitionResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from updating an order custom attribute definition.
+ """
+
+ custom_attribute_definition: typing_extensions.NotRequired[CustomAttributeDefinitionParams]
+ """
+ The updated order custom attribute definition.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_order_response.py b/src/square/requests/update_order_response.py
new file mode 100644
index 00000000..5de4049a
--- /dev/null
+++ b/src/square/requests/update_order_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .order import OrderParams
+
+
+class UpdateOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint.
+ """
+
+ order: typing_extensions.NotRequired[OrderParams]
+ """
+ The updated order.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_payment_link_response.py b/src/square/requests/update_payment_link_response.py
new file mode 100644
index 00000000..cca78889
--- /dev/null
+++ b/src/square/requests/update_payment_link_response.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment_link import PaymentLinkParams
+
+
+class UpdatePaymentLinkResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred when updating the payment link.
+ """
+
+ payment_link: typing_extensions.NotRequired[PaymentLinkParams]
+ """
+ The updated payment link.
+ """
diff --git a/src/square/requests/update_payment_response.py b/src/square/requests/update_payment_response.py
new file mode 100644
index 00000000..9f2e2a02
--- /dev/null
+++ b/src/square/requests/update_payment_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .payment import PaymentParams
+
+
+class UpdatePaymentResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the response returned by
+ [UpdatePayment](api-endpoint:Payments-UpdatePayment).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ payment: typing_extensions.NotRequired[PaymentParams]
+ """
+ The updated payment.
+ """
diff --git a/src/square/requests/update_scheduled_shift_response.py b/src/square/requests/update_scheduled_shift_response.py
new file mode 100644
index 00000000..654f2df2
--- /dev/null
+++ b/src/square/requests/update_scheduled_shift_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .scheduled_shift import ScheduledShiftParams
+
+
+class UpdateScheduledShiftResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [UpdateScheduledShift](api-endpoint:Labor-UpdateScheduledShift) response.
+ Either `scheduled_shift` or `errors` is present in the response.
+ """
+
+ scheduled_shift: typing_extensions.NotRequired[ScheduledShiftParams]
+ """
+ The updated scheduled shift. To make the changes public, call
+ [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) or
+ [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_shift_response.py b/src/square/requests/update_shift_response.py
new file mode 100644
index 00000000..190b0a10
--- /dev/null
+++ b/src/square/requests/update_shift_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .shift import ShiftParams
+
+
+class UpdateShiftResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request to update a `Shift`. The response contains
+ the updated `Shift` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ shift: typing_extensions.NotRequired[ShiftParams]
+ """
+ The updated `Shift`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_subscription_response.py b/src/square/requests/update_subscription_response.py
new file mode 100644
index 00000000..522752d5
--- /dev/null
+++ b/src/square/requests/update_subscription_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .subscription import SubscriptionParams
+
+
+class UpdateSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines output parameters in a response from the
+ [UpdateSubscription](api-endpoint:Subscriptions-UpdateSubscription) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[SubscriptionParams]
+ """
+ The updated subscription.
+ """
diff --git a/src/square/requests/update_team_member_request.py b/src/square/requests/update_team_member_request.py
new file mode 100644
index 00000000..ad652136
--- /dev/null
+++ b/src/square/requests/update_team_member_request.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from .team_member import TeamMemberParams
+
+
+class UpdateTeamMemberRequestParams(typing_extensions.TypedDict):
+ """
+ Represents an update request for a `TeamMember` object.
+ """
+
+ team_member: typing_extensions.NotRequired[TeamMemberParams]
+ """
+ The team member fields to add, change, or clear. Fields can be cleared using a null value. To update
+ `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed, call
+ [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
+ """
diff --git a/src/square/requests/update_team_member_response.py b/src/square/requests/update_team_member_response.py
new file mode 100644
index 00000000..72d8dc36
--- /dev/null
+++ b/src/square/requests/update_team_member_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .team_member import TeamMemberParams
+
+
+class UpdateTeamMemberResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from an update request containing the updated `TeamMember` object or error messages.
+ """
+
+ team_member: typing_extensions.NotRequired[TeamMemberParams]
+ """
+ The successfully updated `TeamMember` object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_timecard_response.py b/src/square/requests/update_timecard_response.py
new file mode 100644
index 00000000..313a6ab2
--- /dev/null
+++ b/src/square/requests/update_timecard_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .timecard import TimecardParams
+
+
+class UpdateTimecardResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request to update a `Timecard`. The response contains
+ the updated `Timecard` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ timecard: typing_extensions.NotRequired[TimecardParams]
+ """
+ The updated `Timecard`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_transfer_order_data.py b/src/square/requests/update_transfer_order_data.py
new file mode 100644
index 00000000..c16f8b15
--- /dev/null
+++ b/src/square/requests/update_transfer_order_data.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .update_transfer_order_line_data import UpdateTransferOrderLineDataParams
+
+
+class UpdateTransferOrderDataParams(typing_extensions.TypedDict):
+ """
+ Data model for updating a transfer order. All fields are optional.
+ """
+
+ source_location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The source [Location](entity:Location) that will send the items. Must be an active location
+ in your Square account with sufficient inventory of the requested items.
+ """
+
+ destination_location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The destination [Location](entity:Location) that will receive the items. Must be an active location
+ in your Square account.
+ """
+
+ expected_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Expected transfer date in RFC 3339 format (e.g. "2023-10-01T12:00:00Z").
+ """
+
+ notes: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Optional notes about the transfer
+ """
+
+ tracking_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Shipment tracking number
+ """
+
+ line_items: typing_extensions.NotRequired[typing.Optional[typing.Sequence[UpdateTransferOrderLineDataParams]]]
+ """
+ List of items being transferred
+ """
diff --git a/src/square/requests/update_transfer_order_line_data.py b/src/square/requests/update_transfer_order_line_data.py
new file mode 100644
index 00000000..ce5982df
--- /dev/null
+++ b/src/square/requests/update_transfer_order_line_data.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class UpdateTransferOrderLineDataParams(typing_extensions.TypedDict):
+ """
+ Represents a line item update in a transfer order
+ """
+
+ uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Line item id being updated. Required for updating/removing existing line items, but should not be set for new line items.
+ """
+
+ item_variation_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Catalog item variation being transferred
+
+ Required for new line items, but otherwise is not updatable.
+ """
+
+ quantity_ordered: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Total quantity ordered
+ """
+
+ remove: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Flag to remove the line item during update. Must include `uid` in removal request
+ """
diff --git a/src/square/requests/update_transfer_order_response.py b/src/square/requests/update_transfer_order_response.py
new file mode 100644
index 00000000..cff2fe53
--- /dev/null
+++ b/src/square/requests/update_transfer_order_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .transfer_order import TransferOrderParams
+
+
+class UpdateTransferOrderResponseParams(typing_extensions.TypedDict):
+ """
+ Response for updating a transfer order
+ """
+
+ transfer_order: typing_extensions.NotRequired[TransferOrderParams]
+ """
+ The updated transfer order
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request
+ """
diff --git a/src/square/requests/update_vendor_request.py b/src/square/requests/update_vendor_request.py
new file mode 100644
index 00000000..04176e0c
--- /dev/null
+++ b/src/square/requests/update_vendor_request.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .vendor import VendorParams
+
+
+class UpdateVendorRequestParams(typing_extensions.TypedDict):
+ """
+ Represents an input to a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor).
+ """
+
+ idempotency_key: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+ """
+
+ vendor: VendorParams
+ """
+ The specified [Vendor](entity:Vendor) to be updated.
+ """
diff --git a/src/square/requests/update_vendor_response.py b/src/square/requests/update_vendor_response.py
new file mode 100644
index 00000000..05805b99
--- /dev/null
+++ b/src/square/requests/update_vendor_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .vendor import VendorParams
+
+
+class UpdateVendorResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors occurred when the request fails.
+ """
+
+ vendor: typing_extensions.NotRequired[VendorParams]
+ """
+ The [Vendor](entity:Vendor) that has been updated.
+ """
diff --git a/src/square/requests/update_wage_setting_response.py b/src/square/requests/update_wage_setting_response.py
new file mode 100644
index 00000000..401d762c
--- /dev/null
+++ b/src/square/requests/update_wage_setting_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .wage_setting import WageSettingParams
+
+
+class UpdateWageSettingResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from an update request containing the updated `WageSetting` object
+ or error messages.
+ """
+
+ wage_setting: typing_extensions.NotRequired[WageSettingParams]
+ """
+ The successfully updated `WageSetting` object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ The errors that occurred during the request.
+ """
diff --git a/src/square/requests/update_webhook_subscription_response.py b/src/square/requests/update_webhook_subscription_response.py
new file mode 100644
index 00000000..179c0804
--- /dev/null
+++ b/src/square/requests/update_webhook_subscription_response.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .webhook_subscription import WebhookSubscriptionParams
+
+
+class UpdateWebhookSubscriptionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [UpdateWebhookSubscription](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscription) endpoint.
+
+ Note: If there are errors processing the request, the [Subscription](entity:WebhookSubscription) is not
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ subscription: typing_extensions.NotRequired[WebhookSubscriptionParams]
+ """
+ The updated [Subscription](entity:WebhookSubscription).
+ """
diff --git a/src/square/requests/update_webhook_subscription_signature_key_response.py b/src/square/requests/update_webhook_subscription_signature_key_response.py
new file mode 100644
index 00000000..7d1293a1
--- /dev/null
+++ b/src/square/requests/update_webhook_subscription_signature_key_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class UpdateWebhookSubscriptionSignatureKeyResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) endpoint.
+
+ Note: If there are errors processing the request, the [Subscription](entity:WebhookSubscription) is not
+ present.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Information on errors encountered during the request.
+ """
+
+ signature_key: typing_extensions.NotRequired[str]
+ """
+ The new Square-generated signature key used to validate the origin of the webhook event.
+ """
diff --git a/src/square/requests/update_workweek_config_response.py b/src/square/requests/update_workweek_config_response.py
new file mode 100644
index 00000000..fab22faa
--- /dev/null
+++ b/src/square/requests/update_workweek_config_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .workweek_config import WorkweekConfigParams
+
+
+class UpdateWorkweekConfigResponseParams(typing_extensions.TypedDict):
+ """
+ The response to a request to update a `WorkweekConfig` object. The response contains
+ the updated `WorkweekConfig` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ workweek_config: typing_extensions.NotRequired[WorkweekConfigParams]
+ """
+ The response object.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/upsert_booking_custom_attribute_response.py b/src/square/requests/upsert_booking_custom_attribute_response.py
new file mode 100644
index 00000000..2dd695c3
--- /dev/null
+++ b/src/square/requests/upsert_booking_custom_attribute_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class UpsertBookingCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [UpsertBookingCustomAttribute](api-endpoint:BookingCustomAttributes-UpsertBookingCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/upsert_catalog_object_response.py b/src/square/requests/upsert_catalog_object_response.py
new file mode 100644
index 00000000..67111f36
--- /dev/null
+++ b/src/square/requests/upsert_catalog_object_response.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .catalog_id_mapping import CatalogIdMappingParams
+from .catalog_object import CatalogObjectParams
+from .error import ErrorParams
+
+
+class UpsertCatalogObjectResponseParams(typing_extensions.TypedDict):
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ catalog_object: typing_extensions.NotRequired[CatalogObjectParams]
+ """
+ The successfully created or updated CatalogObject.
+ """
+
+ id_mappings: typing_extensions.NotRequired[typing.Sequence[CatalogIdMappingParams]]
+ """
+ The mapping between client and server IDs for this upsert.
+ """
diff --git a/src/square/requests/upsert_customer_custom_attribute_response.py b/src/square/requests/upsert_customer_custom_attribute_response.py
new file mode 100644
index 00000000..bd1002f7
--- /dev/null
+++ b/src/square/requests/upsert_customer_custom_attribute_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class UpsertCustomerCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/upsert_location_custom_attribute_response.py b/src/square/requests/upsert_location_custom_attribute_response.py
new file mode 100644
index 00000000..0426d562
--- /dev/null
+++ b/src/square/requests/upsert_location_custom_attribute_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class UpsertLocationCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/upsert_merchant_custom_attribute_response.py b/src/square/requests/upsert_merchant_custom_attribute_response.py
new file mode 100644
index 00000000..e747c16a
--- /dev/null
+++ b/src/square/requests/upsert_merchant_custom_attribute_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class UpsertMerchantCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/upsert_order_custom_attribute_response.py b/src/square/requests/upsert_order_custom_attribute_response.py
new file mode 100644
index 00000000..820cfe5f
--- /dev/null
+++ b/src/square/requests/upsert_order_custom_attribute_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .custom_attribute import CustomAttributeParams
+from .error import ErrorParams
+
+
+class UpsertOrderCustomAttributeResponseParams(typing_extensions.TypedDict):
+ """
+ Represents a response from upserting order custom attribute definitions.
+ """
+
+ custom_attribute: typing_extensions.NotRequired[CustomAttributeParams]
+ """
+ The order custom attribute that was created or modified.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/upsert_snippet_response.py b/src/square/requests/upsert_snippet_response.py
new file mode 100644
index 00000000..6921aa03
--- /dev/null
+++ b/src/square/requests/upsert_snippet_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .snippet import SnippetParams
+
+
+class UpsertSnippetResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an `UpsertSnippet` response. The response can include either `snippet` or `errors`.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ snippet: typing_extensions.NotRequired[SnippetParams]
+ """
+ The new or updated snippet.
+ """
diff --git a/src/square/requests/v1money.py b/src/square/requests/v1money.py
new file mode 100644
index 00000000..0e4fa4c2
--- /dev/null
+++ b/src/square/requests/v1money.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.currency import Currency
+
+
+class V1MoneyParams(typing_extensions.TypedDict):
+ amount: typing_extensions.NotRequired[typing.Optional[int]]
+ """
+ Amount in the lowest denominated value of this Currency. E.g. in USD
+ these are cents, in JPY they are Yen (which do not have a 'cent' concept).
+ """
+
+ currency_code: typing_extensions.NotRequired[Currency]
+ """
+
+ See [Currency](#type-currency) for possible values
+ """
diff --git a/src/square/requests/v1order.py b/src/square/requests/v1order.py
new file mode 100644
index 00000000..020a1b93
--- /dev/null
+++ b/src/square/requests/v1order.py
@@ -0,0 +1,143 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.v1order_state import V1OrderState
+from .address import AddressParams
+from .error import ErrorParams
+from .v1money import V1MoneyParams
+from .v1order_history_entry import V1OrderHistoryEntryParams
+from .v1tender import V1TenderParams
+
+
+class V1OrderParams(typing_extensions.TypedDict):
+ """
+ V1Order
+ """
+
+ errors: typing_extensions.NotRequired[typing.Optional[typing.Sequence[ErrorParams]]]
+ """
+ Any errors that occurred during the request.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The order's unique identifier.
+ """
+
+ buyer_email: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The email address of the order's buyer.
+ """
+
+ recipient_name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the order's buyer.
+ """
+
+ recipient_phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The phone number to use for the order's delivery.
+ """
+
+ state: typing_extensions.NotRequired[V1OrderState]
+ """
+ Whether the tax is an ADDITIVE tax or an INCLUSIVE tax.
+ See [V1OrderState](#type-v1orderstate) for possible values
+ """
+
+ shipping_address: typing_extensions.NotRequired[AddressParams]
+ """
+ The address to ship the order to.
+ """
+
+ subtotal_money: typing_extensions.NotRequired[V1MoneyParams]
+ """
+ The amount of all items purchased in the order, before taxes and shipping.
+ """
+
+ total_shipping_money: typing_extensions.NotRequired[V1MoneyParams]
+ """
+ The shipping cost for the order.
+ """
+
+ total_tax_money: typing_extensions.NotRequired[V1MoneyParams]
+ """
+ The total of all taxes applied to the order.
+ """
+
+ total_price_money: typing_extensions.NotRequired[V1MoneyParams]
+ """
+ The total cost of the order.
+ """
+
+ total_discount_money: typing_extensions.NotRequired[V1MoneyParams]
+ """
+ The total of all discounts applied to the order.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The time when the order was created, in ISO 8601 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The time when the order was last modified, in ISO 8601 format.
+ """
+
+ expires_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The time when the order expires if no action is taken, in ISO 8601 format.
+ """
+
+ payment_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The unique identifier of the payment associated with the order.
+ """
+
+ buyer_note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note provided by the buyer when the order was created, if any.
+ """
+
+ completed_note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note provided by the merchant when the order's state was set to COMPLETED, if any
+ """
+
+ refunded_note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note provided by the merchant when the order's state was set to REFUNDED, if any.
+ """
+
+ canceled_note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note provided by the merchant when the order's state was set to CANCELED, if any.
+ """
+
+ tender: typing_extensions.NotRequired[V1TenderParams]
+ """
+ The tender used to pay for the order.
+ """
+
+ order_history: typing_extensions.NotRequired[typing.Optional[typing.Sequence[V1OrderHistoryEntryParams]]]
+ """
+ The history of actions associated with the order.
+ """
+
+ promo_code: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The promo code provided by the buyer, if any.
+ """
+
+ btc_receive_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ For Bitcoin transactions, the address that the buyer sent Bitcoin to.
+ """
+
+ btc_price_satoshi: typing_extensions.NotRequired[typing.Optional[float]]
+ """
+ For Bitcoin transactions, the price of the buyer's order in satoshi (100 million satoshi equals 1 BTC).
+ """
diff --git a/src/square/requests/v1order_history_entry.py b/src/square/requests/v1order_history_entry.py
new file mode 100644
index 00000000..a4ffb99c
--- /dev/null
+++ b/src/square/requests/v1order_history_entry.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.v1order_history_entry_action import V1OrderHistoryEntryAction
+
+
+class V1OrderHistoryEntryParams(typing_extensions.TypedDict):
+ """
+ V1OrderHistoryEntry
+ """
+
+ action: typing_extensions.NotRequired[V1OrderHistoryEntryAction]
+ """
+ The type of action performed on the order.
+ See [V1OrderHistoryEntryAction](#type-v1orderhistoryentryaction) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The time when the action was performed, in ISO 8601 format.
+ """
diff --git a/src/square/requests/v1tender.py b/src/square/requests/v1tender.py
new file mode 100644
index 00000000..2a45fe0c
--- /dev/null
+++ b/src/square/requests/v1tender.py
@@ -0,0 +1,119 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.v1tender_card_brand import V1TenderCardBrand
+from ..types.v1tender_entry_method import V1TenderEntryMethod
+from ..types.v1tender_type import V1TenderType
+from .v1money import V1MoneyParams
+
+
+class V1TenderParams(typing_extensions.TypedDict):
+ """
+ A tender represents a discrete monetary exchange. Square represents this
+ exchange as a money object with a specific currency and amount, where the
+ amount is given in the smallest denomination of the given currency.
+
+ Square POS can accept more than one form of tender for a single payment (such
+ as by splitting a bill between a credit card and a gift card). The `tender`
+ field of the Payment object lists all forms of tender used for the payment.
+
+ Split tender payments behave slightly differently from single tender payments:
+
+ The receipt_url for a split tender corresponds only to the first tender listed
+ in the tender field. To get the receipt URLs for the remaining tenders, use
+ the receipt_url fields of the corresponding Tender objects.
+
+ *A note on gift cards**: when a customer purchases a Square gift card from a
+ merchant, the merchant receives the full amount of the gift card in the
+ associated payment.
+
+ When that gift card is used as a tender, the balance of the gift card is
+ reduced and the merchant receives no funds. A `Tender` object with a type of
+ `SQUARE_GIFT_CARD` indicates a gift card was used for some or all of the
+ associated payment.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The tender's unique ID.
+ """
+
+ type: typing_extensions.NotRequired[V1TenderType]
+ """
+ The type of tender.
+ See [V1TenderType](#type-v1tendertype) for possible values
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A human-readable description of the tender.
+ """
+
+ employee_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the employee that processed the tender.
+ """
+
+ receipt_url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The URL of the receipt for the tender.
+ """
+
+ card_brand: typing_extensions.NotRequired[V1TenderCardBrand]
+ """
+ The brand of credit card provided.
+ See [V1TenderCardBrand](#type-v1tendercardbrand) for possible values
+ """
+
+ pan_suffix: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The last four digits of the provided credit card's account number.
+ """
+
+ entry_method: typing_extensions.NotRequired[V1TenderEntryMethod]
+ """
+ The tender's unique ID.
+ See [V1TenderEntryMethod](#type-v1tenderentrymethod) for possible values
+ """
+
+ payment_note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Notes entered by the merchant about the tender at the time of payment, if any. Typically only present for tender with the type: OTHER.
+ """
+
+ total_money: typing_extensions.NotRequired[V1MoneyParams]
+ """
+ The total amount of money provided in this form of tender.
+ """
+
+ tendered_money: typing_extensions.NotRequired[V1MoneyParams]
+ """
+ The amount of total_money applied to the payment.
+ """
+
+ tendered_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The time when the tender was created, in ISO 8601 format.
+ """
+
+ settled_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The time when the tender was settled, in ISO 8601 format.
+ """
+
+ change_back_money: typing_extensions.NotRequired[V1MoneyParams]
+ """
+ The amount of total_money returned to the buyer as change.
+ """
+
+ refunded_money: typing_extensions.NotRequired[V1MoneyParams]
+ """
+ The total of all refunds applied to this tender. This amount is always negative or zero.
+ """
+
+ is_exchange: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether or not the tender is associated with an exchange. If is_exchange is true, the tender represents the value of goods returned in an exchange not the actual money paid. The exchange value reduces the tender amounts needed to pay for items purchased in the exchange.
+ """
diff --git a/src/square/requests/vendor.py b/src/square/requests/vendor.py
new file mode 100644
index 00000000..bbb1247f
--- /dev/null
+++ b/src/square/requests/vendor.py
@@ -0,0 +1,69 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.vendor_status import VendorStatus
+from .address import AddressParams
+from .vendor_contact import VendorContactParams
+
+
+class VendorParams(typing_extensions.TypedDict):
+ """
+ Represents a supplier to a seller.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique Square-generated ID for the [Vendor](entity:Vendor).
+ This field is required when attempting to update a [Vendor](entity:Vendor).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ An RFC 3339-formatted timestamp that indicates when the
+ [Vendor](entity:Vendor) was created.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ An RFC 3339-formatted timestamp that indicates when the
+ [Vendor](entity:Vendor) was last updated.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the [Vendor](entity:Vendor).
+ This field is required when attempting to create or update a [Vendor](entity:Vendor).
+ """
+
+ address: typing_extensions.NotRequired[AddressParams]
+ """
+ The address of the [Vendor](entity:Vendor).
+ """
+
+ contacts: typing_extensions.NotRequired[typing.Optional[typing.Sequence[VendorContactParams]]]
+ """
+ The contacts of the [Vendor](entity:Vendor).
+ """
+
+ account_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The account number of the [Vendor](entity:Vendor).
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note detailing information about the [Vendor](entity:Vendor).
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ The version of the [Vendor](entity:Vendor).
+ """
+
+ status: typing_extensions.NotRequired[VendorStatus]
+ """
+ The status of the [Vendor](entity:Vendor).
+ See [Status](#type-status) for possible values
+ """
diff --git a/src/square/requests/vendor_contact.py b/src/square/requests/vendor_contact.py
new file mode 100644
index 00000000..c7cf2d65
--- /dev/null
+++ b/src/square/requests/vendor_contact.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class VendorContactParams(typing_extensions.TypedDict):
+ """
+ Represents a contact of a [Vendor](entity:Vendor).
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A unique Square-generated ID for the [VendorContact](entity:VendorContact).
+ This field is required when attempting to update a [VendorContact](entity:VendorContact).
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of the [VendorContact](entity:VendorContact).
+ This field is required when attempting to create a [Vendor](entity:Vendor).
+ """
+
+ email_address: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The email address of the [VendorContact](entity:VendorContact).
+ """
+
+ phone_number: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The phone number of the [VendorContact](entity:VendorContact).
+ """
+
+ removed: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ The state of the [VendorContact](entity:VendorContact).
+ """
+
+ ordinal: int
+ """
+ The ordinal of the [VendorContact](entity:VendorContact).
+ """
diff --git a/src/square/requests/vendor_created_event.py b/src/square/requests/vendor_created_event.py
new file mode 100644
index 00000000..d441df10
--- /dev/null
+++ b/src/square/requests/vendor_created_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .vendor_created_event_data import VendorCreatedEventDataParams
+
+
+class VendorCreatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Vendor](entity:Vendor) is created.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of a seller associated with this event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of a location associated with the event, if the event is associated with the location of the seller.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"vendor.created".`
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for this event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The RFC 3339-formatted time when the underlying event data object is created.
+ """
+
+ data: typing_extensions.NotRequired[VendorCreatedEventDataParams]
+ """
+ The data associated with this event.
+ """
diff --git a/src/square/requests/vendor_created_event_data.py b/src/square/requests/vendor_created_event_data.py
new file mode 100644
index 00000000..b75b8fe6
--- /dev/null
+++ b/src/square/requests/vendor_created_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .vendor_created_event_object import VendorCreatedEventObjectParams
+
+
+class VendorCreatedEventDataParams(typing_extensions.TypedDict):
+ """
+ Defines the `vendor.created` event data structure.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `vendor`
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[VendorCreatedEventObjectParams]
+ """
+ An object containing the created vendor.
+ """
diff --git a/src/square/requests/vendor_created_event_object.py b/src/square/requests/vendor_created_event_object.py
new file mode 100644
index 00000000..0c72b421
--- /dev/null
+++ b/src/square/requests/vendor_created_event_object.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.vendor_created_event_object_operation import VendorCreatedEventObjectOperation
+from .vendor import VendorParams
+
+
+class VendorCreatedEventObjectParams(typing_extensions.TypedDict):
+ operation: typing_extensions.NotRequired[VendorCreatedEventObjectOperation]
+ """
+ The operation on the vendor that caused the event to be published. The value is `CREATED`.
+ See [Operation](#type-operation) for possible values
+ """
+
+ vendor: typing_extensions.NotRequired[VendorParams]
+ """
+ The created vendor as the result of the specified operation.
+ """
diff --git a/src/square/requests/vendor_updated_event.py b/src/square/requests/vendor_updated_event.py
new file mode 100644
index 00000000..0c33d282
--- /dev/null
+++ b/src/square/requests/vendor_updated_event.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .vendor_updated_event_data import VendorUpdatedEventDataParams
+
+
+class VendorUpdatedEventParams(typing_extensions.TypedDict):
+ """
+ Published when a [Vendor](entity:Vendor) is updated.
+ """
+
+ merchant_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of a seller associated with this event.
+ """
+
+ location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of a seller location associated with this event, if the event is associated with the location.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of this event. The value is `"vendor.updated".`
+ """
+
+ event_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A unique ID for this webhoook event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The RFC 3339-formatted time when the underlying event data object is created.
+ """
+
+ data: typing_extensions.NotRequired[VendorUpdatedEventDataParams]
+ """
+ The data associated with this event.
+ """
diff --git a/src/square/requests/vendor_updated_event_data.py b/src/square/requests/vendor_updated_event_data.py
new file mode 100644
index 00000000..5ee1813f
--- /dev/null
+++ b/src/square/requests/vendor_updated_event_data.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .vendor_updated_event_object import VendorUpdatedEventObjectParams
+
+
+class VendorUpdatedEventDataParams(typing_extensions.TypedDict):
+ """
+ Defines the `vendor.updated` event data structure.
+ """
+
+ type: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The type of the event data object. The value is `vendor`.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The ID of the event data object.
+ """
+
+ object: typing_extensions.NotRequired[VendorUpdatedEventObjectParams]
+ """
+ An object containing updated vendor.
+ """
diff --git a/src/square/requests/vendor_updated_event_object.py b/src/square/requests/vendor_updated_event_object.py
new file mode 100644
index 00000000..e5daa87e
--- /dev/null
+++ b/src/square/requests/vendor_updated_event_object.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.vendor_updated_event_object_operation import VendorUpdatedEventObjectOperation
+from .vendor import VendorParams
+
+
+class VendorUpdatedEventObjectParams(typing_extensions.TypedDict):
+ operation: typing_extensions.NotRequired[VendorUpdatedEventObjectOperation]
+ """
+ The operation on the vendor that caused the event to be published. The value is `UPDATED`.
+ See [Operation](#type-operation) for possible values
+ """
+
+ vendor: typing_extensions.NotRequired[VendorParams]
+ """
+ The updated vendor as the result of the specified operation.
+ """
diff --git a/src/square/requests/void_transaction_response.py b/src/square/requests/void_transaction_response.py
new file mode 100644
index 00000000..dab4a82e
--- /dev/null
+++ b/src/square/requests/void_transaction_response.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+
+
+class VoidTransactionResponseParams(typing_extensions.TypedDict):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [VoidTransaction](api-endpoint:Transactions-VoidTransaction) endpoint.
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Any errors that occurred during the request.
+ """
diff --git a/src/square/requests/wage_setting.py b/src/square/requests/wage_setting.py
new file mode 100644
index 00000000..d077c8fe
--- /dev/null
+++ b/src/square/requests/wage_setting.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .job_assignment import JobAssignmentParams
+
+
+class WageSettingParams(typing_extensions.TypedDict):
+ """
+ Represents information about the overtime exemption status, job assignments, and compensation
+ for a [team member](entity:TeamMember).
+ """
+
+ team_member_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The ID of the team member associated with the wage setting.
+ """
+
+ job_assignments: typing_extensions.NotRequired[typing.Optional[typing.Sequence[JobAssignmentParams]]]
+ """
+ **Required** The ordered list of jobs that the team member is assigned to.
+ The first job assignment is considered the team member's primary job.
+ """
+
+ is_overtime_exempt: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Whether the team member is exempt from the overtime rules of the seller's country.
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ **Read only** Used for resolving concurrency issues. The request fails if the version
+ provided does not match the server version at the time of the request. If not provided,
+ Square executes a blind write, potentially overwriting data from another write. For more information,
+ see [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency).
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the wage setting was created, in RFC 3339 format.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp when the wage setting was last updated, in RFC 3339 format.
+ """
diff --git a/src/square/requests/webhook_subscription.py b/src/square/requests/webhook_subscription.py
new file mode 100644
index 00000000..72d71dd4
--- /dev/null
+++ b/src/square/requests/webhook_subscription.py
@@ -0,0 +1,60 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+
+
+class WebhookSubscriptionParams(typing_extensions.TypedDict):
+ """
+ Represents the details of a webhook subscription, including notification URL,
+ event types, and signature key.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ A Square-generated unique ID for the subscription.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The name of this subscription.
+ """
+
+ enabled: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether the subscription is enabled (`true`) or not (`false`).
+ """
+
+ event_types: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]]
+ """
+ The event types associated with this subscription.
+ """
+
+ notification_url: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The URL to which webhooks are sent.
+ """
+
+ api_version: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The API version of the subscription.
+ This field is optional for `CreateWebhookSubscription`.
+ The value defaults to the API version used by the application.
+ """
+
+ signature_key: typing_extensions.NotRequired[str]
+ """
+ The Square-generated signature key used to validate the origin of the webhook event.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the subscription was created, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z".
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ The timestamp of when the subscription was last updated, in RFC 3339 format.
+ For example, "2016-09-04T23:59:33.123Z".
+ """
diff --git a/src/square/requests/workweek_config.py b/src/square/requests/workweek_config.py
new file mode 100644
index 00000000..ade9d7fb
--- /dev/null
+++ b/src/square/requests/workweek_config.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.weekday import Weekday
+
+
+class WorkweekConfigParams(typing_extensions.TypedDict):
+ """
+ Sets the day of the week and hour of the day that a business starts a
+ workweek. This is used to calculate overtime pay.
+ """
+
+ id: typing_extensions.NotRequired[str]
+ """
+ The UUID for this object.
+ """
+
+ start_of_week: Weekday
+ """
+ The day of the week on which a business week starts for
+ compensation purposes.
+ See [Weekday](#type-weekday) for possible values
+ """
+
+ start_of_day_local_time: str
+ """
+ The local time at which a business week starts. Represented as a
+ string in `HH:MM` format (`HH:MM:SS` is also accepted, but seconds are
+ truncated).
+ """
+
+ version: typing_extensions.NotRequired[int]
+ """
+ Used for resolving concurrency issues. The request fails if the version
+ provided does not match the server version at the time of the request. If not provided,
+ Square executes a blind write; potentially overwriting data from another
+ write.
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ A read-only timestamp in RFC 3339 format; presented in UTC.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ A read-only timestamp in RFC 3339 format; presented in UTC.
+ """
diff --git a/src/square/sites/__init__.py b/src/square/sites/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/sites/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/sites/client.py b/src/square/sites/client.py
new file mode 100644
index 00000000..aae113f8
--- /dev/null
+++ b/src/square/sites/client.py
@@ -0,0 +1,106 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..types.list_sites_response import ListSitesResponse
+from .raw_client import AsyncRawSitesClient, RawSitesClient
+
+
+class SitesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawSitesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawSitesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawSitesClient
+ """
+ return self._raw_client
+
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListSitesResponse:
+ """
+ Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the `created_at` date.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListSitesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.sites.list()
+ """
+ _response = self._raw_client.list(request_options=request_options)
+ return _response.data
+
+
+class AsyncSitesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawSitesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawSitesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawSitesClient
+ """
+ return self._raw_client
+
+ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListSitesResponse:
+ """
+ Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the `created_at` date.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListSitesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.sites.list()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.list(request_options=request_options)
+ return _response.data
diff --git a/src/square/sites/raw_client.py b/src/square/sites/raw_client.py
new file mode 100644
index 00000000..67ee2a44
--- /dev/null
+++ b/src/square/sites/raw_client.py
@@ -0,0 +1,97 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.request_options import RequestOptions
+from ..core.unchecked_base_model import construct_type
+from ..types.list_sites_response import ListSitesResponse
+
+
+class RawSitesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[ListSitesResponse]:
+ """
+ Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the `created_at` date.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ListSitesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/sites",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListSitesResponse,
+ construct_type(
+ type_=ListSitesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawSitesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[ListSitesResponse]:
+ """
+ Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the `created_at` date.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ListSitesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/sites",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListSitesResponse,
+ construct_type(
+ type_=ListSitesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/snippets/__init__.py b/src/square/snippets/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/snippets/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/snippets/client.py b/src/square/snippets/client.py
new file mode 100644
index 00000000..0257aff6
--- /dev/null
+++ b/src/square/snippets/client.py
@@ -0,0 +1,302 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..requests.snippet import SnippetParams
+from ..types.delete_snippet_response import DeleteSnippetResponse
+from ..types.get_snippet_response import GetSnippetResponse
+from ..types.upsert_snippet_response import UpsertSnippetResponse
+from .raw_client import AsyncRawSnippetsClient, RawSnippetsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class SnippetsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawSnippetsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawSnippetsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawSnippetsClient
+ """
+ return self._raw_client
+
+ def get(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetSnippetResponse:
+ """
+ Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site that contains the snippet.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetSnippetResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.snippets.get(
+ site_id="site_id",
+ )
+ """
+ _response = self._raw_client.get(site_id, request_options=request_options)
+ return _response.data
+
+ def upsert(
+ self, site_id: str, *, snippet: SnippetParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpsertSnippetResponse:
+ """
+ Adds a snippet to a Square Online site or updates the existing snippet on the site.
+ The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site where you want to add or update the snippet.
+
+ snippet : SnippetParams
+ The snippet for the site.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpsertSnippetResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.snippets.upsert(
+ site_id="site_id",
+ snippet={"content": ""},
+ )
+ """
+ _response = self._raw_client.upsert(site_id, snippet=snippet, request_options=request_options)
+ return _response.data
+
+ def delete(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DeleteSnippetResponse:
+ """
+ Removes your snippet from a Square Online site.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site that contains the snippet.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteSnippetResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.snippets.delete(
+ site_id="site_id",
+ )
+ """
+ _response = self._raw_client.delete(site_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncSnippetsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawSnippetsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawSnippetsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawSnippetsClient
+ """
+ return self._raw_client
+
+ async def get(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetSnippetResponse:
+ """
+ Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site that contains the snippet.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetSnippetResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.snippets.get(
+ site_id="site_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(site_id, request_options=request_options)
+ return _response.data
+
+ async def upsert(
+ self, site_id: str, *, snippet: SnippetParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpsertSnippetResponse:
+ """
+ Adds a snippet to a Square Online site or updates the existing snippet on the site.
+ The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site where you want to add or update the snippet.
+
+ snippet : SnippetParams
+ The snippet for the site.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpsertSnippetResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.snippets.upsert(
+ site_id="site_id",
+ snippet={"content": ""},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.upsert(site_id, snippet=snippet, request_options=request_options)
+ return _response.data
+
+ async def delete(
+ self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteSnippetResponse:
+ """
+ Removes your snippet from a Square Online site.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site that contains the snippet.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteSnippetResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.snippets.delete(
+ site_id="site_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(site_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/snippets/raw_client.py b/src/square/snippets/raw_client.py
new file mode 100644
index 00000000..a327c08e
--- /dev/null
+++ b/src/square/snippets/raw_client.py
@@ -0,0 +1,319 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.snippet import SnippetParams
+from ..types.delete_snippet_response import DeleteSnippetResponse
+from ..types.get_snippet_response import GetSnippetResponse
+from ..types.upsert_snippet_response import UpsertSnippetResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawSnippetsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def get(
+ self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetSnippetResponse]:
+ """
+ Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site that contains the snippet.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetSnippetResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/sites/{jsonable_encoder(site_id)}/snippet",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetSnippetResponse,
+ construct_type(
+ type_=GetSnippetResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def upsert(
+ self, site_id: str, *, snippet: SnippetParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[UpsertSnippetResponse]:
+ """
+ Adds a snippet to a Square Online site or updates the existing snippet on the site.
+ The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site where you want to add or update the snippet.
+
+ snippet : SnippetParams
+ The snippet for the site.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpsertSnippetResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/sites/{jsonable_encoder(site_id)}/snippet",
+ method="POST",
+ json={
+ "snippet": convert_and_respect_annotation_metadata(
+ object_=snippet, annotation=SnippetParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertSnippetResponse,
+ construct_type(
+ type_=UpsertSnippetResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteSnippetResponse]:
+ """
+ Removes your snippet from a Square Online site.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site that contains the snippet.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteSnippetResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/sites/{jsonable_encoder(site_id)}/snippet",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteSnippetResponse,
+ construct_type(
+ type_=DeleteSnippetResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawSnippetsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def get(
+ self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetSnippetResponse]:
+ """
+ Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site that contains the snippet.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetSnippetResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/sites/{jsonable_encoder(site_id)}/snippet",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetSnippetResponse,
+ construct_type(
+ type_=GetSnippetResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def upsert(
+ self, site_id: str, *, snippet: SnippetParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[UpsertSnippetResponse]:
+ """
+ Adds a snippet to a Square Online site or updates the existing snippet on the site.
+ The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site where you want to add or update the snippet.
+
+ snippet : SnippetParams
+ The snippet for the site.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpsertSnippetResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/sites/{jsonable_encoder(site_id)}/snippet",
+ method="POST",
+ json={
+ "snippet": convert_and_respect_annotation_metadata(
+ object_=snippet, annotation=SnippetParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertSnippetResponse,
+ construct_type(
+ type_=UpsertSnippetResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteSnippetResponse]:
+ """
+ Removes your snippet from a Square Online site.
+
+ You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller.
+
+
+ __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
+
+ Parameters
+ ----------
+ site_id : str
+ The ID of the site that contains the snippet.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteSnippetResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/sites/{jsonable_encoder(site_id)}/snippet",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteSnippetResponse,
+ construct_type(
+ type_=DeleteSnippetResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/subscriptions/__init__.py b/src/square/subscriptions/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/subscriptions/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/subscriptions/client.py b/src/square/subscriptions/client.py
new file mode 100644
index 00000000..b4ebec5e
--- /dev/null
+++ b/src/square/subscriptions/client.py
@@ -0,0 +1,1612 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..requests.money import MoneyParams
+from ..requests.phase import PhaseParams
+from ..requests.phase_input import PhaseInputParams
+from ..requests.search_subscriptions_query import SearchSubscriptionsQueryParams
+from ..requests.subscription import SubscriptionParams
+from ..requests.subscription_source import SubscriptionSourceParams
+from ..types.bulk_swap_plan_response import BulkSwapPlanResponse
+from ..types.cancel_subscription_response import CancelSubscriptionResponse
+from ..types.change_billing_anchor_date_response import ChangeBillingAnchorDateResponse
+from ..types.change_timing import ChangeTiming
+from ..types.create_subscription_response import CreateSubscriptionResponse
+from ..types.delete_subscription_action_response import DeleteSubscriptionActionResponse
+from ..types.get_subscription_response import GetSubscriptionResponse
+from ..types.list_subscription_events_response import ListSubscriptionEventsResponse
+from ..types.pause_subscription_response import PauseSubscriptionResponse
+from ..types.resume_subscription_response import ResumeSubscriptionResponse
+from ..types.search_subscriptions_response import SearchSubscriptionsResponse
+from ..types.subscription_event import SubscriptionEvent
+from ..types.swap_plan_response import SwapPlanResponse
+from ..types.update_subscription_response import UpdateSubscriptionResponse
+from .raw_client import AsyncRawSubscriptionsClient, RawSubscriptionsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class SubscriptionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawSubscriptionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawSubscriptionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawSubscriptionsClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ *,
+ location_id: str,
+ customer_id: str,
+ idempotency_key: typing.Optional[str] = OMIT,
+ plan_variation_id: typing.Optional[str] = OMIT,
+ start_date: typing.Optional[str] = OMIT,
+ canceled_date: typing.Optional[str] = OMIT,
+ tax_percentage: typing.Optional[str] = OMIT,
+ price_override_money: typing.Optional[MoneyParams] = OMIT,
+ card_id: typing.Optional[str] = OMIT,
+ timezone: typing.Optional[str] = OMIT,
+ source: typing.Optional[SubscriptionSourceParams] = OMIT,
+ monthly_billing_anchor_date: typing.Optional[int] = OMIT,
+ phases: typing.Optional[typing.Sequence[PhaseParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateSubscriptionResponse:
+ """
+ Enrolls a customer in a subscription.
+
+ If you provide a card on file in the request, Square charges the card for
+ the subscription. Otherwise, Square sends an invoice to the customer's email
+ address. The subscription starts immediately, unless the request includes
+ the optional `start_date`. Each individual subscription is associated with a particular location.
+
+ For more information, see [Create a subscription](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#create-a-subscription).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location the subscription is associated with.
+
+ customer_id : str
+ The ID of the [customer](entity:Customer) subscribing to the subscription plan variation.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies this `CreateSubscription` request.
+ If you do not provide a unique string (or provide an empty string as the value),
+ the endpoint treats each request as independent.
+
+ For more information, see [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ plan_variation_id : typing.Optional[str]
+ The ID of the [subscription plan variation](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations#plan-variations) created using the Catalog API.
+
+ start_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date to start the subscription.
+ If it is unspecified, the subscription starts immediately.
+
+ canceled_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the newly created subscription is scheduled for cancellation.
+
+ This date overrides the cancellation date set in the plan variation configuration.
+ If the cancellation date is earlier than the end date of a subscription cycle, the subscription stops
+ at the canceled date and the subscriber is sent a prorated invoice at the beginning of the canceled cycle.
+
+ When the subscription plan of the newly created subscription has a fixed number of cycles and the `canceled_date`
+ occurs before the subscription plan completes, the specified `canceled_date` sets the date when the subscription
+ stops through the end of the last cycle.
+
+ tax_percentage : typing.Optional[str]
+ The tax to add when billing the subscription.
+ The percentage is expressed in decimal form, using a `'.'` as the decimal
+ separator and without a `'%'` sign. For example, a value of 7.5
+ corresponds to 7.5%.
+
+ price_override_money : typing.Optional[MoneyParams]
+ A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing.
+ This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead,
+ you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates).
+
+ card_id : typing.Optional[str]
+ The ID of the [subscriber's](entity:Customer) [card](entity:Card) to charge.
+ If it is not specified, the subscriber receives an invoice via email with a link to pay for their subscription.
+
+ timezone : typing.Optional[str]
+ The timezone that is used in date calculations for the subscription. If unset, defaults to
+ the location timezone. If a timezone is not configured for the location, defaults to "America/New_York".
+ Format: the IANA Timezone Database identifier for the location timezone. For
+ a list of time zones, see [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
+
+ source : typing.Optional[SubscriptionSourceParams]
+ The origination details of the subscription.
+
+ monthly_billing_anchor_date : typing.Optional[int]
+ The day-of-the-month to change the billing date to.
+
+ phases : typing.Optional[typing.Sequence[PhaseParams]]
+ array of phases for this subscription
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.create(
+ idempotency_key="8193148c-9586-11e6-99f9-28cfe92138cf",
+ location_id="S8GWD5R9QB376",
+ plan_variation_id="6JHXF3B2CW3YKHDV4XEM674H",
+ customer_id="CHFGVKYY8RSV93M5KCYTG4PN0G",
+ start_date="2023-06-20",
+ card_id="ccof:qy5x8hHGYsgLrp4Q4GB",
+ timezone="America/Los_Angeles",
+ source={"name": "My Application"},
+ phases=[
+ {"ordinal": 0, "order_template_id": "U2NaowWxzXwpsZU697x7ZHOAnCNZY"}
+ ],
+ )
+ """
+ _response = self._raw_client.create(
+ location_id=location_id,
+ customer_id=customer_id,
+ idempotency_key=idempotency_key,
+ plan_variation_id=plan_variation_id,
+ start_date=start_date,
+ canceled_date=canceled_date,
+ tax_percentage=tax_percentage,
+ price_override_money=price_override_money,
+ card_id=card_id,
+ timezone=timezone,
+ source=source,
+ monthly_billing_anchor_date=monthly_billing_anchor_date,
+ phases=phases,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def bulk_swap_plan(
+ self,
+ *,
+ new_plan_variation_id: str,
+ old_plan_variation_id: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkSwapPlanResponse:
+ """
+ Schedules a plan variation change for all active subscriptions under a given plan
+ variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations).
+
+ Parameters
+ ----------
+ new_plan_variation_id : str
+ The ID of the new subscription plan variation.
+
+ This field is required.
+
+ old_plan_variation_id : str
+ The ID of the plan variation whose subscriptions should be swapped. Active subscriptions
+ using this plan variation will be subscribed to the new plan variation on their next billing
+ day.
+
+ location_id : str
+ The ID of the location to associate with the swapped subscriptions.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkSwapPlanResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.bulk_swap_plan(
+ new_plan_variation_id="FQ7CDXXWSLUJRPM3GFJSJGZ7",
+ old_plan_variation_id="6JHXF3B2CW3YKHDV4XEM674H",
+ location_id="S8GWD5R9QB376",
+ )
+ """
+ _response = self._raw_client.bulk_swap_plan(
+ new_plan_variation_id=new_plan_variation_id,
+ old_plan_variation_id=old_plan_variation_id,
+ location_id=location_id,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[SearchSubscriptionsQueryParams] = OMIT,
+ include: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchSubscriptionsResponse:
+ """
+ Searches for subscriptions.
+
+ Results are ordered chronologically by subscription creation date. If
+ the request specifies more than one location ID,
+ the endpoint orders the result
+ by location ID, and then by creation date within each location. If no locations are given
+ in the query, all locations are searched.
+
+ You can also optionally specify `customer_ids` to search by customer.
+ If left unset, all customers
+ associated with the specified locations are returned.
+ If the request specifies customer IDs, the endpoint orders results
+ first by location, within location by customer ID, and within
+ customer by subscription creation date.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ When the total number of resulting subscriptions exceeds the limit of a paged response,
+ specify the cursor returned from a preceding response here to fetch the next set of results.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The upper limit on the number of subscriptions to return
+ in a paged response.
+
+ query : typing.Optional[SearchSubscriptionsQueryParams]
+ A subscription query consisting of specified filtering conditions.
+
+ If this `query` field is unspecified, the `SearchSubscriptions` call will return all subscriptions.
+
+ include : typing.Optional[typing.Sequence[str]]
+ An option to include related information in the response.
+
+ The supported values are:
+
+ - `actions`: to include scheduled actions on the targeted subscriptions.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchSubscriptionsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.search(
+ query={
+ "filter": {
+ "customer_ids": ["CHFGVKYY8RSV93M5KCYTG4PN0G"],
+ "location_ids": ["S8GWD5R9QB376"],
+ "source_names": ["My App"],
+ }
+ },
+ )
+ """
+ _response = self._raw_client.search(
+ cursor=cursor, limit=limit, query=query, include=include, request_options=request_options
+ )
+ return _response.data
+
+ def get(
+ self,
+ subscription_id: str,
+ *,
+ include: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> GetSubscriptionResponse:
+ """
+ Retrieves a specific subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to retrieve.
+
+ include : typing.Optional[str]
+ A query parameter to specify related information to be included in the response.
+
+ The supported query parameter values are:
+
+ - `actions`: to include scheduled actions on the targeted subscription.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.get(
+ subscription_id="subscription_id",
+ include="include",
+ )
+ """
+ _response = self._raw_client.get(subscription_id, include=include, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ subscription_id: str,
+ *,
+ subscription: typing.Optional[SubscriptionParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateSubscriptionResponse:
+ """
+ Updates a subscription by modifying or clearing `subscription` field values.
+ To clear a field, set its value to `null`.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to update.
+
+ subscription : typing.Optional[SubscriptionParams]
+ The subscription object containing the current version, and fields to update.
+ Unset fields will be left at their current server values, and JSON `null` values will
+ be treated as a request to clear the relevant data.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.update(
+ subscription_id="subscription_id",
+ subscription={"card_id": "{NEW CARD ID}"},
+ )
+ """
+ _response = self._raw_client.update(subscription_id, subscription=subscription, request_options=request_options)
+ return _response.data
+
+ def delete_action(
+ self, subscription_id: str, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteSubscriptionActionResponse:
+ """
+ Deletes a scheduled action for a subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription the targeted action is to act upon.
+
+ action_id : str
+ The ID of the targeted action to be deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteSubscriptionActionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.delete_action(
+ subscription_id="subscription_id",
+ action_id="action_id",
+ )
+ """
+ _response = self._raw_client.delete_action(subscription_id, action_id, request_options=request_options)
+ return _response.data
+
+ def change_billing_anchor_date(
+ self,
+ subscription_id: str,
+ *,
+ monthly_billing_anchor_date: typing.Optional[int] = OMIT,
+ effective_date: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ChangeBillingAnchorDateResponse:
+ """
+ Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription-billing#billing-dates)
+ for a subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to update the billing anchor date.
+
+ monthly_billing_anchor_date : typing.Optional[int]
+ The anchor day for the billing cycle.
+
+ effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes
+ place on the subscription.
+
+ When this date is unspecified or falls within the current billing cycle, the billing anchor date
+ is changed immediately.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ChangeBillingAnchorDateResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.change_billing_anchor_date(
+ subscription_id="subscription_id",
+ monthly_billing_anchor_date=1,
+ )
+ """
+ _response = self._raw_client.change_billing_anchor_date(
+ subscription_id,
+ monthly_billing_anchor_date=monthly_billing_anchor_date,
+ effective_date=effective_date,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def cancel(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelSubscriptionResponse:
+ """
+ Schedules a `CANCEL` action to cancel an active subscription. This
+ sets the `canceled_date` field to the end of the active billing period. After this date,
+ the subscription status changes from ACTIVE to CANCELED.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to cancel.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.cancel(
+ subscription_id="subscription_id",
+ )
+ """
+ _response = self._raw_client.cancel(subscription_id, request_options=request_options)
+ return _response.data
+
+ def list_events(
+ self,
+ subscription_id: str,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]:
+ """
+ Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions-events) for a specific subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to retrieve the events for.
+
+ cursor : typing.Optional[str]
+ When the total number of resulting subscription events exceeds the limit of a paged response,
+ specify the cursor returned from a preceding response here to fetch the next set of results.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The upper limit on the number of subscription events to return
+ in a paged response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.subscriptions.list_events(
+ subscription_id="subscription_id",
+ cursor="cursor",
+ limit=1,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list_events(
+ subscription_id, cursor=cursor, limit=limit, request_options=request_options
+ )
+
+ def pause(
+ self,
+ subscription_id: str,
+ *,
+ pause_effective_date: typing.Optional[str] = OMIT,
+ pause_cycle_duration: typing.Optional[int] = OMIT,
+ resume_effective_date: typing.Optional[str] = OMIT,
+ resume_change_timing: typing.Optional[ChangeTiming] = OMIT,
+ pause_reason: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> PauseSubscriptionResponse:
+ """
+ Schedules a `PAUSE` action to pause an active subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to pause.
+
+ pause_effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the scheduled `PAUSE` action takes place on the subscription.
+
+ When this date is unspecified or falls within the current billing cycle, the subscription is paused
+ on the starting date of the next billing cycle.
+
+ pause_cycle_duration : typing.Optional[int]
+ The number of billing cycles the subscription will be paused before it is reactivated.
+
+ When this is set, a `RESUME` action is also scheduled to take place on the subscription at
+ the end of the specified pause cycle duration. In this case, neither `resume_effective_date`
+ nor `resume_change_timing` may be specified.
+
+ resume_effective_date : typing.Optional[str]
+ The date when the subscription is reactivated by a scheduled `RESUME` action.
+ This date must be at least one billing cycle ahead of `pause_effective_date`.
+
+ resume_change_timing : typing.Optional[ChangeTiming]
+ The timing whether the subscription is reactivated immediately or at the end of the billing cycle, relative to
+ `resume_effective_date`.
+ See [ChangeTiming](#type-changetiming) for possible values
+
+ pause_reason : typing.Optional[str]
+ The user-provided reason to pause the subscription.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ PauseSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.pause(
+ subscription_id="subscription_id",
+ )
+ """
+ _response = self._raw_client.pause(
+ subscription_id,
+ pause_effective_date=pause_effective_date,
+ pause_cycle_duration=pause_cycle_duration,
+ resume_effective_date=resume_effective_date,
+ resume_change_timing=resume_change_timing,
+ pause_reason=pause_reason,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def resume(
+ self,
+ subscription_id: str,
+ *,
+ resume_effective_date: typing.Optional[str] = OMIT,
+ resume_change_timing: typing.Optional[ChangeTiming] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ResumeSubscriptionResponse:
+ """
+ Schedules a `RESUME` action to resume a paused or a deactivated subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to resume.
+
+ resume_effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the subscription reactivated.
+
+ resume_change_timing : typing.Optional[ChangeTiming]
+ The timing to resume a subscription, relative to the specified
+ `resume_effective_date` attribute value.
+ See [ChangeTiming](#type-changetiming) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ResumeSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.resume(
+ subscription_id="subscription_id",
+ )
+ """
+ _response = self._raw_client.resume(
+ subscription_id,
+ resume_effective_date=resume_effective_date,
+ resume_change_timing=resume_change_timing,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def swap_plan(
+ self,
+ subscription_id: str,
+ *,
+ new_plan_variation_id: typing.Optional[str] = OMIT,
+ phases: typing.Optional[typing.Sequence[PhaseInputParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SwapPlanResponse:
+ """
+ Schedules a `SWAP_PLAN` action to swap a subscription plan variation in an existing subscription.
+ For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations).
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to swap the subscription plan for.
+
+ new_plan_variation_id : typing.Optional[str]
+ The ID of the new subscription plan variation.
+
+ This field is required.
+
+ phases : typing.Optional[typing.Sequence[PhaseInputParams]]
+ A list of PhaseInputs, to pass phase-specific information used in the swap.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SwapPlanResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.subscriptions.swap_plan(
+ subscription_id="subscription_id",
+ new_plan_variation_id="FQ7CDXXWSLUJRPM3GFJSJGZ7",
+ phases=[
+ {"ordinal": 0, "order_template_id": "uhhnjH9osVv3shUADwaC0b3hNxQZY"}
+ ],
+ )
+ """
+ _response = self._raw_client.swap_plan(
+ subscription_id, new_plan_variation_id=new_plan_variation_id, phases=phases, request_options=request_options
+ )
+ return _response.data
+
+
+class AsyncSubscriptionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawSubscriptionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawSubscriptionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawSubscriptionsClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ *,
+ location_id: str,
+ customer_id: str,
+ idempotency_key: typing.Optional[str] = OMIT,
+ plan_variation_id: typing.Optional[str] = OMIT,
+ start_date: typing.Optional[str] = OMIT,
+ canceled_date: typing.Optional[str] = OMIT,
+ tax_percentage: typing.Optional[str] = OMIT,
+ price_override_money: typing.Optional[MoneyParams] = OMIT,
+ card_id: typing.Optional[str] = OMIT,
+ timezone: typing.Optional[str] = OMIT,
+ source: typing.Optional[SubscriptionSourceParams] = OMIT,
+ monthly_billing_anchor_date: typing.Optional[int] = OMIT,
+ phases: typing.Optional[typing.Sequence[PhaseParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateSubscriptionResponse:
+ """
+ Enrolls a customer in a subscription.
+
+ If you provide a card on file in the request, Square charges the card for
+ the subscription. Otherwise, Square sends an invoice to the customer's email
+ address. The subscription starts immediately, unless the request includes
+ the optional `start_date`. Each individual subscription is associated with a particular location.
+
+ For more information, see [Create a subscription](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#create-a-subscription).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location the subscription is associated with.
+
+ customer_id : str
+ The ID of the [customer](entity:Customer) subscribing to the subscription plan variation.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies this `CreateSubscription` request.
+ If you do not provide a unique string (or provide an empty string as the value),
+ the endpoint treats each request as independent.
+
+ For more information, see [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ plan_variation_id : typing.Optional[str]
+ The ID of the [subscription plan variation](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations#plan-variations) created using the Catalog API.
+
+ start_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date to start the subscription.
+ If it is unspecified, the subscription starts immediately.
+
+ canceled_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the newly created subscription is scheduled for cancellation.
+
+ This date overrides the cancellation date set in the plan variation configuration.
+ If the cancellation date is earlier than the end date of a subscription cycle, the subscription stops
+ at the canceled date and the subscriber is sent a prorated invoice at the beginning of the canceled cycle.
+
+ When the subscription plan of the newly created subscription has a fixed number of cycles and the `canceled_date`
+ occurs before the subscription plan completes, the specified `canceled_date` sets the date when the subscription
+ stops through the end of the last cycle.
+
+ tax_percentage : typing.Optional[str]
+ The tax to add when billing the subscription.
+ The percentage is expressed in decimal form, using a `'.'` as the decimal
+ separator and without a `'%'` sign. For example, a value of 7.5
+ corresponds to 7.5%.
+
+ price_override_money : typing.Optional[MoneyParams]
+ A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing.
+ This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead,
+ you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates).
+
+ card_id : typing.Optional[str]
+ The ID of the [subscriber's](entity:Customer) [card](entity:Card) to charge.
+ If it is not specified, the subscriber receives an invoice via email with a link to pay for their subscription.
+
+ timezone : typing.Optional[str]
+ The timezone that is used in date calculations for the subscription. If unset, defaults to
+ the location timezone. If a timezone is not configured for the location, defaults to "America/New_York".
+ Format: the IANA Timezone Database identifier for the location timezone. For
+ a list of time zones, see [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
+
+ source : typing.Optional[SubscriptionSourceParams]
+ The origination details of the subscription.
+
+ monthly_billing_anchor_date : typing.Optional[int]
+ The day-of-the-month to change the billing date to.
+
+ phases : typing.Optional[typing.Sequence[PhaseParams]]
+ array of phases for this subscription
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.create(
+ idempotency_key="8193148c-9586-11e6-99f9-28cfe92138cf",
+ location_id="S8GWD5R9QB376",
+ plan_variation_id="6JHXF3B2CW3YKHDV4XEM674H",
+ customer_id="CHFGVKYY8RSV93M5KCYTG4PN0G",
+ start_date="2023-06-20",
+ card_id="ccof:qy5x8hHGYsgLrp4Q4GB",
+ timezone="America/Los_Angeles",
+ source={"name": "My Application"},
+ phases=[
+ {"ordinal": 0, "order_template_id": "U2NaowWxzXwpsZU697x7ZHOAnCNZY"}
+ ],
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ location_id=location_id,
+ customer_id=customer_id,
+ idempotency_key=idempotency_key,
+ plan_variation_id=plan_variation_id,
+ start_date=start_date,
+ canceled_date=canceled_date,
+ tax_percentage=tax_percentage,
+ price_override_money=price_override_money,
+ card_id=card_id,
+ timezone=timezone,
+ source=source,
+ monthly_billing_anchor_date=monthly_billing_anchor_date,
+ phases=phases,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def bulk_swap_plan(
+ self,
+ *,
+ new_plan_variation_id: str,
+ old_plan_variation_id: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BulkSwapPlanResponse:
+ """
+ Schedules a plan variation change for all active subscriptions under a given plan
+ variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations).
+
+ Parameters
+ ----------
+ new_plan_variation_id : str
+ The ID of the new subscription plan variation.
+
+ This field is required.
+
+ old_plan_variation_id : str
+ The ID of the plan variation whose subscriptions should be swapped. Active subscriptions
+ using this plan variation will be subscribed to the new plan variation on their next billing
+ day.
+
+ location_id : str
+ The ID of the location to associate with the swapped subscriptions.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BulkSwapPlanResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.bulk_swap_plan(
+ new_plan_variation_id="FQ7CDXXWSLUJRPM3GFJSJGZ7",
+ old_plan_variation_id="6JHXF3B2CW3YKHDV4XEM674H",
+ location_id="S8GWD5R9QB376",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.bulk_swap_plan(
+ new_plan_variation_id=new_plan_variation_id,
+ old_plan_variation_id=old_plan_variation_id,
+ location_id=location_id,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[SearchSubscriptionsQueryParams] = OMIT,
+ include: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchSubscriptionsResponse:
+ """
+ Searches for subscriptions.
+
+ Results are ordered chronologically by subscription creation date. If
+ the request specifies more than one location ID,
+ the endpoint orders the result
+ by location ID, and then by creation date within each location. If no locations are given
+ in the query, all locations are searched.
+
+ You can also optionally specify `customer_ids` to search by customer.
+ If left unset, all customers
+ associated with the specified locations are returned.
+ If the request specifies customer IDs, the endpoint orders results
+ first by location, within location by customer ID, and within
+ customer by subscription creation date.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ When the total number of resulting subscriptions exceeds the limit of a paged response,
+ specify the cursor returned from a preceding response here to fetch the next set of results.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The upper limit on the number of subscriptions to return
+ in a paged response.
+
+ query : typing.Optional[SearchSubscriptionsQueryParams]
+ A subscription query consisting of specified filtering conditions.
+
+ If this `query` field is unspecified, the `SearchSubscriptions` call will return all subscriptions.
+
+ include : typing.Optional[typing.Sequence[str]]
+ An option to include related information in the response.
+
+ The supported values are:
+
+ - `actions`: to include scheduled actions on the targeted subscriptions.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchSubscriptionsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.search(
+ query={
+ "filter": {
+ "customer_ids": ["CHFGVKYY8RSV93M5KCYTG4PN0G"],
+ "location_ids": ["S8GWD5R9QB376"],
+ "source_names": ["My App"],
+ }
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ cursor=cursor, limit=limit, query=query, include=include, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self,
+ subscription_id: str,
+ *,
+ include: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> GetSubscriptionResponse:
+ """
+ Retrieves a specific subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to retrieve.
+
+ include : typing.Optional[str]
+ A query parameter to specify related information to be included in the response.
+
+ The supported query parameter values are:
+
+ - `actions`: to include scheduled actions on the targeted subscription.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.get(
+ subscription_id="subscription_id",
+ include="include",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(subscription_id, include=include, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ subscription_id: str,
+ *,
+ subscription: typing.Optional[SubscriptionParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateSubscriptionResponse:
+ """
+ Updates a subscription by modifying or clearing `subscription` field values.
+ To clear a field, set its value to `null`.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to update.
+
+ subscription : typing.Optional[SubscriptionParams]
+ The subscription object containing the current version, and fields to update.
+ Unset fields will be left at their current server values, and JSON `null` values will
+ be treated as a request to clear the relevant data.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.update(
+ subscription_id="subscription_id",
+ subscription={"card_id": "{NEW CARD ID}"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ subscription_id, subscription=subscription, request_options=request_options
+ )
+ return _response.data
+
+ async def delete_action(
+ self, subscription_id: str, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteSubscriptionActionResponse:
+ """
+ Deletes a scheduled action for a subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription the targeted action is to act upon.
+
+ action_id : str
+ The ID of the targeted action to be deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteSubscriptionActionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.delete_action(
+ subscription_id="subscription_id",
+ action_id="action_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete_action(subscription_id, action_id, request_options=request_options)
+ return _response.data
+
+ async def change_billing_anchor_date(
+ self,
+ subscription_id: str,
+ *,
+ monthly_billing_anchor_date: typing.Optional[int] = OMIT,
+ effective_date: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ChangeBillingAnchorDateResponse:
+ """
+ Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription-billing#billing-dates)
+ for a subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to update the billing anchor date.
+
+ monthly_billing_anchor_date : typing.Optional[int]
+ The anchor day for the billing cycle.
+
+ effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes
+ place on the subscription.
+
+ When this date is unspecified or falls within the current billing cycle, the billing anchor date
+ is changed immediately.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ChangeBillingAnchorDateResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.change_billing_anchor_date(
+ subscription_id="subscription_id",
+ monthly_billing_anchor_date=1,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.change_billing_anchor_date(
+ subscription_id,
+ monthly_billing_anchor_date=monthly_billing_anchor_date,
+ effective_date=effective_date,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def cancel(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelSubscriptionResponse:
+ """
+ Schedules a `CANCEL` action to cancel an active subscription. This
+ sets the `canceled_date` field to the end of the active billing period. After this date,
+ the subscription status changes from ACTIVE to CANCELED.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to cancel.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.cancel(
+ subscription_id="subscription_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.cancel(subscription_id, request_options=request_options)
+ return _response.data
+
+ async def list_events(
+ self,
+ subscription_id: str,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]:
+ """
+ Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions-events) for a specific subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to retrieve the events for.
+
+ cursor : typing.Optional[str]
+ When the total number of resulting subscription events exceeds the limit of a paged response,
+ specify the cursor returned from a preceding response here to fetch the next set of results.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The upper limit on the number of subscription events to return
+ in a paged response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.subscriptions.list_events(
+ subscription_id="subscription_id",
+ cursor="cursor",
+ limit=1,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list_events(
+ subscription_id, cursor=cursor, limit=limit, request_options=request_options
+ )
+
+ async def pause(
+ self,
+ subscription_id: str,
+ *,
+ pause_effective_date: typing.Optional[str] = OMIT,
+ pause_cycle_duration: typing.Optional[int] = OMIT,
+ resume_effective_date: typing.Optional[str] = OMIT,
+ resume_change_timing: typing.Optional[ChangeTiming] = OMIT,
+ pause_reason: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> PauseSubscriptionResponse:
+ """
+ Schedules a `PAUSE` action to pause an active subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to pause.
+
+ pause_effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the scheduled `PAUSE` action takes place on the subscription.
+
+ When this date is unspecified or falls within the current billing cycle, the subscription is paused
+ on the starting date of the next billing cycle.
+
+ pause_cycle_duration : typing.Optional[int]
+ The number of billing cycles the subscription will be paused before it is reactivated.
+
+ When this is set, a `RESUME` action is also scheduled to take place on the subscription at
+ the end of the specified pause cycle duration. In this case, neither `resume_effective_date`
+ nor `resume_change_timing` may be specified.
+
+ resume_effective_date : typing.Optional[str]
+ The date when the subscription is reactivated by a scheduled `RESUME` action.
+ This date must be at least one billing cycle ahead of `pause_effective_date`.
+
+ resume_change_timing : typing.Optional[ChangeTiming]
+ The timing whether the subscription is reactivated immediately or at the end of the billing cycle, relative to
+ `resume_effective_date`.
+ See [ChangeTiming](#type-changetiming) for possible values
+
+ pause_reason : typing.Optional[str]
+ The user-provided reason to pause the subscription.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ PauseSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.pause(
+ subscription_id="subscription_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.pause(
+ subscription_id,
+ pause_effective_date=pause_effective_date,
+ pause_cycle_duration=pause_cycle_duration,
+ resume_effective_date=resume_effective_date,
+ resume_change_timing=resume_change_timing,
+ pause_reason=pause_reason,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def resume(
+ self,
+ subscription_id: str,
+ *,
+ resume_effective_date: typing.Optional[str] = OMIT,
+ resume_change_timing: typing.Optional[ChangeTiming] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ResumeSubscriptionResponse:
+ """
+ Schedules a `RESUME` action to resume a paused or a deactivated subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to resume.
+
+ resume_effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the subscription reactivated.
+
+ resume_change_timing : typing.Optional[ChangeTiming]
+ The timing to resume a subscription, relative to the specified
+ `resume_effective_date` attribute value.
+ See [ChangeTiming](#type-changetiming) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ResumeSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.resume(
+ subscription_id="subscription_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.resume(
+ subscription_id,
+ resume_effective_date=resume_effective_date,
+ resume_change_timing=resume_change_timing,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def swap_plan(
+ self,
+ subscription_id: str,
+ *,
+ new_plan_variation_id: typing.Optional[str] = OMIT,
+ phases: typing.Optional[typing.Sequence[PhaseInputParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SwapPlanResponse:
+ """
+ Schedules a `SWAP_PLAN` action to swap a subscription plan variation in an existing subscription.
+ For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations).
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to swap the subscription plan for.
+
+ new_plan_variation_id : typing.Optional[str]
+ The ID of the new subscription plan variation.
+
+ This field is required.
+
+ phases : typing.Optional[typing.Sequence[PhaseInputParams]]
+ A list of PhaseInputs, to pass phase-specific information used in the swap.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SwapPlanResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.subscriptions.swap_plan(
+ subscription_id="subscription_id",
+ new_plan_variation_id="FQ7CDXXWSLUJRPM3GFJSJGZ7",
+ phases=[
+ {"ordinal": 0, "order_template_id": "uhhnjH9osVv3shUADwaC0b3hNxQZY"}
+ ],
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.swap_plan(
+ subscription_id, new_plan_variation_id=new_plan_variation_id, phases=phases, request_options=request_options
+ )
+ return _response.data
diff --git a/src/square/subscriptions/raw_client.py b/src/square/subscriptions/raw_client.py
new file mode 100644
index 00000000..da656ca0
--- /dev/null
+++ b/src/square/subscriptions/raw_client.py
@@ -0,0 +1,1707 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.money import MoneyParams
+from ..requests.phase import PhaseParams
+from ..requests.phase_input import PhaseInputParams
+from ..requests.search_subscriptions_query import SearchSubscriptionsQueryParams
+from ..requests.subscription import SubscriptionParams
+from ..requests.subscription_source import SubscriptionSourceParams
+from ..types.bulk_swap_plan_response import BulkSwapPlanResponse
+from ..types.cancel_subscription_response import CancelSubscriptionResponse
+from ..types.change_billing_anchor_date_response import ChangeBillingAnchorDateResponse
+from ..types.change_timing import ChangeTiming
+from ..types.create_subscription_response import CreateSubscriptionResponse
+from ..types.delete_subscription_action_response import DeleteSubscriptionActionResponse
+from ..types.get_subscription_response import GetSubscriptionResponse
+from ..types.list_subscription_events_response import ListSubscriptionEventsResponse
+from ..types.pause_subscription_response import PauseSubscriptionResponse
+from ..types.resume_subscription_response import ResumeSubscriptionResponse
+from ..types.search_subscriptions_response import SearchSubscriptionsResponse
+from ..types.subscription_event import SubscriptionEvent
+from ..types.swap_plan_response import SwapPlanResponse
+from ..types.update_subscription_response import UpdateSubscriptionResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawSubscriptionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ location_id: str,
+ customer_id: str,
+ idempotency_key: typing.Optional[str] = OMIT,
+ plan_variation_id: typing.Optional[str] = OMIT,
+ start_date: typing.Optional[str] = OMIT,
+ canceled_date: typing.Optional[str] = OMIT,
+ tax_percentage: typing.Optional[str] = OMIT,
+ price_override_money: typing.Optional[MoneyParams] = OMIT,
+ card_id: typing.Optional[str] = OMIT,
+ timezone: typing.Optional[str] = OMIT,
+ source: typing.Optional[SubscriptionSourceParams] = OMIT,
+ monthly_billing_anchor_date: typing.Optional[int] = OMIT,
+ phases: typing.Optional[typing.Sequence[PhaseParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateSubscriptionResponse]:
+ """
+ Enrolls a customer in a subscription.
+
+ If you provide a card on file in the request, Square charges the card for
+ the subscription. Otherwise, Square sends an invoice to the customer's email
+ address. The subscription starts immediately, unless the request includes
+ the optional `start_date`. Each individual subscription is associated with a particular location.
+
+ For more information, see [Create a subscription](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#create-a-subscription).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location the subscription is associated with.
+
+ customer_id : str
+ The ID of the [customer](entity:Customer) subscribing to the subscription plan variation.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies this `CreateSubscription` request.
+ If you do not provide a unique string (or provide an empty string as the value),
+ the endpoint treats each request as independent.
+
+ For more information, see [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ plan_variation_id : typing.Optional[str]
+ The ID of the [subscription plan variation](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations#plan-variations) created using the Catalog API.
+
+ start_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date to start the subscription.
+ If it is unspecified, the subscription starts immediately.
+
+ canceled_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the newly created subscription is scheduled for cancellation.
+
+ This date overrides the cancellation date set in the plan variation configuration.
+ If the cancellation date is earlier than the end date of a subscription cycle, the subscription stops
+ at the canceled date and the subscriber is sent a prorated invoice at the beginning of the canceled cycle.
+
+ When the subscription plan of the newly created subscription has a fixed number of cycles and the `canceled_date`
+ occurs before the subscription plan completes, the specified `canceled_date` sets the date when the subscription
+ stops through the end of the last cycle.
+
+ tax_percentage : typing.Optional[str]
+ The tax to add when billing the subscription.
+ The percentage is expressed in decimal form, using a `'.'` as the decimal
+ separator and without a `'%'` sign. For example, a value of 7.5
+ corresponds to 7.5%.
+
+ price_override_money : typing.Optional[MoneyParams]
+ A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing.
+ This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead,
+ you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates).
+
+ card_id : typing.Optional[str]
+ The ID of the [subscriber's](entity:Customer) [card](entity:Card) to charge.
+ If it is not specified, the subscriber receives an invoice via email with a link to pay for their subscription.
+
+ timezone : typing.Optional[str]
+ The timezone that is used in date calculations for the subscription. If unset, defaults to
+ the location timezone. If a timezone is not configured for the location, defaults to "America/New_York".
+ Format: the IANA Timezone Database identifier for the location timezone. For
+ a list of time zones, see [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
+
+ source : typing.Optional[SubscriptionSourceParams]
+ The origination details of the subscription.
+
+ monthly_billing_anchor_date : typing.Optional[int]
+ The day-of-the-month to change the billing date to.
+
+ phases : typing.Optional[typing.Sequence[PhaseParams]]
+ array of phases for this subscription
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/subscriptions",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "location_id": location_id,
+ "plan_variation_id": plan_variation_id,
+ "customer_id": customer_id,
+ "start_date": start_date,
+ "canceled_date": canceled_date,
+ "tax_percentage": tax_percentage,
+ "price_override_money": convert_and_respect_annotation_metadata(
+ object_=price_override_money, annotation=MoneyParams, direction="write"
+ ),
+ "card_id": card_id,
+ "timezone": timezone,
+ "source": convert_and_respect_annotation_metadata(
+ object_=source, annotation=SubscriptionSourceParams, direction="write"
+ ),
+ "monthly_billing_anchor_date": monthly_billing_anchor_date,
+ "phases": convert_and_respect_annotation_metadata(
+ object_=phases, annotation=typing.Sequence[PhaseParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateSubscriptionResponse,
+ construct_type(
+ type_=CreateSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def bulk_swap_plan(
+ self,
+ *,
+ new_plan_variation_id: str,
+ old_plan_variation_id: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BulkSwapPlanResponse]:
+ """
+ Schedules a plan variation change for all active subscriptions under a given plan
+ variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations).
+
+ Parameters
+ ----------
+ new_plan_variation_id : str
+ The ID of the new subscription plan variation.
+
+ This field is required.
+
+ old_plan_variation_id : str
+ The ID of the plan variation whose subscriptions should be swapped. Active subscriptions
+ using this plan variation will be subscribed to the new plan variation on their next billing
+ day.
+
+ location_id : str
+ The ID of the location to associate with the swapped subscriptions.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BulkSwapPlanResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/subscriptions/bulk-swap-plan",
+ method="POST",
+ json={
+ "new_plan_variation_id": new_plan_variation_id,
+ "old_plan_variation_id": old_plan_variation_id,
+ "location_id": location_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkSwapPlanResponse,
+ construct_type(
+ type_=BulkSwapPlanResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[SearchSubscriptionsQueryParams] = OMIT,
+ include: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchSubscriptionsResponse]:
+ """
+ Searches for subscriptions.
+
+ Results are ordered chronologically by subscription creation date. If
+ the request specifies more than one location ID,
+ the endpoint orders the result
+ by location ID, and then by creation date within each location. If no locations are given
+ in the query, all locations are searched.
+
+ You can also optionally specify `customer_ids` to search by customer.
+ If left unset, all customers
+ associated with the specified locations are returned.
+ If the request specifies customer IDs, the endpoint orders results
+ first by location, within location by customer ID, and within
+ customer by subscription creation date.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ When the total number of resulting subscriptions exceeds the limit of a paged response,
+ specify the cursor returned from a preceding response here to fetch the next set of results.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The upper limit on the number of subscriptions to return
+ in a paged response.
+
+ query : typing.Optional[SearchSubscriptionsQueryParams]
+ A subscription query consisting of specified filtering conditions.
+
+ If this `query` field is unspecified, the `SearchSubscriptions` call will return all subscriptions.
+
+ include : typing.Optional[typing.Sequence[str]]
+ An option to include related information in the response.
+
+ The supported values are:
+
+ - `actions`: to include scheduled actions on the targeted subscriptions.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchSubscriptionsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/subscriptions/search",
+ method="POST",
+ json={
+ "cursor": cursor,
+ "limit": limit,
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchSubscriptionsQueryParams, direction="write"
+ ),
+ "include": include,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchSubscriptionsResponse,
+ construct_type(
+ type_=SearchSubscriptionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self,
+ subscription_id: str,
+ *,
+ include: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[GetSubscriptionResponse]:
+ """
+ Retrieves a specific subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to retrieve.
+
+ include : typing.Optional[str]
+ A query parameter to specify related information to be included in the response.
+
+ The supported query parameter values are:
+
+ - `actions`: to include scheduled actions on the targeted subscription.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}",
+ method="GET",
+ params={
+ "include": include,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetSubscriptionResponse,
+ construct_type(
+ type_=GetSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ subscription_id: str,
+ *,
+ subscription: typing.Optional[SubscriptionParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateSubscriptionResponse]:
+ """
+ Updates a subscription by modifying or clearing `subscription` field values.
+ To clear a field, set its value to `null`.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to update.
+
+ subscription : typing.Optional[SubscriptionParams]
+ The subscription object containing the current version, and fields to update.
+ Unset fields will be left at their current server values, and JSON `null` values will
+ be treated as a request to clear the relevant data.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}",
+ method="PUT",
+ json={
+ "subscription": convert_and_respect_annotation_metadata(
+ object_=subscription, annotation=SubscriptionParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateSubscriptionResponse,
+ construct_type(
+ type_=UpdateSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete_action(
+ self, subscription_id: str, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteSubscriptionActionResponse]:
+ """
+ Deletes a scheduled action for a subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription the targeted action is to act upon.
+
+ action_id : str
+ The ID of the targeted action to be deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteSubscriptionActionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/actions/{jsonable_encoder(action_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteSubscriptionActionResponse,
+ construct_type(
+ type_=DeleteSubscriptionActionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def change_billing_anchor_date(
+ self,
+ subscription_id: str,
+ *,
+ monthly_billing_anchor_date: typing.Optional[int] = OMIT,
+ effective_date: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[ChangeBillingAnchorDateResponse]:
+ """
+ Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription-billing#billing-dates)
+ for a subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to update the billing anchor date.
+
+ monthly_billing_anchor_date : typing.Optional[int]
+ The anchor day for the billing cycle.
+
+ effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes
+ place on the subscription.
+
+ When this date is unspecified or falls within the current billing cycle, the billing anchor date
+ is changed immediately.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ChangeBillingAnchorDateResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/billing-anchor",
+ method="POST",
+ json={
+ "monthly_billing_anchor_date": monthly_billing_anchor_date,
+ "effective_date": effective_date,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ChangeBillingAnchorDateResponse,
+ construct_type(
+ type_=ChangeBillingAnchorDateResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def cancel(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[CancelSubscriptionResponse]:
+ """
+ Schedules a `CANCEL` action to cancel an active subscription. This
+ sets the `canceled_date` field to the end of the active billing period. After this date,
+ the subscription status changes from ACTIVE to CANCELED.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to cancel.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CancelSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelSubscriptionResponse,
+ construct_type(
+ type_=CancelSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def list_events(
+ self,
+ subscription_id: str,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]:
+ """
+ Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions-events) for a specific subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to retrieve the events for.
+
+ cursor : typing.Optional[str]
+ When the total number of resulting subscription events exceeds the limit of a paged response,
+ specify the cursor returned from a preceding response here to fetch the next set of results.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The upper limit on the number of subscription events to return
+ in a paged response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/events",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListSubscriptionEventsResponse,
+ construct_type(
+ type_=ListSubscriptionEventsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.subscription_events
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list_events(
+ subscription_id,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def pause(
+ self,
+ subscription_id: str,
+ *,
+ pause_effective_date: typing.Optional[str] = OMIT,
+ pause_cycle_duration: typing.Optional[int] = OMIT,
+ resume_effective_date: typing.Optional[str] = OMIT,
+ resume_change_timing: typing.Optional[ChangeTiming] = OMIT,
+ pause_reason: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[PauseSubscriptionResponse]:
+ """
+ Schedules a `PAUSE` action to pause an active subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to pause.
+
+ pause_effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the scheduled `PAUSE` action takes place on the subscription.
+
+ When this date is unspecified or falls within the current billing cycle, the subscription is paused
+ on the starting date of the next billing cycle.
+
+ pause_cycle_duration : typing.Optional[int]
+ The number of billing cycles the subscription will be paused before it is reactivated.
+
+ When this is set, a `RESUME` action is also scheduled to take place on the subscription at
+ the end of the specified pause cycle duration. In this case, neither `resume_effective_date`
+ nor `resume_change_timing` may be specified.
+
+ resume_effective_date : typing.Optional[str]
+ The date when the subscription is reactivated by a scheduled `RESUME` action.
+ This date must be at least one billing cycle ahead of `pause_effective_date`.
+
+ resume_change_timing : typing.Optional[ChangeTiming]
+ The timing whether the subscription is reactivated immediately or at the end of the billing cycle, relative to
+ `resume_effective_date`.
+ See [ChangeTiming](#type-changetiming) for possible values
+
+ pause_reason : typing.Optional[str]
+ The user-provided reason to pause the subscription.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[PauseSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/pause",
+ method="POST",
+ json={
+ "pause_effective_date": pause_effective_date,
+ "pause_cycle_duration": pause_cycle_duration,
+ "resume_effective_date": resume_effective_date,
+ "resume_change_timing": resume_change_timing,
+ "pause_reason": pause_reason,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ PauseSubscriptionResponse,
+ construct_type(
+ type_=PauseSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def resume(
+ self,
+ subscription_id: str,
+ *,
+ resume_effective_date: typing.Optional[str] = OMIT,
+ resume_change_timing: typing.Optional[ChangeTiming] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[ResumeSubscriptionResponse]:
+ """
+ Schedules a `RESUME` action to resume a paused or a deactivated subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to resume.
+
+ resume_effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the subscription reactivated.
+
+ resume_change_timing : typing.Optional[ChangeTiming]
+ The timing to resume a subscription, relative to the specified
+ `resume_effective_date` attribute value.
+ See [ChangeTiming](#type-changetiming) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ResumeSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/resume",
+ method="POST",
+ json={
+ "resume_effective_date": resume_effective_date,
+ "resume_change_timing": resume_change_timing,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ResumeSubscriptionResponse,
+ construct_type(
+ type_=ResumeSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def swap_plan(
+ self,
+ subscription_id: str,
+ *,
+ new_plan_variation_id: typing.Optional[str] = OMIT,
+ phases: typing.Optional[typing.Sequence[PhaseInputParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SwapPlanResponse]:
+ """
+ Schedules a `SWAP_PLAN` action to swap a subscription plan variation in an existing subscription.
+ For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations).
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to swap the subscription plan for.
+
+ new_plan_variation_id : typing.Optional[str]
+ The ID of the new subscription plan variation.
+
+ This field is required.
+
+ phases : typing.Optional[typing.Sequence[PhaseInputParams]]
+ A list of PhaseInputs, to pass phase-specific information used in the swap.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SwapPlanResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/swap-plan",
+ method="POST",
+ json={
+ "new_plan_variation_id": new_plan_variation_id,
+ "phases": convert_and_respect_annotation_metadata(
+ object_=phases, annotation=typing.Optional[typing.Sequence[PhaseInputParams]], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SwapPlanResponse,
+ construct_type(
+ type_=SwapPlanResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawSubscriptionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ location_id: str,
+ customer_id: str,
+ idempotency_key: typing.Optional[str] = OMIT,
+ plan_variation_id: typing.Optional[str] = OMIT,
+ start_date: typing.Optional[str] = OMIT,
+ canceled_date: typing.Optional[str] = OMIT,
+ tax_percentage: typing.Optional[str] = OMIT,
+ price_override_money: typing.Optional[MoneyParams] = OMIT,
+ card_id: typing.Optional[str] = OMIT,
+ timezone: typing.Optional[str] = OMIT,
+ source: typing.Optional[SubscriptionSourceParams] = OMIT,
+ monthly_billing_anchor_date: typing.Optional[int] = OMIT,
+ phases: typing.Optional[typing.Sequence[PhaseParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateSubscriptionResponse]:
+ """
+ Enrolls a customer in a subscription.
+
+ If you provide a card on file in the request, Square charges the card for
+ the subscription. Otherwise, Square sends an invoice to the customer's email
+ address. The subscription starts immediately, unless the request includes
+ the optional `start_date`. Each individual subscription is associated with a particular location.
+
+ For more information, see [Create a subscription](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#create-a-subscription).
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location the subscription is associated with.
+
+ customer_id : str
+ The ID of the [customer](entity:Customer) subscribing to the subscription plan variation.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies this `CreateSubscription` request.
+ If you do not provide a unique string (or provide an empty string as the value),
+ the endpoint treats each request as independent.
+
+ For more information, see [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ plan_variation_id : typing.Optional[str]
+ The ID of the [subscription plan variation](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations#plan-variations) created using the Catalog API.
+
+ start_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date to start the subscription.
+ If it is unspecified, the subscription starts immediately.
+
+ canceled_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the newly created subscription is scheduled for cancellation.
+
+ This date overrides the cancellation date set in the plan variation configuration.
+ If the cancellation date is earlier than the end date of a subscription cycle, the subscription stops
+ at the canceled date and the subscriber is sent a prorated invoice at the beginning of the canceled cycle.
+
+ When the subscription plan of the newly created subscription has a fixed number of cycles and the `canceled_date`
+ occurs before the subscription plan completes, the specified `canceled_date` sets the date when the subscription
+ stops through the end of the last cycle.
+
+ tax_percentage : typing.Optional[str]
+ The tax to add when billing the subscription.
+ The percentage is expressed in decimal form, using a `'.'` as the decimal
+ separator and without a `'%'` sign. For example, a value of 7.5
+ corresponds to 7.5%.
+
+ price_override_money : typing.Optional[MoneyParams]
+ A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing.
+ This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead,
+ you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates).
+
+ card_id : typing.Optional[str]
+ The ID of the [subscriber's](entity:Customer) [card](entity:Card) to charge.
+ If it is not specified, the subscriber receives an invoice via email with a link to pay for their subscription.
+
+ timezone : typing.Optional[str]
+ The timezone that is used in date calculations for the subscription. If unset, defaults to
+ the location timezone. If a timezone is not configured for the location, defaults to "America/New_York".
+ Format: the IANA Timezone Database identifier for the location timezone. For
+ a list of time zones, see [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
+
+ source : typing.Optional[SubscriptionSourceParams]
+ The origination details of the subscription.
+
+ monthly_billing_anchor_date : typing.Optional[int]
+ The day-of-the-month to change the billing date to.
+
+ phases : typing.Optional[typing.Sequence[PhaseParams]]
+ array of phases for this subscription
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/subscriptions",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "location_id": location_id,
+ "plan_variation_id": plan_variation_id,
+ "customer_id": customer_id,
+ "start_date": start_date,
+ "canceled_date": canceled_date,
+ "tax_percentage": tax_percentage,
+ "price_override_money": convert_and_respect_annotation_metadata(
+ object_=price_override_money, annotation=MoneyParams, direction="write"
+ ),
+ "card_id": card_id,
+ "timezone": timezone,
+ "source": convert_and_respect_annotation_metadata(
+ object_=source, annotation=SubscriptionSourceParams, direction="write"
+ ),
+ "monthly_billing_anchor_date": monthly_billing_anchor_date,
+ "phases": convert_and_respect_annotation_metadata(
+ object_=phases, annotation=typing.Sequence[PhaseParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateSubscriptionResponse,
+ construct_type(
+ type_=CreateSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def bulk_swap_plan(
+ self,
+ *,
+ new_plan_variation_id: str,
+ old_plan_variation_id: str,
+ location_id: str,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BulkSwapPlanResponse]:
+ """
+ Schedules a plan variation change for all active subscriptions under a given plan
+ variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations).
+
+ Parameters
+ ----------
+ new_plan_variation_id : str
+ The ID of the new subscription plan variation.
+
+ This field is required.
+
+ old_plan_variation_id : str
+ The ID of the plan variation whose subscriptions should be swapped. Active subscriptions
+ using this plan variation will be subscribed to the new plan variation on their next billing
+ day.
+
+ location_id : str
+ The ID of the location to associate with the swapped subscriptions.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BulkSwapPlanResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/subscriptions/bulk-swap-plan",
+ method="POST",
+ json={
+ "new_plan_variation_id": new_plan_variation_id,
+ "old_plan_variation_id": old_plan_variation_id,
+ "location_id": location_id,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BulkSwapPlanResponse,
+ construct_type(
+ type_=BulkSwapPlanResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ query: typing.Optional[SearchSubscriptionsQueryParams] = OMIT,
+ include: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchSubscriptionsResponse]:
+ """
+ Searches for subscriptions.
+
+ Results are ordered chronologically by subscription creation date. If
+ the request specifies more than one location ID,
+ the endpoint orders the result
+ by location ID, and then by creation date within each location. If no locations are given
+ in the query, all locations are searched.
+
+ You can also optionally specify `customer_ids` to search by customer.
+ If left unset, all customers
+ associated with the specified locations are returned.
+ If the request specifies customer IDs, the endpoint orders results
+ first by location, within location by customer ID, and within
+ customer by subscription creation date.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ When the total number of resulting subscriptions exceeds the limit of a paged response,
+ specify the cursor returned from a preceding response here to fetch the next set of results.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The upper limit on the number of subscriptions to return
+ in a paged response.
+
+ query : typing.Optional[SearchSubscriptionsQueryParams]
+ A subscription query consisting of specified filtering conditions.
+
+ If this `query` field is unspecified, the `SearchSubscriptions` call will return all subscriptions.
+
+ include : typing.Optional[typing.Sequence[str]]
+ An option to include related information in the response.
+
+ The supported values are:
+
+ - `actions`: to include scheduled actions on the targeted subscriptions.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchSubscriptionsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/subscriptions/search",
+ method="POST",
+ json={
+ "cursor": cursor,
+ "limit": limit,
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchSubscriptionsQueryParams, direction="write"
+ ),
+ "include": include,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchSubscriptionsResponse,
+ construct_type(
+ type_=SearchSubscriptionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self,
+ subscription_id: str,
+ *,
+ include: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[GetSubscriptionResponse]:
+ """
+ Retrieves a specific subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to retrieve.
+
+ include : typing.Optional[str]
+ A query parameter to specify related information to be included in the response.
+
+ The supported query parameter values are:
+
+ - `actions`: to include scheduled actions on the targeted subscription.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}",
+ method="GET",
+ params={
+ "include": include,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetSubscriptionResponse,
+ construct_type(
+ type_=GetSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ subscription_id: str,
+ *,
+ subscription: typing.Optional[SubscriptionParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateSubscriptionResponse]:
+ """
+ Updates a subscription by modifying or clearing `subscription` field values.
+ To clear a field, set its value to `null`.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to update.
+
+ subscription : typing.Optional[SubscriptionParams]
+ The subscription object containing the current version, and fields to update.
+ Unset fields will be left at their current server values, and JSON `null` values will
+ be treated as a request to clear the relevant data.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}",
+ method="PUT",
+ json={
+ "subscription": convert_and_respect_annotation_metadata(
+ object_=subscription, annotation=SubscriptionParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateSubscriptionResponse,
+ construct_type(
+ type_=UpdateSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete_action(
+ self, subscription_id: str, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteSubscriptionActionResponse]:
+ """
+ Deletes a scheduled action for a subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription the targeted action is to act upon.
+
+ action_id : str
+ The ID of the targeted action to be deleted.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteSubscriptionActionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/actions/{jsonable_encoder(action_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteSubscriptionActionResponse,
+ construct_type(
+ type_=DeleteSubscriptionActionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def change_billing_anchor_date(
+ self,
+ subscription_id: str,
+ *,
+ monthly_billing_anchor_date: typing.Optional[int] = OMIT,
+ effective_date: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[ChangeBillingAnchorDateResponse]:
+ """
+ Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription-billing#billing-dates)
+ for a subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to update the billing anchor date.
+
+ monthly_billing_anchor_date : typing.Optional[int]
+ The anchor day for the billing cycle.
+
+ effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes
+ place on the subscription.
+
+ When this date is unspecified or falls within the current billing cycle, the billing anchor date
+ is changed immediately.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ChangeBillingAnchorDateResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/billing-anchor",
+ method="POST",
+ json={
+ "monthly_billing_anchor_date": monthly_billing_anchor_date,
+ "effective_date": effective_date,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ChangeBillingAnchorDateResponse,
+ construct_type(
+ type_=ChangeBillingAnchorDateResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def cancel(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[CancelSubscriptionResponse]:
+ """
+ Schedules a `CANCEL` action to cancel an active subscription. This
+ sets the `canceled_date` field to the end of the active billing period. After this date,
+ the subscription status changes from ACTIVE to CANCELED.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to cancel.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CancelSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelSubscriptionResponse,
+ construct_type(
+ type_=CancelSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def list_events(
+ self,
+ subscription_id: str,
+ *,
+ cursor: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]:
+ """
+ Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions-events) for a specific subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to retrieve the events for.
+
+ cursor : typing.Optional[str]
+ When the total number of resulting subscription events exceeds the limit of a paged response,
+ specify the cursor returned from a preceding response here to fetch the next set of results.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ limit : typing.Optional[int]
+ The upper limit on the number of subscription events to return
+ in a paged response.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/events",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListSubscriptionEventsResponse,
+ construct_type(
+ type_=ListSubscriptionEventsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.subscription_events
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list_events(
+ subscription_id,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def pause(
+ self,
+ subscription_id: str,
+ *,
+ pause_effective_date: typing.Optional[str] = OMIT,
+ pause_cycle_duration: typing.Optional[int] = OMIT,
+ resume_effective_date: typing.Optional[str] = OMIT,
+ resume_change_timing: typing.Optional[ChangeTiming] = OMIT,
+ pause_reason: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[PauseSubscriptionResponse]:
+ """
+ Schedules a `PAUSE` action to pause an active subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to pause.
+
+ pause_effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the scheduled `PAUSE` action takes place on the subscription.
+
+ When this date is unspecified or falls within the current billing cycle, the subscription is paused
+ on the starting date of the next billing cycle.
+
+ pause_cycle_duration : typing.Optional[int]
+ The number of billing cycles the subscription will be paused before it is reactivated.
+
+ When this is set, a `RESUME` action is also scheduled to take place on the subscription at
+ the end of the specified pause cycle duration. In this case, neither `resume_effective_date`
+ nor `resume_change_timing` may be specified.
+
+ resume_effective_date : typing.Optional[str]
+ The date when the subscription is reactivated by a scheduled `RESUME` action.
+ This date must be at least one billing cycle ahead of `pause_effective_date`.
+
+ resume_change_timing : typing.Optional[ChangeTiming]
+ The timing whether the subscription is reactivated immediately or at the end of the billing cycle, relative to
+ `resume_effective_date`.
+ See [ChangeTiming](#type-changetiming) for possible values
+
+ pause_reason : typing.Optional[str]
+ The user-provided reason to pause the subscription.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[PauseSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/pause",
+ method="POST",
+ json={
+ "pause_effective_date": pause_effective_date,
+ "pause_cycle_duration": pause_cycle_duration,
+ "resume_effective_date": resume_effective_date,
+ "resume_change_timing": resume_change_timing,
+ "pause_reason": pause_reason,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ PauseSubscriptionResponse,
+ construct_type(
+ type_=PauseSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def resume(
+ self,
+ subscription_id: str,
+ *,
+ resume_effective_date: typing.Optional[str] = OMIT,
+ resume_change_timing: typing.Optional[ChangeTiming] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[ResumeSubscriptionResponse]:
+ """
+ Schedules a `RESUME` action to resume a paused or a deactivated subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to resume.
+
+ resume_effective_date : typing.Optional[str]
+ The `YYYY-MM-DD`-formatted date when the subscription reactivated.
+
+ resume_change_timing : typing.Optional[ChangeTiming]
+ The timing to resume a subscription, relative to the specified
+ `resume_effective_date` attribute value.
+ See [ChangeTiming](#type-changetiming) for possible values
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ResumeSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/resume",
+ method="POST",
+ json={
+ "resume_effective_date": resume_effective_date,
+ "resume_change_timing": resume_change_timing,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ResumeSubscriptionResponse,
+ construct_type(
+ type_=ResumeSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def swap_plan(
+ self,
+ subscription_id: str,
+ *,
+ new_plan_variation_id: typing.Optional[str] = OMIT,
+ phases: typing.Optional[typing.Sequence[PhaseInputParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SwapPlanResponse]:
+ """
+ Schedules a `SWAP_PLAN` action to swap a subscription plan variation in an existing subscription.
+ For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations).
+
+ Parameters
+ ----------
+ subscription_id : str
+ The ID of the subscription to swap the subscription plan for.
+
+ new_plan_variation_id : typing.Optional[str]
+ The ID of the new subscription plan variation.
+
+ This field is required.
+
+ phases : typing.Optional[typing.Sequence[PhaseInputParams]]
+ A list of PhaseInputs, to pass phase-specific information used in the swap.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SwapPlanResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/subscriptions/{jsonable_encoder(subscription_id)}/swap-plan",
+ method="POST",
+ json={
+ "new_plan_variation_id": new_plan_variation_id,
+ "phases": convert_and_respect_annotation_metadata(
+ object_=phases, annotation=typing.Optional[typing.Sequence[PhaseInputParams]], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SwapPlanResponse,
+ construct_type(
+ type_=SwapPlanResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/team/__init__.py b/src/square/team/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/team/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/team/client.py b/src/square/team/client.py
new file mode 100644
index 00000000..00da1e88
--- /dev/null
+++ b/src/square/team/client.py
@@ -0,0 +1,379 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..requests.job import JobParams
+from ..types.create_job_response import CreateJobResponse
+from ..types.list_jobs_response import ListJobsResponse
+from ..types.retrieve_job_response import RetrieveJobResponse
+from ..types.update_job_response import UpdateJobResponse
+from .raw_client import AsyncRawTeamClient, RawTeamClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class TeamClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawTeamClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawTeamClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawTeamClient
+ """
+ return self._raw_client
+
+ def list_jobs(
+ self, *, cursor: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> ListJobsResponse:
+ """
+ Lists jobs in a seller account. Results are sorted by title in ascending order.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ The pagination cursor returned by the previous call to this endpoint. Provide this
+ cursor to retrieve the next page of results for your original request. For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListJobsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team.list_jobs(
+ cursor="cursor",
+ )
+ """
+ _response = self._raw_client.list_jobs(cursor=cursor, request_options=request_options)
+ return _response.data
+
+ def create_job(
+ self, *, job: JobParams, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> CreateJobResponse:
+ """
+ Creates a job in a seller account. A job defines a title and tip eligibility. Note that
+ compensation is defined in a [job assignment](entity:JobAssignment) in a team member's wage setting.
+
+ Parameters
+ ----------
+ job : JobParams
+ The job to create. The `title` field is required and `is_tip_eligible` defaults to true.
+
+ idempotency_key : str
+ A unique identifier for the `CreateJob` request. Keys can be any valid string,
+ but must be unique for each request. For more information, see
+ [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateJobResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team.create_job(
+ job={"title": "Cashier", "is_tip_eligible": True},
+ idempotency_key="idempotency-key-0",
+ )
+ """
+ _response = self._raw_client.create_job(
+ job=job, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def retrieve_job(
+ self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveJobResponse:
+ """
+ Retrieves a specified job.
+
+ Parameters
+ ----------
+ job_id : str
+ The ID of the job to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveJobResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team.retrieve_job(
+ job_id="job_id",
+ )
+ """
+ _response = self._raw_client.retrieve_job(job_id, request_options=request_options)
+ return _response.data
+
+ def update_job(
+ self, job_id: str, *, job: JobParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateJobResponse:
+ """
+ Updates the title or tip eligibility of a job. Changes to the title propagate to all
+ `JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to
+ tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID.
+
+ Parameters
+ ----------
+ job_id : str
+ The ID of the job to update.
+
+ job : JobParams
+ The job with the updated fields, either `title`, `is_tip_eligible`, or both. Only changed fields need
+ to be included in the request. Optionally include `version` to enable optimistic concurrency control.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateJobResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team.update_job(
+ job_id="job_id",
+ job={"title": "Cashier 1", "is_tip_eligible": True},
+ )
+ """
+ _response = self._raw_client.update_job(job_id, job=job, request_options=request_options)
+ return _response.data
+
+
+class AsyncTeamClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawTeamClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawTeamClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawTeamClient
+ """
+ return self._raw_client
+
+ async def list_jobs(
+ self, *, cursor: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> ListJobsResponse:
+ """
+ Lists jobs in a seller account. Results are sorted by title in ascending order.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ The pagination cursor returned by the previous call to this endpoint. Provide this
+ cursor to retrieve the next page of results for your original request. For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListJobsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team.list_jobs(
+ cursor="cursor",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.list_jobs(cursor=cursor, request_options=request_options)
+ return _response.data
+
+ async def create_job(
+ self, *, job: JobParams, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> CreateJobResponse:
+ """
+ Creates a job in a seller account. A job defines a title and tip eligibility. Note that
+ compensation is defined in a [job assignment](entity:JobAssignment) in a team member's wage setting.
+
+ Parameters
+ ----------
+ job : JobParams
+ The job to create. The `title` field is required and `is_tip_eligible` defaults to true.
+
+ idempotency_key : str
+ A unique identifier for the `CreateJob` request. Keys can be any valid string,
+ but must be unique for each request. For more information, see
+ [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateJobResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team.create_job(
+ job={"title": "Cashier", "is_tip_eligible": True},
+ idempotency_key="idempotency-key-0",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create_job(
+ job=job, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def retrieve_job(
+ self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveJobResponse:
+ """
+ Retrieves a specified job.
+
+ Parameters
+ ----------
+ job_id : str
+ The ID of the job to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveJobResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team.retrieve_job(
+ job_id="job_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.retrieve_job(job_id, request_options=request_options)
+ return _response.data
+
+ async def update_job(
+ self, job_id: str, *, job: JobParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> UpdateJobResponse:
+ """
+ Updates the title or tip eligibility of a job. Changes to the title propagate to all
+ `JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to
+ tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID.
+
+ Parameters
+ ----------
+ job_id : str
+ The ID of the job to update.
+
+ job : JobParams
+ The job with the updated fields, either `title`, `is_tip_eligible`, or both. Only changed fields need
+ to be included in the request. Optionally include `version` to enable optimistic concurrency control.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateJobResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team.update_job(
+ job_id="job_id",
+ job={"title": "Cashier 1", "is_tip_eligible": True},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update_job(job_id, job=job, request_options=request_options)
+ return _response.data
diff --git a/src/square/team/raw_client.py b/src/square/team/raw_client.py
new file mode 100644
index 00000000..cdcbd1e7
--- /dev/null
+++ b/src/square/team/raw_client.py
@@ -0,0 +1,406 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.job import JobParams
+from ..types.create_job_response import CreateJobResponse
+from ..types.list_jobs_response import ListJobsResponse
+from ..types.retrieve_job_response import RetrieveJobResponse
+from ..types.update_job_response import UpdateJobResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawTeamClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list_jobs(
+ self, *, cursor: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[ListJobsResponse]:
+ """
+ Lists jobs in a seller account. Results are sorted by title in ascending order.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ The pagination cursor returned by the previous call to this endpoint. Provide this
+ cursor to retrieve the next page of results for your original request. For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ListJobsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/team-members/jobs",
+ method="GET",
+ params={
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListJobsResponse,
+ construct_type(
+ type_=ListJobsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create_job(
+ self, *, job: JobParams, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[CreateJobResponse]:
+ """
+ Creates a job in a seller account. A job defines a title and tip eligibility. Note that
+ compensation is defined in a [job assignment](entity:JobAssignment) in a team member's wage setting.
+
+ Parameters
+ ----------
+ job : JobParams
+ The job to create. The `title` field is required and `is_tip_eligible` defaults to true.
+
+ idempotency_key : str
+ A unique identifier for the `CreateJob` request. Keys can be any valid string,
+ but must be unique for each request. For more information, see
+ [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateJobResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/team-members/jobs",
+ method="POST",
+ json={
+ "job": convert_and_respect_annotation_metadata(object_=job, annotation=JobParams, direction="write"),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateJobResponse,
+ construct_type(
+ type_=CreateJobResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def retrieve_job(
+ self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RetrieveJobResponse]:
+ """
+ Retrieves a specified job.
+
+ Parameters
+ ----------
+ job_id : str
+ The ID of the job to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveJobResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/team-members/jobs/{jsonable_encoder(job_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveJobResponse,
+ construct_type(
+ type_=RetrieveJobResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update_job(
+ self, job_id: str, *, job: JobParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[UpdateJobResponse]:
+ """
+ Updates the title or tip eligibility of a job. Changes to the title propagate to all
+ `JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to
+ tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID.
+
+ Parameters
+ ----------
+ job_id : str
+ The ID of the job to update.
+
+ job : JobParams
+ The job with the updated fields, either `title`, `is_tip_eligible`, or both. Only changed fields need
+ to be included in the request. Optionally include `version` to enable optimistic concurrency control.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateJobResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/team-members/jobs/{jsonable_encoder(job_id)}",
+ method="PUT",
+ json={
+ "job": convert_and_respect_annotation_metadata(object_=job, annotation=JobParams, direction="write"),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateJobResponse,
+ construct_type(
+ type_=UpdateJobResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawTeamClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list_jobs(
+ self, *, cursor: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[ListJobsResponse]:
+ """
+ Lists jobs in a seller account. Results are sorted by title in ascending order.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ The pagination cursor returned by the previous call to this endpoint. Provide this
+ cursor to retrieve the next page of results for your original request. For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ListJobsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/team-members/jobs",
+ method="GET",
+ params={
+ "cursor": cursor,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListJobsResponse,
+ construct_type(
+ type_=ListJobsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create_job(
+ self, *, job: JobParams, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[CreateJobResponse]:
+ """
+ Creates a job in a seller account. A job defines a title and tip eligibility. Note that
+ compensation is defined in a [job assignment](entity:JobAssignment) in a team member's wage setting.
+
+ Parameters
+ ----------
+ job : JobParams
+ The job to create. The `title` field is required and `is_tip_eligible` defaults to true.
+
+ idempotency_key : str
+ A unique identifier for the `CreateJob` request. Keys can be any valid string,
+ but must be unique for each request. For more information, see
+ [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateJobResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/team-members/jobs",
+ method="POST",
+ json={
+ "job": convert_and_respect_annotation_metadata(object_=job, annotation=JobParams, direction="write"),
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateJobResponse,
+ construct_type(
+ type_=CreateJobResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def retrieve_job(
+ self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RetrieveJobResponse]:
+ """
+ Retrieves a specified job.
+
+ Parameters
+ ----------
+ job_id : str
+ The ID of the job to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveJobResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/team-members/jobs/{jsonable_encoder(job_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveJobResponse,
+ construct_type(
+ type_=RetrieveJobResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update_job(
+ self, job_id: str, *, job: JobParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[UpdateJobResponse]:
+ """
+ Updates the title or tip eligibility of a job. Changes to the title propagate to all
+ `JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to
+ tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID.
+
+ Parameters
+ ----------
+ job_id : str
+ The ID of the job to update.
+
+ job : JobParams
+ The job with the updated fields, either `title`, `is_tip_eligible`, or both. Only changed fields need
+ to be included in the request. Optionally include `version` to enable optimistic concurrency control.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateJobResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/team-members/jobs/{jsonable_encoder(job_id)}",
+ method="PUT",
+ json={
+ "job": convert_and_respect_annotation_metadata(object_=job, annotation=JobParams, direction="write"),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateJobResponse,
+ construct_type(
+ type_=UpdateJobResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/team_members/__init__.py b/src/square/team_members/__init__.py
new file mode 100644
index 00000000..9ab60957
--- /dev/null
+++ b/src/square/team_members/__init__.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import wage_setting
+_dynamic_imports: typing.Dict[str, str] = {"wage_setting": ".wage_setting"}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["wage_setting"]
diff --git a/src/square/team_members/client.py b/src/square/team_members/client.py
new file mode 100644
index 00000000..9dc0559c
--- /dev/null
+++ b/src/square/team_members/client.py
@@ -0,0 +1,888 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..requests.create_team_member_request import CreateTeamMemberRequestParams
+from ..requests.search_team_members_query import SearchTeamMembersQueryParams
+from ..requests.team_member import TeamMemberParams
+from ..requests.update_team_member_request import UpdateTeamMemberRequestParams
+from ..types.batch_create_team_members_response import BatchCreateTeamMembersResponse
+from ..types.batch_update_team_members_response import BatchUpdateTeamMembersResponse
+from ..types.create_team_member_response import CreateTeamMemberResponse
+from ..types.get_team_member_response import GetTeamMemberResponse
+from ..types.search_team_members_response import SearchTeamMembersResponse
+from ..types.update_team_member_response import UpdateTeamMemberResponse
+from .raw_client import AsyncRawTeamMembersClient, RawTeamMembersClient
+
+if typing.TYPE_CHECKING:
+ from .wage_setting.client import AsyncWageSettingClient, WageSettingClient
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class TeamMembersClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawTeamMembersClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._wage_setting: typing.Optional[WageSettingClient] = None
+
+ @property
+ def with_raw_response(self) -> RawTeamMembersClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawTeamMembersClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ team_member: typing.Optional[TeamMemberParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTeamMemberResponse:
+ """
+ Creates a single `TeamMember` object. The `TeamMember` object is returned on successful creates.
+ You must provide the following values in your request to this endpoint:
+ - `given_name`
+ - `family_name`
+
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#createteammember).
+
+ Parameters
+ ----------
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies this `CreateTeamMember` request.
+ Keys can be any valid string, but must be unique for every request.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ The minimum length is 1 and the maximum length is 45.
+
+ team_member : typing.Optional[TeamMemberParams]
+ **Required** The data used to create the `TeamMember` object. If you include `wage_setting`, you must provide
+ `job_id` for each job assignment. To get job IDs, call [ListJobs](api-endpoint:Team-ListJobs).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTeamMemberResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team_members.create(
+ idempotency_key="idempotency-key-0",
+ team_member={
+ "reference_id": "reference_id_1",
+ "status": "ACTIVE",
+ "given_name": "Joe",
+ "family_name": "Doe",
+ "email_address": "joe_doe@gmail.com",
+ "phone_number": "+14159283333",
+ "assigned_locations": {
+ "assignment_type": "EXPLICIT_LOCATIONS",
+ "location_ids": ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"],
+ },
+ "wage_setting": {
+ "job_assignments": [
+ {
+ "pay_type": "SALARY",
+ "annual_rate": {"amount": 3000000, "currency": "USD"},
+ "weekly_hours": 40,
+ "job_id": "FjS8x95cqHiMenw4f1NAUH4P",
+ },
+ {
+ "pay_type": "HOURLY",
+ "hourly_rate": {"amount": 2000, "currency": "USD"},
+ "job_id": "VDNpRv8da51NU8qZFC5zDWpF",
+ },
+ ],
+ "is_overtime_exempt": True,
+ },
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ idempotency_key=idempotency_key, team_member=team_member, request_options=request_options
+ )
+ return _response.data
+
+ def batch_create(
+ self,
+ *,
+ team_members: typing.Dict[str, CreateTeamMemberRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchCreateTeamMembersResponse:
+ """
+ Creates multiple `TeamMember` objects. The created `TeamMember` objects are returned on successful creates.
+ This process is non-transactional and processes as much of the request as possible. If one of the creates in
+ the request cannot be successfully processed, the request is not marked as failed, but the body of the response
+ contains explicit error information for the failed create.
+
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-team-members).
+
+ Parameters
+ ----------
+ team_members : typing.Dict[str, CreateTeamMemberRequestParams]
+ The data used to create the `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`.
+ The maximum number of create objects is 25.
+
+ If you include a team member's `wage_setting`, you must provide `job_id` for each job assignment. To get job IDs,
+ call [ListJobs](api-endpoint:Team-ListJobs).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchCreateTeamMembersResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team_members.batch_create(
+ team_members={
+ "idempotency-key-1": {
+ "team_member": {
+ "reference_id": "reference_id_1",
+ "given_name": "Joe",
+ "family_name": "Doe",
+ "email_address": "joe_doe@gmail.com",
+ "phone_number": "+14159283333",
+ "assigned_locations": {
+ "assignment_type": "EXPLICIT_LOCATIONS",
+ "location_ids": ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"],
+ },
+ }
+ },
+ "idempotency-key-2": {
+ "team_member": {
+ "reference_id": "reference_id_2",
+ "given_name": "Jane",
+ "family_name": "Smith",
+ "email_address": "jane_smith@gmail.com",
+ "phone_number": "+14159223334",
+ "assigned_locations": {
+ "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
+ },
+ }
+ },
+ },
+ )
+ """
+ _response = self._raw_client.batch_create(team_members=team_members, request_options=request_options)
+ return _response.data
+
+ def batch_update(
+ self,
+ *,
+ team_members: typing.Dict[str, UpdateTeamMemberRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchUpdateTeamMembersResponse:
+ """
+ Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful updates.
+ This process is non-transactional and processes as much of the request as possible. If one of the updates in
+ the request cannot be successfully processed, the request is not marked as failed, but the body of the response
+ contains explicit error information for the failed update.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-team-members).
+
+ Parameters
+ ----------
+ team_members : typing.Dict[str, UpdateTeamMemberRequestParams]
+ The data used to update the `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`.
+ The maximum number of update objects is 25.
+
+ For each team member, include the fields to add, change, or clear. Fields can be cleared using a null value.
+ To update `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed,
+ call [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchUpdateTeamMembersResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team_members.batch_update(
+ team_members={
+ "AFMwA08kR-MIF-3Vs0OE": {
+ "team_member": {
+ "reference_id": "reference_id_2",
+ "is_owner": False,
+ "status": "ACTIVE",
+ "given_name": "Jane",
+ "family_name": "Smith",
+ "email_address": "jane_smith@gmail.com",
+ "phone_number": "+14159223334",
+ "assigned_locations": {
+ "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
+ },
+ }
+ },
+ "fpgteZNMaf0qOK-a4t6P": {
+ "team_member": {
+ "reference_id": "reference_id_1",
+ "is_owner": False,
+ "status": "ACTIVE",
+ "given_name": "Joe",
+ "family_name": "Doe",
+ "email_address": "joe_doe@gmail.com",
+ "phone_number": "+14159283333",
+ "assigned_locations": {
+ "assignment_type": "EXPLICIT_LOCATIONS",
+ "location_ids": ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"],
+ },
+ }
+ },
+ },
+ )
+ """
+ _response = self._raw_client.batch_update(team_members=team_members, request_options=request_options)
+ return _response.data
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[SearchTeamMembersQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchTeamMembersResponse:
+ """
+ Returns a paginated list of `TeamMember` objects for a business.
+ The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether
+ the team member is the Square account owner.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchTeamMembersQueryParams]
+ The query parameters.
+
+ limit : typing.Optional[int]
+ The maximum number of `TeamMember` objects in a page (100 by default).
+
+ cursor : typing.Optional[str]
+ The opaque cursor for fetching the next page. For more information, see
+ [pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchTeamMembersResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team_members.search(
+ query={"filter": {"location_ids": ["0G5P3VGACMMQZ"], "status": "ACTIVE"}},
+ limit=10,
+ )
+ """
+ _response = self._raw_client.search(query=query, limit=limit, cursor=cursor, request_options=request_options)
+ return _response.data
+
+ def get(
+ self, team_member_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTeamMemberResponse:
+ """
+ Retrieves a `TeamMember` object for the given `TeamMember.id`.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-team-member).
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTeamMemberResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team_members.get(
+ team_member_id="team_member_id",
+ )
+ """
+ _response = self._raw_client.get(team_member_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ team_member_id: str,
+ *,
+ team_member: typing.Optional[TeamMemberParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateTeamMemberResponse:
+ """
+ Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#update-a-team-member).
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member to update.
+
+ team_member : typing.Optional[TeamMemberParams]
+ The team member fields to add, change, or clear. Fields can be cleared using a null value. To update
+ `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed, call
+ [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateTeamMemberResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team_members.update(
+ team_member_id="team_member_id",
+ team_member={
+ "reference_id": "reference_id_1",
+ "status": "ACTIVE",
+ "given_name": "Joe",
+ "family_name": "Doe",
+ "email_address": "joe_doe@gmail.com",
+ "phone_number": "+14159283333",
+ "assigned_locations": {
+ "assignment_type": "EXPLICIT_LOCATIONS",
+ "location_ids": ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"],
+ },
+ "wage_setting": {
+ "job_assignments": [
+ {
+ "pay_type": "SALARY",
+ "annual_rate": {"amount": 3000000, "currency": "USD"},
+ "weekly_hours": 40,
+ "job_id": "FjS8x95cqHiMenw4f1NAUH4P",
+ },
+ {
+ "pay_type": "HOURLY",
+ "hourly_rate": {"amount": 1200, "currency": "USD"},
+ "job_id": "VDNpRv8da51NU8qZFC5zDWpF",
+ },
+ ],
+ "is_overtime_exempt": True,
+ },
+ },
+ )
+ """
+ _response = self._raw_client.update(team_member_id, team_member=team_member, request_options=request_options)
+ return _response.data
+
+ @property
+ def wage_setting(self):
+ if self._wage_setting is None:
+ from .wage_setting.client import WageSettingClient # noqa: E402
+
+ self._wage_setting = WageSettingClient(client_wrapper=self._client_wrapper)
+ return self._wage_setting
+
+
+class AsyncTeamMembersClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawTeamMembersClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._wage_setting: typing.Optional[AsyncWageSettingClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawTeamMembersClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawTeamMembersClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ team_member: typing.Optional[TeamMemberParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTeamMemberResponse:
+ """
+ Creates a single `TeamMember` object. The `TeamMember` object is returned on successful creates.
+ You must provide the following values in your request to this endpoint:
+ - `given_name`
+ - `family_name`
+
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#createteammember).
+
+ Parameters
+ ----------
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies this `CreateTeamMember` request.
+ Keys can be any valid string, but must be unique for every request.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ The minimum length is 1 and the maximum length is 45.
+
+ team_member : typing.Optional[TeamMemberParams]
+ **Required** The data used to create the `TeamMember` object. If you include `wage_setting`, you must provide
+ `job_id` for each job assignment. To get job IDs, call [ListJobs](api-endpoint:Team-ListJobs).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTeamMemberResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team_members.create(
+ idempotency_key="idempotency-key-0",
+ team_member={
+ "reference_id": "reference_id_1",
+ "status": "ACTIVE",
+ "given_name": "Joe",
+ "family_name": "Doe",
+ "email_address": "joe_doe@gmail.com",
+ "phone_number": "+14159283333",
+ "assigned_locations": {
+ "assignment_type": "EXPLICIT_LOCATIONS",
+ "location_ids": ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"],
+ },
+ "wage_setting": {
+ "job_assignments": [
+ {
+ "pay_type": "SALARY",
+ "annual_rate": {"amount": 3000000, "currency": "USD"},
+ "weekly_hours": 40,
+ "job_id": "FjS8x95cqHiMenw4f1NAUH4P",
+ },
+ {
+ "pay_type": "HOURLY",
+ "hourly_rate": {"amount": 2000, "currency": "USD"},
+ "job_id": "VDNpRv8da51NU8qZFC5zDWpF",
+ },
+ ],
+ "is_overtime_exempt": True,
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ idempotency_key=idempotency_key, team_member=team_member, request_options=request_options
+ )
+ return _response.data
+
+ async def batch_create(
+ self,
+ *,
+ team_members: typing.Dict[str, CreateTeamMemberRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchCreateTeamMembersResponse:
+ """
+ Creates multiple `TeamMember` objects. The created `TeamMember` objects are returned on successful creates.
+ This process is non-transactional and processes as much of the request as possible. If one of the creates in
+ the request cannot be successfully processed, the request is not marked as failed, but the body of the response
+ contains explicit error information for the failed create.
+
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-team-members).
+
+ Parameters
+ ----------
+ team_members : typing.Dict[str, CreateTeamMemberRequestParams]
+ The data used to create the `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`.
+ The maximum number of create objects is 25.
+
+ If you include a team member's `wage_setting`, you must provide `job_id` for each job assignment. To get job IDs,
+ call [ListJobs](api-endpoint:Team-ListJobs).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchCreateTeamMembersResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team_members.batch_create(
+ team_members={
+ "idempotency-key-1": {
+ "team_member": {
+ "reference_id": "reference_id_1",
+ "given_name": "Joe",
+ "family_name": "Doe",
+ "email_address": "joe_doe@gmail.com",
+ "phone_number": "+14159283333",
+ "assigned_locations": {
+ "assignment_type": "EXPLICIT_LOCATIONS",
+ "location_ids": ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"],
+ },
+ }
+ },
+ "idempotency-key-2": {
+ "team_member": {
+ "reference_id": "reference_id_2",
+ "given_name": "Jane",
+ "family_name": "Smith",
+ "email_address": "jane_smith@gmail.com",
+ "phone_number": "+14159223334",
+ "assigned_locations": {
+ "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
+ },
+ }
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_create(team_members=team_members, request_options=request_options)
+ return _response.data
+
+ async def batch_update(
+ self,
+ *,
+ team_members: typing.Dict[str, UpdateTeamMemberRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchUpdateTeamMembersResponse:
+ """
+ Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful updates.
+ This process is non-transactional and processes as much of the request as possible. If one of the updates in
+ the request cannot be successfully processed, the request is not marked as failed, but the body of the response
+ contains explicit error information for the failed update.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-team-members).
+
+ Parameters
+ ----------
+ team_members : typing.Dict[str, UpdateTeamMemberRequestParams]
+ The data used to update the `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`.
+ The maximum number of update objects is 25.
+
+ For each team member, include the fields to add, change, or clear. Fields can be cleared using a null value.
+ To update `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed,
+ call [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchUpdateTeamMembersResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team_members.batch_update(
+ team_members={
+ "AFMwA08kR-MIF-3Vs0OE": {
+ "team_member": {
+ "reference_id": "reference_id_2",
+ "is_owner": False,
+ "status": "ACTIVE",
+ "given_name": "Jane",
+ "family_name": "Smith",
+ "email_address": "jane_smith@gmail.com",
+ "phone_number": "+14159223334",
+ "assigned_locations": {
+ "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
+ },
+ }
+ },
+ "fpgteZNMaf0qOK-a4t6P": {
+ "team_member": {
+ "reference_id": "reference_id_1",
+ "is_owner": False,
+ "status": "ACTIVE",
+ "given_name": "Joe",
+ "family_name": "Doe",
+ "email_address": "joe_doe@gmail.com",
+ "phone_number": "+14159283333",
+ "assigned_locations": {
+ "assignment_type": "EXPLICIT_LOCATIONS",
+ "location_ids": ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"],
+ },
+ }
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_update(team_members=team_members, request_options=request_options)
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[SearchTeamMembersQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchTeamMembersResponse:
+ """
+ Returns a paginated list of `TeamMember` objects for a business.
+ The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether
+ the team member is the Square account owner.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchTeamMembersQueryParams]
+ The query parameters.
+
+ limit : typing.Optional[int]
+ The maximum number of `TeamMember` objects in a page (100 by default).
+
+ cursor : typing.Optional[str]
+ The opaque cursor for fetching the next page. For more information, see
+ [pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchTeamMembersResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team_members.search(
+ query={
+ "filter": {"location_ids": ["0G5P3VGACMMQZ"], "status": "ACTIVE"}
+ },
+ limit=10,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ query=query, limit=limit, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, team_member_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTeamMemberResponse:
+ """
+ Retrieves a `TeamMember` object for the given `TeamMember.id`.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-team-member).
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTeamMemberResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team_members.get(
+ team_member_id="team_member_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(team_member_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ team_member_id: str,
+ *,
+ team_member: typing.Optional[TeamMemberParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateTeamMemberResponse:
+ """
+ Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#update-a-team-member).
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member to update.
+
+ team_member : typing.Optional[TeamMemberParams]
+ The team member fields to add, change, or clear. Fields can be cleared using a null value. To update
+ `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed, call
+ [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateTeamMemberResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team_members.update(
+ team_member_id="team_member_id",
+ team_member={
+ "reference_id": "reference_id_1",
+ "status": "ACTIVE",
+ "given_name": "Joe",
+ "family_name": "Doe",
+ "email_address": "joe_doe@gmail.com",
+ "phone_number": "+14159283333",
+ "assigned_locations": {
+ "assignment_type": "EXPLICIT_LOCATIONS",
+ "location_ids": ["YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT"],
+ },
+ "wage_setting": {
+ "job_assignments": [
+ {
+ "pay_type": "SALARY",
+ "annual_rate": {"amount": 3000000, "currency": "USD"},
+ "weekly_hours": 40,
+ "job_id": "FjS8x95cqHiMenw4f1NAUH4P",
+ },
+ {
+ "pay_type": "HOURLY",
+ "hourly_rate": {"amount": 1200, "currency": "USD"},
+ "job_id": "VDNpRv8da51NU8qZFC5zDWpF",
+ },
+ ],
+ "is_overtime_exempt": True,
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ team_member_id, team_member=team_member, request_options=request_options
+ )
+ return _response.data
+
+ @property
+ def wage_setting(self):
+ if self._wage_setting is None:
+ from .wage_setting.client import AsyncWageSettingClient # noqa: E402
+
+ self._wage_setting = AsyncWageSettingClient(client_wrapper=self._client_wrapper)
+ return self._wage_setting
diff --git a/src/square/team_members/raw_client.py b/src/square/team_members/raw_client.py
new file mode 100644
index 00000000..29a9b11f
--- /dev/null
+++ b/src/square/team_members/raw_client.py
@@ -0,0 +1,725 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.create_team_member_request import CreateTeamMemberRequestParams
+from ..requests.search_team_members_query import SearchTeamMembersQueryParams
+from ..requests.team_member import TeamMemberParams
+from ..requests.update_team_member_request import UpdateTeamMemberRequestParams
+from ..types.batch_create_team_members_response import BatchCreateTeamMembersResponse
+from ..types.batch_update_team_members_response import BatchUpdateTeamMembersResponse
+from ..types.create_team_member_response import CreateTeamMemberResponse
+from ..types.get_team_member_response import GetTeamMemberResponse
+from ..types.search_team_members_response import SearchTeamMembersResponse
+from ..types.update_team_member_response import UpdateTeamMemberResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawTeamMembersClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ team_member: typing.Optional[TeamMemberParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateTeamMemberResponse]:
+ """
+ Creates a single `TeamMember` object. The `TeamMember` object is returned on successful creates.
+ You must provide the following values in your request to this endpoint:
+ - `given_name`
+ - `family_name`
+
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#createteammember).
+
+ Parameters
+ ----------
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies this `CreateTeamMember` request.
+ Keys can be any valid string, but must be unique for every request.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ The minimum length is 1 and the maximum length is 45.
+
+ team_member : typing.Optional[TeamMemberParams]
+ **Required** The data used to create the `TeamMember` object. If you include `wage_setting`, you must provide
+ `job_id` for each job assignment. To get job IDs, call [ListJobs](api-endpoint:Team-ListJobs).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateTeamMemberResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/team-members",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "team_member": convert_and_respect_annotation_metadata(
+ object_=team_member, annotation=TeamMemberParams, direction="write"
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTeamMemberResponse,
+ construct_type(
+ type_=CreateTeamMemberResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_create(
+ self,
+ *,
+ team_members: typing.Dict[str, CreateTeamMemberRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BatchCreateTeamMembersResponse]:
+ """
+ Creates multiple `TeamMember` objects. The created `TeamMember` objects are returned on successful creates.
+ This process is non-transactional and processes as much of the request as possible. If one of the creates in
+ the request cannot be successfully processed, the request is not marked as failed, but the body of the response
+ contains explicit error information for the failed create.
+
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-team-members).
+
+ Parameters
+ ----------
+ team_members : typing.Dict[str, CreateTeamMemberRequestParams]
+ The data used to create the `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`.
+ The maximum number of create objects is 25.
+
+ If you include a team member's `wage_setting`, you must provide `job_id` for each job assignment. To get job IDs,
+ call [ListJobs](api-endpoint:Team-ListJobs).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchCreateTeamMembersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/team-members/bulk-create",
+ method="POST",
+ json={
+ "team_members": convert_and_respect_annotation_metadata(
+ object_=team_members, annotation=typing.Dict[str, CreateTeamMemberRequestParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchCreateTeamMembersResponse,
+ construct_type(
+ type_=BatchCreateTeamMembersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_update(
+ self,
+ *,
+ team_members: typing.Dict[str, UpdateTeamMemberRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BatchUpdateTeamMembersResponse]:
+ """
+ Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful updates.
+ This process is non-transactional and processes as much of the request as possible. If one of the updates in
+ the request cannot be successfully processed, the request is not marked as failed, but the body of the response
+ contains explicit error information for the failed update.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-team-members).
+
+ Parameters
+ ----------
+ team_members : typing.Dict[str, UpdateTeamMemberRequestParams]
+ The data used to update the `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`.
+ The maximum number of update objects is 25.
+
+ For each team member, include the fields to add, change, or clear. Fields can be cleared using a null value.
+ To update `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed,
+ call [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchUpdateTeamMembersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/team-members/bulk-update",
+ method="POST",
+ json={
+ "team_members": convert_and_respect_annotation_metadata(
+ object_=team_members, annotation=typing.Dict[str, UpdateTeamMemberRequestParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchUpdateTeamMembersResponse,
+ construct_type(
+ type_=BatchUpdateTeamMembersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[SearchTeamMembersQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchTeamMembersResponse]:
+ """
+ Returns a paginated list of `TeamMember` objects for a business.
+ The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether
+ the team member is the Square account owner.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchTeamMembersQueryParams]
+ The query parameters.
+
+ limit : typing.Optional[int]
+ The maximum number of `TeamMember` objects in a page (100 by default).
+
+ cursor : typing.Optional[str]
+ The opaque cursor for fetching the next page. For more information, see
+ [pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchTeamMembersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/team-members/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchTeamMembersQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchTeamMembersResponse,
+ construct_type(
+ type_=SearchTeamMembersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, team_member_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetTeamMemberResponse]:
+ """
+ Retrieves a `TeamMember` object for the given `TeamMember.id`.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-team-member).
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetTeamMemberResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/team-members/{jsonable_encoder(team_member_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTeamMemberResponse,
+ construct_type(
+ type_=GetTeamMemberResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ team_member_id: str,
+ *,
+ team_member: typing.Optional[TeamMemberParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateTeamMemberResponse]:
+ """
+ Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#update-a-team-member).
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member to update.
+
+ team_member : typing.Optional[TeamMemberParams]
+ The team member fields to add, change, or clear. Fields can be cleared using a null value. To update
+ `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed, call
+ [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateTeamMemberResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/team-members/{jsonable_encoder(team_member_id)}",
+ method="PUT",
+ json={
+ "team_member": convert_and_respect_annotation_metadata(
+ object_=team_member, annotation=TeamMemberParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateTeamMemberResponse,
+ construct_type(
+ type_=UpdateTeamMemberResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawTeamMembersClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ team_member: typing.Optional[TeamMemberParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateTeamMemberResponse]:
+ """
+ Creates a single `TeamMember` object. The `TeamMember` object is returned on successful creates.
+ You must provide the following values in your request to this endpoint:
+ - `given_name`
+ - `family_name`
+
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#createteammember).
+
+ Parameters
+ ----------
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies this `CreateTeamMember` request.
+ Keys can be any valid string, but must be unique for every request.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ The minimum length is 1 and the maximum length is 45.
+
+ team_member : typing.Optional[TeamMemberParams]
+ **Required** The data used to create the `TeamMember` object. If you include `wage_setting`, you must provide
+ `job_id` for each job assignment. To get job IDs, call [ListJobs](api-endpoint:Team-ListJobs).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateTeamMemberResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/team-members",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "team_member": convert_and_respect_annotation_metadata(
+ object_=team_member, annotation=TeamMemberParams, direction="write"
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTeamMemberResponse,
+ construct_type(
+ type_=CreateTeamMemberResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_create(
+ self,
+ *,
+ team_members: typing.Dict[str, CreateTeamMemberRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BatchCreateTeamMembersResponse]:
+ """
+ Creates multiple `TeamMember` objects. The created `TeamMember` objects are returned on successful creates.
+ This process is non-transactional and processes as much of the request as possible. If one of the creates in
+ the request cannot be successfully processed, the request is not marked as failed, but the body of the response
+ contains explicit error information for the failed create.
+
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-team-members).
+
+ Parameters
+ ----------
+ team_members : typing.Dict[str, CreateTeamMemberRequestParams]
+ The data used to create the `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`.
+ The maximum number of create objects is 25.
+
+ If you include a team member's `wage_setting`, you must provide `job_id` for each job assignment. To get job IDs,
+ call [ListJobs](api-endpoint:Team-ListJobs).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchCreateTeamMembersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/team-members/bulk-create",
+ method="POST",
+ json={
+ "team_members": convert_and_respect_annotation_metadata(
+ object_=team_members, annotation=typing.Dict[str, CreateTeamMemberRequestParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchCreateTeamMembersResponse,
+ construct_type(
+ type_=BatchCreateTeamMembersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_update(
+ self,
+ *,
+ team_members: typing.Dict[str, UpdateTeamMemberRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BatchUpdateTeamMembersResponse]:
+ """
+ Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful updates.
+ This process is non-transactional and processes as much of the request as possible. If one of the updates in
+ the request cannot be successfully processed, the request is not marked as failed, but the body of the response
+ contains explicit error information for the failed update.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-team-members).
+
+ Parameters
+ ----------
+ team_members : typing.Dict[str, UpdateTeamMemberRequestParams]
+ The data used to update the `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`.
+ The maximum number of update objects is 25.
+
+ For each team member, include the fields to add, change, or clear. Fields can be cleared using a null value.
+ To update `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed,
+ call [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchUpdateTeamMembersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/team-members/bulk-update",
+ method="POST",
+ json={
+ "team_members": convert_and_respect_annotation_metadata(
+ object_=team_members, annotation=typing.Dict[str, UpdateTeamMemberRequestParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchUpdateTeamMembersResponse,
+ construct_type(
+ type_=BatchUpdateTeamMembersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[SearchTeamMembersQueryParams] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchTeamMembersResponse]:
+ """
+ Returns a paginated list of `TeamMember` objects for a business.
+ The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether
+ the team member is the Square account owner.
+
+ Parameters
+ ----------
+ query : typing.Optional[SearchTeamMembersQueryParams]
+ The query parameters.
+
+ limit : typing.Optional[int]
+ The maximum number of `TeamMember` objects in a page (100 by default).
+
+ cursor : typing.Optional[str]
+ The opaque cursor for fetching the next page. For more information, see
+ [pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchTeamMembersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/team-members/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=SearchTeamMembersQueryParams, direction="write"
+ ),
+ "limit": limit,
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchTeamMembersResponse,
+ construct_type(
+ type_=SearchTeamMembersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, team_member_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetTeamMemberResponse]:
+ """
+ Retrieves a `TeamMember` object for the given `TeamMember.id`.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-team-member).
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetTeamMemberResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/team-members/{jsonable_encoder(team_member_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTeamMemberResponse,
+ construct_type(
+ type_=GetTeamMemberResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ team_member_id: str,
+ *,
+ team_member: typing.Optional[TeamMemberParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateTeamMemberResponse]:
+ """
+ Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates.
+ Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#update-a-team-member).
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member to update.
+
+ team_member : typing.Optional[TeamMemberParams]
+ The team member fields to add, change, or clear. Fields can be cleared using a null value. To update
+ `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed, call
+ [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateTeamMemberResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/team-members/{jsonable_encoder(team_member_id)}",
+ method="PUT",
+ json={
+ "team_member": convert_and_respect_annotation_metadata(
+ object_=team_member, annotation=TeamMemberParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateTeamMemberResponse,
+ construct_type(
+ type_=UpdateTeamMemberResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/team_members/wage_setting/__init__.py b/src/square/team_members/wage_setting/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/team_members/wage_setting/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/team_members/wage_setting/client.py b/src/square/team_members/wage_setting/client.py
new file mode 100644
index 00000000..9d5b4ccc
--- /dev/null
+++ b/src/square/team_members/wage_setting/client.py
@@ -0,0 +1,273 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...requests.wage_setting import WageSettingParams
+from ...types.get_wage_setting_response import GetWageSettingResponse
+from ...types.update_wage_setting_response import UpdateWageSettingResponse
+from .raw_client import AsyncRawWageSettingClient, RawWageSettingClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class WageSettingClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawWageSettingClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawWageSettingClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawWageSettingClient
+ """
+ return self._raw_client
+
+ def get(
+ self, team_member_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetWageSettingResponse:
+ """
+ Retrieves a `WageSetting` object for a team member specified
+ by `TeamMember.id`. For more information, see
+ [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrievewagesetting).
+
+ Square recommends using [RetrieveTeamMember](api-endpoint:Team-RetrieveTeamMember) or [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get this information directly from the `TeamMember.wage_setting` field.
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member for which to retrieve the wage setting.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetWageSettingResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team_members.wage_setting.get(
+ team_member_id="team_member_id",
+ )
+ """
+ _response = self._raw_client.get(team_member_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ team_member_id: str,
+ *,
+ wage_setting: WageSettingParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateWageSettingResponse:
+ """
+ Creates or updates a `WageSetting` object. The object is created if a
+ `WageSetting` with the specified `team_member_id` doesn't exist. Otherwise,
+ it fully replaces the `WageSetting` object for the team member.
+ The `WageSetting` is returned on a successful update. For more information, see
+ [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#create-or-update-a-wage-setting).
+
+ Square recommends using [CreateTeamMember](api-endpoint:Team-CreateTeamMember) or [UpdateTeamMember](api-endpoint:Team-UpdateTeamMember)
+ to manage the `TeamMember.wage_setting` field directly.
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member for which to update the `WageSetting` object.
+
+ wage_setting : WageSettingParams
+ The complete `WageSetting` object. For all job assignments, specify one of the following:
+ - `job_id` (recommended) - If needed, call [ListJobs](api-endpoint:Team-ListJobs) to get a list of all jobs.
+ Requires Square API version 2024-12-18 or later.
+ - `job_title` - Use the exact, case-sensitive spelling of an existing title unless you want to create a new job.
+ This value is ignored if `job_id` is also provided.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateWageSettingResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.team_members.wage_setting.update(
+ team_member_id="team_member_id",
+ wage_setting={
+ "job_assignments": [
+ {
+ "job_title": "Manager",
+ "pay_type": "SALARY",
+ "annual_rate": {"amount": 3000000, "currency": "USD"},
+ "weekly_hours": 40,
+ },
+ {
+ "job_title": "Cashier",
+ "pay_type": "HOURLY",
+ "hourly_rate": {"amount": 2000, "currency": "USD"},
+ },
+ ],
+ "is_overtime_exempt": True,
+ },
+ )
+ """
+ _response = self._raw_client.update(team_member_id, wage_setting=wage_setting, request_options=request_options)
+ return _response.data
+
+
+class AsyncWageSettingClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawWageSettingClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawWageSettingClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawWageSettingClient
+ """
+ return self._raw_client
+
+ async def get(
+ self, team_member_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetWageSettingResponse:
+ """
+ Retrieves a `WageSetting` object for a team member specified
+ by `TeamMember.id`. For more information, see
+ [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrievewagesetting).
+
+ Square recommends using [RetrieveTeamMember](api-endpoint:Team-RetrieveTeamMember) or [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get this information directly from the `TeamMember.wage_setting` field.
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member for which to retrieve the wage setting.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetWageSettingResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team_members.wage_setting.get(
+ team_member_id="team_member_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(team_member_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ team_member_id: str,
+ *,
+ wage_setting: WageSettingParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateWageSettingResponse:
+ """
+ Creates or updates a `WageSetting` object. The object is created if a
+ `WageSetting` with the specified `team_member_id` doesn't exist. Otherwise,
+ it fully replaces the `WageSetting` object for the team member.
+ The `WageSetting` is returned on a successful update. For more information, see
+ [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#create-or-update-a-wage-setting).
+
+ Square recommends using [CreateTeamMember](api-endpoint:Team-CreateTeamMember) or [UpdateTeamMember](api-endpoint:Team-UpdateTeamMember)
+ to manage the `TeamMember.wage_setting` field directly.
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member for which to update the `WageSetting` object.
+
+ wage_setting : WageSettingParams
+ The complete `WageSetting` object. For all job assignments, specify one of the following:
+ - `job_id` (recommended) - If needed, call [ListJobs](api-endpoint:Team-ListJobs) to get a list of all jobs.
+ Requires Square API version 2024-12-18 or later.
+ - `job_title` - Use the exact, case-sensitive spelling of an existing title unless you want to create a new job.
+ This value is ignored if `job_id` is also provided.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateWageSettingResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.team_members.wage_setting.update(
+ team_member_id="team_member_id",
+ wage_setting={
+ "job_assignments": [
+ {
+ "job_title": "Manager",
+ "pay_type": "SALARY",
+ "annual_rate": {"amount": 3000000, "currency": "USD"},
+ "weekly_hours": 40,
+ },
+ {
+ "job_title": "Cashier",
+ "pay_type": "HOURLY",
+ "hourly_rate": {"amount": 2000, "currency": "USD"},
+ },
+ ],
+ "is_overtime_exempt": True,
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ team_member_id, wage_setting=wage_setting, request_options=request_options
+ )
+ return _response.data
diff --git a/src/square/team_members/wage_setting/raw_client.py b/src/square/team_members/wage_setting/raw_client.py
new file mode 100644
index 00000000..35ddec82
--- /dev/null
+++ b/src/square/team_members/wage_setting/raw_client.py
@@ -0,0 +1,248 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.wage_setting import WageSettingParams
+from ...types.get_wage_setting_response import GetWageSettingResponse
+from ...types.update_wage_setting_response import UpdateWageSettingResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawWageSettingClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def get(
+ self, team_member_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetWageSettingResponse]:
+ """
+ Retrieves a `WageSetting` object for a team member specified
+ by `TeamMember.id`. For more information, see
+ [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrievewagesetting).
+
+ Square recommends using [RetrieveTeamMember](api-endpoint:Team-RetrieveTeamMember) or [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get this information directly from the `TeamMember.wage_setting` field.
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member for which to retrieve the wage setting.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetWageSettingResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/team-members/{jsonable_encoder(team_member_id)}/wage-setting",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetWageSettingResponse,
+ construct_type(
+ type_=GetWageSettingResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ team_member_id: str,
+ *,
+ wage_setting: WageSettingParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateWageSettingResponse]:
+ """
+ Creates or updates a `WageSetting` object. The object is created if a
+ `WageSetting` with the specified `team_member_id` doesn't exist. Otherwise,
+ it fully replaces the `WageSetting` object for the team member.
+ The `WageSetting` is returned on a successful update. For more information, see
+ [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#create-or-update-a-wage-setting).
+
+ Square recommends using [CreateTeamMember](api-endpoint:Team-CreateTeamMember) or [UpdateTeamMember](api-endpoint:Team-UpdateTeamMember)
+ to manage the `TeamMember.wage_setting` field directly.
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member for which to update the `WageSetting` object.
+
+ wage_setting : WageSettingParams
+ The complete `WageSetting` object. For all job assignments, specify one of the following:
+ - `job_id` (recommended) - If needed, call [ListJobs](api-endpoint:Team-ListJobs) to get a list of all jobs.
+ Requires Square API version 2024-12-18 or later.
+ - `job_title` - Use the exact, case-sensitive spelling of an existing title unless you want to create a new job.
+ This value is ignored if `job_id` is also provided.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateWageSettingResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/team-members/{jsonable_encoder(team_member_id)}/wage-setting",
+ method="PUT",
+ json={
+ "wage_setting": convert_and_respect_annotation_metadata(
+ object_=wage_setting, annotation=WageSettingParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateWageSettingResponse,
+ construct_type(
+ type_=UpdateWageSettingResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawWageSettingClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def get(
+ self, team_member_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetWageSettingResponse]:
+ """
+ Retrieves a `WageSetting` object for a team member specified
+ by `TeamMember.id`. For more information, see
+ [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrievewagesetting).
+
+ Square recommends using [RetrieveTeamMember](api-endpoint:Team-RetrieveTeamMember) or [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)
+ to get this information directly from the `TeamMember.wage_setting` field.
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member for which to retrieve the wage setting.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetWageSettingResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/team-members/{jsonable_encoder(team_member_id)}/wage-setting",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetWageSettingResponse,
+ construct_type(
+ type_=GetWageSettingResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ team_member_id: str,
+ *,
+ wage_setting: WageSettingParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateWageSettingResponse]:
+ """
+ Creates or updates a `WageSetting` object. The object is created if a
+ `WageSetting` with the specified `team_member_id` doesn't exist. Otherwise,
+ it fully replaces the `WageSetting` object for the team member.
+ The `WageSetting` is returned on a successful update. For more information, see
+ [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#create-or-update-a-wage-setting).
+
+ Square recommends using [CreateTeamMember](api-endpoint:Team-CreateTeamMember) or [UpdateTeamMember](api-endpoint:Team-UpdateTeamMember)
+ to manage the `TeamMember.wage_setting` field directly.
+
+ Parameters
+ ----------
+ team_member_id : str
+ The ID of the team member for which to update the `WageSetting` object.
+
+ wage_setting : WageSettingParams
+ The complete `WageSetting` object. For all job assignments, specify one of the following:
+ - `job_id` (recommended) - If needed, call [ListJobs](api-endpoint:Team-ListJobs) to get a list of all jobs.
+ Requires Square API version 2024-12-18 or later.
+ - `job_title` - Use the exact, case-sensitive spelling of an existing title unless you want to create a new job.
+ This value is ignored if `job_id` is also provided.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateWageSettingResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/team-members/{jsonable_encoder(team_member_id)}/wage-setting",
+ method="PUT",
+ json={
+ "wage_setting": convert_and_respect_annotation_metadata(
+ object_=wage_setting, annotation=WageSettingParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateWageSettingResponse,
+ construct_type(
+ type_=UpdateWageSettingResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/terminal/__init__.py b/src/square/terminal/__init__.py
new file mode 100644
index 00000000..0f6c8376
--- /dev/null
+++ b/src/square/terminal/__init__.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import actions, checkouts, refunds
+_dynamic_imports: typing.Dict[str, str] = {"actions": ".actions", "checkouts": ".checkouts", "refunds": ".refunds"}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["actions", "checkouts", "refunds"]
diff --git a/src/square/terminal/actions/__init__.py b/src/square/terminal/actions/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/terminal/actions/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/terminal/actions/client.py b/src/square/terminal/actions/client.py
new file mode 100644
index 00000000..e7209de5
--- /dev/null
+++ b/src/square/terminal/actions/client.py
@@ -0,0 +1,428 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...requests.terminal_action import TerminalActionParams
+from ...requests.terminal_action_query import TerminalActionQueryParams
+from ...types.cancel_terminal_action_response import CancelTerminalActionResponse
+from ...types.create_terminal_action_response import CreateTerminalActionResponse
+from ...types.get_terminal_action_response import GetTerminalActionResponse
+from ...types.search_terminal_actions_response import SearchTerminalActionsResponse
+from .raw_client import AsyncRawActionsClient, RawActionsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class ActionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawActionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawActionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawActionsClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ action: TerminalActionParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTerminalActionResponse:
+ """
+ Creates a Terminal action request and sends it to the specified device.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateAction` request. Keys can be any valid string
+ but must be unique for every `CreateAction` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more
+ information.
+
+ action : TerminalActionParams
+ The Action to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTerminalActionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.actions.create(
+ idempotency_key="thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e",
+ action={
+ "device_id": "{{DEVICE_ID}}",
+ "deadline_duration": "PT5M",
+ "type": "SAVE_CARD",
+ "save_card_options": {
+ "customer_id": "{{CUSTOMER_ID}}",
+ "reference_id": "user-id-1",
+ },
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ idempotency_key=idempotency_key, action=action, request_options=request_options
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[TerminalActionQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchTerminalActionsResponse:
+ """
+ Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalActionQueryParams]
+ Queries terminal actions based on given conditions and sort order.
+ Leaving this unset will return all actions with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more
+ information.
+
+ limit : typing.Optional[int]
+ Limit the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchTerminalActionsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.actions.search(
+ query={
+ "filter": {"created_at": {"start_at": "2022-04-01T00:00:00.000Z"}},
+ "sort": {"sort_order": "DESC"},
+ },
+ limit=2,
+ )
+ """
+ _response = self._raw_client.search(query=query, cursor=cursor, limit=limit, request_options=request_options)
+ return _response.data
+
+ def get(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTerminalActionResponse:
+ """
+ Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 days.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the desired `TerminalAction`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTerminalActionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.actions.get(
+ action_id="action_id",
+ )
+ """
+ _response = self._raw_client.get(action_id, request_options=request_options)
+ return _response.data
+
+ def cancel(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelTerminalActionResponse:
+ """
+ Cancels a Terminal action request if the status of the request permits it.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the desired `TerminalAction`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelTerminalActionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.actions.cancel(
+ action_id="action_id",
+ )
+ """
+ _response = self._raw_client.cancel(action_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncActionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawActionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawActionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawActionsClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ action: TerminalActionParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTerminalActionResponse:
+ """
+ Creates a Terminal action request and sends it to the specified device.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateAction` request. Keys can be any valid string
+ but must be unique for every `CreateAction` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more
+ information.
+
+ action : TerminalActionParams
+ The Action to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTerminalActionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.actions.create(
+ idempotency_key="thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e",
+ action={
+ "device_id": "{{DEVICE_ID}}",
+ "deadline_duration": "PT5M",
+ "type": "SAVE_CARD",
+ "save_card_options": {
+ "customer_id": "{{CUSTOMER_ID}}",
+ "reference_id": "user-id-1",
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ idempotency_key=idempotency_key, action=action, request_options=request_options
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[TerminalActionQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchTerminalActionsResponse:
+ """
+ Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalActionQueryParams]
+ Queries terminal actions based on given conditions and sort order.
+ Leaving this unset will return all actions with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more
+ information.
+
+ limit : typing.Optional[int]
+ Limit the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchTerminalActionsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.actions.search(
+ query={
+ "filter": {"created_at": {"start_at": "2022-04-01T00:00:00.000Z"}},
+ "sort": {"sort_order": "DESC"},
+ },
+ limit=2,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ query=query, cursor=cursor, limit=limit, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTerminalActionResponse:
+ """
+ Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 days.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the desired `TerminalAction`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTerminalActionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.actions.get(
+ action_id="action_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(action_id, request_options=request_options)
+ return _response.data
+
+ async def cancel(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelTerminalActionResponse:
+ """
+ Cancels a Terminal action request if the status of the request permits it.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the desired `TerminalAction`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelTerminalActionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.actions.cancel(
+ action_id="action_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.cancel(action_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/terminal/actions/raw_client.py b/src/square/terminal/actions/raw_client.py
new file mode 100644
index 00000000..e65e41b5
--- /dev/null
+++ b/src/square/terminal/actions/raw_client.py
@@ -0,0 +1,437 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.terminal_action import TerminalActionParams
+from ...requests.terminal_action_query import TerminalActionQueryParams
+from ...types.cancel_terminal_action_response import CancelTerminalActionResponse
+from ...types.create_terminal_action_response import CreateTerminalActionResponse
+from ...types.get_terminal_action_response import GetTerminalActionResponse
+from ...types.search_terminal_actions_response import SearchTerminalActionsResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawActionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ action: TerminalActionParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateTerminalActionResponse]:
+ """
+ Creates a Terminal action request and sends it to the specified device.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateAction` request. Keys can be any valid string
+ but must be unique for every `CreateAction` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more
+ information.
+
+ action : TerminalActionParams
+ The Action to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateTerminalActionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/terminals/actions",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "action": convert_and_respect_annotation_metadata(
+ object_=action, annotation=TerminalActionParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTerminalActionResponse,
+ construct_type(
+ type_=CreateTerminalActionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[TerminalActionQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchTerminalActionsResponse]:
+ """
+ Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalActionQueryParams]
+ Queries terminal actions based on given conditions and sort order.
+ Leaving this unset will return all actions with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more
+ information.
+
+ limit : typing.Optional[int]
+ Limit the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchTerminalActionsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/terminals/actions/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=TerminalActionQueryParams, direction="write"
+ ),
+ "cursor": cursor,
+ "limit": limit,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchTerminalActionsResponse,
+ construct_type(
+ type_=SearchTerminalActionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetTerminalActionResponse]:
+ """
+ Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 days.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the desired `TerminalAction`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetTerminalActionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/terminals/actions/{jsonable_encoder(action_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTerminalActionResponse,
+ construct_type(
+ type_=GetTerminalActionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def cancel(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[CancelTerminalActionResponse]:
+ """
+ Cancels a Terminal action request if the status of the request permits it.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the desired `TerminalAction`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CancelTerminalActionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/terminals/actions/{jsonable_encoder(action_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelTerminalActionResponse,
+ construct_type(
+ type_=CancelTerminalActionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawActionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ action: TerminalActionParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateTerminalActionResponse]:
+ """
+ Creates a Terminal action request and sends it to the specified device.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateAction` request. Keys can be any valid string
+ but must be unique for every `CreateAction` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more
+ information.
+
+ action : TerminalActionParams
+ The Action to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateTerminalActionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/terminals/actions",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "action": convert_and_respect_annotation_metadata(
+ object_=action, annotation=TerminalActionParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTerminalActionResponse,
+ construct_type(
+ type_=CreateTerminalActionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[TerminalActionQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchTerminalActionsResponse]:
+ """
+ Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalActionQueryParams]
+ Queries terminal actions based on given conditions and sort order.
+ Leaving this unset will return all actions with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more
+ information.
+
+ limit : typing.Optional[int]
+ Limit the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchTerminalActionsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/terminals/actions/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=TerminalActionQueryParams, direction="write"
+ ),
+ "cursor": cursor,
+ "limit": limit,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchTerminalActionsResponse,
+ construct_type(
+ type_=SearchTerminalActionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetTerminalActionResponse]:
+ """
+ Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 days.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the desired `TerminalAction`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetTerminalActionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/terminals/actions/{jsonable_encoder(action_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTerminalActionResponse,
+ construct_type(
+ type_=GetTerminalActionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def cancel(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[CancelTerminalActionResponse]:
+ """
+ Cancels a Terminal action request if the status of the request permits it.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the desired `TerminalAction`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CancelTerminalActionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/terminals/actions/{jsonable_encoder(action_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelTerminalActionResponse,
+ construct_type(
+ type_=CancelTerminalActionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/terminal/checkouts/__init__.py b/src/square/terminal/checkouts/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/terminal/checkouts/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/terminal/checkouts/client.py b/src/square/terminal/checkouts/client.py
new file mode 100644
index 00000000..9c124ea3
--- /dev/null
+++ b/src/square/terminal/checkouts/client.py
@@ -0,0 +1,416 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...requests.terminal_checkout import TerminalCheckoutParams
+from ...requests.terminal_checkout_query import TerminalCheckoutQueryParams
+from ...types.cancel_terminal_checkout_response import CancelTerminalCheckoutResponse
+from ...types.create_terminal_checkout_response import CreateTerminalCheckoutResponse
+from ...types.get_terminal_checkout_response import GetTerminalCheckoutResponse
+from ...types.search_terminal_checkouts_response import SearchTerminalCheckoutsResponse
+from .raw_client import AsyncRawCheckoutsClient, RawCheckoutsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class CheckoutsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawCheckoutsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawCheckoutsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawCheckoutsClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ checkout: TerminalCheckoutParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTerminalCheckoutResponse:
+ """
+ Creates a Terminal checkout request and sends it to the specified device to take a payment
+ for the requested amount.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateCheckout` request. Keys can be any valid string but
+ must be unique for every `CreateCheckout` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ checkout : TerminalCheckoutParams
+ The checkout to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTerminalCheckoutResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.checkouts.create(
+ idempotency_key="28a0c3bc-7839-11ea-bc55-0242ac130003",
+ checkout={
+ "amount_money": {"amount": 2610, "currency": "USD"},
+ "reference_id": "id11572",
+ "note": "A brief note",
+ "device_options": {"device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003"},
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ idempotency_key=idempotency_key, checkout=checkout, request_options=request_options
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[TerminalCheckoutQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchTerminalCheckoutsResponse:
+ """
+ Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalCheckoutQueryParams]
+ Queries Terminal checkouts based on given conditions and the sort order.
+ Leaving these unset returns all checkouts with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+
+ limit : typing.Optional[int]
+ Limits the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchTerminalCheckoutsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.checkouts.search(
+ query={"filter": {"status": "COMPLETED"}},
+ limit=2,
+ )
+ """
+ _response = self._raw_client.search(query=query, cursor=cursor, limit=limit, request_options=request_options)
+ return _response.data
+
+ def get(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTerminalCheckoutResponse:
+ """
+ Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for 30 days.
+
+ Parameters
+ ----------
+ checkout_id : str
+ The unique ID for the desired `TerminalCheckout`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTerminalCheckoutResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.checkouts.get(
+ checkout_id="checkout_id",
+ )
+ """
+ _response = self._raw_client.get(checkout_id, request_options=request_options)
+ return _response.data
+
+ def cancel(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelTerminalCheckoutResponse:
+ """
+ Cancels a Terminal checkout request if the status of the request permits it.
+
+ Parameters
+ ----------
+ checkout_id : str
+ The unique ID for the desired `TerminalCheckout`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelTerminalCheckoutResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.checkouts.cancel(
+ checkout_id="checkout_id",
+ )
+ """
+ _response = self._raw_client.cancel(checkout_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncCheckoutsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawCheckoutsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawCheckoutsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawCheckoutsClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ checkout: TerminalCheckoutParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTerminalCheckoutResponse:
+ """
+ Creates a Terminal checkout request and sends it to the specified device to take a payment
+ for the requested amount.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateCheckout` request. Keys can be any valid string but
+ must be unique for every `CreateCheckout` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ checkout : TerminalCheckoutParams
+ The checkout to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTerminalCheckoutResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.checkouts.create(
+ idempotency_key="28a0c3bc-7839-11ea-bc55-0242ac130003",
+ checkout={
+ "amount_money": {"amount": 2610, "currency": "USD"},
+ "reference_id": "id11572",
+ "note": "A brief note",
+ "device_options": {
+ "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003"
+ },
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ idempotency_key=idempotency_key, checkout=checkout, request_options=request_options
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[TerminalCheckoutQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchTerminalCheckoutsResponse:
+ """
+ Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalCheckoutQueryParams]
+ Queries Terminal checkouts based on given conditions and the sort order.
+ Leaving these unset returns all checkouts with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+
+ limit : typing.Optional[int]
+ Limits the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchTerminalCheckoutsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.checkouts.search(
+ query={"filter": {"status": "COMPLETED"}},
+ limit=2,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ query=query, cursor=cursor, limit=limit, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTerminalCheckoutResponse:
+ """
+ Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for 30 days.
+
+ Parameters
+ ----------
+ checkout_id : str
+ The unique ID for the desired `TerminalCheckout`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTerminalCheckoutResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.checkouts.get(
+ checkout_id="checkout_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(checkout_id, request_options=request_options)
+ return _response.data
+
+ async def cancel(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelTerminalCheckoutResponse:
+ """
+ Cancels a Terminal checkout request if the status of the request permits it.
+
+ Parameters
+ ----------
+ checkout_id : str
+ The unique ID for the desired `TerminalCheckout`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelTerminalCheckoutResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.checkouts.cancel(
+ checkout_id="checkout_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.cancel(checkout_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/terminal/checkouts/raw_client.py b/src/square/terminal/checkouts/raw_client.py
new file mode 100644
index 00000000..66b66deb
--- /dev/null
+++ b/src/square/terminal/checkouts/raw_client.py
@@ -0,0 +1,435 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.terminal_checkout import TerminalCheckoutParams
+from ...requests.terminal_checkout_query import TerminalCheckoutQueryParams
+from ...types.cancel_terminal_checkout_response import CancelTerminalCheckoutResponse
+from ...types.create_terminal_checkout_response import CreateTerminalCheckoutResponse
+from ...types.get_terminal_checkout_response import GetTerminalCheckoutResponse
+from ...types.search_terminal_checkouts_response import SearchTerminalCheckoutsResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawCheckoutsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ checkout: TerminalCheckoutParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateTerminalCheckoutResponse]:
+ """
+ Creates a Terminal checkout request and sends it to the specified device to take a payment
+ for the requested amount.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateCheckout` request. Keys can be any valid string but
+ must be unique for every `CreateCheckout` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ checkout : TerminalCheckoutParams
+ The checkout to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateTerminalCheckoutResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/terminals/checkouts",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "checkout": convert_and_respect_annotation_metadata(
+ object_=checkout, annotation=TerminalCheckoutParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTerminalCheckoutResponse,
+ construct_type(
+ type_=CreateTerminalCheckoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[TerminalCheckoutQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchTerminalCheckoutsResponse]:
+ """
+ Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalCheckoutQueryParams]
+ Queries Terminal checkouts based on given conditions and the sort order.
+ Leaving these unset returns all checkouts with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+
+ limit : typing.Optional[int]
+ Limits the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchTerminalCheckoutsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/terminals/checkouts/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=TerminalCheckoutQueryParams, direction="write"
+ ),
+ "cursor": cursor,
+ "limit": limit,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchTerminalCheckoutsResponse,
+ construct_type(
+ type_=SearchTerminalCheckoutsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetTerminalCheckoutResponse]:
+ """
+ Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for 30 days.
+
+ Parameters
+ ----------
+ checkout_id : str
+ The unique ID for the desired `TerminalCheckout`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetTerminalCheckoutResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/terminals/checkouts/{jsonable_encoder(checkout_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTerminalCheckoutResponse,
+ construct_type(
+ type_=GetTerminalCheckoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def cancel(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[CancelTerminalCheckoutResponse]:
+ """
+ Cancels a Terminal checkout request if the status of the request permits it.
+
+ Parameters
+ ----------
+ checkout_id : str
+ The unique ID for the desired `TerminalCheckout`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CancelTerminalCheckoutResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/terminals/checkouts/{jsonable_encoder(checkout_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelTerminalCheckoutResponse,
+ construct_type(
+ type_=CancelTerminalCheckoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawCheckoutsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ checkout: TerminalCheckoutParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateTerminalCheckoutResponse]:
+ """
+ Creates a Terminal checkout request and sends it to the specified device to take a payment
+ for the requested amount.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateCheckout` request. Keys can be any valid string but
+ must be unique for every `CreateCheckout` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ checkout : TerminalCheckoutParams
+ The checkout to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateTerminalCheckoutResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/terminals/checkouts",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "checkout": convert_and_respect_annotation_metadata(
+ object_=checkout, annotation=TerminalCheckoutParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTerminalCheckoutResponse,
+ construct_type(
+ type_=CreateTerminalCheckoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[TerminalCheckoutQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchTerminalCheckoutsResponse]:
+ """
+ Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalCheckoutQueryParams]
+ Queries Terminal checkouts based on given conditions and the sort order.
+ Leaving these unset returns all checkouts with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+
+ limit : typing.Optional[int]
+ Limits the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchTerminalCheckoutsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/terminals/checkouts/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=TerminalCheckoutQueryParams, direction="write"
+ ),
+ "cursor": cursor,
+ "limit": limit,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchTerminalCheckoutsResponse,
+ construct_type(
+ type_=SearchTerminalCheckoutsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetTerminalCheckoutResponse]:
+ """
+ Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for 30 days.
+
+ Parameters
+ ----------
+ checkout_id : str
+ The unique ID for the desired `TerminalCheckout`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetTerminalCheckoutResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/terminals/checkouts/{jsonable_encoder(checkout_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTerminalCheckoutResponse,
+ construct_type(
+ type_=GetTerminalCheckoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def cancel(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[CancelTerminalCheckoutResponse]:
+ """
+ Cancels a Terminal checkout request if the status of the request permits it.
+
+ Parameters
+ ----------
+ checkout_id : str
+ The unique ID for the desired `TerminalCheckout`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CancelTerminalCheckoutResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/terminals/checkouts/{jsonable_encoder(checkout_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelTerminalCheckoutResponse,
+ construct_type(
+ type_=CancelTerminalCheckoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/terminal/client.py b/src/square/terminal/client.py
new file mode 100644
index 00000000..2f71f21b
--- /dev/null
+++ b/src/square/terminal/client.py
@@ -0,0 +1,331 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..types.dismiss_terminal_action_response import DismissTerminalActionResponse
+from ..types.dismiss_terminal_checkout_response import DismissTerminalCheckoutResponse
+from ..types.dismiss_terminal_refund_response import DismissTerminalRefundResponse
+from .raw_client import AsyncRawTerminalClient, RawTerminalClient
+
+if typing.TYPE_CHECKING:
+ from .actions.client import ActionsClient, AsyncActionsClient
+ from .checkouts.client import AsyncCheckoutsClient, CheckoutsClient
+ from .refunds.client import AsyncRefundsClient, RefundsClient
+
+
+class TerminalClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawTerminalClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._actions: typing.Optional[ActionsClient] = None
+ self._checkouts: typing.Optional[CheckoutsClient] = None
+ self._refunds: typing.Optional[RefundsClient] = None
+
+ @property
+ def with_raw_response(self) -> RawTerminalClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawTerminalClient
+ """
+ return self._raw_client
+
+ def dismiss_terminal_action(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DismissTerminalActionResponse:
+ """
+ Dismisses a Terminal action request if the status and type of the request permits it.
+
+ See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the `TerminalAction` associated with the action to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DismissTerminalActionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.dismiss_terminal_action(
+ action_id="action_id",
+ )
+ """
+ _response = self._raw_client.dismiss_terminal_action(action_id, request_options=request_options)
+ return _response.data
+
+ def dismiss_terminal_checkout(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DismissTerminalCheckoutResponse:
+ """
+ Dismisses a Terminal checkout request if the status and type of the request permits it.
+
+ Parameters
+ ----------
+ checkout_id : str
+ Unique ID for the `TerminalCheckout` associated with the checkout to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DismissTerminalCheckoutResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.dismiss_terminal_checkout(
+ checkout_id="checkout_id",
+ )
+ """
+ _response = self._raw_client.dismiss_terminal_checkout(checkout_id, request_options=request_options)
+ return _response.data
+
+ def dismiss_terminal_refund(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DismissTerminalRefundResponse:
+ """
+ Dismisses a Terminal refund request if the status and type of the request permits it.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ Unique ID for the `TerminalRefund` associated with the refund to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DismissTerminalRefundResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.dismiss_terminal_refund(
+ terminal_refund_id="terminal_refund_id",
+ )
+ """
+ _response = self._raw_client.dismiss_terminal_refund(terminal_refund_id, request_options=request_options)
+ return _response.data
+
+ @property
+ def actions(self):
+ if self._actions is None:
+ from .actions.client import ActionsClient # noqa: E402
+
+ self._actions = ActionsClient(client_wrapper=self._client_wrapper)
+ return self._actions
+
+ @property
+ def checkouts(self):
+ if self._checkouts is None:
+ from .checkouts.client import CheckoutsClient # noqa: E402
+
+ self._checkouts = CheckoutsClient(client_wrapper=self._client_wrapper)
+ return self._checkouts
+
+ @property
+ def refunds(self):
+ if self._refunds is None:
+ from .refunds.client import RefundsClient # noqa: E402
+
+ self._refunds = RefundsClient(client_wrapper=self._client_wrapper)
+ return self._refunds
+
+
+class AsyncTerminalClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawTerminalClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._actions: typing.Optional[AsyncActionsClient] = None
+ self._checkouts: typing.Optional[AsyncCheckoutsClient] = None
+ self._refunds: typing.Optional[AsyncRefundsClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawTerminalClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawTerminalClient
+ """
+ return self._raw_client
+
+ async def dismiss_terminal_action(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DismissTerminalActionResponse:
+ """
+ Dismisses a Terminal action request if the status and type of the request permits it.
+
+ See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the `TerminalAction` associated with the action to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DismissTerminalActionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.dismiss_terminal_action(
+ action_id="action_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.dismiss_terminal_action(action_id, request_options=request_options)
+ return _response.data
+
+ async def dismiss_terminal_checkout(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DismissTerminalCheckoutResponse:
+ """
+ Dismisses a Terminal checkout request if the status and type of the request permits it.
+
+ Parameters
+ ----------
+ checkout_id : str
+ Unique ID for the `TerminalCheckout` associated with the checkout to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DismissTerminalCheckoutResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.dismiss_terminal_checkout(
+ checkout_id="checkout_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.dismiss_terminal_checkout(checkout_id, request_options=request_options)
+ return _response.data
+
+ async def dismiss_terminal_refund(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DismissTerminalRefundResponse:
+ """
+ Dismisses a Terminal refund request if the status and type of the request permits it.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ Unique ID for the `TerminalRefund` associated with the refund to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DismissTerminalRefundResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.dismiss_terminal_refund(
+ terminal_refund_id="terminal_refund_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.dismiss_terminal_refund(terminal_refund_id, request_options=request_options)
+ return _response.data
+
+ @property
+ def actions(self):
+ if self._actions is None:
+ from .actions.client import AsyncActionsClient # noqa: E402
+
+ self._actions = AsyncActionsClient(client_wrapper=self._client_wrapper)
+ return self._actions
+
+ @property
+ def checkouts(self):
+ if self._checkouts is None:
+ from .checkouts.client import AsyncCheckoutsClient # noqa: E402
+
+ self._checkouts = AsyncCheckoutsClient(client_wrapper=self._client_wrapper)
+ return self._checkouts
+
+ @property
+ def refunds(self):
+ if self._refunds is None:
+ from .refunds.client import AsyncRefundsClient # noqa: E402
+
+ self._refunds = AsyncRefundsClient(client_wrapper=self._client_wrapper)
+ return self._refunds
diff --git a/src/square/terminal/raw_client.py b/src/square/terminal/raw_client.py
new file mode 100644
index 00000000..4b3dbe6e
--- /dev/null
+++ b/src/square/terminal/raw_client.py
@@ -0,0 +1,262 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.request_options import RequestOptions
+from ..core.unchecked_base_model import construct_type
+from ..types.dismiss_terminal_action_response import DismissTerminalActionResponse
+from ..types.dismiss_terminal_checkout_response import DismissTerminalCheckoutResponse
+from ..types.dismiss_terminal_refund_response import DismissTerminalRefundResponse
+
+
+class RawTerminalClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def dismiss_terminal_action(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DismissTerminalActionResponse]:
+ """
+ Dismisses a Terminal action request if the status and type of the request permits it.
+
+ See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the `TerminalAction` associated with the action to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DismissTerminalActionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/terminals/actions/{jsonable_encoder(action_id)}/dismiss",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DismissTerminalActionResponse,
+ construct_type(
+ type_=DismissTerminalActionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def dismiss_terminal_checkout(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DismissTerminalCheckoutResponse]:
+ """
+ Dismisses a Terminal checkout request if the status and type of the request permits it.
+
+ Parameters
+ ----------
+ checkout_id : str
+ Unique ID for the `TerminalCheckout` associated with the checkout to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DismissTerminalCheckoutResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/terminals/checkouts/{jsonable_encoder(checkout_id)}/dismiss",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DismissTerminalCheckoutResponse,
+ construct_type(
+ type_=DismissTerminalCheckoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def dismiss_terminal_refund(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DismissTerminalRefundResponse]:
+ """
+ Dismisses a Terminal refund request if the status and type of the request permits it.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ Unique ID for the `TerminalRefund` associated with the refund to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DismissTerminalRefundResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/terminals/refunds/{jsonable_encoder(terminal_refund_id)}/dismiss",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DismissTerminalRefundResponse,
+ construct_type(
+ type_=DismissTerminalRefundResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawTerminalClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def dismiss_terminal_action(
+ self, action_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DismissTerminalActionResponse]:
+ """
+ Dismisses a Terminal action request if the status and type of the request permits it.
+
+ See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details.
+
+ Parameters
+ ----------
+ action_id : str
+ Unique ID for the `TerminalAction` associated with the action to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DismissTerminalActionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/terminals/actions/{jsonable_encoder(action_id)}/dismiss",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DismissTerminalActionResponse,
+ construct_type(
+ type_=DismissTerminalActionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def dismiss_terminal_checkout(
+ self, checkout_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DismissTerminalCheckoutResponse]:
+ """
+ Dismisses a Terminal checkout request if the status and type of the request permits it.
+
+ Parameters
+ ----------
+ checkout_id : str
+ Unique ID for the `TerminalCheckout` associated with the checkout to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DismissTerminalCheckoutResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/terminals/checkouts/{jsonable_encoder(checkout_id)}/dismiss",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DismissTerminalCheckoutResponse,
+ construct_type(
+ type_=DismissTerminalCheckoutResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def dismiss_terminal_refund(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DismissTerminalRefundResponse]:
+ """
+ Dismisses a Terminal refund request if the status and type of the request permits it.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ Unique ID for the `TerminalRefund` associated with the refund to be dismissed.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DismissTerminalRefundResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/terminals/refunds/{jsonable_encoder(terminal_refund_id)}/dismiss",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DismissTerminalRefundResponse,
+ construct_type(
+ type_=DismissTerminalRefundResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/terminal/refunds/__init__.py b/src/square/terminal/refunds/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/terminal/refunds/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/terminal/refunds/client.py b/src/square/terminal/refunds/client.py
new file mode 100644
index 00000000..3df92941
--- /dev/null
+++ b/src/square/terminal/refunds/client.py
@@ -0,0 +1,412 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...requests.terminal_refund import TerminalRefundParams
+from ...requests.terminal_refund_query import TerminalRefundQueryParams
+from ...types.cancel_terminal_refund_response import CancelTerminalRefundResponse
+from ...types.create_terminal_refund_response import CreateTerminalRefundResponse
+from ...types.get_terminal_refund_response import GetTerminalRefundResponse
+from ...types.search_terminal_refunds_response import SearchTerminalRefundsResponse
+from .raw_client import AsyncRawRefundsClient, RawRefundsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RefundsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawRefundsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawRefundsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawRefundsClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ refund: typing.Optional[TerminalRefundParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTerminalRefundResponse:
+ """
+ Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](api:Refunds).
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateRefund` request. Keys can be any valid string but
+ must be unique for every `CreateRefund` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ refund : typing.Optional[TerminalRefundParams]
+ The refund to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTerminalRefundResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.refunds.create(
+ idempotency_key="402a640b-b26f-401f-b406-46f839590c04",
+ refund={
+ "payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY",
+ "amount_money": {"amount": 111, "currency": "CAD"},
+ "reason": "Returning items",
+ "device_id": "f72dfb8e-4d65-4e56-aade-ec3fb8d33291",
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ idempotency_key=idempotency_key, refund=refund, request_options=request_options
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[TerminalRefundQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchTerminalRefundsResponse:
+ """
+ Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalRefundQueryParams]
+ Queries the Terminal refunds based on given conditions and the sort order. Calling
+ `SearchTerminalRefunds` without an explicit query parameter returns all available
+ refunds with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ limit : typing.Optional[int]
+ Limits the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchTerminalRefundsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.refunds.search(
+ query={"filter": {"status": "COMPLETED"}},
+ limit=1,
+ )
+ """
+ _response = self._raw_client.search(query=query, cursor=cursor, limit=limit, request_options=request_options)
+ return _response.data
+
+ def get(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTerminalRefundResponse:
+ """
+ Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ The unique ID for the desired `TerminalRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTerminalRefundResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.refunds.get(
+ terminal_refund_id="terminal_refund_id",
+ )
+ """
+ _response = self._raw_client.get(terminal_refund_id, request_options=request_options)
+ return _response.data
+
+ def cancel(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelTerminalRefundResponse:
+ """
+ Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ The unique ID for the desired `TerminalRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelTerminalRefundResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.terminal.refunds.cancel(
+ terminal_refund_id="terminal_refund_id",
+ )
+ """
+ _response = self._raw_client.cancel(terminal_refund_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncRefundsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawRefundsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawRefundsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawRefundsClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ refund: typing.Optional[TerminalRefundParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTerminalRefundResponse:
+ """
+ Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](api:Refunds).
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateRefund` request. Keys can be any valid string but
+ must be unique for every `CreateRefund` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ refund : typing.Optional[TerminalRefundParams]
+ The refund to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTerminalRefundResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.refunds.create(
+ idempotency_key="402a640b-b26f-401f-b406-46f839590c04",
+ refund={
+ "payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY",
+ "amount_money": {"amount": 111, "currency": "CAD"},
+ "reason": "Returning items",
+ "device_id": "f72dfb8e-4d65-4e56-aade-ec3fb8d33291",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ idempotency_key=idempotency_key, refund=refund, request_options=request_options
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[TerminalRefundQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchTerminalRefundsResponse:
+ """
+ Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalRefundQueryParams]
+ Queries the Terminal refunds based on given conditions and the sort order. Calling
+ `SearchTerminalRefunds` without an explicit query parameter returns all available
+ refunds with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ limit : typing.Optional[int]
+ Limits the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchTerminalRefundsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.refunds.search(
+ query={"filter": {"status": "COMPLETED"}},
+ limit=1,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ query=query, cursor=cursor, limit=limit, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetTerminalRefundResponse:
+ """
+ Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ The unique ID for the desired `TerminalRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetTerminalRefundResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.refunds.get(
+ terminal_refund_id="terminal_refund_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(terminal_refund_id, request_options=request_options)
+ return _response.data
+
+ async def cancel(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> CancelTerminalRefundResponse:
+ """
+ Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ The unique ID for the desired `TerminalRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelTerminalRefundResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.terminal.refunds.cancel(
+ terminal_refund_id="terminal_refund_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.cancel(terminal_refund_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/terminal/refunds/raw_client.py b/src/square/terminal/refunds/raw_client.py
new file mode 100644
index 00000000..3ed83e41
--- /dev/null
+++ b/src/square/terminal/refunds/raw_client.py
@@ -0,0 +1,433 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.terminal_refund import TerminalRefundParams
+from ...requests.terminal_refund_query import TerminalRefundQueryParams
+from ...types.cancel_terminal_refund_response import CancelTerminalRefundResponse
+from ...types.create_terminal_refund_response import CreateTerminalRefundResponse
+from ...types.get_terminal_refund_response import GetTerminalRefundResponse
+from ...types.search_terminal_refunds_response import SearchTerminalRefundsResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawRefundsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ refund: typing.Optional[TerminalRefundParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateTerminalRefundResponse]:
+ """
+ Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](api:Refunds).
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateRefund` request. Keys can be any valid string but
+ must be unique for every `CreateRefund` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ refund : typing.Optional[TerminalRefundParams]
+ The refund to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateTerminalRefundResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/terminals/refunds",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "refund": convert_and_respect_annotation_metadata(
+ object_=refund, annotation=TerminalRefundParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTerminalRefundResponse,
+ construct_type(
+ type_=CreateTerminalRefundResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[TerminalRefundQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchTerminalRefundsResponse]:
+ """
+ Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalRefundQueryParams]
+ Queries the Terminal refunds based on given conditions and the sort order. Calling
+ `SearchTerminalRefunds` without an explicit query parameter returns all available
+ refunds with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ limit : typing.Optional[int]
+ Limits the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchTerminalRefundsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/terminals/refunds/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=TerminalRefundQueryParams, direction="write"
+ ),
+ "cursor": cursor,
+ "limit": limit,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchTerminalRefundsResponse,
+ construct_type(
+ type_=SearchTerminalRefundsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetTerminalRefundResponse]:
+ """
+ Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ The unique ID for the desired `TerminalRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetTerminalRefundResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/terminals/refunds/{jsonable_encoder(terminal_refund_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTerminalRefundResponse,
+ construct_type(
+ type_=GetTerminalRefundResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def cancel(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[CancelTerminalRefundResponse]:
+ """
+ Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ The unique ID for the desired `TerminalRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CancelTerminalRefundResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/terminals/refunds/{jsonable_encoder(terminal_refund_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelTerminalRefundResponse,
+ construct_type(
+ type_=CancelTerminalRefundResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawRefundsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ refund: typing.Optional[TerminalRefundParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateTerminalRefundResponse]:
+ """
+ Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](api:Refunds).
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this `CreateRefund` request. Keys can be any valid string but
+ must be unique for every `CreateRefund` request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+
+ refund : typing.Optional[TerminalRefundParams]
+ The refund to create.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateTerminalRefundResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/terminals/refunds",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "refund": convert_and_respect_annotation_metadata(
+ object_=refund, annotation=TerminalRefundParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTerminalRefundResponse,
+ construct_type(
+ type_=CreateTerminalRefundResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[TerminalRefundQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchTerminalRefundsResponse]:
+ """
+ Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days.
+
+ Parameters
+ ----------
+ query : typing.Optional[TerminalRefundQueryParams]
+ Queries the Terminal refunds based on given conditions and the sort order. Calling
+ `SearchTerminalRefunds` without an explicit query parameter returns all available
+ refunds with the default sort order.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this cursor to retrieve the next set of results for the original query.
+
+ limit : typing.Optional[int]
+ Limits the number of results returned for a single request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchTerminalRefundsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/terminals/refunds/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=TerminalRefundQueryParams, direction="write"
+ ),
+ "cursor": cursor,
+ "limit": limit,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchTerminalRefundsResponse,
+ construct_type(
+ type_=SearchTerminalRefundsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetTerminalRefundResponse]:
+ """
+ Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ The unique ID for the desired `TerminalRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetTerminalRefundResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/terminals/refunds/{jsonable_encoder(terminal_refund_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetTerminalRefundResponse,
+ construct_type(
+ type_=GetTerminalRefundResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def cancel(
+ self, terminal_refund_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[CancelTerminalRefundResponse]:
+ """
+ Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it.
+
+ Parameters
+ ----------
+ terminal_refund_id : str
+ The unique ID for the desired `TerminalRefund`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CancelTerminalRefundResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/terminals/refunds/{jsonable_encoder(terminal_refund_id)}/cancel",
+ method="POST",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelTerminalRefundResponse,
+ construct_type(
+ type_=CancelTerminalRefundResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/transfer_orders/__init__.py b/src/square/transfer_orders/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/transfer_orders/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/transfer_orders/client.py b/src/square/transfer_orders/client.py
new file mode 100644
index 00000000..cec61a34
--- /dev/null
+++ b/src/square/transfer_orders/client.py
@@ -0,0 +1,1123 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..requests.create_transfer_order_data import CreateTransferOrderDataParams
+from ..requests.transfer_order_goods_receipt import TransferOrderGoodsReceiptParams
+from ..requests.transfer_order_query import TransferOrderQueryParams
+from ..requests.update_transfer_order_data import UpdateTransferOrderDataParams
+from ..types.cancel_transfer_order_response import CancelTransferOrderResponse
+from ..types.create_transfer_order_response import CreateTransferOrderResponse
+from ..types.delete_transfer_order_response import DeleteTransferOrderResponse
+from ..types.receive_transfer_order_response import ReceiveTransferOrderResponse
+from ..types.retrieve_transfer_order_response import RetrieveTransferOrderResponse
+from ..types.search_transfer_orders_response import SearchTransferOrdersResponse
+from ..types.start_transfer_order_response import StartTransferOrderResponse
+from ..types.transfer_order import TransferOrder
+from ..types.update_transfer_order_response import UpdateTransferOrderResponse
+from .raw_client import AsyncRawTransferOrdersClient, RawTransferOrdersClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class TransferOrdersClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawTransferOrdersClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawTransferOrdersClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawTransferOrdersClient
+ """
+ return self._raw_client
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ transfer_order: CreateTransferOrderDataParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTransferOrderResponse:
+ """
+ Creates a new transfer order in [DRAFT](entity:TransferOrderStatus) status. A transfer order represents the intent
+ to move [CatalogItemVariation](entity:CatalogItemVariation)s from one [Location](entity:Location) to another.
+ The source and destination locations must be different and must belong to your Square account.
+
+ In [DRAFT](entity:TransferOrderStatus) status, you can:
+ - Add or remove items
+ - Modify quantities
+ - Update shipping information
+ - Delete the entire order via [DeleteTransferOrder](api-endpoint:TransferOrders-DeleteTransferOrder)
+
+ The request requires source_location_id and destination_location_id.
+ Inventory levels are not affected until the order is started via
+ [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder).
+
+ Common integration points:
+ - Sync with warehouse management systems
+ - Automate regular stock transfers
+ - Initialize transfers from inventory optimization systems
+
+ Creates a [transfer_order.created](webhook:transfer_order.created) webhook event.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this CreateTransferOrder request. Keys can be
+ any valid string but must be unique for every CreateTransferOrder request.
+
+ transfer_order : CreateTransferOrderDataParams
+ The transfer order to create
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.transfer_orders.create(
+ idempotency_key="65cc0586-3e82-384s-b524-3885cffd52",
+ transfer_order={
+ "source_location_id": "EXAMPLE_SOURCE_LOCATION_ID_123",
+ "destination_location_id": "EXAMPLE_DEST_LOCATION_ID_456",
+ "expected_at": "2025-11-09T05:00:00Z",
+ "notes": "Example transfer order for inventory redistribution between locations",
+ "tracking_number": "TRACK123456789",
+ "created_by_team_member_id": "EXAMPLE_TEAM_MEMBER_ID_789",
+ "line_items": [
+ {
+ "item_variation_id": "EXAMPLE_ITEM_VARIATION_ID_001",
+ "quantity_ordered": "5",
+ },
+ {
+ "item_variation_id": "EXAMPLE_ITEM_VARIATION_ID_002",
+ "quantity_ordered": "3",
+ },
+ ],
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ idempotency_key=idempotency_key, transfer_order=transfer_order, request_options=request_options
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[TransferOrderQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[TransferOrder, SearchTransferOrdersResponse]:
+ """
+ Searches for transfer orders using filters. Returns a paginated list of matching
+ [TransferOrder](entity:TransferOrder)s sorted by creation date.
+
+ Common search scenarios:
+ - Find orders for a source [Location](entity:Location)
+ - Find orders for a destination [Location](entity:Location)
+ - Find orders in a particular [TransferOrderStatus](entity:TransferOrderStatus)
+
+ Parameters
+ ----------
+ query : typing.Optional[TransferOrderQueryParams]
+ The search query
+
+ cursor : typing.Optional[str]
+ Pagination cursor from a previous search response
+
+ limit : typing.Optional[int]
+ Maximum number of results to return (1-100)
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[TransferOrder, SearchTransferOrdersResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.transfer_orders.search(
+ query={
+ "filter": {
+ "source_location_ids": ["EXAMPLE_SOURCE_LOCATION_ID_123"],
+ "destination_location_ids": ["EXAMPLE_DEST_LOCATION_ID_456"],
+ "statuses": ["STARTED", "PARTIALLY_RECEIVED"],
+ },
+ "sort": {"field": "UPDATED_AT", "order": "DESC"},
+ },
+ cursor="eyJsYXN0X3VwZGF0ZWRfYXQiOjE3NTMxMTg2NjQ4NzN9",
+ limit=10,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.search(query=query, cursor=cursor, limit=limit, request_options=request_options)
+
+ def get(
+ self, transfer_order_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveTransferOrderResponse:
+ """
+ Retrieves a specific [TransferOrder](entity:TransferOrder) by ID. Returns the complete
+ order details including:
+
+ - Basic information (status, dates, notes)
+ - Line items with ordered and received quantities
+ - Source and destination [Location](entity:Location)s
+ - Tracking information (if available)
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to retrieve
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.transfer_orders.get(
+ transfer_order_id="transfer_order_id",
+ )
+ """
+ _response = self._raw_client.get(transfer_order_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ transfer_order: UpdateTransferOrderDataParams,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateTransferOrderResponse:
+ """
+ Updates an existing transfer order. This endpoint supports sparse updates,
+ allowing you to modify specific fields without affecting others.
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to update
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys must contain only alphanumeric characters, dashes and underscores
+
+ transfer_order : UpdateTransferOrderDataParams
+ The transfer order updates to apply
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.transfer_orders.update(
+ transfer_order_id="transfer_order_id",
+ idempotency_key="f47ac10b-58cc-4372-a567-0e02b2c3d479",
+ transfer_order={
+ "source_location_id": "EXAMPLE_SOURCE_LOCATION_ID_789",
+ "destination_location_id": "EXAMPLE_DEST_LOCATION_ID_101",
+ "expected_at": "2025-11-10T08:00:00Z",
+ "notes": "Updated: Priority transfer due to low stock at destination",
+ "tracking_number": "TRACK987654321",
+ "line_items": [
+ {"uid": "1", "quantity_ordered": "7"},
+ {
+ "item_variation_id": "EXAMPLE_NEW_ITEM_VARIATION_ID_003",
+ "quantity_ordered": "2",
+ },
+ {"uid": "2", "remove": True},
+ ],
+ },
+ version=1753109537351,
+ )
+ """
+ _response = self._raw_client.update(
+ transfer_order_id,
+ idempotency_key=idempotency_key,
+ transfer_order=transfer_order,
+ version=version,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def delete(
+ self,
+ transfer_order_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> DeleteTransferOrderResponse:
+ """
+ Deletes a transfer order in [DRAFT](entity:TransferOrderStatus) status.
+ Only draft orders can be deleted. Once an order is started via
+ [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder), it can no longer be deleted.
+
+ Creates a [transfer_order.deleted](webhook:transfer_order.deleted) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to delete
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.transfer_orders.delete(
+ transfer_order_id="transfer_order_id",
+ version=1000000,
+ )
+ """
+ _response = self._raw_client.delete(transfer_order_id, version=version, request_options=request_options)
+ return _response.data
+
+ def cancel(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CancelTransferOrderResponse:
+ """
+ Cancels a transfer order in [STARTED](entity:TransferOrderStatus) or
+ [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status. Any unreceived quantities will no
+ longer be receivable and will be immediately returned to the source [Location](entity:Location)'s inventory.
+
+ Common reasons for cancellation:
+ - Items no longer needed at destination
+ - Source location needs the inventory
+ - Order created in error
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to cancel. Must be in STARTED or PARTIALLY_RECEIVED status.
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys can be
+ any valid string but must be unique for every UpdateTransferOrder request.
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.transfer_orders.cancel(
+ transfer_order_id="transfer_order_id",
+ idempotency_key="65cc0586-3e82-4d08-b524-3885cffd52",
+ version=1753117449752,
+ )
+ """
+ _response = self._raw_client.cancel(
+ transfer_order_id, idempotency_key=idempotency_key, version=version, request_options=request_options
+ )
+ return _response.data
+
+ def receive(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ receipt: TransferOrderGoodsReceiptParams,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ReceiveTransferOrderResponse:
+ """
+ Records receipt of [CatalogItemVariation](entity:CatalogItemVariation)s for a transfer order.
+ This endpoint supports partial receiving - you can receive items in multiple batches.
+
+ For each line item, you can specify:
+ - Quantity received in good condition (added to destination inventory with [InventoryState](entity:InventoryState) of IN_STOCK)
+ - Quantity damaged during transit/handling (added to destination inventory with [InventoryState](entity:InventoryState) of WASTE)
+ - Quantity canceled (returned to source location's inventory)
+
+ The order must be in [STARTED](entity:TransferOrderStatus) or [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status.
+ Received quantities are added to the destination [Location](entity:Location)'s inventory according to their condition.
+ Canceled quantities are immediately returned to the source [Location](entity:Location)'s inventory.
+
+ When all items are either received, damaged, or canceled, the order moves to
+ [COMPLETED](entity:TransferOrderStatus) status.
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to receive items for
+
+ idempotency_key : str
+ A unique key to make this request idempotent
+
+ receipt : TransferOrderGoodsReceiptParams
+ The receipt details
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ReceiveTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.transfer_orders.receive(
+ transfer_order_id="transfer_order_id",
+ idempotency_key="EXAMPLE_IDEMPOTENCY_KEY_101",
+ receipt={
+ "line_items": [
+ {
+ "transfer_order_line_uid": "1",
+ "quantity_received": "3",
+ "quantity_damaged": "1",
+ "quantity_canceled": "1",
+ },
+ {
+ "transfer_order_line_uid": "2",
+ "quantity_received": "2",
+ "quantity_canceled": "1",
+ },
+ ]
+ },
+ version=1753118664873,
+ )
+ """
+ _response = self._raw_client.receive(
+ transfer_order_id,
+ idempotency_key=idempotency_key,
+ receipt=receipt,
+ version=version,
+ request_options=request_options,
+ )
+ return _response.data
+
+ def start(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> StartTransferOrderResponse:
+ """
+ Changes a [DRAFT](entity:TransferOrderStatus) transfer order to [STARTED](entity:TransferOrderStatus) status.
+ This decrements inventory at the source [Location](entity:Location) and marks it as in-transit.
+
+ The order must be in [DRAFT](entity:TransferOrderStatus) status and have all required fields populated.
+ Once started, the order can no longer be deleted, but it can be canceled via
+ [CancelTransferOrder](api-endpoint:TransferOrders-CancelTransferOrder).
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to start. Must be in DRAFT status.
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys can be
+ any valid string but must be unique for every UpdateTransferOrder request.
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ StartTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.transfer_orders.start(
+ transfer_order_id="transfer_order_id",
+ idempotency_key="EXAMPLE_IDEMPOTENCY_KEY_789",
+ version=1753109537351,
+ )
+ """
+ _response = self._raw_client.start(
+ transfer_order_id, idempotency_key=idempotency_key, version=version, request_options=request_options
+ )
+ return _response.data
+
+
+class AsyncTransferOrdersClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawTransferOrdersClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawTransferOrdersClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawTransferOrdersClient
+ """
+ return self._raw_client
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ transfer_order: CreateTransferOrderDataParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateTransferOrderResponse:
+ """
+ Creates a new transfer order in [DRAFT](entity:TransferOrderStatus) status. A transfer order represents the intent
+ to move [CatalogItemVariation](entity:CatalogItemVariation)s from one [Location](entity:Location) to another.
+ The source and destination locations must be different and must belong to your Square account.
+
+ In [DRAFT](entity:TransferOrderStatus) status, you can:
+ - Add or remove items
+ - Modify quantities
+ - Update shipping information
+ - Delete the entire order via [DeleteTransferOrder](api-endpoint:TransferOrders-DeleteTransferOrder)
+
+ The request requires source_location_id and destination_location_id.
+ Inventory levels are not affected until the order is started via
+ [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder).
+
+ Common integration points:
+ - Sync with warehouse management systems
+ - Automate regular stock transfers
+ - Initialize transfers from inventory optimization systems
+
+ Creates a [transfer_order.created](webhook:transfer_order.created) webhook event.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this CreateTransferOrder request. Keys can be
+ any valid string but must be unique for every CreateTransferOrder request.
+
+ transfer_order : CreateTransferOrderDataParams
+ The transfer order to create
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.transfer_orders.create(
+ idempotency_key="65cc0586-3e82-384s-b524-3885cffd52",
+ transfer_order={
+ "source_location_id": "EXAMPLE_SOURCE_LOCATION_ID_123",
+ "destination_location_id": "EXAMPLE_DEST_LOCATION_ID_456",
+ "expected_at": "2025-11-09T05:00:00Z",
+ "notes": "Example transfer order for inventory redistribution between locations",
+ "tracking_number": "TRACK123456789",
+ "created_by_team_member_id": "EXAMPLE_TEAM_MEMBER_ID_789",
+ "line_items": [
+ {
+ "item_variation_id": "EXAMPLE_ITEM_VARIATION_ID_001",
+ "quantity_ordered": "5",
+ },
+ {
+ "item_variation_id": "EXAMPLE_ITEM_VARIATION_ID_002",
+ "quantity_ordered": "3",
+ },
+ ],
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ idempotency_key=idempotency_key, transfer_order=transfer_order, request_options=request_options
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[TransferOrderQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[TransferOrder, SearchTransferOrdersResponse]:
+ """
+ Searches for transfer orders using filters. Returns a paginated list of matching
+ [TransferOrder](entity:TransferOrder)s sorted by creation date.
+
+ Common search scenarios:
+ - Find orders for a source [Location](entity:Location)
+ - Find orders for a destination [Location](entity:Location)
+ - Find orders in a particular [TransferOrderStatus](entity:TransferOrderStatus)
+
+ Parameters
+ ----------
+ query : typing.Optional[TransferOrderQueryParams]
+ The search query
+
+ cursor : typing.Optional[str]
+ Pagination cursor from a previous search response
+
+ limit : typing.Optional[int]
+ Maximum number of results to return (1-100)
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[TransferOrder, SearchTransferOrdersResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.transfer_orders.search(
+ query={
+ "filter": {
+ "source_location_ids": ["EXAMPLE_SOURCE_LOCATION_ID_123"],
+ "destination_location_ids": ["EXAMPLE_DEST_LOCATION_ID_456"],
+ "statuses": ["STARTED", "PARTIALLY_RECEIVED"],
+ },
+ "sort": {"field": "UPDATED_AT", "order": "DESC"},
+ },
+ cursor="eyJsYXN0X3VwZGF0ZWRfYXQiOjE3NTMxMTg2NjQ4NzN9",
+ limit=10,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.search(query=query, cursor=cursor, limit=limit, request_options=request_options)
+
+ async def get(
+ self, transfer_order_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveTransferOrderResponse:
+ """
+ Retrieves a specific [TransferOrder](entity:TransferOrder) by ID. Returns the complete
+ order details including:
+
+ - Basic information (status, dates, notes)
+ - Line items with ordered and received quantities
+ - Source and destination [Location](entity:Location)s
+ - Tracking information (if available)
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to retrieve
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.transfer_orders.get(
+ transfer_order_id="transfer_order_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(transfer_order_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ transfer_order: UpdateTransferOrderDataParams,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateTransferOrderResponse:
+ """
+ Updates an existing transfer order. This endpoint supports sparse updates,
+ allowing you to modify specific fields without affecting others.
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to update
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys must contain only alphanumeric characters, dashes and underscores
+
+ transfer_order : UpdateTransferOrderDataParams
+ The transfer order updates to apply
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.transfer_orders.update(
+ transfer_order_id="transfer_order_id",
+ idempotency_key="f47ac10b-58cc-4372-a567-0e02b2c3d479",
+ transfer_order={
+ "source_location_id": "EXAMPLE_SOURCE_LOCATION_ID_789",
+ "destination_location_id": "EXAMPLE_DEST_LOCATION_ID_101",
+ "expected_at": "2025-11-10T08:00:00Z",
+ "notes": "Updated: Priority transfer due to low stock at destination",
+ "tracking_number": "TRACK987654321",
+ "line_items": [
+ {"uid": "1", "quantity_ordered": "7"},
+ {
+ "item_variation_id": "EXAMPLE_NEW_ITEM_VARIATION_ID_003",
+ "quantity_ordered": "2",
+ },
+ {"uid": "2", "remove": True},
+ ],
+ },
+ version=1753109537351,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ transfer_order_id,
+ idempotency_key=idempotency_key,
+ transfer_order=transfer_order,
+ version=version,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def delete(
+ self,
+ transfer_order_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> DeleteTransferOrderResponse:
+ """
+ Deletes a transfer order in [DRAFT](entity:TransferOrderStatus) status.
+ Only draft orders can be deleted. Once an order is started via
+ [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder), it can no longer be deleted.
+
+ Creates a [transfer_order.deleted](webhook:transfer_order.deleted) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to delete
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.transfer_orders.delete(
+ transfer_order_id="transfer_order_id",
+ version=1000000,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(transfer_order_id, version=version, request_options=request_options)
+ return _response.data
+
+ async def cancel(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CancelTransferOrderResponse:
+ """
+ Cancels a transfer order in [STARTED](entity:TransferOrderStatus) or
+ [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status. Any unreceived quantities will no
+ longer be receivable and will be immediately returned to the source [Location](entity:Location)'s inventory.
+
+ Common reasons for cancellation:
+ - Items no longer needed at destination
+ - Source location needs the inventory
+ - Order created in error
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to cancel. Must be in STARTED or PARTIALLY_RECEIVED status.
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys can be
+ any valid string but must be unique for every UpdateTransferOrder request.
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CancelTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.transfer_orders.cancel(
+ transfer_order_id="transfer_order_id",
+ idempotency_key="65cc0586-3e82-4d08-b524-3885cffd52",
+ version=1753117449752,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.cancel(
+ transfer_order_id, idempotency_key=idempotency_key, version=version, request_options=request_options
+ )
+ return _response.data
+
+ async def receive(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ receipt: TransferOrderGoodsReceiptParams,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ReceiveTransferOrderResponse:
+ """
+ Records receipt of [CatalogItemVariation](entity:CatalogItemVariation)s for a transfer order.
+ This endpoint supports partial receiving - you can receive items in multiple batches.
+
+ For each line item, you can specify:
+ - Quantity received in good condition (added to destination inventory with [InventoryState](entity:InventoryState) of IN_STOCK)
+ - Quantity damaged during transit/handling (added to destination inventory with [InventoryState](entity:InventoryState) of WASTE)
+ - Quantity canceled (returned to source location's inventory)
+
+ The order must be in [STARTED](entity:TransferOrderStatus) or [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status.
+ Received quantities are added to the destination [Location](entity:Location)'s inventory according to their condition.
+ Canceled quantities are immediately returned to the source [Location](entity:Location)'s inventory.
+
+ When all items are either received, damaged, or canceled, the order moves to
+ [COMPLETED](entity:TransferOrderStatus) status.
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to receive items for
+
+ idempotency_key : str
+ A unique key to make this request idempotent
+
+ receipt : TransferOrderGoodsReceiptParams
+ The receipt details
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ReceiveTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.transfer_orders.receive(
+ transfer_order_id="transfer_order_id",
+ idempotency_key="EXAMPLE_IDEMPOTENCY_KEY_101",
+ receipt={
+ "line_items": [
+ {
+ "transfer_order_line_uid": "1",
+ "quantity_received": "3",
+ "quantity_damaged": "1",
+ "quantity_canceled": "1",
+ },
+ {
+ "transfer_order_line_uid": "2",
+ "quantity_received": "2",
+ "quantity_canceled": "1",
+ },
+ ]
+ },
+ version=1753118664873,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.receive(
+ transfer_order_id,
+ idempotency_key=idempotency_key,
+ receipt=receipt,
+ version=version,
+ request_options=request_options,
+ )
+ return _response.data
+
+ async def start(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> StartTransferOrderResponse:
+ """
+ Changes a [DRAFT](entity:TransferOrderStatus) transfer order to [STARTED](entity:TransferOrderStatus) status.
+ This decrements inventory at the source [Location](entity:Location) and marks it as in-transit.
+
+ The order must be in [DRAFT](entity:TransferOrderStatus) status and have all required fields populated.
+ Once started, the order can no longer be deleted, but it can be canceled via
+ [CancelTransferOrder](api-endpoint:TransferOrders-CancelTransferOrder).
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to start. Must be in DRAFT status.
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys can be
+ any valid string but must be unique for every UpdateTransferOrder request.
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ StartTransferOrderResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.transfer_orders.start(
+ transfer_order_id="transfer_order_id",
+ idempotency_key="EXAMPLE_IDEMPOTENCY_KEY_789",
+ version=1753109537351,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.start(
+ transfer_order_id, idempotency_key=idempotency_key, version=version, request_options=request_options
+ )
+ return _response.data
diff --git a/src/square/transfer_orders/raw_client.py b/src/square/transfer_orders/raw_client.py
new file mode 100644
index 00000000..515b181c
--- /dev/null
+++ b/src/square/transfer_orders/raw_client.py
@@ -0,0 +1,1106 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.pagination import AsyncPager, SyncPager
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.create_transfer_order_data import CreateTransferOrderDataParams
+from ..requests.transfer_order_goods_receipt import TransferOrderGoodsReceiptParams
+from ..requests.transfer_order_query import TransferOrderQueryParams
+from ..requests.update_transfer_order_data import UpdateTransferOrderDataParams
+from ..types.cancel_transfer_order_response import CancelTransferOrderResponse
+from ..types.create_transfer_order_response import CreateTransferOrderResponse
+from ..types.delete_transfer_order_response import DeleteTransferOrderResponse
+from ..types.receive_transfer_order_response import ReceiveTransferOrderResponse
+from ..types.retrieve_transfer_order_response import RetrieveTransferOrderResponse
+from ..types.search_transfer_orders_response import SearchTransferOrdersResponse
+from ..types.start_transfer_order_response import StartTransferOrderResponse
+from ..types.transfer_order import TransferOrder
+from ..types.update_transfer_order_response import UpdateTransferOrderResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawTransferOrdersClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ transfer_order: CreateTransferOrderDataParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateTransferOrderResponse]:
+ """
+ Creates a new transfer order in [DRAFT](entity:TransferOrderStatus) status. A transfer order represents the intent
+ to move [CatalogItemVariation](entity:CatalogItemVariation)s from one [Location](entity:Location) to another.
+ The source and destination locations must be different and must belong to your Square account.
+
+ In [DRAFT](entity:TransferOrderStatus) status, you can:
+ - Add or remove items
+ - Modify quantities
+ - Update shipping information
+ - Delete the entire order via [DeleteTransferOrder](api-endpoint:TransferOrders-DeleteTransferOrder)
+
+ The request requires source_location_id and destination_location_id.
+ Inventory levels are not affected until the order is started via
+ [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder).
+
+ Common integration points:
+ - Sync with warehouse management systems
+ - Automate regular stock transfers
+ - Initialize transfers from inventory optimization systems
+
+ Creates a [transfer_order.created](webhook:transfer_order.created) webhook event.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this CreateTransferOrder request. Keys can be
+ any valid string but must be unique for every CreateTransferOrder request.
+
+ transfer_order : CreateTransferOrderDataParams
+ The transfer order to create
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateTransferOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/transfer-orders",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "transfer_order": convert_and_respect_annotation_metadata(
+ object_=transfer_order, annotation=CreateTransferOrderDataParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTransferOrderResponse,
+ construct_type(
+ type_=CreateTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ query: typing.Optional[TransferOrderQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[TransferOrder, SearchTransferOrdersResponse]:
+ """
+ Searches for transfer orders using filters. Returns a paginated list of matching
+ [TransferOrder](entity:TransferOrder)s sorted by creation date.
+
+ Common search scenarios:
+ - Find orders for a source [Location](entity:Location)
+ - Find orders for a destination [Location](entity:Location)
+ - Find orders in a particular [TransferOrderStatus](entity:TransferOrderStatus)
+
+ Parameters
+ ----------
+ query : typing.Optional[TransferOrderQueryParams]
+ The search query
+
+ cursor : typing.Optional[str]
+ Pagination cursor from a previous search response
+
+ limit : typing.Optional[int]
+ Maximum number of results to return (1-100)
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[TransferOrder, SearchTransferOrdersResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/transfer-orders/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=TransferOrderQueryParams, direction="write"
+ ),
+ "cursor": cursor,
+ "limit": limit,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ SearchTransferOrdersResponse,
+ construct_type(
+ type_=SearchTransferOrdersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.transfer_orders
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.search(
+ query=query,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, transfer_order_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RetrieveTransferOrderResponse]:
+ """
+ Retrieves a specific [TransferOrder](entity:TransferOrder) by ID. Returns the complete
+ order details including:
+
+ - Basic information (status, dates, notes)
+ - Line items with ordered and received quantities
+ - Source and destination [Location](entity:Location)s
+ - Tracking information (if available)
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to retrieve
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[RetrieveTransferOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveTransferOrderResponse,
+ construct_type(
+ type_=RetrieveTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ transfer_order: UpdateTransferOrderDataParams,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateTransferOrderResponse]:
+ """
+ Updates an existing transfer order. This endpoint supports sparse updates,
+ allowing you to modify specific fields without affecting others.
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to update
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys must contain only alphanumeric characters, dashes and underscores
+
+ transfer_order : UpdateTransferOrderDataParams
+ The transfer order updates to apply
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateTransferOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}",
+ method="PUT",
+ json={
+ "idempotency_key": idempotency_key,
+ "transfer_order": convert_and_respect_annotation_metadata(
+ object_=transfer_order, annotation=UpdateTransferOrderDataParams, direction="write"
+ ),
+ "version": version,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateTransferOrderResponse,
+ construct_type(
+ type_=UpdateTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self,
+ transfer_order_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[DeleteTransferOrderResponse]:
+ """
+ Deletes a transfer order in [DRAFT](entity:TransferOrderStatus) status.
+ Only draft orders can be deleted. Once an order is started via
+ [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder), it can no longer be deleted.
+
+ Creates a [transfer_order.deleted](webhook:transfer_order.deleted) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to delete
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteTransferOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}",
+ method="DELETE",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteTransferOrderResponse,
+ construct_type(
+ type_=DeleteTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def cancel(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CancelTransferOrderResponse]:
+ """
+ Cancels a transfer order in [STARTED](entity:TransferOrderStatus) or
+ [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status. Any unreceived quantities will no
+ longer be receivable and will be immediately returned to the source [Location](entity:Location)'s inventory.
+
+ Common reasons for cancellation:
+ - Items no longer needed at destination
+ - Source location needs the inventory
+ - Order created in error
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to cancel. Must be in STARTED or PARTIALLY_RECEIVED status.
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys can be
+ any valid string but must be unique for every UpdateTransferOrder request.
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CancelTransferOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}/cancel",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "version": version,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelTransferOrderResponse,
+ construct_type(
+ type_=CancelTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def receive(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ receipt: TransferOrderGoodsReceiptParams,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[ReceiveTransferOrderResponse]:
+ """
+ Records receipt of [CatalogItemVariation](entity:CatalogItemVariation)s for a transfer order.
+ This endpoint supports partial receiving - you can receive items in multiple batches.
+
+ For each line item, you can specify:
+ - Quantity received in good condition (added to destination inventory with [InventoryState](entity:InventoryState) of IN_STOCK)
+ - Quantity damaged during transit/handling (added to destination inventory with [InventoryState](entity:InventoryState) of WASTE)
+ - Quantity canceled (returned to source location's inventory)
+
+ The order must be in [STARTED](entity:TransferOrderStatus) or [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status.
+ Received quantities are added to the destination [Location](entity:Location)'s inventory according to their condition.
+ Canceled quantities are immediately returned to the source [Location](entity:Location)'s inventory.
+
+ When all items are either received, damaged, or canceled, the order moves to
+ [COMPLETED](entity:TransferOrderStatus) status.
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to receive items for
+
+ idempotency_key : str
+ A unique key to make this request idempotent
+
+ receipt : TransferOrderGoodsReceiptParams
+ The receipt details
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ReceiveTransferOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}/receive",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "receipt": convert_and_respect_annotation_metadata(
+ object_=receipt, annotation=TransferOrderGoodsReceiptParams, direction="write"
+ ),
+ "version": version,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ReceiveTransferOrderResponse,
+ construct_type(
+ type_=ReceiveTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def start(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[StartTransferOrderResponse]:
+ """
+ Changes a [DRAFT](entity:TransferOrderStatus) transfer order to [STARTED](entity:TransferOrderStatus) status.
+ This decrements inventory at the source [Location](entity:Location) and marks it as in-transit.
+
+ The order must be in [DRAFT](entity:TransferOrderStatus) status and have all required fields populated.
+ Once started, the order can no longer be deleted, but it can be canceled via
+ [CancelTransferOrder](api-endpoint:TransferOrders-CancelTransferOrder).
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to start. Must be in DRAFT status.
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys can be
+ any valid string but must be unique for every UpdateTransferOrder request.
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[StartTransferOrderResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}/start",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "version": version,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ StartTransferOrderResponse,
+ construct_type(
+ type_=StartTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawTransferOrdersClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ transfer_order: CreateTransferOrderDataParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateTransferOrderResponse]:
+ """
+ Creates a new transfer order in [DRAFT](entity:TransferOrderStatus) status. A transfer order represents the intent
+ to move [CatalogItemVariation](entity:CatalogItemVariation)s from one [Location](entity:Location) to another.
+ The source and destination locations must be different and must belong to your Square account.
+
+ In [DRAFT](entity:TransferOrderStatus) status, you can:
+ - Add or remove items
+ - Modify quantities
+ - Update shipping information
+ - Delete the entire order via [DeleteTransferOrder](api-endpoint:TransferOrders-DeleteTransferOrder)
+
+ The request requires source_location_id and destination_location_id.
+ Inventory levels are not affected until the order is started via
+ [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder).
+
+ Common integration points:
+ - Sync with warehouse management systems
+ - Automate regular stock transfers
+ - Initialize transfers from inventory optimization systems
+
+ Creates a [transfer_order.created](webhook:transfer_order.created) webhook event.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A unique string that identifies this CreateTransferOrder request. Keys can be
+ any valid string but must be unique for every CreateTransferOrder request.
+
+ transfer_order : CreateTransferOrderDataParams
+ The transfer order to create
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateTransferOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/transfer-orders",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "transfer_order": convert_and_respect_annotation_metadata(
+ object_=transfer_order, annotation=CreateTransferOrderDataParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateTransferOrderResponse,
+ construct_type(
+ type_=CreateTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ query: typing.Optional[TransferOrderQueryParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ limit: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[TransferOrder, SearchTransferOrdersResponse]:
+ """
+ Searches for transfer orders using filters. Returns a paginated list of matching
+ [TransferOrder](entity:TransferOrder)s sorted by creation date.
+
+ Common search scenarios:
+ - Find orders for a source [Location](entity:Location)
+ - Find orders for a destination [Location](entity:Location)
+ - Find orders in a particular [TransferOrderStatus](entity:TransferOrderStatus)
+
+ Parameters
+ ----------
+ query : typing.Optional[TransferOrderQueryParams]
+ The search query
+
+ cursor : typing.Optional[str]
+ Pagination cursor from a previous search response
+
+ limit : typing.Optional[int]
+ Maximum number of results to return (1-100)
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[TransferOrder, SearchTransferOrdersResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/transfer-orders/search",
+ method="POST",
+ json={
+ "query": convert_and_respect_annotation_metadata(
+ object_=query, annotation=TransferOrderQueryParams, direction="write"
+ ),
+ "cursor": cursor,
+ "limit": limit,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ SearchTransferOrdersResponse,
+ construct_type(
+ type_=SearchTransferOrdersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.transfer_orders
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.search(
+ query=query,
+ cursor=_parsed_next,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, transfer_order_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RetrieveTransferOrderResponse]:
+ """
+ Retrieves a specific [TransferOrder](entity:TransferOrder) by ID. Returns the complete
+ order details including:
+
+ - Basic information (status, dates, notes)
+ - Line items with ordered and received quantities
+ - Source and destination [Location](entity:Location)s
+ - Tracking information (if available)
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to retrieve
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RetrieveTransferOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RetrieveTransferOrderResponse,
+ construct_type(
+ type_=RetrieveTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ transfer_order: UpdateTransferOrderDataParams,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateTransferOrderResponse]:
+ """
+ Updates an existing transfer order. This endpoint supports sparse updates,
+ allowing you to modify specific fields without affecting others.
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to update
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys must contain only alphanumeric characters, dashes and underscores
+
+ transfer_order : UpdateTransferOrderDataParams
+ The transfer order updates to apply
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateTransferOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}",
+ method="PUT",
+ json={
+ "idempotency_key": idempotency_key,
+ "transfer_order": convert_and_respect_annotation_metadata(
+ object_=transfer_order, annotation=UpdateTransferOrderDataParams, direction="write"
+ ),
+ "version": version,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateTransferOrderResponse,
+ construct_type(
+ type_=UpdateTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self,
+ transfer_order_id: str,
+ *,
+ version: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[DeleteTransferOrderResponse]:
+ """
+ Deletes a transfer order in [DRAFT](entity:TransferOrderStatus) status.
+ Only draft orders can be deleted. Once an order is started via
+ [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder), it can no longer be deleted.
+
+ Creates a [transfer_order.deleted](webhook:transfer_order.deleted) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to delete
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteTransferOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}",
+ method="DELETE",
+ params={
+ "version": version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteTransferOrderResponse,
+ construct_type(
+ type_=DeleteTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def cancel(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CancelTransferOrderResponse]:
+ """
+ Cancels a transfer order in [STARTED](entity:TransferOrderStatus) or
+ [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status. Any unreceived quantities will no
+ longer be receivable and will be immediately returned to the source [Location](entity:Location)'s inventory.
+
+ Common reasons for cancellation:
+ - Items no longer needed at destination
+ - Source location needs the inventory
+ - Order created in error
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to cancel. Must be in STARTED or PARTIALLY_RECEIVED status.
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys can be
+ any valid string but must be unique for every UpdateTransferOrder request.
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CancelTransferOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}/cancel",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "version": version,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CancelTransferOrderResponse,
+ construct_type(
+ type_=CancelTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def receive(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ receipt: TransferOrderGoodsReceiptParams,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[ReceiveTransferOrderResponse]:
+ """
+ Records receipt of [CatalogItemVariation](entity:CatalogItemVariation)s for a transfer order.
+ This endpoint supports partial receiving - you can receive items in multiple batches.
+
+ For each line item, you can specify:
+ - Quantity received in good condition (added to destination inventory with [InventoryState](entity:InventoryState) of IN_STOCK)
+ - Quantity damaged during transit/handling (added to destination inventory with [InventoryState](entity:InventoryState) of WASTE)
+ - Quantity canceled (returned to source location's inventory)
+
+ The order must be in [STARTED](entity:TransferOrderStatus) or [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status.
+ Received quantities are added to the destination [Location](entity:Location)'s inventory according to their condition.
+ Canceled quantities are immediately returned to the source [Location](entity:Location)'s inventory.
+
+ When all items are either received, damaged, or canceled, the order moves to
+ [COMPLETED](entity:TransferOrderStatus) status.
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to receive items for
+
+ idempotency_key : str
+ A unique key to make this request idempotent
+
+ receipt : TransferOrderGoodsReceiptParams
+ The receipt details
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ReceiveTransferOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}/receive",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "receipt": convert_and_respect_annotation_metadata(
+ object_=receipt, annotation=TransferOrderGoodsReceiptParams, direction="write"
+ ),
+ "version": version,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ReceiveTransferOrderResponse,
+ construct_type(
+ type_=ReceiveTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def start(
+ self,
+ transfer_order_id: str,
+ *,
+ idempotency_key: str,
+ version: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[StartTransferOrderResponse]:
+ """
+ Changes a [DRAFT](entity:TransferOrderStatus) transfer order to [STARTED](entity:TransferOrderStatus) status.
+ This decrements inventory at the source [Location](entity:Location) and marks it as in-transit.
+
+ The order must be in [DRAFT](entity:TransferOrderStatus) status and have all required fields populated.
+ Once started, the order can no longer be deleted, but it can be canceled via
+ [CancelTransferOrder](api-endpoint:TransferOrders-CancelTransferOrder).
+
+ Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
+
+ Parameters
+ ----------
+ transfer_order_id : str
+ The ID of the transfer order to start. Must be in DRAFT status.
+
+ idempotency_key : str
+ A unique string that identifies this UpdateTransferOrder request. Keys can be
+ any valid string but must be unique for every UpdateTransferOrder request.
+
+ version : typing.Optional[int]
+ Version for optimistic concurrency
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[StartTransferOrderResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/transfer-orders/{jsonable_encoder(transfer_order_id)}/start",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "version": version,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ StartTransferOrderResponse,
+ construct_type(
+ type_=StartTransferOrderResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/types/__init__.py b/src/square/types/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/types/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/types/accept_dispute_response.py b/src/square/types/accept_dispute_response.py
new file mode 100644
index 00000000..1f8a7edb
--- /dev/null
+++ b/src/square/types/accept_dispute_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+from .error import Error
+
+
+class AcceptDisputeResponse(UncheckedBaseModel):
+ """
+ Defines the fields in an `AcceptDispute` response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ dispute: typing.Optional[Dispute] = pydantic.Field(default=None)
+ """
+ Details about the accepted dispute.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/accepted_payment_methods.py b/src/square/types/accepted_payment_methods.py
new file mode 100644
index 00000000..71e3175c
--- /dev/null
+++ b/src/square/types/accepted_payment_methods.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class AcceptedPaymentMethods(UncheckedBaseModel):
+ apple_pay: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether Apple Pay is accepted at checkout.
+ """
+
+ google_pay: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether Google Pay is accepted at checkout.
+ """
+
+ cash_app_pay: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether Cash App Pay is accepted at checkout.
+ """
+
+ afterpay_clearpay: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether Afterpay/Clearpay is accepted at checkout.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/accumulate_loyalty_points_response.py b/src/square/types/accumulate_loyalty_points_response.py
new file mode 100644
index 00000000..29d2527e
--- /dev/null
+++ b/src/square/types/accumulate_loyalty_points_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_event import LoyaltyEvent
+
+
+class AccumulateLoyaltyPointsResponse(UncheckedBaseModel):
+ """
+ Represents an [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ event: typing.Optional[LoyaltyEvent] = pydantic.Field(default=None)
+ """
+ The resulting loyalty event. Starting in Square version 2022-08-17, this field is no longer returned.
+ """
+
+ events: typing.Optional[typing.List[LoyaltyEvent]] = pydantic.Field(default=None)
+ """
+ The resulting loyalty events. If the purchase qualifies for points, the `ACCUMULATE_POINTS` event
+ is always included. When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included
+ if the purchase also qualifies for a loyalty promotion.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/ach_details.py b/src/square/types/ach_details.py
new file mode 100644
index 00000000..d74fe7dc
--- /dev/null
+++ b/src/square/types/ach_details.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class AchDetails(UncheckedBaseModel):
+ """
+ ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type` of `ACH`.
+ """
+
+ routing_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The routing number for the bank account.
+ """
+
+ account_number_suffix: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The last few digits of the bank account number.
+ """
+
+ account_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the bank account performing the transfer. The account type can be `CHECKING`,
+ `SAVINGS`, or `UNKNOWN`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/action_cancel_reason.py b/src/square/types/action_cancel_reason.py
new file mode 100644
index 00000000..200467ad
--- /dev/null
+++ b/src/square/types/action_cancel_reason.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ActionCancelReason = typing.Union[typing.Literal["BUYER_CANCELED", "SELLER_CANCELED", "TIMED_OUT"], typing.Any]
diff --git a/src/square/types/activity_type.py b/src/square/types/activity_type.py
new file mode 100644
index 00000000..c60fab1f
--- /dev/null
+++ b/src/square/types/activity_type.py
@@ -0,0 +1,67 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ActivityType = typing.Union[
+ typing.Literal[
+ "ADJUSTMENT",
+ "APP_FEE_REFUND",
+ "APP_FEE_REVENUE",
+ "AUTOMATIC_SAVINGS",
+ "AUTOMATIC_SAVINGS_REVERSED",
+ "CHARGE",
+ "DEPOSIT_FEE",
+ "DEPOSIT_FEE_REVERSED",
+ "DISPUTE",
+ "ESCHEATMENT",
+ "FEE",
+ "FREE_PROCESSING",
+ "HOLD_ADJUSTMENT",
+ "INITIAL_BALANCE_CHANGE",
+ "MONEY_TRANSFER",
+ "MONEY_TRANSFER_REVERSAL",
+ "OPEN_DISPUTE",
+ "OTHER",
+ "OTHER_ADJUSTMENT",
+ "PAID_SERVICE_FEE",
+ "PAID_SERVICE_FEE_REFUND",
+ "REDEMPTION_CODE",
+ "REFUND",
+ "RELEASE_ADJUSTMENT",
+ "RESERVE_HOLD",
+ "RESERVE_RELEASE",
+ "RETURNED_PAYOUT",
+ "SQUARE_CAPITAL_PAYMENT",
+ "SQUARE_CAPITAL_REVERSED_PAYMENT",
+ "SUBSCRIPTION_FEE",
+ "SUBSCRIPTION_FEE_PAID_REFUND",
+ "SUBSCRIPTION_FEE_REFUND",
+ "TAX_ON_FEE",
+ "THIRD_PARTY_FEE",
+ "THIRD_PARTY_FEE_REFUND",
+ "PAYOUT",
+ "AUTOMATIC_BITCOIN_CONVERSIONS",
+ "AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED",
+ "CREDIT_CARD_REPAYMENT",
+ "CREDIT_CARD_REPAYMENT_REVERSED",
+ "LOCAL_OFFERS_CASHBACK",
+ "LOCAL_OFFERS_FEE",
+ "PERCENTAGE_PROCESSING_ENROLLMENT",
+ "PERCENTAGE_PROCESSING_DEACTIVATION",
+ "PERCENTAGE_PROCESSING_REPAYMENT",
+ "PERCENTAGE_PROCESSING_REPAYMENT_REVERSED",
+ "PROCESSING_FEE",
+ "PROCESSING_FEE_REFUND",
+ "UNDO_PROCESSING_FEE_REFUND",
+ "GIFT_CARD_LOAD_FEE",
+ "GIFT_CARD_LOAD_FEE_REFUND",
+ "UNDO_GIFT_CARD_LOAD_FEE_REFUND",
+ "BALANCE_FOLDERS_TRANSFER",
+ "BALANCE_FOLDERS_TRANSFER_REVERSED",
+ "GIFT_CARD_POOL_TRANSFER",
+ "GIFT_CARD_POOL_TRANSFER_REVERSED",
+ "SQUARE_PAYROLL_TRANSFER",
+ "SQUARE_PAYROLL_TRANSFER_REVERSED",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/add_group_to_customer_response.py b/src/square/types/add_group_to_customer_response.py
new file mode 100644
index 00000000..66230cb2
--- /dev/null
+++ b/src/square/types/add_group_to_customer_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class AddGroupToCustomerResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [AddGroupToCustomer](api-endpoint:Customers-AddGroupToCustomer) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/additional_recipient.py b/src/square/types/additional_recipient.py
new file mode 100644
index 00000000..33d422e1
--- /dev/null
+++ b/src/square/types/additional_recipient.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class AdditionalRecipient(UncheckedBaseModel):
+ """
+ Represents an additional recipient (other than the merchant) receiving a portion of this tender.
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The location ID for a recipient (other than the merchant) receiving a portion of this tender.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the additional recipient.
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount of money distributed to the recipient.
+ """
+
+ receivable_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the RETIRED `AdditionalRecipientReceivable` object. This field should be empty for any `AdditionalRecipient` objects created after the retirement.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/address.py b/src/square/types/address.py
new file mode 100644
index 00000000..e22a03b6
--- /dev/null
+++ b/src/square/types/address.py
@@ -0,0 +1,111 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .country import Country
+
+
+class Address(UncheckedBaseModel):
+ """
+ Represents a postal address in a country.
+ For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
+ """
+
+ address_line1: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="address_line_1"),
+ pydantic.Field(
+ alias="address_line_1",
+ description="The first line of the address.\n\nFields that start with `address_line` provide the address's most specific\ndetails, like street number, street name, and building name. They do *not*\nprovide less specific details like city, state/province, or country (these\ndetails are provided in other fields).",
+ ),
+ ] = None
+ address_line2: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="address_line_2"),
+ pydantic.Field(alias="address_line_2", description="The second line of the address, if any."),
+ ] = None
+ address_line3: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="address_line_3"),
+ pydantic.Field(alias="address_line_3", description="The third line of the address, if any."),
+ ] = None
+ locality: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The city or town of the address. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
+ """
+
+ sublocality: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A civil region within the address's `locality`, if any.
+ """
+
+ sublocality2: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="sublocality_2"),
+ pydantic.Field(alias="sublocality_2", description="A civil region within the address's `sublocality`, if any."),
+ ] = None
+ sublocality3: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="sublocality_3"),
+ pydantic.Field(
+ alias="sublocality_3", description="A civil region within the address's `sublocality_2`, if any."
+ ),
+ ] = None
+ administrative_district_level1: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="administrative_district_level_1"),
+ pydantic.Field(
+ alias="administrative_district_level_1",
+ description="A civil entity within the address's country. In the US, this\nis the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).",
+ ),
+ ] = None
+ administrative_district_level2: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="administrative_district_level_2"),
+ pydantic.Field(
+ alias="administrative_district_level_2",
+ description="A civil entity within the address's `administrative_district_level_1`.\nIn the US, this is the county.",
+ ),
+ ] = None
+ administrative_district_level3: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="administrative_district_level_3"),
+ pydantic.Field(
+ alias="administrative_district_level_3",
+ description="A civil entity within the address's `administrative_district_level_2`,\nif any.",
+ ),
+ ] = None
+ postal_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The address's postal code. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
+ """
+
+ country: typing.Optional[Country] = pydantic.Field(default=None)
+ """
+ The address's country, in the two-letter format of ISO 3166. For example, `US` or `FR`.
+ See [Country](#type-country) for possible values
+ """
+
+ first_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional first name when it's representing recipient.
+ """
+
+ last_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional last name when it's representing recipient.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/adjust_loyalty_points_response.py b/src/square/types/adjust_loyalty_points_response.py
new file mode 100644
index 00000000..631c79ed
--- /dev/null
+++ b/src/square/types/adjust_loyalty_points_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_event import LoyaltyEvent
+
+
+class AdjustLoyaltyPointsResponse(UncheckedBaseModel):
+ """
+ Represents an [AdjustLoyaltyPoints](api-endpoint:Loyalty-AdjustLoyaltyPoints) request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ event: typing.Optional[LoyaltyEvent] = pydantic.Field(default=None)
+ """
+ The resulting event data for the adjustment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/afterpay_details.py b/src/square/types/afterpay_details.py
new file mode 100644
index 00000000..e031dd74
--- /dev/null
+++ b/src/square/types/afterpay_details.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class AfterpayDetails(UncheckedBaseModel):
+ """
+ Additional details about Afterpay payments.
+ """
+
+ email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Email address on the buyer's Afterpay account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/application_details.py b/src/square/types/application_details.py
new file mode 100644
index 00000000..f5130c43
--- /dev/null
+++ b/src/square/types/application_details.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .application_details_external_square_product import ApplicationDetailsExternalSquareProduct
+
+
+class ApplicationDetails(UncheckedBaseModel):
+ """
+ Details about the application that took the payment.
+ """
+
+ square_product: typing.Optional[ApplicationDetailsExternalSquareProduct] = pydantic.Field(default=None)
+ """
+ The Square product, such as Square Point of Sale (POS),
+ Square Invoices, or Square Virtual Terminal.
+ See [ExternalSquareProduct](#type-externalsquareproduct) for possible values
+ """
+
+ application_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square ID assigned to the application used to take the payment.
+ Application developers can use this information to identify payments that
+ their application processed.
+ For example, if a developer uses a custom application to process payments,
+ this field contains the application ID from the Developer Dashboard.
+ If a seller uses a [Square App Marketplace](https://developer.squareup.com/docs/app-marketplace)
+ application to process payments, the field contains the corresponding application ID.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/application_details_external_square_product.py b/src/square/types/application_details_external_square_product.py
new file mode 100644
index 00000000..fd85383a
--- /dev/null
+++ b/src/square/types/application_details_external_square_product.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ApplicationDetailsExternalSquareProduct = typing.Union[
+ typing.Literal[
+ "APPOINTMENTS",
+ "ECOMMERCE_API",
+ "INVOICES",
+ "ONLINE_STORE",
+ "OTHER",
+ "RESTAURANTS",
+ "RETAIL",
+ "SQUARE_POS",
+ "TERMINAL_API",
+ "VIRTUAL_TERMINAL",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/application_type.py b/src/square/types/application_type.py
new file mode 100644
index 00000000..9b5e0515
--- /dev/null
+++ b/src/square/types/application_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ApplicationType = typing.Literal["TERMINAL_API"]
diff --git a/src/square/types/appointment_segment.py b/src/square/types/appointment_segment.py
new file mode 100644
index 00000000..670043b2
--- /dev/null
+++ b/src/square/types/appointment_segment.py
@@ -0,0 +1,57 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class AppointmentSegment(UncheckedBaseModel):
+ """
+ Defines an appointment segment of a booking.
+ """
+
+ duration_minutes: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The time span in minutes of an appointment segment.
+ """
+
+ service_variation_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment.
+ """
+
+ team_member_id: str = pydantic.Field()
+ """
+ The ID of the [TeamMember](entity:TeamMember) object representing the team member booked in this segment.
+ """
+
+ service_variation_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The current version of the item variation representing the service booked in this segment.
+ """
+
+ intermission_minutes: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time between the end of this segment and the beginning of the subsequent segment.
+ """
+
+ any_team_member: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the customer accepts any team member, instead of a specific one, to serve this segment.
+ """
+
+ resource_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of the seller-accessible resources used for this appointment segment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/archived_state.py b/src/square/types/archived_state.py
new file mode 100644
index 00000000..e31bd1ce
--- /dev/null
+++ b/src/square/types/archived_state.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ArchivedState = typing.Union[
+ typing.Literal["ARCHIVED_STATE_NOT_ARCHIVED", "ARCHIVED_STATE_ARCHIVED", "ARCHIVED_STATE_ALL"], typing.Any
+]
diff --git a/src/square/types/availability.py b/src/square/types/availability.py
new file mode 100644
index 00000000..abe78790
--- /dev/null
+++ b/src/square/types/availability.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .appointment_segment import AppointmentSegment
+
+
+class Availability(UncheckedBaseModel):
+ """
+ Defines an appointment slot that encapsulates the appointment segments, location and starting time available for booking.
+ """
+
+ start_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The RFC 3339 timestamp specifying the beginning time of the slot available for booking.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location available for booking.
+ """
+
+ appointment_segments: typing.Optional[typing.List[AppointmentSegment]] = pydantic.Field(default=None)
+ """
+ The list of appointment segments available for booking
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account.py b/src/square/types/bank_account.py
new file mode 100644
index 00000000..412d783c
--- /dev/null
+++ b/src/square/types/bank_account.py
@@ -0,0 +1,133 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account_status import BankAccountStatus
+from .bank_account_type import BankAccountType
+from .country import Country
+from .currency import Currency
+
+
+class BankAccount(UncheckedBaseModel):
+ """
+ Represents a bank account. For more information about
+ linking a bank account to a Square account, see
+ [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).
+ """
+
+ id: str = pydantic.Field()
+ """
+ The unique, Square-issued identifier for the bank account.
+ """
+
+ account_number_suffix: str = pydantic.Field()
+ """
+ The last few digits of the account number.
+ """
+
+ country: Country = pydantic.Field()
+ """
+ The ISO 3166 Alpha-2 country code where the bank account is based.
+ See [Country](#type-country) for possible values
+ """
+
+ currency: Currency = pydantic.Field()
+ """
+ The 3-character ISO 4217 currency code indicating the operating
+ currency of the bank account. For example, the currency code for US dollars
+ is `USD`.
+ See [Currency](#type-currency) for possible values
+ """
+
+ account_type: BankAccountType = pydantic.Field()
+ """
+ The financial purpose of the associated bank account.
+ See [BankAccountType](#type-bankaccounttype) for possible values
+ """
+
+ holder_name: str = pydantic.Field()
+ """
+ Name of the account holder. This name must match the name
+ on the targeted bank account record.
+ """
+
+ primary_bank_identification_number: str = pydantic.Field()
+ """
+ Primary identifier for the bank. For more information, see
+ [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).
+ """
+
+ secondary_bank_identification_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Secondary identifier for the bank. For more information, see
+ [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).
+ """
+
+ debit_mandate_reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Reference identifier that will be displayed to UK bank account owners
+ when collecting direct debit authorization. Only required for UK bank accounts.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Client-provided identifier for linking the banking account to an entity
+ in a third-party system (for example, a bank account number or a user identifier).
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The location to which the bank account belongs.
+ """
+
+ status: BankAccountStatus = pydantic.Field()
+ """
+ Read-only. The current verification status of this BankAccount object.
+ See [BankAccountStatus](#type-bankaccountstatus) for possible values
+ """
+
+ creditable: bool = pydantic.Field()
+ """
+ Indicates whether it is possible for Square to send money to this bank account.
+ """
+
+ debitable: bool = pydantic.Field()
+ """
+ Indicates whether it is possible for Square to take money from this
+ bank account.
+ """
+
+ fingerprint: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A Square-assigned, unique identifier for the bank account based on the
+ account information. The account fingerprint can be used to compare account
+ entries and determine if the they represent the same real-world bank account.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The current version of the `BankAccount`.
+ """
+
+ bank_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Read only. Name of actual financial institution.
+ For example "Bank of America".
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the customer who owns the bank account
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account_created_event.py b/src/square/types/bank_account_created_event.py
new file mode 100644
index 00000000..737c8b35
--- /dev/null
+++ b/src/square/types/bank_account_created_event.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account_created_event_data import BankAccountCreatedEventData
+
+
+class BankAccountCreatedEvent(UncheckedBaseModel):
+ """
+ Published when you link an external bank account to a Square
+ account in the Seller Dashboard. Square sets the initial status to
+ `VERIFICATION_IN_PROGRESS` and publishes the event.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"bank_account.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[BankAccountCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account_created_event_data.py b/src/square/types/bank_account_created_event_data.py
new file mode 100644
index 00000000..1cf23caa
--- /dev/null
+++ b/src/square/types/bank_account_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account_created_event_object import BankAccountCreatedEventObject
+
+
+class BankAccountCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"bank_account"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected bank account.
+ """
+
+ object: typing.Optional[BankAccountCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created bank account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account_created_event_object.py b/src/square/types/bank_account_created_event_object.py
new file mode 100644
index 00000000..8d02b0c6
--- /dev/null
+++ b/src/square/types/bank_account_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account import BankAccount
+
+
+class BankAccountCreatedEventObject(UncheckedBaseModel):
+ bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None)
+ """
+ The created bank account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account_disabled_event.py b/src/square/types/bank_account_disabled_event.py
new file mode 100644
index 00000000..7dedd436
--- /dev/null
+++ b/src/square/types/bank_account_disabled_event.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account_disabled_event_data import BankAccountDisabledEventData
+
+
+class BankAccountDisabledEvent(UncheckedBaseModel):
+ """
+ Published when Square sets the status of a
+ [BankAccount](entity:BankAccount) to `DISABLED`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"bank_account.disabled"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was disabled, in RFC 3339 format.
+ """
+
+ data: typing.Optional[BankAccountDisabledEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account_disabled_event_data.py b/src/square/types/bank_account_disabled_event_data.py
new file mode 100644
index 00000000..eb4b8ad3
--- /dev/null
+++ b/src/square/types/bank_account_disabled_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account_disabled_event_object import BankAccountDisabledEventObject
+
+
+class BankAccountDisabledEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"bank_account"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected bank account.
+ """
+
+ object: typing.Optional[BankAccountDisabledEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the disabled bank account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account_disabled_event_object.py b/src/square/types/bank_account_disabled_event_object.py
new file mode 100644
index 00000000..f218ad66
--- /dev/null
+++ b/src/square/types/bank_account_disabled_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account import BankAccount
+
+
+class BankAccountDisabledEventObject(UncheckedBaseModel):
+ bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None)
+ """
+ The disabled bank account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account_payment_details.py b/src/square/types/bank_account_payment_details.py
new file mode 100644
index 00000000..df83d3c9
--- /dev/null
+++ b/src/square/types/bank_account_payment_details.py
@@ -0,0 +1,67 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .ach_details import AchDetails
+from .error import Error
+
+
+class BankAccountPaymentDetails(UncheckedBaseModel):
+ """
+ Additional details about BANK_ACCOUNT type payments.
+ """
+
+ bank_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the bank associated with the bank account.
+ """
+
+ transfer_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the bank transfer. The type can be `ACH` or `UNKNOWN`.
+ """
+
+ account_ownership_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ownership type of the bank account performing the transfer.
+ The type can be `INDIVIDUAL`, `COMPANY`, or `ACCOUNT_TYPE_UNKNOWN`.
+ """
+
+ fingerprint: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Uniquely identifies the bank account for this seller and can be used
+ to determine if payments are from the same bank account.
+ """
+
+ country: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The two-letter ISO code representing the country the bank account is located in.
+ """
+
+ statement_description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The statement description as sent to the bank.
+ """
+
+ ach_details: typing.Optional[AchDetails] = pydantic.Field(default=None)
+ """
+ ACH-specific information about the transfer. The information is only populated
+ if the `transfer_type` is `ACH`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account_status.py b/src/square/types/bank_account_status.py
new file mode 100644
index 00000000..acb22001
--- /dev/null
+++ b/src/square/types/bank_account_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BankAccountStatus = typing.Union[typing.Literal["VERIFICATION_IN_PROGRESS", "VERIFIED", "DISABLED"], typing.Any]
diff --git a/src/square/types/bank_account_type.py b/src/square/types/bank_account_type.py
new file mode 100644
index 00000000..53626337
--- /dev/null
+++ b/src/square/types/bank_account_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BankAccountType = typing.Union[
+ typing.Literal["CHECKING", "SAVINGS", "INVESTMENT", "OTHER", "BUSINESS_CHECKING"], typing.Any
+]
diff --git a/src/square/types/bank_account_verified_event.py b/src/square/types/bank_account_verified_event.py
new file mode 100644
index 00000000..7f0c08a9
--- /dev/null
+++ b/src/square/types/bank_account_verified_event.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account_verified_event_data import BankAccountVerifiedEventData
+
+
+class BankAccountVerifiedEvent(UncheckedBaseModel):
+ """
+ Published when Square sets the status of a
+ [BankAccount](entity:BankAccount) to `VERIFIED`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"bank_account.verified"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was verified, in RFC 3339 format.
+ """
+
+ data: typing.Optional[BankAccountVerifiedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account_verified_event_data.py b/src/square/types/bank_account_verified_event_data.py
new file mode 100644
index 00000000..6bc3f160
--- /dev/null
+++ b/src/square/types/bank_account_verified_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account_verified_event_object import BankAccountVerifiedEventObject
+
+
+class BankAccountVerifiedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"bank_account"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected bank account.
+ """
+
+ object: typing.Optional[BankAccountVerifiedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the verified bank account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bank_account_verified_event_object.py b/src/square/types/bank_account_verified_event_object.py
new file mode 100644
index 00000000..dff2c54c
--- /dev/null
+++ b/src/square/types/bank_account_verified_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account import BankAccount
+
+
+class BankAccountVerifiedEventObject(UncheckedBaseModel):
+ bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None)
+ """
+ The verified bank account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_change_inventory_request.py b/src/square/types/batch_change_inventory_request.py
new file mode 100644
index 00000000..ef6df43e
--- /dev/null
+++ b/src/square/types/batch_change_inventory_request.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_change import InventoryChange
+
+
+class BatchChangeInventoryRequest(UncheckedBaseModel):
+ idempotency_key: str = pydantic.Field()
+ """
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+ """
+
+ changes: typing.Optional[typing.List[InventoryChange]] = pydantic.Field(default=None)
+ """
+ The set of physical counts and inventory adjustments to be made.
+ Changes are applied based on the client-supplied timestamp and may be sent
+ out of order.
+ """
+
+ ignore_unchanged_counts: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the current physical count should be ignored if
+ the quantity is unchanged since the last physical count. Default: `true`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_change_inventory_response.py b/src/square/types/batch_change_inventory_response.py
new file mode 100644
index 00000000..c297c9fe
--- /dev/null
+++ b/src/square/types/batch_change_inventory_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_change import InventoryChange
+from .inventory_count import InventoryCount
+
+
+class BatchChangeInventoryResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ counts: typing.Optional[typing.List[InventoryCount]] = pydantic.Field(default=None)
+ """
+ The current counts for all objects referenced in the request.
+ """
+
+ changes: typing.Optional[typing.List[InventoryChange]] = pydantic.Field(default=None)
+ """
+ Changes created for the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_create_team_members_response.py b/src/square/types/batch_create_team_members_response.py
new file mode 100644
index 00000000..3abc2a02
--- /dev/null
+++ b/src/square/types/batch_create_team_members_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .create_team_member_response import CreateTeamMemberResponse
+from .error import Error
+
+
+class BatchCreateTeamMembersResponse(UncheckedBaseModel):
+ """
+ Represents a response from a bulk create request containing the created `TeamMember` objects or error messages.
+ """
+
+ team_members: typing.Optional[typing.Dict[str, CreateTeamMemberResponse]] = pydantic.Field(default=None)
+ """
+ The successfully created `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_create_vendors_response.py b/src/square/types/batch_create_vendors_response.py
new file mode 100644
index 00000000..cea4b23d
--- /dev/null
+++ b/src/square/types/batch_create_vendors_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .create_vendor_response import CreateVendorResponse
+from .error import Error
+
+
+class BatchCreateVendorsResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [BulkCreateVendors](api-endpoint:Vendors-BulkCreateVendors).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ responses: typing.Optional[typing.Dict[str, CreateVendorResponse]] = pydantic.Field(default=None)
+ """
+ A set of [CreateVendorResponse](entity:CreateVendorResponse) objects encapsulating successfully created [Vendor](entity:Vendor)
+ objects or error responses for failed attempts. The set is represented by
+ a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The idempotency keys correspond to those specified
+ in the input.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_delete_catalog_objects_response.py b/src/square/types/batch_delete_catalog_objects_response.py
new file mode 100644
index 00000000..a69c2218
--- /dev/null
+++ b/src/square/types/batch_delete_catalog_objects_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class BatchDeleteCatalogObjectsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ deleted_object_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of all CatalogObjects deleted by this request.
+ """
+
+ deleted_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this deletion in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_get_catalog_objects_response.py b/src/square/types/batch_get_catalog_objects_response.py
new file mode 100644
index 00000000..d47dad47
--- /dev/null
+++ b/src/square/types/batch_get_catalog_objects_response.py
@@ -0,0 +1,60 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class BatchGetCatalogObjectsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ objects: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ A list of [CatalogObject](entity:CatalogObject)s returned.
+ """
+
+ related_objects: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ A list of [CatalogObject](entity:CatalogObject)s referenced by the object in the `objects` field.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ BatchGetCatalogObjectsResponse,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/batch_get_inventory_changes_response.py b/src/square/types/batch_get_inventory_changes_response.py
new file mode 100644
index 00000000..3f1ca249
--- /dev/null
+++ b/src/square/types/batch_get_inventory_changes_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_change import InventoryChange
+
+
+class BatchGetInventoryChangesResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ changes: typing.Optional[typing.List[InventoryChange]] = pydantic.Field(default=None)
+ """
+ The current calculated inventory changes for the requested objects
+ and locations.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_get_inventory_counts_request.py b/src/square/types/batch_get_inventory_counts_request.py
new file mode 100644
index 00000000..b8b0ec34
--- /dev/null
+++ b/src/square/types/batch_get_inventory_counts_request.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_state import InventoryState
+
+
+class BatchGetInventoryCountsRequest(UncheckedBaseModel):
+ catalog_object_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The filter to return results by `CatalogObject` ID.
+ The filter is applicable only when set. The default is null.
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The filter to return results by `Location` ID.
+ This filter is applicable only when set. The default is null.
+ """
+
+ updated_after: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
+
+ states: typing.Optional[typing.List[InventoryState]] = pydantic.Field(default=None)
+ """
+ The filter to return results by `InventoryState`. The filter is only applicable when set.
+ Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
+ The default is null.
+ """
+
+ limit: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of [records](entity:InventoryCount) to return.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_get_inventory_counts_response.py b/src/square/types/batch_get_inventory_counts_response.py
new file mode 100644
index 00000000..0404e55f
--- /dev/null
+++ b/src/square/types/batch_get_inventory_counts_response.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_count import InventoryCount
+
+
+class BatchGetInventoryCountsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ counts: typing.Optional[typing.List[InventoryCount]] = pydantic.Field(default=None)
+ """
+ The current calculated inventory counts for the requested objects
+ and locations.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_get_orders_response.py b/src/square/types/batch_get_orders_response.py
new file mode 100644
index 00000000..0d3dab83
--- /dev/null
+++ b/src/square/types/batch_get_orders_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .order import Order
+
+
+class BatchGetOrdersResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `BatchRetrieveOrders` endpoint.
+ """
+
+ orders: typing.Optional[typing.List[Order]] = pydantic.Field(default=None)
+ """
+ The requested orders. This will omit any requested orders that do not exist.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_get_vendors_response.py b/src/square/types/batch_get_vendors_response.py
new file mode 100644
index 00000000..f3b81215
--- /dev/null
+++ b/src/square/types/batch_get_vendors_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .get_vendor_response import GetVendorResponse
+
+
+class BatchGetVendorsResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [BulkRetrieveVendors](api-endpoint:Vendors-BulkRetrieveVendors).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ responses: typing.Optional[typing.Dict[str, GetVendorResponse]] = pydantic.Field(default=None)
+ """
+ The set of [RetrieveVendorResponse](entity:RetrieveVendorResponse) objects encapsulating successfully retrieved [Vendor](entity:Vendor)
+ objects or error responses for failed attempts. The set is represented by
+ a collection of `Vendor`-ID/`Vendor`-object or `Vendor`-ID/error-object pairs.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_retrieve_inventory_changes_request.py b/src/square/types/batch_retrieve_inventory_changes_request.py
new file mode 100644
index 00000000..ca682b97
--- /dev/null
+++ b/src/square/types/batch_retrieve_inventory_changes_request.py
@@ -0,0 +1,89 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .batch_retrieve_inventory_changes_sort import BatchRetrieveInventoryChangesSort
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonId
+from .inventory_change_type import InventoryChangeType
+from .inventory_state import InventoryState
+
+
+class BatchRetrieveInventoryChangesRequest(UncheckedBaseModel):
+ catalog_object_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The filter to return results by `CatalogObject` ID.
+ The filter is only applicable when set. The default value is null.
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The filter to return results by `Location` ID.
+ The filter is only applicable when set. The default value is null.
+ """
+
+ types: typing.Optional[typing.List[InventoryChangeType]] = pydantic.Field(default=None)
+ """
+ The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
+ The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.
+ """
+
+ states: typing.Optional[typing.List[InventoryState]] = pydantic.Field(default=None)
+ """
+ The filter to return `ADJUSTMENT` query results by
+ `InventoryState`. This filter is only applied when set.
+ The default value is null.
+ """
+
+ updated_after: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The filter to return results with their `calculated_at` value
+ after the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+ """
+
+ updated_before: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The filter to return results with their `created_at` or `calculated_at` value
+ strictly before the given time as specified in an RFC 3339 timestamp.
+ The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
+
+ limit: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of [records](entity:InventoryChange) to return.
+ """
+
+ sort: typing.Optional[BatchRetrieveInventoryChangesSort] = pydantic.Field(default=None)
+ """
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+ """
+
+ reason_ids: typing.Optional[typing.List[InventoryAdjustmentReasonId]] = pydantic.Field(default=None)
+ """
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_retrieve_inventory_changes_sort.py b/src/square/types/batch_retrieve_inventory_changes_sort.py
new file mode 100644
index 00000000..aaa1c633
--- /dev/null
+++ b/src/square/types/batch_retrieve_inventory_changes_sort.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .batch_retrieve_inventory_changes_sort_field import BatchRetrieveInventoryChangesSortField
+from .sort_order import SortOrder
+
+
+class BatchRetrieveInventoryChangesSort(UncheckedBaseModel):
+ field: typing.Optional[BatchRetrieveInventoryChangesSortField] = pydantic.Field(default=None)
+ """
+ The field to sort inventory changes by.
+ See [Field](#type-field) for possible values
+ """
+
+ order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The order to sort inventory changes by.
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_retrieve_inventory_changes_sort_field.py b/src/square/types/batch_retrieve_inventory_changes_sort_field.py
new file mode 100644
index 00000000..9ecf1398
--- /dev/null
+++ b/src/square/types/batch_retrieve_inventory_changes_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BatchRetrieveInventoryChangesSortField = typing.Literal["OCCURRED_AT"]
diff --git a/src/square/types/batch_update_team_members_response.py b/src/square/types/batch_update_team_members_response.py
new file mode 100644
index 00000000..2cd85479
--- /dev/null
+++ b/src/square/types/batch_update_team_members_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .update_team_member_response import UpdateTeamMemberResponse
+
+
+class BatchUpdateTeamMembersResponse(UncheckedBaseModel):
+ """
+ Represents a response from a bulk update request containing the updated `TeamMember` objects or error messages.
+ """
+
+ team_members: typing.Optional[typing.Dict[str, UpdateTeamMemberResponse]] = pydantic.Field(default=None)
+ """
+ The successfully updated `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_update_vendors_response.py b/src/square/types/batch_update_vendors_response.py
new file mode 100644
index 00000000..160e9480
--- /dev/null
+++ b/src/square/types/batch_update_vendors_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .update_vendor_response import UpdateVendorResponse
+
+
+class BatchUpdateVendorsResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [BulkUpdateVendors](api-endpoint:Vendors-BulkUpdateVendors).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ responses: typing.Optional[typing.Dict[str, UpdateVendorResponse]] = pydantic.Field(default=None)
+ """
+ A set of [UpdateVendorResponse](entity:UpdateVendorResponse) objects encapsulating successfully created [Vendor](entity:Vendor)
+ objects or error responses for failed attempts. The set is represented by a collection of `Vendor`-ID/`UpdateVendorResponse`-object or
+ `Vendor`-ID/error-object pairs.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_upsert_catalog_objects_response.py b/src/square/types/batch_upsert_catalog_objects_response.py
new file mode 100644
index 00000000..79f52b4b
--- /dev/null
+++ b/src/square/types/batch_upsert_catalog_objects_response.py
@@ -0,0 +1,66 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_id_mapping import CatalogIdMapping
+from .error import Error
+
+
+class BatchUpsertCatalogObjectsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ objects: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ The created successfully created CatalogObjects.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".
+ """
+
+ id_mappings: typing.Optional[typing.List[CatalogIdMapping]] = pydantic.Field(default=None)
+ """
+ The mapping between client and server IDs for this upsert.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ BatchUpsertCatalogObjectsResponse,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.py b/src/square/types/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.py
new file mode 100644
index 00000000..f015e341
--- /dev/null
+++ b/src/square/types/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+
+
+class BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest(UncheckedBaseModel):
+ """
+ Represents an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes)
+ request. An individual request contains a customer ID, the custom attribute to create or update,
+ and an optional idempotency key.
+ """
+
+ customer_id: str = pydantic.Field()
+ """
+ The ID of the target [customer profile](entity:Customer).
+ """
+
+ custom_attribute: CustomAttribute = pydantic.Field()
+ """
+ The custom attribute to create or update, with following fields:
+
+ - `key`. This key must match the `key` of a custom attribute definition in the Square seller
+ account. If the requesting application is not the definition owner, you must provide the qualified key.
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for update operations, include this optional field in the request and set the
+ value to the current version of the custom attribute.
+ """
+
+ idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique identifier for this individual upsert request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_upsert_customer_custom_attributes_response.py b/src/square/types/batch_upsert_customer_custom_attributes_response.py
new file mode 100644
index 00000000..802822ab
--- /dev/null
+++ b/src/square/types/batch_upsert_customer_custom_attributes_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response import (
+ BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse,
+)
+from .error import Error
+
+
+class BatchUpsertCustomerCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual upsert request.
+ """
+
+ values: typing.Optional[
+ typing.Dict[str, BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse]
+ ] = pydantic.Field(default=None)
+ """
+ A map of responses that correspond to individual upsert requests. Each response has the
+ same ID as the corresponding request and contains either a `customer_id` and `custom_attribute` or an `errors` field.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.py b/src/square/types/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.py
new file mode 100644
index 00000000..f35386d0
--- /dev/null
+++ b/src/square/types/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse(UncheckedBaseModel):
+ """
+ Represents a response for an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) operation.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the customer profile associated with the custom attribute.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred while processing the individual request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking.py b/src/square/types/booking.py
new file mode 100644
index 00000000..122ccf8c
--- /dev/null
+++ b/src/square/types/booking.py
@@ -0,0 +1,120 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .appointment_segment import AppointmentSegment
+from .booking_booking_source import BookingBookingSource
+from .booking_creator_details import BookingCreatorDetails
+from .booking_status import BookingStatus
+from .business_appointment_settings_booking_location_type import BusinessAppointmentSettingsBookingLocationType
+
+
+class Booking(UncheckedBaseModel):
+ """
+ Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
+ at a given location to a requesting customer in one or more appointment segments.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID of this object representing a booking.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The revision number for the booking used for optimistic concurrency.
+ """
+
+ status: typing.Optional[BookingStatus] = pydantic.Field(default=None)
+ """
+ The status of the booking, describing where the booking stands with respect to the booking state machine.
+ See [BookingStatus](#type-bookingstatus) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The RFC 3339 timestamp specifying the creation time of this booking.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The RFC 3339 timestamp specifying the most recent update time of this booking.
+ """
+
+ start_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The RFC 3339 timestamp specifying the starting time of this booking.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [Location](entity:Location) object representing the location where the booked service is provided. Once set when the booking is created, its value cannot be changed.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [Customer](entity:Customer) object representing the customer receiving the booked service.
+ """
+
+ customer_note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The free-text field for the customer to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a relevant [CatalogObject](entity:CatalogObject) instance.
+ """
+
+ seller_note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The free-text field for the seller to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a specific [CatalogObject](entity:CatalogObject) instance.
+ This field should not be visible to customers.
+ """
+
+ appointment_segments: typing.Optional[typing.List[AppointmentSegment]] = pydantic.Field(default=None)
+ """
+ A list of appointment segments for this booking.
+ """
+
+ transition_time_minutes: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Additional time at the end of a booking.
+ Applications should not make this field visible to customers of a seller.
+ """
+
+ all_day: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the booking is of a full business day.
+ """
+
+ location_type: typing.Optional[BusinessAppointmentSettingsBookingLocationType] = pydantic.Field(default=None)
+ """
+ The type of location where the booking is held.
+ See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values
+ """
+
+ creator_details: typing.Optional[BookingCreatorDetails] = pydantic.Field(default=None)
+ """
+ Information about the booking creator.
+ """
+
+ source: typing.Optional[BookingBookingSource] = pydantic.Field(default=None)
+ """
+ The source of the booking.
+ Access to this field requires seller-level permissions.
+ See [BookingBookingSource](#type-bookingbookingsource) for possible values
+ """
+
+ address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ Stores a customer address if the location type is `CUSTOMER_LOCATION`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_booking_source.py b/src/square/types/booking_booking_source.py
new file mode 100644
index 00000000..c0d34cc0
--- /dev/null
+++ b/src/square/types/booking_booking_source.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BookingBookingSource = typing.Union[
+ typing.Literal["FIRST_PARTY_MERCHANT", "FIRST_PARTY_BUYER", "THIRD_PARTY_BUYER", "API"], typing.Any
+]
diff --git a/src/square/types/booking_created_event.py b/src/square/types/booking_created_event.py
new file mode 100644
index 00000000..efe1ff42
--- /dev/null
+++ b/src/square/types/booking_created_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking_created_event_data import BookingCreatedEventData
+
+
+class BookingCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a booking is created.
+
+ To receive this event with buyer-level permissions, you must have `APPOINTMENTS_READ` set for the OAuth scope.
+ To receive this event with seller-level permissions, you must have `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` set for the OAuth scope.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[BookingCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_created_event_data.py b/src/square/types/booking_created_event_data.py
new file mode 100644
index 00000000..6dd3c62b
--- /dev/null
+++ b/src/square/types/booking_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking_created_event_object import BookingCreatedEventObject
+
+
+class BookingCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `"booking"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[BookingCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created booking.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_created_event_object.py b/src/square/types/booking_created_event_object.py
new file mode 100644
index 00000000..d4255f56
--- /dev/null
+++ b/src/square/types/booking_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking import Booking
+
+
+class BookingCreatedEventObject(UncheckedBaseModel):
+ booking: typing.Optional[Booking] = pydantic.Field(default=None)
+ """
+ The created booking.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_creator_details.py b/src/square/types/booking_creator_details.py
new file mode 100644
index 00000000..08d463ae
--- /dev/null
+++ b/src/square/types/booking_creator_details.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking_creator_details_creator_type import BookingCreatorDetailsCreatorType
+
+
+class BookingCreatorDetails(UncheckedBaseModel):
+ """
+ Information about a booking creator.
+ """
+
+ creator_type: typing.Optional[BookingCreatorDetailsCreatorType] = pydantic.Field(default=None)
+ """
+ The seller-accessible type of the creator of the booking.
+ See [BookingCreatorDetailsCreatorType](#type-bookingcreatordetailscreatortype) for possible values
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the team member who created the booking, when the booking creator is of the `TEAM_MEMBER` type.
+ Access to this field requires seller-level permissions.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the customer who created the booking, when the booking creator is of the `CUSTOMER` type.
+ Access to this field requires seller-level permissions.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_creator_details_creator_type.py b/src/square/types/booking_creator_details_creator_type.py
new file mode 100644
index 00000000..9a6be86e
--- /dev/null
+++ b/src/square/types/booking_creator_details_creator_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BookingCreatorDetailsCreatorType = typing.Union[typing.Literal["TEAM_MEMBER", "CUSTOMER"], typing.Any]
diff --git a/src/square/types/booking_custom_attribute_definition_owned_created_event.py b/src/square/types/booking_custom_attribute_definition_owned_created_event.py
new file mode 100644
index 00000000..e72d893a
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_definition_owned_created_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class BookingCustomAttributeDefinitionOwnedCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ is created by the subscribing application. Subscribe to this event to be notified
+ when your application creates a booking custom attribute definition.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.owned.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_definition_owned_deleted_event.py b/src/square/types/booking_custom_attribute_definition_owned_deleted_event.py
new file mode 100644
index 00000000..a0904e1d
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_definition_owned_deleted_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class BookingCustomAttributeDefinitionOwnedDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ is deleted by the subscribing application. Subscribe to this event to be notified
+ when your application deletes a booking custom attribute definition.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.owned.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_definition_owned_updated_event.py b/src/square/types/booking_custom_attribute_definition_owned_updated_event.py
new file mode 100644
index 00000000..86e7b5b4
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_definition_owned_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class BookingCustomAttributeDefinitionOwnedUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ is updated by the subscribing application. Subscribe to this event to be notified
+ when your application updates a booking custom attribute definition.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.owned.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_definition_visible_created_event.py b/src/square/types/booking_custom_attribute_definition_visible_created_event.py
new file mode 100644
index 00000000..8a3120d9
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_definition_visible_created_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class BookingCustomAttributeDefinitionVisibleCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is created.
+ An application that subscribes to this event is notified when a booking custom attribute definition is created
+ by any application for which the subscribing application has read access to the booking custom attribute definition.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.visible.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_definition_visible_deleted_event.py b/src/square/types/booking_custom_attribute_definition_visible_deleted_event.py
new file mode 100644
index 00000000..614d1634
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_definition_visible_deleted_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class BookingCustomAttributeDefinitionVisibleDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted.
+ An application that subscribes to this event is notified when a booking custom attribute definition is deleted
+ by any application for which the subscribing application has read access to the booking custom attribute definition.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.visible.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_definition_visible_updated_event.py b/src/square/types/booking_custom_attribute_definition_visible_updated_event.py
new file mode 100644
index 00000000..b38b614f
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_definition_visible_updated_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class BookingCustomAttributeDefinitionVisibleUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a booking [custom attribute definition](entity:CustomAttributeDefinition)
+ with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated.
+ An application that subscribes to this event is notified when a booking custom attribute definition is updated
+ by any application for which the subscribing application has read access to the booking custom attribute definition.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.custom_attribute_definition.visible.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_delete_request.py b/src/square/types/booking_custom_attribute_delete_request.py
new file mode 100644
index 00000000..6e7bcf89
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_delete_request.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class BookingCustomAttributeDeleteRequest(UncheckedBaseModel):
+ """
+ Represents an individual delete request in a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes)
+ request. An individual request contains a booking ID, the custom attribute to delete, and an optional idempotency key.
+ """
+
+ booking_id: str = pydantic.Field()
+ """
+ The ID of the target [booking](entity:Booking).
+ """
+
+ key: str = pydantic.Field()
+ """
+ The key of the custom attribute to delete. This key must match the `key` of a
+ custom attribute definition in the Square seller account. If the requesting application is not
+ the definition owner, you must use the qualified key.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_delete_response.py b/src/square/types/booking_custom_attribute_delete_response.py
new file mode 100644
index 00000000..94bea07b
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_delete_response.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class BookingCustomAttributeDeleteResponse(UncheckedBaseModel):
+ """
+ Represents a response for an individual upsert request in a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) operation.
+ """
+
+ booking_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [booking](entity:Booking) associated with the custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred while processing the individual request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_owned_deleted_event.py b/src/square/types/booking_custom_attribute_owned_deleted_event.py
new file mode 100644
index 00000000..ad02fbb4
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_owned_deleted_event.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class BookingCustomAttributeOwnedDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a booking [custom attribute](entity:CustomAttribute)
+ associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is
+ owned by the subscribing application is deleted.
+ Subscribe to this event to be notified
+ when your application deletes a booking custom attribute.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.custom_attribute.owned.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_owned_updated_event.py b/src/square/types/booking_custom_attribute_owned_updated_event.py
new file mode 100644
index 00000000..f603760b
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_owned_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class BookingCustomAttributeOwnedUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a booking [custom attribute](entity:CustomAttribute)
+ is updated by the subscribing application. Subscribe to this event to be notified
+ when your application updates a booking custom attribute.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.custom_attribute.owned.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_upsert_request.py b/src/square/types/booking_custom_attribute_upsert_request.py
new file mode 100644
index 00000000..3c4f4ad7
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_upsert_request.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+
+
+class BookingCustomAttributeUpsertRequest(UncheckedBaseModel):
+ """
+ Represents an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes)
+ request. An individual request contains a booking ID, the custom attribute to create or update,
+ and an optional idempotency key.
+ """
+
+ booking_id: str = pydantic.Field()
+ """
+ The ID of the target [booking](entity:Booking).
+ """
+
+ custom_attribute: CustomAttribute = pydantic.Field()
+ """
+ The custom attribute to create or update, with following fields:
+
+ - `key`. This key must match the `key` of a custom attribute definition in the Square seller
+ account. If the requesting application is not the definition owner, you must provide the qualified key.
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/booking-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control for update operations, include this optional field in the request and set the
+ value to the current version of the custom attribute.
+ """
+
+ idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique identifier for this individual upsert request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_upsert_response.py b/src/square/types/booking_custom_attribute_upsert_response.py
new file mode 100644
index 00000000..f408c4b8
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_upsert_response.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class BookingCustomAttributeUpsertResponse(UncheckedBaseModel):
+ """
+ Represents a response for an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) operation.
+ """
+
+ booking_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [booking](entity:Booking) associated with the custom attribute.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred while processing the individual request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_visible_deleted_event.py b/src/square/types/booking_custom_attribute_visible_deleted_event.py
new file mode 100644
index 00000000..243f0905
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_visible_deleted_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class BookingCustomAttributeVisibleDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a booking [custom attribute](entity:CustomAttribute) with
+ the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted.
+ An application that subscribes to this event is notified when a booking custom attribute is deleted
+ by any application for which the subscribing application has read access to the booking custom attribute.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.custom_attribute.visible.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_custom_attribute_visible_updated_event.py b/src/square/types/booking_custom_attribute_visible_updated_event.py
new file mode 100644
index 00000000..e5a8ebb2
--- /dev/null
+++ b/src/square/types/booking_custom_attribute_visible_updated_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class BookingCustomAttributeVisibleUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a booking [custom attribute](entity:CustomAttribute)
+ with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated.
+ An application that subscribes to this event is notified when a booking custom attribute is updated
+ by any application for which the subscribing application has read access to the booking custom attribute.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.custom_attribute.visible.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_status.py b/src/square/types/booking_status.py
new file mode 100644
index 00000000..662cbd32
--- /dev/null
+++ b/src/square/types/booking_status.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BookingStatus = typing.Union[
+ typing.Literal["PENDING", "CANCELLED_BY_CUSTOMER", "CANCELLED_BY_SELLER", "DECLINED", "ACCEPTED", "NO_SHOW"],
+ typing.Any,
+]
diff --git a/src/square/types/booking_updated_event.py b/src/square/types/booking_updated_event.py
new file mode 100644
index 00000000..ea72b5c5
--- /dev/null
+++ b/src/square/types/booking_updated_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking_updated_event_data import BookingUpdatedEventData
+
+
+class BookingUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a booking is updated or cancelled.
+
+ To receive this event with buyer-level permissions, you must have `APPOINTMENTS_READ` set for the OAuth scope.
+ To receive this event with seller-level permissions, you must have `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` set for the OAuth scope.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"booking.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[BookingUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_updated_event_data.py b/src/square/types/booking_updated_event_data.py
new file mode 100644
index 00000000..741b4ca1
--- /dev/null
+++ b/src/square/types/booking_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking_updated_event_object import BookingUpdatedEventObject
+
+
+class BookingUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `"booking"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[BookingUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated booking.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/booking_updated_event_object.py b/src/square/types/booking_updated_event_object.py
new file mode 100644
index 00000000..4003d4b4
--- /dev/null
+++ b/src/square/types/booking_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking import Booking
+
+
+class BookingUpdatedEventObject(UncheckedBaseModel):
+ booking: typing.Optional[Booking] = pydantic.Field(default=None)
+ """
+ The updated booking.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/break_.py b/src/square/types/break_.py
new file mode 100644
index 00000000..77da7832
--- /dev/null
+++ b/src/square/types/break_.py
@@ -0,0 +1,63 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class Break(UncheckedBaseModel):
+ """
+ A record of a team member's break on a [timecard](entity:Timecard).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The UUID for this object.
+ """
+
+ start_at: str = pydantic.Field()
+ """
+ RFC 3339; follows the same timezone information as the [timecard](entity:Timecard). Precision up to
+ the minute is respected; seconds are truncated.
+ """
+
+ end_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339; follows the same timezone information as the [timecard](entity:Timecard). Precision up to
+ the minute is respected; seconds are truncated.
+ """
+
+ break_type_id: str = pydantic.Field()
+ """
+ The [BreakType](entity:BreakType) that this break was templated on.
+ """
+
+ name: str = pydantic.Field()
+ """
+ A human-readable name.
+ """
+
+ expected_duration: str = pydantic.Field()
+ """
+ Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of
+ the break.
+
+ Example for break expected duration of 15 minutes: PT15M
+ """
+
+ is_paid: bool = pydantic.Field()
+ """
+ Whether this break counts towards time worked for compensation
+ purposes.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/break_type.py b/src/square/types/break_type.py
new file mode 100644
index 00000000..067acdd5
--- /dev/null
+++ b/src/square/types/break_type.py
@@ -0,0 +1,71 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class BreakType(UncheckedBaseModel):
+ """
+ A template for a type of [break](entity:Break) that can be added to a
+ [timecard](entity:Timecard), including the expected duration and paid status.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The UUID for this object.
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The ID of the business location this type of break applies to.
+ """
+
+ break_name: str = pydantic.Field()
+ """
+ A human-readable name for this type of break. The name is displayed to
+ team members in Square products.
+ """
+
+ expected_duration: str = pydantic.Field()
+ """
+ Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of
+ this break. Precision less than minutes is truncated.
+
+ Example for break expected duration of 15 minutes: PT15M
+ """
+
+ is_paid: bool = pydantic.Field()
+ """
+ Whether this break counts towards time worked for compensation
+ purposes.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Used for resolving concurrency issues. The request fails if the version
+ provided does not match the server version at the time of the request. If a value is not
+ provided, Square's servers execute a "blind" write; potentially
+ overwriting another writer's data.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A read-only timestamp in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A read-only timestamp in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_create_customer_data.py b/src/square/types/bulk_create_customer_data.py
new file mode 100644
index 00000000..9ec61e8c
--- /dev/null
+++ b/src/square/types/bulk_create_customer_data.py
@@ -0,0 +1,90 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .customer_tax_ids import CustomerTaxIds
+
+
+class BulkCreateCustomerData(UncheckedBaseModel):
+ """
+ Defines the customer data provided in individual create requests for a
+ [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) operation.
+ """
+
+ given_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The given name (that is, the first name) associated with the customer profile.
+ """
+
+ family_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The family name (that is, the last name) associated with the customer profile.
+ """
+
+ company_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A business name associated with the customer profile.
+ """
+
+ nickname: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A nickname for the customer profile.
+ """
+
+ email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address associated with the customer profile.
+ """
+
+ address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The physical address associated with the customer profile. For maximum length constraints,
+ see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+ """
+
+ phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The phone number associated with the customer profile. The phone number must be valid
+ and can contain 9–16 digits, with an optional `+` prefix and country code. For more information,
+ see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A custom note associated with the customer profile.
+ """
+
+ birthday: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format.
+ For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21.
+ Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or
+ `0000` if a birth year is not specified.
+ """
+
+ tax_ids: typing.Optional[CustomerTaxIds] = pydantic.Field(default=None)
+ """
+ The tax ID associated with the customer profile. This field is available only for
+ customers of sellers in EU countries or the United Kingdom. For more information, see
+ [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_create_customers_response.py b/src/square/types/bulk_create_customers_response.py
new file mode 100644
index 00000000..9fa9b316
--- /dev/null
+++ b/src/square/types/bulk_create_customers_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .create_customer_response import CreateCustomerResponse
+from .error import Error
+
+
+class BulkCreateCustomersResponse(UncheckedBaseModel):
+ """
+ Defines the fields included in the response body from the
+ [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint.
+ """
+
+ responses: typing.Optional[typing.Dict[str, CreateCustomerResponse]] = pydantic.Field(default=None)
+ """
+ A map of responses that correspond to individual create requests, represented by
+ key-value pairs.
+
+ Each key is the idempotency key that was provided for a create request and each value
+ is the corresponding response.
+ If the request succeeds, the value is the new customer profile.
+ If the request fails, the value contains any errors that occurred during the request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any top-level errors that prevented the bulk operation from running.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_delete_booking_custom_attributes_response.py b/src/square/types/bulk_delete_booking_custom_attributes_response.py
new file mode 100644
index 00000000..ed5a5cd6
--- /dev/null
+++ b/src/square/types/bulk_delete_booking_custom_attributes_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking_custom_attribute_delete_response import BookingCustomAttributeDeleteResponse
+from .error import Error
+
+
+class BulkDeleteBookingCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual delete request.
+ """
+
+ values: typing.Optional[typing.Dict[str, BookingCustomAttributeDeleteResponse]] = pydantic.Field(default=None)
+ """
+ A map of responses that correspond to individual delete requests. Each response has the
+ same ID as the corresponding request and contains `booking_id` and `errors` field.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_delete_customers_response.py b/src/square/types/bulk_delete_customers_response.py
new file mode 100644
index 00000000..8186fb09
--- /dev/null
+++ b/src/square/types/bulk_delete_customers_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .delete_customer_response import DeleteCustomerResponse
+from .error import Error
+
+
+class BulkDeleteCustomersResponse(UncheckedBaseModel):
+ """
+ Defines the fields included in the response body from the
+ [BulkDeleteCustomers](api-endpoint:Customers-BulkDeleteCustomers) endpoint.
+ """
+
+ responses: typing.Optional[typing.Dict[str, DeleteCustomerResponse]] = pydantic.Field(default=None)
+ """
+ A map of responses that correspond to individual delete requests, represented by
+ key-value pairs.
+
+ Each key is the customer ID that was specified for a delete request and each value
+ is the corresponding response.
+ If the request succeeds, the value is an empty object (`{ }`).
+ If the request fails, the value contains any errors that occurred during the request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any top-level errors that prevented the bulk operation from running.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.py b/src/square/types/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.py
new file mode 100644
index 00000000..25b1d9da
--- /dev/null
+++ b/src/square/types/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest(UncheckedBaseModel):
+ """
+ Represents an individual delete request in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes)
+ request. An individual request contains an optional ID of the associated custom attribute definition
+ and optional key of the associated custom attribute definition.
+ """
+
+ key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The key of the associated custom attribute definition.
+ Represented as a qualified key if the requesting app is not the definition owner.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_delete_location_custom_attributes_response.py b/src/square/types/bulk_delete_location_custom_attributes_response.py
new file mode 100644
index 00000000..0afdab7c
--- /dev/null
+++ b/src/square/types/bulk_delete_location_custom_attributes_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response import (
+ BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse,
+)
+from .error import Error
+
+
+class BulkDeleteLocationCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual delete request.
+ """
+
+ values: typing.Dict[str, BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse] = (
+ pydantic.Field()
+ )
+ """
+ A map of responses that correspond to individual delete requests. Each response has the
+ same key as the corresponding request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.py b/src/square/types/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.py
new file mode 100644
index 00000000..4580d8e6
--- /dev/null
+++ b/src/square/types/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse(UncheckedBaseModel):
+ """
+ Represents an individual delete response in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes)
+ request.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location associated with the custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred while processing the individual LocationCustomAttributeDeleteRequest request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.py b/src/square/types/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.py
new file mode 100644
index 00000000..5a039fbb
--- /dev/null
+++ b/src/square/types/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest(UncheckedBaseModel):
+ """
+ Represents an individual delete request in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes)
+ request. An individual request contains an optional ID of the associated custom attribute definition
+ and optional key of the associated custom attribute definition.
+ """
+
+ key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The key of the associated custom attribute definition.
+ Represented as a qualified key if the requesting app is not the definition owner.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_delete_merchant_custom_attributes_response.py b/src/square/types/bulk_delete_merchant_custom_attributes_response.py
new file mode 100644
index 00000000..792940d7
--- /dev/null
+++ b/src/square/types/bulk_delete_merchant_custom_attributes_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response import (
+ BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse,
+)
+from .error import Error
+
+
+class BulkDeleteMerchantCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual delete request.
+ """
+
+ values: typing.Dict[str, BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse] = (
+ pydantic.Field()
+ )
+ """
+ A map of responses that correspond to individual delete requests. Each response has the
+ same key as the corresponding request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.py b/src/square/types/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.py
new file mode 100644
index 00000000..2e0489bc
--- /dev/null
+++ b/src/square/types/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse(UncheckedBaseModel):
+ """
+ Represents an individual delete response in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes)
+ request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred while processing the individual MerchantCustomAttributeDeleteRequest request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_delete_order_custom_attributes_request_delete_custom_attribute.py b/src/square/types/bulk_delete_order_custom_attributes_request_delete_custom_attribute.py
new file mode 100644
index 00000000..e2f092cb
--- /dev/null
+++ b/src/square/types/bulk_delete_order_custom_attributes_request_delete_custom_attribute.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute(UncheckedBaseModel):
+ """
+ Represents one delete within the bulk operation.
+ """
+
+ key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The key of the custom attribute to delete. This key must match the key
+ of an existing custom attribute definition.
+ """
+
+ order_id: str = pydantic.Field()
+ """
+ The ID of the target [order](entity:Order).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_delete_order_custom_attributes_response.py b/src/square/types/bulk_delete_order_custom_attributes_response.py
new file mode 100644
index 00000000..2d3c2714
--- /dev/null
+++ b/src/square/types/bulk_delete_order_custom_attributes_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .delete_order_custom_attribute_response import DeleteOrderCustomAttributeResponse
+from .error import Error
+
+
+class BulkDeleteOrderCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a response from deleting one or more order custom attributes.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ values: typing.Dict[str, DeleteOrderCustomAttributeResponse] = pydantic.Field()
+ """
+ A map of responses that correspond to individual delete requests. Each response has the same ID
+ as the corresponding request and contains either a `custom_attribute` or an `errors` field.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_publish_scheduled_shifts_data.py b/src/square/types/bulk_publish_scheduled_shifts_data.py
new file mode 100644
index 00000000..eae202f9
--- /dev/null
+++ b/src/square/types/bulk_publish_scheduled_shifts_data.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class BulkPublishScheduledShiftsData(UncheckedBaseModel):
+ """
+ Represents options for an individual publish request in a
+ [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts)
+ operation, provided as the value in a key-value pair.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The current version of the scheduled shift, used to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control. If the provided version doesn't match the server version, the request fails.
+ If omitted, Square executes a blind write, potentially overwriting data from another publish request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_publish_scheduled_shifts_response.py b/src/square/types/bulk_publish_scheduled_shifts_response.py
new file mode 100644
index 00000000..61640447
--- /dev/null
+++ b/src/square/types/bulk_publish_scheduled_shifts_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .publish_scheduled_shift_response import PublishScheduledShiftResponse
+
+
+class BulkPublishScheduledShiftsResponse(UncheckedBaseModel):
+ """
+ Represents a [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts) response.
+ Either `scheduled_shifts` or `errors` is present in the response.
+ """
+
+ responses: typing.Optional[typing.Dict[str, PublishScheduledShiftResponse]] = pydantic.Field(default=None)
+ """
+ A map of key-value pairs that represent responses for individual publish requests.
+ The order of responses might differ from the order in which the requests were provided.
+
+ - Each key is the scheduled shift ID that was specified for a publish request.
+ - Each value is the corresponding response. If the request succeeds, the value is the
+ published scheduled shift. If the request fails, the value is an `errors` array containing
+ any errors that occurred while processing the request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any top-level errors that prevented the bulk operation from succeeding.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_retrieve_bookings_response.py b/src/square/types/bulk_retrieve_bookings_response.py
new file mode 100644
index 00000000..5b12336e
--- /dev/null
+++ b/src/square/types/bulk_retrieve_bookings_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .get_booking_response import GetBookingResponse
+
+
+class BulkRetrieveBookingsResponse(UncheckedBaseModel):
+ """
+ Response payload for bulk retrieval of bookings.
+ """
+
+ bookings: typing.Optional[typing.Dict[str, GetBookingResponse]] = pydantic.Field(default=None)
+ """
+ Requested bookings returned as a map containing `booking_id` as the key and `RetrieveBookingResponse` as the value.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_retrieve_channels_request_constants.py b/src/square/types/bulk_retrieve_channels_request_constants.py
new file mode 100644
index 00000000..16779a7d
--- /dev/null
+++ b/src/square/types/bulk_retrieve_channels_request_constants.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BulkRetrieveChannelsRequestConstants = typing.Literal["MAX_BATCH_SIZE"]
diff --git a/src/square/types/bulk_retrieve_channels_response.py b/src/square/types/bulk_retrieve_channels_response.py
new file mode 100644
index 00000000..b448ef5f
--- /dev/null
+++ b/src/square/types/bulk_retrieve_channels_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .retrieve_channel_response import RetrieveChannelResponse
+
+
+class BulkRetrieveChannelsResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the request body for the
+ [BulkRetrieveChannels](api-endpoint:Channels-BulkRetrieveChannels) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ responses: typing.Optional[typing.Dict[str, RetrieveChannelResponse]] = pydantic.Field(default=None)
+ """
+ A map of channel IDs to channel responses which tell whether
+ retrieval for a specific channel is success or not.
+ Channel response of a success retrieval would contain channel info
+ whereas channel response of a failed retrieval would have error info.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_retrieve_customers_response.py b/src/square/types/bulk_retrieve_customers_response.py
new file mode 100644
index 00000000..db08eb1f
--- /dev/null
+++ b/src/square/types/bulk_retrieve_customers_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .get_customer_response import GetCustomerResponse
+
+
+class BulkRetrieveCustomersResponse(UncheckedBaseModel):
+ """
+ Defines the fields included in the response body from the
+ [BulkRetrieveCustomers](api-endpoint:Customers-BulkRetrieveCustomers) endpoint.
+ """
+
+ responses: typing.Optional[typing.Dict[str, GetCustomerResponse]] = pydantic.Field(default=None)
+ """
+ A map of responses that correspond to individual retrieve requests, represented by
+ key-value pairs.
+
+ Each key is the customer ID that was specified for a retrieve request and each value
+ is the corresponding response.
+ If the request succeeds, the value is the requested customer profile.
+ If the request fails, the value contains any errors that occurred during the request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any top-level errors that prevented the bulk operation from running.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_retrieve_team_member_booking_profiles_response.py b/src/square/types/bulk_retrieve_team_member_booking_profiles_response.py
new file mode 100644
index 00000000..e1dc8972
--- /dev/null
+++ b/src/square/types/bulk_retrieve_team_member_booking_profiles_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .get_team_member_booking_profile_response import GetTeamMemberBookingProfileResponse
+
+
+class BulkRetrieveTeamMemberBookingProfilesResponse(UncheckedBaseModel):
+ """
+ Response payload for the [BulkRetrieveTeamMemberBookingProfiles](api-endpoint:Bookings-BulkRetrieveTeamMemberBookingProfiles) endpoint.
+ """
+
+ team_member_booking_profiles: typing.Optional[typing.Dict[str, GetTeamMemberBookingProfileResponse]] = (
+ pydantic.Field(default=None)
+ )
+ """
+ The returned team members' booking profiles, as a map with `team_member_id` as the key and [TeamMemberBookingProfile](entity:TeamMemberBookingProfile) the value.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_swap_plan_response.py b/src/square/types/bulk_swap_plan_response.py
new file mode 100644
index 00000000..e002e411
--- /dev/null
+++ b/src/square/types/bulk_swap_plan_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class BulkSwapPlanResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response of the
+ [BulkSwapPlan](api-endpoint:Subscriptions-BulkSwapPlan) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ affected_subscriptions: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of affected subscriptions.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_update_customer_data.py b/src/square/types/bulk_update_customer_data.py
new file mode 100644
index 00000000..7c2eb3d5
--- /dev/null
+++ b/src/square/types/bulk_update_customer_data.py
@@ -0,0 +1,99 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .customer_tax_ids import CustomerTaxIds
+
+
+class BulkUpdateCustomerData(UncheckedBaseModel):
+ """
+ Defines the customer data provided in individual update requests for a
+ [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) operation.
+ """
+
+ given_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The given name (that is, the first name) associated with the customer profile.
+ """
+
+ family_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The family name (that is, the last name) associated with the customer profile.
+ """
+
+ company_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A business name associated with the customer profile.
+ """
+
+ nickname: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A nickname for the customer profile.
+ """
+
+ email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address associated with the customer profile.
+ """
+
+ address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The physical address associated with the customer profile. For maximum length constraints,
+ see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
+ The `first_name` and `last_name` fields are ignored if they are present in the request.
+ """
+
+ phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The phone number associated with the customer profile. The phone number must be valid
+ and can contain 9–16 digits, with an optional `+` prefix and country code. For more information,
+ see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An custom note associates with the customer profile.
+ """
+
+ birthday: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format.
+ For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21.
+ Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or
+ `0000` if a birth year is not specified.
+ """
+
+ tax_ids: typing.Optional[CustomerTaxIds] = pydantic.Field(default=None)
+ """
+ The tax ID associated with the customer profile. This field is available only for
+ customers of sellers in EU countries or the United Kingdom. For more information, see
+ [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The current version of the customer profile.
+
+ As a best practice, you should include this field to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_update_customers_response.py b/src/square/types/bulk_update_customers_response.py
new file mode 100644
index 00000000..804c708e
--- /dev/null
+++ b/src/square/types/bulk_update_customers_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .update_customer_response import UpdateCustomerResponse
+
+
+class BulkUpdateCustomersResponse(UncheckedBaseModel):
+ """
+ Defines the fields included in the response body from the
+ [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) endpoint.
+ """
+
+ responses: typing.Optional[typing.Dict[str, UpdateCustomerResponse]] = pydantic.Field(default=None)
+ """
+ A map of responses that correspond to individual update requests, represented by
+ key-value pairs.
+
+ Each key is the customer ID that was specified for an update request and each value
+ is the corresponding response.
+ If the request succeeds, the value is the updated customer profile.
+ If the request fails, the value contains any errors that occurred during the request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any top-level errors that prevented the bulk operation from running.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_upsert_booking_custom_attributes_response.py b/src/square/types/bulk_upsert_booking_custom_attributes_response.py
new file mode 100644
index 00000000..d6a0da93
--- /dev/null
+++ b/src/square/types/bulk_upsert_booking_custom_attributes_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking_custom_attribute_upsert_response import BookingCustomAttributeUpsertResponse
+from .error import Error
+
+
+class BulkUpsertBookingCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual upsert request.
+ """
+
+ values: typing.Optional[typing.Dict[str, BookingCustomAttributeUpsertResponse]] = pydantic.Field(default=None)
+ """
+ A map of responses that correspond to individual upsert requests. Each response has the
+ same ID as the corresponding request and contains either a `booking_id` and `custom_attribute` or an `errors` field.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.py b/src/square/types/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.py
new file mode 100644
index 00000000..c3e794b5
--- /dev/null
+++ b/src/square/types/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+
+
+class BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest(UncheckedBaseModel):
+ """
+ Represents an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes)
+ request. An individual request contains a location ID, the custom attribute to create or update,
+ and an optional idempotency key.
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The ID of the target [location](entity:Location).
+ """
+
+ custom_attribute: CustomAttribute = pydantic.Field()
+ """
+ The custom attribute to create or update, with following fields:
+ - `key`. This key must match the `key` of a custom attribute definition in the Square seller
+ account. If the requesting application is not the definition owner, you must provide the qualified key.
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types)..
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, specify the current version of the custom attribute.
+ If this is not important for your application, `version` can be set to -1.
+ """
+
+ idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique identifier for this individual upsert request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_upsert_location_custom_attributes_response.py b/src/square/types/bulk_upsert_location_custom_attributes_response.py
new file mode 100644
index 00000000..762ffbff
--- /dev/null
+++ b/src/square/types/bulk_upsert_location_custom_attributes_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response import (
+ BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse,
+)
+from .error import Error
+
+
+class BulkUpsertLocationCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual upsert request.
+ """
+
+ values: typing.Optional[
+ typing.Dict[str, BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse]
+ ] = pydantic.Field(default=None)
+ """
+ A map of responses that correspond to individual upsert requests. Each response has the
+ same ID as the corresponding request and contains either a `location_id` and `custom_attribute` or an `errors` field.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.py b/src/square/types/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.py
new file mode 100644
index 00000000..e30c6196
--- /dev/null
+++ b/src/square/types/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse(UncheckedBaseModel):
+ """
+ Represents a response for an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) operation.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location associated with the custom attribute.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred while processing the individual request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.py b/src/square/types/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.py
new file mode 100644
index 00000000..91cb2096
--- /dev/null
+++ b/src/square/types/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+
+
+class BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest(UncheckedBaseModel):
+ """
+ Represents an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes)
+ request. An individual request contains a merchant ID, the custom attribute to create or update,
+ and an optional idempotency key.
+ """
+
+ merchant_id: str = pydantic.Field()
+ """
+ The ID of the target [merchant](entity:Merchant).
+ """
+
+ custom_attribute: CustomAttribute = pydantic.Field()
+ """
+ The custom attribute to create or update, with following fields:
+ - `key`. This key must match the `key` of a custom attribute definition in the Square seller
+ account. If the requesting application is not the definition owner, you must provide the qualified key.
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).
+ - The version field must match the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
+ """
+
+ idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique identifier for this individual upsert request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_upsert_merchant_custom_attributes_response.py b/src/square/types/bulk_upsert_merchant_custom_attributes_response.py
new file mode 100644
index 00000000..cbe56a86
--- /dev/null
+++ b/src/square/types/bulk_upsert_merchant_custom_attributes_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response import (
+ BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse,
+)
+from .error import Error
+
+
+class BulkUpsertMerchantCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) response,
+ which contains a map of responses that each corresponds to an individual upsert request.
+ """
+
+ values: typing.Optional[
+ typing.Dict[str, BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse]
+ ] = pydantic.Field(default=None)
+ """
+ A map of responses that correspond to individual upsert requests. Each response has the
+ same ID as the corresponding request and contains either a `merchant_id` and `custom_attribute` or an `errors` field.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.py b/src/square/types/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.py
new file mode 100644
index 00000000..3d7ef7e3
--- /dev/null
+++ b/src/square/types/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse(UncheckedBaseModel):
+ """
+ Represents a response for an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) operation.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the custom attribute.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred while processing the individual request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_upsert_order_custom_attributes_request_upsert_custom_attribute.py b/src/square/types/bulk_upsert_order_custom_attributes_request_upsert_custom_attribute.py
new file mode 100644
index 00000000..3dd4b292
--- /dev/null
+++ b/src/square/types/bulk_upsert_order_custom_attributes_request_upsert_custom_attribute.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+
+
+class BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute(UncheckedBaseModel):
+ """
+ Represents one upsert within the bulk operation.
+ """
+
+ custom_attribute: CustomAttribute = pydantic.Field()
+ """
+ The custom attribute to create or update, with the following fields:
+
+ - `value`. This value must conform to the `schema` specified by the definition.
+ For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types).
+
+ - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control, include this optional field and specify the current version of the custom attribute.
+ """
+
+ idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique identifier for this request, used to ensure idempotency.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
+
+ order_id: str = pydantic.Field()
+ """
+ The ID of the target [order](entity:Order).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/bulk_upsert_order_custom_attributes_response.py b/src/square/types/bulk_upsert_order_custom_attributes_response.py
new file mode 100644
index 00000000..b09f66f2
--- /dev/null
+++ b/src/square/types/bulk_upsert_order_custom_attributes_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .upsert_order_custom_attribute_response import UpsertOrderCustomAttributeResponse
+
+
+class BulkUpsertOrderCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a response from a bulk upsert of order custom attributes.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ values: typing.Dict[str, UpsertOrderCustomAttributeResponse] = pydantic.Field()
+ """
+ A map of responses that correspond to individual upsert operations for custom attributes.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/business_appointment_settings.py b/src/square/types/business_appointment_settings.py
new file mode 100644
index 00000000..af5de66c
--- /dev/null
+++ b/src/square/types/business_appointment_settings.py
@@ -0,0 +1,104 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .business_appointment_settings_alignment_time import BusinessAppointmentSettingsAlignmentTime
+from .business_appointment_settings_booking_location_type import BusinessAppointmentSettingsBookingLocationType
+from .business_appointment_settings_cancellation_policy import BusinessAppointmentSettingsCancellationPolicy
+from .business_appointment_settings_max_appointments_per_day_limit_type import (
+ BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType,
+)
+from .money import Money
+
+
+class BusinessAppointmentSettings(UncheckedBaseModel):
+ """
+ The service appointment settings, including where and how the service is provided.
+ """
+
+ location_types: typing.Optional[typing.List[BusinessAppointmentSettingsBookingLocationType]] = pydantic.Field(
+ default=None
+ )
+ """
+ Types of the location allowed for bookings.
+ See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values
+ """
+
+ alignment_time: typing.Optional[BusinessAppointmentSettingsAlignmentTime] = pydantic.Field(default=None)
+ """
+ The time unit of the service duration for bookings.
+ See [BusinessAppointmentSettingsAlignmentTime](#type-businessappointmentsettingsalignmenttime) for possible values
+ """
+
+ min_booking_lead_time_seconds: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The minimum lead time in seconds before a service can be booked. A booking must be created at least this amount of time before its starting time.
+ """
+
+ max_booking_lead_time_seconds: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum lead time in seconds before a service can be booked. A booking must be created at most this amount of time before its starting time.
+ """
+
+ any_team_member_booking_enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether a customer can choose from all available time slots and have a staff member assigned
+ automatically (`true`) or not (`false`).
+ """
+
+ multiple_service_booking_enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether a customer can book multiple services in a single online booking.
+ """
+
+ max_appointments_per_day_limit_type: typing.Optional[BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType] = (
+ pydantic.Field(default=None)
+ )
+ """
+ Indicates whether the daily appointment limit applies to team members or to
+ business locations.
+ See [BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType](#type-businessappointmentsettingsmaxappointmentsperdaylimittype) for possible values
+ """
+
+ max_appointments_per_day_limit: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of daily appointments per team member or per location.
+ """
+
+ cancellation_window_seconds: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The cut-off time in seconds for allowing clients to cancel or reschedule an appointment.
+ """
+
+ cancellation_fee_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The flat-fee amount charged for a no-show booking.
+ """
+
+ cancellation_policy: typing.Optional[BusinessAppointmentSettingsCancellationPolicy] = pydantic.Field(default=None)
+ """
+ The cancellation policy adopted by the seller.
+ See [BusinessAppointmentSettingsCancellationPolicy](#type-businessappointmentsettingscancellationpolicy) for possible values
+ """
+
+ cancellation_policy_text: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The free-form text of the seller's cancellation policy.
+ """
+
+ skip_booking_flow_staff_selection: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether customers has an assigned staff member (`true`) or can select s staff member of their choice (`false`).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/business_appointment_settings_alignment_time.py b/src/square/types/business_appointment_settings_alignment_time.py
new file mode 100644
index 00000000..ca455e8f
--- /dev/null
+++ b/src/square/types/business_appointment_settings_alignment_time.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BusinessAppointmentSettingsAlignmentTime = typing.Union[
+ typing.Literal["SERVICE_DURATION", "QUARTER_HOURLY", "HALF_HOURLY", "HOURLY"], typing.Any
+]
diff --git a/src/square/types/business_appointment_settings_booking_location_type.py b/src/square/types/business_appointment_settings_booking_location_type.py
new file mode 100644
index 00000000..7ddd5238
--- /dev/null
+++ b/src/square/types/business_appointment_settings_booking_location_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BusinessAppointmentSettingsBookingLocationType = typing.Union[
+ typing.Literal["BUSINESS_LOCATION", "CUSTOMER_LOCATION", "PHONE"], typing.Any
+]
diff --git a/src/square/types/business_appointment_settings_cancellation_policy.py b/src/square/types/business_appointment_settings_cancellation_policy.py
new file mode 100644
index 00000000..463117f7
--- /dev/null
+++ b/src/square/types/business_appointment_settings_cancellation_policy.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BusinessAppointmentSettingsCancellationPolicy = typing.Union[
+ typing.Literal["CANCELLATION_TREATED_AS_NO_SHOW", "CUSTOM_POLICY"], typing.Any
+]
diff --git a/src/square/types/business_appointment_settings_max_appointments_per_day_limit_type.py b/src/square/types/business_appointment_settings_max_appointments_per_day_limit_type.py
new file mode 100644
index 00000000..e5a7680d
--- /dev/null
+++ b/src/square/types/business_appointment_settings_max_appointments_per_day_limit_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType = typing.Union[
+ typing.Literal["PER_TEAM_MEMBER", "PER_LOCATION"], typing.Any
+]
diff --git a/src/square/types/business_booking_profile.py b/src/square/types/business_booking_profile.py
new file mode 100644
index 00000000..ce21ba2d
--- /dev/null
+++ b/src/square/types/business_booking_profile.py
@@ -0,0 +1,71 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .business_appointment_settings import BusinessAppointmentSettings
+from .business_booking_profile_booking_policy import BusinessBookingProfileBookingPolicy
+from .business_booking_profile_customer_timezone_choice import BusinessBookingProfileCustomerTimezoneChoice
+
+
+class BusinessBookingProfile(UncheckedBaseModel):
+ """
+ A seller's business booking profile, including booking policy, appointment settings, etc.
+ """
+
+ seller_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller, obtainable using the Merchants API.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The RFC 3339 timestamp specifying the booking's creation time.
+ """
+
+ booking_enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the seller is open for booking.
+ """
+
+ customer_timezone_choice: typing.Optional[BusinessBookingProfileCustomerTimezoneChoice] = pydantic.Field(
+ default=None
+ )
+ """
+ The choice of customer's time zone information of a booking.
+ The Square online booking site and all notifications to customers uses either the seller location’s time zone
+ or the time zone the customer chooses at booking.
+ See [BusinessBookingProfileCustomerTimezoneChoice](#type-businessbookingprofilecustomertimezonechoice) for possible values
+ """
+
+ booking_policy: typing.Optional[BusinessBookingProfileBookingPolicy] = pydantic.Field(default=None)
+ """
+ The policy for the seller to automatically accept booking requests (`ACCEPT_ALL`) or not (`REQUIRES_ACCEPTANCE`).
+ See [BusinessBookingProfileBookingPolicy](#type-businessbookingprofilebookingpolicy) for possible values
+ """
+
+ allow_user_cancel: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether customers can cancel or reschedule their own bookings (`true`) or not (`false`).
+ """
+
+ business_appointment_settings: typing.Optional[BusinessAppointmentSettings] = pydantic.Field(default=None)
+ """
+ Settings for appointment-type bookings.
+ """
+
+ support_seller_level_writes: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the seller's subscription to Square Appointments supports creating, updating or canceling an appointment through the API (`true`) or not (`false`) using seller permission.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/business_booking_profile_booking_policy.py b/src/square/types/business_booking_profile_booking_policy.py
new file mode 100644
index 00000000..4e2be969
--- /dev/null
+++ b/src/square/types/business_booking_profile_booking_policy.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BusinessBookingProfileBookingPolicy = typing.Union[typing.Literal["ACCEPT_ALL", "REQUIRES_ACCEPTANCE"], typing.Any]
diff --git a/src/square/types/business_booking_profile_customer_timezone_choice.py b/src/square/types/business_booking_profile_customer_timezone_choice.py
new file mode 100644
index 00000000..b41e8533
--- /dev/null
+++ b/src/square/types/business_booking_profile_customer_timezone_choice.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BusinessBookingProfileCustomerTimezoneChoice = typing.Union[
+ typing.Literal["BUSINESS_LOCATION_TIMEZONE", "CUSTOMER_CHOICE"], typing.Any
+]
diff --git a/src/square/types/business_hours.py b/src/square/types/business_hours.py
new file mode 100644
index 00000000..63507106
--- /dev/null
+++ b/src/square/types/business_hours.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .business_hours_period import BusinessHoursPeriod
+
+
+class BusinessHours(UncheckedBaseModel):
+ """
+ The hours of operation for a location.
+ """
+
+ periods: typing.Optional[typing.List[BusinessHoursPeriod]] = pydantic.Field(default=None)
+ """
+ The list of time periods during which the business is open. There can be at most 10 periods per day.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/business_hours_period.py b/src/square/types/business_hours_period.py
new file mode 100644
index 00000000..80a0c02c
--- /dev/null
+++ b/src/square/types/business_hours_period.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .day_of_week import DayOfWeek
+
+
+class BusinessHoursPeriod(UncheckedBaseModel):
+ """
+ Represents a period of time during which a business location is open.
+ """
+
+ day_of_week: typing.Optional[DayOfWeek] = pydantic.Field(default=None)
+ """
+ The day of the week for this time period.
+ See [DayOfWeek](#type-dayofweek) for possible values
+ """
+
+ start_local_time: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The start time of a business hours period, specified in local time using partial-time
+ RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning.
+ Note that the seconds value is always :00, but it is appended for conformance to the RFC.
+ """
+
+ end_local_time: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The end time of a business hours period, specified in local time using partial-time
+ RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening.
+ Note that the seconds value is always :00, but it is appended for conformance to the RFC.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/buy_now_pay_later_details.py b/src/square/types/buy_now_pay_later_details.py
new file mode 100644
index 00000000..159ef743
--- /dev/null
+++ b/src/square/types/buy_now_pay_later_details.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .afterpay_details import AfterpayDetails
+from .clearpay_details import ClearpayDetails
+from .error import Error
+
+
+class BuyNowPayLaterDetails(UncheckedBaseModel):
+ """
+ Additional details about a Buy Now Pay Later payment type.
+ """
+
+ brand: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The brand used for the Buy Now Pay Later payment.
+ The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`.
+ """
+
+ afterpay_details: typing.Optional[AfterpayDetails] = pydantic.Field(default=None)
+ """
+ Details about an Afterpay payment. These details are only populated if the `brand` is
+ `AFTERPAY`.
+ """
+
+ clearpay_details: typing.Optional[ClearpayDetails] = pydantic.Field(default=None)
+ """
+ Details about a Clearpay payment. These details are only populated if the `brand` is
+ `CLEARPAY`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the payment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cache_mode.py b/src/square/types/cache_mode.py
new file mode 100644
index 00000000..76c99ce0
--- /dev/null
+++ b/src/square/types/cache_mode.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CacheMode = typing.Union[
+ typing.Literal["stale-if-slow", "stale-while-revalidate", "must-revalidate", "no-cache"], typing.Any
+]
diff --git a/src/square/types/calculate_loyalty_points_response.py b/src/square/types/calculate_loyalty_points_response.py
new file mode 100644
index 00000000..db1cbd65
--- /dev/null
+++ b/src/square/types/calculate_loyalty_points_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class CalculateLoyaltyPointsResponse(UncheckedBaseModel):
+ """
+ Represents a [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints) response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ points: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of points that the buyer can earn from the base loyalty program.
+ """
+
+ promotion_points: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of points that the buyer can earn from a loyalty promotion. To be eligible
+ to earn promotion points, the purchase must first qualify for program points. When `order_id`
+ is not provided in the request, this value is always 0.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/calculate_order_response.py b/src/square/types/calculate_order_response.py
new file mode 100644
index 00000000..63d596bb
--- /dev/null
+++ b/src/square/types/calculate_order_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .order import Order
+
+
+class CalculateOrderResponse(UncheckedBaseModel):
+ order: typing.Optional[Order] = pydantic.Field(default=None)
+ """
+ The calculated version of the order provided in the request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cancel_booking_response.py b/src/square/types/cancel_booking_response.py
new file mode 100644
index 00000000..52e29727
--- /dev/null
+++ b/src/square/types/cancel_booking_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking import Booking
+from .error import Error
+
+
+class CancelBookingResponse(UncheckedBaseModel):
+ booking: typing.Optional[Booking] = pydantic.Field(default=None)
+ """
+ The booking that was cancelled.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cancel_invoice_response.py b/src/square/types/cancel_invoice_response.py
new file mode 100644
index 00000000..75e4eee1
--- /dev/null
+++ b/src/square/types/cancel_invoice_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .invoice import Invoice
+
+
+class CancelInvoiceResponse(UncheckedBaseModel):
+ """
+ The response returned by the `CancelInvoice` request.
+ """
+
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The canceled invoice.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cancel_loyalty_promotion_response.py b/src/square/types/cancel_loyalty_promotion_response.py
new file mode 100644
index 00000000..6f6872a0
--- /dev/null
+++ b/src/square/types/cancel_loyalty_promotion_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_promotion import LoyaltyPromotion
+
+
+class CancelLoyaltyPromotionResponse(UncheckedBaseModel):
+ """
+ Represents a [CancelLoyaltyPromotion](api-endpoint:Loyalty-CancelLoyaltyPromotion) response.
+ Either `loyalty_promotion` or `errors` is present in the response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_promotion: typing.Optional[LoyaltyPromotion] = pydantic.Field(default=None)
+ """
+ The canceled loyalty promotion.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cancel_payment_by_idempotency_key_response.py b/src/square/types/cancel_payment_by_idempotency_key_response.py
new file mode 100644
index 00000000..e04f399c
--- /dev/null
+++ b/src/square/types/cancel_payment_by_idempotency_key_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class CancelPaymentByIdempotencyKeyResponse(UncheckedBaseModel):
+ """
+ Defines the response returned by
+ [CancelPaymentByIdempotencyKey](api-endpoint:Payments-CancelPaymentByIdempotencyKey).
+ On success, `errors` is empty.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cancel_payment_response.py b/src/square/types/cancel_payment_response.py
new file mode 100644
index 00000000..4c77fec9
--- /dev/null
+++ b/src/square/types/cancel_payment_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment import Payment
+
+
+class CancelPaymentResponse(UncheckedBaseModel):
+ """
+ Defines the response returned by [CancelPayment](api-endpoint:Payments-CancelPayment).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ payment: typing.Optional[Payment] = pydantic.Field(default=None)
+ """
+ The successfully canceled `Payment` object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cancel_subscription_response.py b/src/square/types/cancel_subscription_response.py
new file mode 100644
index 00000000..4527ba0b
--- /dev/null
+++ b/src/square/types/cancel_subscription_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription import Subscription
+from .subscription_action import SubscriptionAction
+
+
+class CancelSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response from the
+ [CancelSubscription](api-endpoint:Subscriptions-CancelSubscription) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The specified subscription scheduled for cancellation according to the action created by the request.
+ """
+
+ actions: typing.Optional[typing.List[SubscriptionAction]] = pydantic.Field(default=None)
+ """
+ A list of a single `CANCEL` action scheduled for the subscription.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cancel_terminal_action_response.py b/src/square/types/cancel_terminal_action_response.py
new file mode 100644
index 00000000..74d9875f
--- /dev/null
+++ b/src/square/types/cancel_terminal_action_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_action import TerminalAction
+
+
+class CancelTerminalActionResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ action: typing.Optional[TerminalAction] = pydantic.Field(default=None)
+ """
+ The canceled `TerminalAction`
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cancel_terminal_checkout_response.py b/src/square/types/cancel_terminal_checkout_response.py
new file mode 100644
index 00000000..918c3207
--- /dev/null
+++ b/src/square/types/cancel_terminal_checkout_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_checkout import TerminalCheckout
+
+
+class CancelTerminalCheckoutResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ checkout: typing.Optional[TerminalCheckout] = pydantic.Field(default=None)
+ """
+ The canceled `TerminalCheckout`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cancel_terminal_refund_response.py b/src/square/types/cancel_terminal_refund_response.py
new file mode 100644
index 00000000..f1b1cd3f
--- /dev/null
+++ b/src/square/types/cancel_terminal_refund_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_refund import TerminalRefund
+
+
+class CancelTerminalRefundResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ refund: typing.Optional[TerminalRefund] = pydantic.Field(default=None)
+ """
+ The updated `TerminalRefund`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cancel_transfer_order_response.py b/src/square/types/cancel_transfer_order_response.py
new file mode 100644
index 00000000..26e2324f
--- /dev/null
+++ b/src/square/types/cancel_transfer_order_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .transfer_order import TransferOrder
+
+
+class CancelTransferOrderResponse(UncheckedBaseModel):
+ """
+ Response for canceling a transfer order
+ """
+
+ transfer_order: typing.Optional[TransferOrder] = pydantic.Field(default=None)
+ """
+ The updated transfer order with status changed to CANCELED
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/capture_transaction_response.py b/src/square/types/capture_transaction_response.py
new file mode 100644
index 00000000..1ad61d65
--- /dev/null
+++ b/src/square/types/capture_transaction_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class CaptureTransactionResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CaptureTransaction](api-endpoint:Transactions-CaptureTransaction) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card.py b/src/square/types/card.py
new file mode 100644
index 00000000..f27b69ea
--- /dev/null
+++ b/src/square/types/card.py
@@ -0,0 +1,165 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .card_brand import CardBrand
+from .card_co_brand import CardCoBrand
+from .card_issuer_alert import CardIssuerAlert
+from .card_prepaid_type import CardPrepaidType
+from .card_type import CardType
+
+
+class Card(UncheckedBaseModel):
+ """
+ Represents the payment details of a card to be used for payments. These
+ details are determined by the payment token generated by Web Payments SDK.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique ID for this card. Generated by Square.
+ """
+
+ card_brand: typing.Optional[CardBrand] = pydantic.Field(default=None)
+ """
+ The card's brand.
+ See [CardBrand](#type-cardbrand) for possible values
+ """
+
+ last4: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="last_4"),
+ pydantic.Field(alias="last_4", description="The last 4 digits of the card number."),
+ ] = None
+ exp_month: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The expiration month of the associated card as an integer between 1 and 12.
+ """
+
+ exp_year: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The four-digit year of the card's expiration date.
+ """
+
+ cardholder_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the cardholder.
+ """
+
+ billing_address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The billing address for this card. `US` postal codes can be provided as a 5-digit zip code
+ or 9-digit ZIP+4 (example: `12345-6789`). For a full list of field meanings by country, see
+ [Working with Addresses](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-addresses).
+ """
+
+ fingerprint: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Intended as a Square-assigned identifier, based
+ on the card number, to identify the card across multiple locations within a
+ single application.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ **Required** The ID of a [customer](entity:Customer) to be associated with the card.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the card.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional user-defined reference ID that associates this card with
+ another entity in an external system. For example, a customer ID from an
+ external customer management system.
+ """
+
+ enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether or not a card can be used for payments.
+ """
+
+ card_type: typing.Optional[CardType] = pydantic.Field(default=None)
+ """
+ The type of the card.
+ The Card object includes this field only in response to Payments API calls.
+ See [CardType](#type-cardtype) for possible values
+ """
+
+ prepaid_type: typing.Optional[CardPrepaidType] = pydantic.Field(default=None)
+ """
+ Indicates whether the card is prepaid or not.
+ See [CardPrepaidType](#type-cardprepaidtype) for possible values
+ """
+
+ bin: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API
+ returns this field.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp for when the card object was created on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".
+ """
+
+ disabled_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp for when the card object was disabled on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Current version number of the card. Increments with each card update. Requests to update an
+ existing Card object will be rejected unless the version in the request matches the current
+ version for the Card.
+ """
+
+ card_co_brand: typing.Optional[CardCoBrand] = pydantic.Field(default=None)
+ """
+ The card's co-brand if available. For example, an Afterpay virtual card would have a
+ co-brand of AFTERPAY.
+ See [CardCoBrand](#type-cardcobrand) for possible values
+ """
+
+ issuer_alert: typing.Optional[CardIssuerAlert] = pydantic.Field(default=None)
+ """
+ An alert from the issuing bank about the card status. Alerts can indicate whether
+ future charges to the card are likely to fail. For more information, see
+ [Manage Card on File Declines](https://developer.squareup.com/docs/cards-api/manage-card-on-file-declines).
+
+ This field is present only if there's an active issuer alert.
+ See [IssuerAlert](#type-issueralert) for possible values
+ """
+
+ issuer_alert_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the current issuer alert was received and processed, in
+ RFC 3339 format.
+
+ This field is present only if there's an active issuer alert.
+ """
+
+ hsa_fsa: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the card is linked to a Health Savings Account (HSA) or Flexible
+ Spending Account (FSA), based on the card BIN.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_automatically_updated_event.py b/src/square/types/card_automatically_updated_event.py
new file mode 100644
index 00000000..be8d2ed9
--- /dev/null
+++ b/src/square/types/card_automatically_updated_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_automatically_updated_event_data import CardAutomaticallyUpdatedEventData
+
+
+class CardAutomaticallyUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when Square automatically updates the expiration date or
+ primary account number (PAN) of a [card](entity:Card) or adds or removes an issuer alert.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"card.automatically_updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CardAutomaticallyUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_automatically_updated_event_data.py b/src/square/types/card_automatically_updated_event_data.py
new file mode 100644
index 00000000..2b65f1a3
--- /dev/null
+++ b/src/square/types/card_automatically_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_automatically_updated_event_object import CardAutomaticallyUpdatedEventObject
+
+
+class CardAutomaticallyUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `"card"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[CardAutomaticallyUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the automatically updated card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_automatically_updated_event_object.py b/src/square/types/card_automatically_updated_event_object.py
new file mode 100644
index 00000000..a073a90d
--- /dev/null
+++ b/src/square/types/card_automatically_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+
+
+class CardAutomaticallyUpdatedEventObject(UncheckedBaseModel):
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The automatically updated card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_brand.py b/src/square/types/card_brand.py
new file mode 100644
index 00000000..b04c28bb
--- /dev/null
+++ b/src/square/types/card_brand.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CardBrand = typing.Union[
+ typing.Literal[
+ "OTHER_BRAND",
+ "VISA",
+ "MASTERCARD",
+ "AMERICAN_EXPRESS",
+ "DISCOVER",
+ "DISCOVER_DINERS",
+ "JCB",
+ "CHINA_UNIONPAY",
+ "SQUARE_GIFT_CARD",
+ "SQUARE_CAPITAL_CARD",
+ "INTERAC",
+ "EFTPOS",
+ "FELICA",
+ "EBT",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/card_co_brand.py b/src/square/types/card_co_brand.py
new file mode 100644
index 00000000..e35b230c
--- /dev/null
+++ b/src/square/types/card_co_brand.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CardCoBrand = typing.Union[typing.Literal["UNKNOWN", "AFTERPAY", "CLEARPAY"], typing.Any]
diff --git a/src/square/types/card_created_event.py b/src/square/types/card_created_event.py
new file mode 100644
index 00000000..67fbb239
--- /dev/null
+++ b/src/square/types/card_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_created_event_data import CardCreatedEventData
+
+
+class CardCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [card](entity:Card) is created or imported.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"card.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CardCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_created_event_data.py b/src/square/types/card_created_event_data.py
new file mode 100644
index 00000000..118ff842
--- /dev/null
+++ b/src/square/types/card_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_created_event_object import CardCreatedEventObject
+
+
+class CardCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `"card"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[CardCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_created_event_object.py b/src/square/types/card_created_event_object.py
new file mode 100644
index 00000000..f1bfcd58
--- /dev/null
+++ b/src/square/types/card_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+
+
+class CardCreatedEventObject(UncheckedBaseModel):
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The created card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_disabled_event.py b/src/square/types/card_disabled_event.py
new file mode 100644
index 00000000..8ac71ee4
--- /dev/null
+++ b/src/square/types/card_disabled_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_disabled_event_data import CardDisabledEventData
+
+
+class CardDisabledEvent(UncheckedBaseModel):
+ """
+ Published when a [card](entity:Card) is disabled.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"card.disabled"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CardDisabledEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_disabled_event_data.py b/src/square/types/card_disabled_event_data.py
new file mode 100644
index 00000000..7eae28a1
--- /dev/null
+++ b/src/square/types/card_disabled_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_disabled_event_object import CardDisabledEventObject
+
+
+class CardDisabledEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `"card"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[CardDisabledEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the disabled card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_disabled_event_object.py b/src/square/types/card_disabled_event_object.py
new file mode 100644
index 00000000..5029e079
--- /dev/null
+++ b/src/square/types/card_disabled_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+
+
+class CardDisabledEventObject(UncheckedBaseModel):
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The disabled card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_forgotten_event.py b/src/square/types/card_forgotten_event.py
new file mode 100644
index 00000000..26ad3067
--- /dev/null
+++ b/src/square/types/card_forgotten_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_forgotten_event_data import CardForgottenEventData
+
+
+class CardForgottenEvent(UncheckedBaseModel):
+ """
+ Published when a [card](entity:Card) is GDPR forgotten or vaulted.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"card.forgotten"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CardForgottenEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_forgotten_event_card.py b/src/square/types/card_forgotten_event_card.py
new file mode 100644
index 00000000..3696fdac
--- /dev/null
+++ b/src/square/types/card_forgotten_event_card.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CardForgottenEventCard(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique ID for this card. Generated by Square.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of a customer created using the Customers API associated with the card.
+ """
+
+ enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether or not a card can be used for payments.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional user-defined reference ID that associates this card with
+ another entity in an external system. For example, a customer ID from an
+ external customer management system.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Current version number of the card. Increments with each card update. Requests to update an
+ existing Card object will be rejected unless the version in the request matches the current
+ version for the Card.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_forgotten_event_data.py b/src/square/types/card_forgotten_event_data.py
new file mode 100644
index 00000000..f26729de
--- /dev/null
+++ b/src/square/types/card_forgotten_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_forgotten_event_object import CardForgottenEventObject
+
+
+class CardForgottenEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `"card"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[CardForgottenEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the forgotten card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_forgotten_event_object.py b/src/square/types/card_forgotten_event_object.py
new file mode 100644
index 00000000..2bb2ac16
--- /dev/null
+++ b/src/square/types/card_forgotten_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_forgotten_event_card import CardForgottenEventCard
+
+
+class CardForgottenEventObject(UncheckedBaseModel):
+ card: typing.Optional[CardForgottenEventCard] = pydantic.Field(default=None)
+ """
+ The forgotten card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_issuer_alert.py b/src/square/types/card_issuer_alert.py
new file mode 100644
index 00000000..a5cd6405
--- /dev/null
+++ b/src/square/types/card_issuer_alert.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CardIssuerAlert = typing.Literal["ISSUER_ALERT_CARD_CLOSED"]
diff --git a/src/square/types/card_payment_details.py b/src/square/types/card_payment_details.py
new file mode 100644
index 00000000..58a5547e
--- /dev/null
+++ b/src/square/types/card_payment_details.py
@@ -0,0 +1,136 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+from .card_payment_timeline import CardPaymentTimeline
+from .card_surcharge_details import CardSurchargeDetails
+from .device_details import DeviceDetails
+from .error import Error
+
+
+class CardPaymentDetails(UncheckedBaseModel):
+ """
+ Reflects the current status of a card payment. Contains only non-confidential information.
+ """
+
+ status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The card payment's current state. The state can be AUTHORIZED, CAPTURED, VOIDED, or
+ FAILED.
+ """
+
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The credit card's non-confidential details.
+ """
+
+ entry_method: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The method used to enter the card's details for the payment. The method can be
+ `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
+ """
+
+ cvv_status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The status code returned from the Card Verification Value (CVV) check. The code can be
+ `CVV_ACCEPTED`, `CVV_REJECTED`, or `CVV_NOT_CHECKED`.
+ """
+
+ avs_status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The status code returned from the Address Verification System (AVS) check. The code can be
+ `AVS_ACCEPTED`, `AVS_REJECTED`, or `AVS_NOT_CHECKED`.
+ """
+
+ auth_result_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The status code returned by the card issuer that describes the payment's
+ authorization status.
+ """
+
+ application_identifier: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ For EMV payments, the application ID identifies the EMV application used for the payment.
+ """
+
+ application_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ For EMV payments, the human-readable name of the EMV application used for the payment.
+ """
+
+ application_cryptogram: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ For EMV payments, the cryptogram generated for the payment.
+ """
+
+ verification_method: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ For EMV payments, the method used to verify the cardholder's identity. The method can be
+ `PIN`, `SIGNATURE`, `PIN_AND_SIGNATURE`, `ON_DEVICE`, or `NONE`.
+ """
+
+ verification_results: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ For EMV payments, the results of the cardholder verification. The result can be
+ `SUCCESS`, `FAILURE`, or `UNKNOWN`.
+ """
+
+ statement_description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The statement description sent to the card networks.
+
+ Note: The actual statement description varies and is likely to be truncated and appended with
+ additional information on a per issuer basis.
+ """
+
+ device_details: typing.Optional[DeviceDetails] = pydantic.Field(default=None)
+ """
+ __Deprecated__: Use `Payment.device_details` instead.
+
+ Details about the device that took the payment.
+ """
+
+ card_payment_timeline: typing.Optional[CardPaymentTimeline] = pydantic.Field(default=None)
+ """
+ The timeline for card payments.
+ """
+
+ refund_requires_card_presence: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the card must be physically present for the payment to
+ be refunded. If set to `true`, the card must be present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ applied_card_surcharge_details: typing.Optional[CardSurchargeDetails] = pydantic.Field(default=None)
+ """
+ Additional information about a card_surcharge on the payment.
+ """
+
+ wallet_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of digital wallet used for this card payment, if applicable.
+ Currently only populated for in-person Apple Pay payments. Detection has no false
+ positives but may have false negatives (some Apple Pay payments may not be detected).
+
+ For payments with `source_type` of `WALLET`, see `DigitalWalletDetails` instead.
+
+ Values: `APPLE_PAY`
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_payment_timeline.py b/src/square/types/card_payment_timeline.py
new file mode 100644
index 00000000..49467632
--- /dev/null
+++ b/src/square/types/card_payment_timeline.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CardPaymentTimeline(UncheckedBaseModel):
+ """
+ The timeline for card payments.
+ """
+
+ authorized_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the payment was authorized, in RFC 3339 format.
+ """
+
+ captured_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the payment was captured, in RFC 3339 format.
+ """
+
+ voided_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the payment was voided, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_prepaid_type.py b/src/square/types/card_prepaid_type.py
new file mode 100644
index 00000000..105ba23e
--- /dev/null
+++ b/src/square/types/card_prepaid_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CardPrepaidType = typing.Union[typing.Literal["UNKNOWN_PREPAID_TYPE", "NOT_PREPAID", "PREPAID"], typing.Any]
diff --git a/src/square/types/card_surcharge_details.py b/src/square/types/card_surcharge_details.py
new file mode 100644
index 00000000..1ad958cd
--- /dev/null
+++ b/src/square/types/card_surcharge_details.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class CardSurchargeDetails(UncheckedBaseModel):
+ """
+ Details related to an attempt to apply a card surcharge to this payment. When surcharge
+ eligibility is not known in advance, such as when the card type (debit or credit) is required
+ to make the eligibility determination, proposed_card_surcharge_money and
+ proposed_additional_amount_money will match the values in the request, while card_surcharge_money
+ and additional_amount_money are present only when the payment has a surcharge applied.
+ """
+
+ card_surcharge_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ A specific surcharge levied by the merchant, if a card payment is used, instead of cash or
+ some other payment type. Should only include the base surcharge amount. Any additional fees related
+ to the surcharge (e.g. taxes on the surcharge) should only be included in the additional_amount_money.
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+ The currency code must match the currency associated with the business that is accepting the
+ payment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_type.py b/src/square/types/card_type.py
new file mode 100644
index 00000000..3fbd004e
--- /dev/null
+++ b/src/square/types/card_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CardType = typing.Union[typing.Literal["UNKNOWN_CARD_TYPE", "CREDIT", "DEBIT"], typing.Any]
diff --git a/src/square/types/card_updated_event.py b/src/square/types/card_updated_event.py
new file mode 100644
index 00000000..a5943f9b
--- /dev/null
+++ b/src/square/types/card_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_updated_event_data import CardUpdatedEventData
+
+
+class CardUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [card](entity:Card) is updated by the seller in the Square Dashboard.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"card.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CardUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_updated_event_data.py b/src/square/types/card_updated_event_data.py
new file mode 100644
index 00000000..d6e6027c
--- /dev/null
+++ b/src/square/types/card_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_updated_event_object import CardUpdatedEventObject
+
+
+class CardUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `"card"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[CardUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/card_updated_event_object.py b/src/square/types/card_updated_event_object.py
new file mode 100644
index 00000000..5c31ee88
--- /dev/null
+++ b/src/square/types/card_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+
+
+class CardUpdatedEventObject(UncheckedBaseModel):
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The updated card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cash_app_details.py b/src/square/types/cash_app_details.py
new file mode 100644
index 00000000..996e7770
--- /dev/null
+++ b/src/square/types/cash_app_details.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CashAppDetails(UncheckedBaseModel):
+ """
+ Additional details about `WALLET` type payments with the `brand` of `CASH_APP`.
+ """
+
+ buyer_full_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the Cash App account holder.
+ """
+
+ buyer_country_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The country of the Cash App account holder, in ISO 3166-1-alpha-2 format.
+
+ For possible values, see [Country](entity:Country).
+ """
+
+ buyer_cashtag: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ $Cashtag of the Cash App account holder.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cash_drawer_device.py b/src/square/types/cash_drawer_device.py
new file mode 100644
index 00000000..10cd29bf
--- /dev/null
+++ b/src/square/types/cash_drawer_device.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CashDrawerDevice(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The device Square-issued ID
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The device merchant-specified name.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cash_drawer_event_type.py b/src/square/types/cash_drawer_event_type.py
new file mode 100644
index 00000000..2e9944b1
--- /dev/null
+++ b/src/square/types/cash_drawer_event_type.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CashDrawerEventType = typing.Union[
+ typing.Literal[
+ "NO_SALE",
+ "CASH_TENDER_PAYMENT",
+ "OTHER_TENDER_PAYMENT",
+ "CASH_TENDER_CANCELLED_PAYMENT",
+ "OTHER_TENDER_CANCELLED_PAYMENT",
+ "CASH_TENDER_REFUND",
+ "OTHER_TENDER_REFUND",
+ "PAID_IN",
+ "PAID_OUT",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/cash_drawer_shift.py b/src/square/types/cash_drawer_shift.py
new file mode 100644
index 00000000..967ddfe8
--- /dev/null
+++ b/src/square/types/cash_drawer_shift.py
@@ -0,0 +1,153 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .cash_drawer_device import CashDrawerDevice
+from .cash_drawer_shift_state import CashDrawerShiftState
+from .money import Money
+
+
+class CashDrawerShift(UncheckedBaseModel):
+ """
+ This model gives the details of a cash drawer shift.
+ The cash_payment_money, cash_refund_money, cash_paid_in_money,
+ and cash_paid_out_money fields are all computed by summing their respective
+ event types.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shift unique ID.
+ """
+
+ state: typing.Optional[CashDrawerShiftState] = pydantic.Field(default=None)
+ """
+ The shift current state.
+ See [CashDrawerShiftState](#type-cashdrawershiftstate) for possible values
+ """
+
+ opened_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the shift began, in ISO 8601 format.
+ """
+
+ ended_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the shift ended, in ISO 8601 format.
+ """
+
+ closed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the shift was closed, in ISO 8601 format.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The free-form text description of a cash drawer by an employee.
+ """
+
+ opened_cash_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money in the cash drawer at the start of the shift.
+ The amount must be greater than or equal to zero.
+ """
+
+ cash_payment_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money added to the cash drawer from cash payments.
+ This is computed by summing all events with the types CASH_TENDER_PAYMENT and
+ CASH_TENDER_CANCELED_PAYMENT. The amount is always greater than or equal to
+ zero.
+ """
+
+ cash_refunds_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money removed from the cash drawer from cash refunds.
+ It is computed by summing the events of type CASH_TENDER_REFUND. The amount
+ is always greater than or equal to zero.
+ """
+
+ cash_paid_in_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money added to the cash drawer for reasons other than cash
+ payments. It is computed by summing the events of type PAID_IN. The amount is
+ always greater than or equal to zero.
+ """
+
+ cash_paid_out_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money removed from the cash drawer for reasons other than
+ cash refunds. It is computed by summing the events of type PAID_OUT. The amount
+ is always greater than or equal to zero.
+ """
+
+ expected_cash_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money that should be in the cash drawer at the end of the
+ shift, based on the shift's other money amounts.
+ This can be negative if employees have not correctly recorded all the events
+ on the cash drawer.
+ cash_paid_out_money is a summation of amounts from cash_payment_money (zero
+ or positive), cash_refunds_money (zero or negative), cash_paid_in_money (zero
+ or positive), and cash_paid_out_money (zero or negative) event types.
+ """
+
+ closed_cash_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money found in the cash drawer at the end of the shift
+ by an auditing employee. The amount should be positive.
+ """
+
+ device: typing.Optional[CashDrawerDevice] = pydantic.Field(default=None)
+ """
+ The device running Square Point of Sale that was connected to the cash drawer.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shift start time in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shift updated at time in RFC 3339 format.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location the cash drawer shift belongs to.
+ """
+
+ team_member_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of all team members that were logged into Square Point of Sale at any
+ point while the cash drawer shift was open.
+ """
+
+ opening_team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the team member that started the cash drawer shift.
+ """
+
+ ending_team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the team member that ended the cash drawer shift.
+ """
+
+ closing_team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the team member that closed the cash drawer shift by auditing
+ the cash drawer contents.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cash_drawer_shift_event.py b/src/square/types/cash_drawer_shift_event.py
new file mode 100644
index 00000000..49a2cba7
--- /dev/null
+++ b/src/square/types/cash_drawer_shift_event.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .cash_drawer_event_type import CashDrawerEventType
+from .money import Money
+
+
+class CashDrawerShiftEvent(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the event.
+ """
+
+ event_type: typing.Optional[CashDrawerEventType] = pydantic.Field(default=None)
+ """
+ The type of cash drawer shift event.
+ See [CashDrawerEventType](#type-cashdrawereventtype) for possible values
+ """
+
+ event_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money that was added to or removed from the cash drawer
+ in the event. The amount can be positive (for added money)
+ or zero (for other tender type payments). The addition or removal of money can be determined by
+ by the event type.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The event time in RFC 3339 format.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional description of the event, entered by the employee that
+ created the event.
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the team member that created the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cash_drawer_shift_state.py b/src/square/types/cash_drawer_shift_state.py
new file mode 100644
index 00000000..b8b834a2
--- /dev/null
+++ b/src/square/types/cash_drawer_shift_state.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CashDrawerShiftState = typing.Union[typing.Literal["OPEN", "ENDED", "CLOSED"], typing.Any]
diff --git a/src/square/types/cash_drawer_shift_summary.py b/src/square/types/cash_drawer_shift_summary.py
new file mode 100644
index 00000000..ef988c82
--- /dev/null
+++ b/src/square/types/cash_drawer_shift_summary.py
@@ -0,0 +1,94 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .cash_drawer_shift_state import CashDrawerShiftState
+from .money import Money
+
+
+class CashDrawerShiftSummary(UncheckedBaseModel):
+ """
+ The summary of a closed cash drawer shift.
+ This model contains only the money counted to start a cash drawer shift, counted
+ at the end of the shift, and the amount that should be in the drawer at shift
+ end based on summing all cash drawer shift events.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shift unique ID.
+ """
+
+ state: typing.Optional[CashDrawerShiftState] = pydantic.Field(default=None)
+ """
+ The shift current state.
+ See [CashDrawerShiftState](#type-cashdrawershiftstate) for possible values
+ """
+
+ opened_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shift start time in ISO 8601 format.
+ """
+
+ ended_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shift end time in ISO 8601 format.
+ """
+
+ closed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shift close time in ISO 8601 format.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An employee free-text description of a cash drawer shift.
+ """
+
+ opened_cash_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money in the cash drawer at the start of the shift. This
+ must be a positive amount.
+ """
+
+ expected_cash_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money that should be in the cash drawer at the end of the
+ shift, based on the cash drawer events on the shift.
+ The amount is correct if all shift employees accurately recorded their
+ cash drawer shift events. Unrecorded events and events with the wrong amount
+ result in an incorrect expected_cash_money amount that can be negative.
+ """
+
+ closed_cash_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money found in the cash drawer at the end of the shift by
+ an auditing employee. The amount must be greater than or equal to zero.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shift start time in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shift updated at time in RFC 3339 format.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location the cash drawer shift belongs to.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cash_payment_details.py b/src/square/types/cash_payment_details.py
new file mode 100644
index 00000000..afe88268
--- /dev/null
+++ b/src/square/types/cash_payment_details.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class CashPaymentDetails(UncheckedBaseModel):
+ """
+ Stores details about a cash payment. Contains only non-confidential information. For more information, see
+ [Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments).
+ """
+
+ buyer_supplied_money: Money = pydantic.Field()
+ """
+ The amount and currency of the money supplied by the buyer.
+ """
+
+ change_back_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of change due back to the buyer.
+ This read-only field is calculated
+ from the `amount_money` and `buyer_supplied_money` fields.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_availability_period.py b/src/square/types/catalog_availability_period.py
new file mode 100644
index 00000000..d6a4f2d4
--- /dev/null
+++ b/src/square/types/catalog_availability_period.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .day_of_week import DayOfWeek
+
+
+class CatalogAvailabilityPeriod(UncheckedBaseModel):
+ """
+ Represents a time period of availability.
+ """
+
+ start_local_time: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The start time of an availability period, specified in local time using partial-time
+ RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning.
+ Note that the seconds value is always :00, but it is appended for conformance to the RFC.
+ """
+
+ end_local_time: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The end time of an availability period, specified in local time using partial-time
+ RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening.
+ Note that the seconds value is always :00, but it is appended for conformance to the RFC.
+ """
+
+ day_of_week: typing.Optional[DayOfWeek] = pydantic.Field(default=None)
+ """
+ The day of the week for this availability period.
+ See [DayOfWeek](#type-dayofweek) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_category.py b/src/square/types/catalog_category.py
new file mode 100644
index 00000000..8508aea7
--- /dev/null
+++ b/src/square/types/catalog_category.py
@@ -0,0 +1,91 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_category_type import CatalogCategoryType
+from .catalog_ecom_seo_data import CatalogEcomSeoData
+from .category_path_to_root_node import CategoryPathToRootNode
+
+
+class CatalogCategory(UncheckedBaseModel):
+ """
+ A category to which a `CatalogItem` instance belongs.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The category name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
+ """
+
+ image_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of images associated with this `CatalogCategory` instance.
+ Currently these images are not displayed by Square, but are free to be displayed in 3rd party applications.
+ """
+
+ category_type: typing.Optional[CatalogCategoryType] = pydantic.Field(default=None)
+ """
+ The type of the category.
+ See [CatalogCategoryType](#type-catalogcategorytype) for possible values
+ """
+
+ parent_category: typing.Optional["CatalogObjectCategory"] = pydantic.Field(default=None)
+ """
+ The parent category of this category instance. This includes the parent category ID and an ordinal
+ value that determines the category's relative position among sibling categories with the same parent.
+ """
+
+ is_top_level: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether a category is a top level category, which does not have any parent_category.
+ """
+
+ channels: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of IDs representing channels, such as a Square Online site, where the category can be made visible.
+ """
+
+ availability_period_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of the `CatalogAvailabilityPeriod` objects associated with the category.
+ """
+
+ online_visibility: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the category is visible (`true`) or hidden (`false`) on all of the seller's Square Online sites.
+ """
+
+ root_category: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The top-level category in a category hierarchy.
+ """
+
+ ecom_seo_data: typing.Optional[CatalogEcomSeoData] = pydantic.Field(default=None)
+ """
+ The SEO data for a seller's Square Online store.
+ """
+
+ path_to_root: typing.Optional[typing.List[CategoryPathToRootNode]] = pydantic.Field(default=None)
+ """
+ The path from the category to its root category. The first node of the path is the parent of the category
+ and the last is the root category. The path is empty if the category is a root category.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_object_category import CatalogObjectCategory # noqa: E402, I001
+
+update_forward_refs(CatalogCategory, CatalogObjectCategory=CatalogObjectCategory)
diff --git a/src/square/types/catalog_category_type.py b/src/square/types/catalog_category_type.py
new file mode 100644
index 00000000..5a34272d
--- /dev/null
+++ b/src/square/types/catalog_category_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogCategoryType = typing.Union[typing.Literal["REGULAR_CATEGORY", "MENU_CATEGORY", "KITCHEN_CATEGORY"], typing.Any]
diff --git a/src/square/types/catalog_custom_attribute_definition.py b/src/square/types/catalog_custom_attribute_definition.py
new file mode 100644
index 00000000..93cf4bea
--- /dev/null
+++ b/src/square/types/catalog_custom_attribute_definition.py
@@ -0,0 +1,112 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_custom_attribute_definition_app_visibility import CatalogCustomAttributeDefinitionAppVisibility
+from .catalog_custom_attribute_definition_number_config import CatalogCustomAttributeDefinitionNumberConfig
+from .catalog_custom_attribute_definition_selection_config import CatalogCustomAttributeDefinitionSelectionConfig
+from .catalog_custom_attribute_definition_seller_visibility import CatalogCustomAttributeDefinitionSellerVisibility
+from .catalog_custom_attribute_definition_string_config import CatalogCustomAttributeDefinitionStringConfig
+from .catalog_custom_attribute_definition_type import CatalogCustomAttributeDefinitionType
+from .catalog_object_type import CatalogObjectType
+from .source_application import SourceApplication
+
+
+class CatalogCustomAttributeDefinition(UncheckedBaseModel):
+ """
+ Contains information defining a custom attribute. Custom attributes are
+ intended to store additional information about a catalog object or to associate a
+ catalog object with an entity in another system. Do not use custom attributes
+ to store any sensitive information (personally identifiable information, card details, etc.).
+ [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes)
+ """
+
+ type: CatalogCustomAttributeDefinitionType = pydantic.Field()
+ """
+ The type of this custom attribute. Cannot be modified after creation.
+ Required.
+ See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values
+ """
+
+ name: str = pydantic.Field()
+ """
+ The name of this definition for API and seller-facing UI purposes.
+ The name must be unique within the (merchant, application) pair. Required.
+ May not be empty and may not exceed 255 characters. Can be modified after creation.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Seller-oriented description of the meaning of this Custom Attribute,
+ any constraints that the seller should observe, etc. May be displayed as a tooltip in Square UIs.
+ """
+
+ source_application: typing.Optional[SourceApplication] = pydantic.Field(default=None)
+ """
+ __Read only.__ Contains information about the application that
+ created this custom attribute definition.
+ """
+
+ allowed_object_types: typing.List[CatalogObjectType] = pydantic.Field()
+ """
+ The set of `CatalogObject` types that this custom atttribute may be applied to.
+ Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. At least one type must be included.
+ See [CatalogObjectType](#type-catalogobjecttype) for possible values
+ """
+
+ seller_visibility: typing.Optional[CatalogCustomAttributeDefinitionSellerVisibility] = pydantic.Field(default=None)
+ """
+ The visibility of a custom attribute in seller-facing UIs (including Square Point
+ of Sale applications and Square Dashboard). May be modified.
+ See [CatalogCustomAttributeDefinitionSellerVisibility](#type-catalogcustomattributedefinitionsellervisibility) for possible values
+ """
+
+ app_visibility: typing.Optional[CatalogCustomAttributeDefinitionAppVisibility] = pydantic.Field(default=None)
+ """
+ The visibility of a custom attribute to applications other than the application
+ that created the attribute.
+ See [CatalogCustomAttributeDefinitionAppVisibility](#type-catalogcustomattributedefinitionappvisibility) for possible values
+ """
+
+ string_config: typing.Optional[CatalogCustomAttributeDefinitionStringConfig] = pydantic.Field(default=None)
+ """
+ Optionally, populated when `type` = `STRING`, unset otherwise.
+ """
+
+ number_config: typing.Optional[CatalogCustomAttributeDefinitionNumberConfig] = pydantic.Field(default=None)
+ """
+ Optionally, populated when `type` = `NUMBER`, unset otherwise.
+ """
+
+ selection_config: typing.Optional[CatalogCustomAttributeDefinitionSelectionConfig] = pydantic.Field(default=None)
+ """
+ Populated when `type` is set to `SELECTION`, unset otherwise.
+ """
+
+ custom_attribute_usage_count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of custom attributes that reference this
+ custom attribute definition. Set by the server in response to a ListCatalog
+ request with `include_counts` set to `true`. If the actual count is greater
+ than 100, `custom_attribute_usage_count` will be set to `100`.
+ """
+
+ key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the desired custom attribute key that can be used to access
+ the custom attribute value on catalog objects. Cannot be modified after the
+ custom attribute definition has been created.
+ Must be between 1 and 60 characters, and may only contain the characters `[a-zA-Z0-9_-]`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_custom_attribute_definition_app_visibility.py b/src/square/types/catalog_custom_attribute_definition_app_visibility.py
new file mode 100644
index 00000000..1133675a
--- /dev/null
+++ b/src/square/types/catalog_custom_attribute_definition_app_visibility.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogCustomAttributeDefinitionAppVisibility = typing.Union[
+ typing.Literal["APP_VISIBILITY_HIDDEN", "APP_VISIBILITY_READ_ONLY", "APP_VISIBILITY_READ_WRITE_VALUES"], typing.Any
+]
diff --git a/src/square/types/catalog_custom_attribute_definition_number_config.py b/src/square/types/catalog_custom_attribute_definition_number_config.py
new file mode 100644
index 00000000..8c722499
--- /dev/null
+++ b/src/square/types/catalog_custom_attribute_definition_number_config.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogCustomAttributeDefinitionNumberConfig(UncheckedBaseModel):
+ precision: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ An integer between 0 and 5 that represents the maximum number of
+ positions allowed after the decimal in number custom attribute values
+ For example:
+
+ - if the precision is 0, the quantity can be 1, 2, 3, etc.
+ - if the precision is 1, the quantity can be 0.1, 0.2, etc.
+ - if the precision is 2, the quantity can be 0.01, 0.12, etc.
+
+ Default: 5
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_custom_attribute_definition_selection_config.py b/src/square/types/catalog_custom_attribute_definition_selection_config.py
new file mode 100644
index 00000000..ccaf9071
--- /dev/null
+++ b/src/square/types/catalog_custom_attribute_definition_selection_config.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_custom_attribute_definition_selection_config_custom_attribute_selection import (
+ CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection,
+)
+
+
+class CatalogCustomAttributeDefinitionSelectionConfig(UncheckedBaseModel):
+ """
+ Configuration associated with `SELECTION`-type custom attribute definitions.
+ """
+
+ max_allowed_selections: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of selections that can be set. The maximum value for this
+ attribute is 100. The default value is 1. The value can be modified, but changing the value will not
+ affect existing custom attribute values on objects. Clients need to
+ handle custom attributes with more selected values than allowed by this limit.
+ """
+
+ allowed_selections: typing.Optional[
+ typing.List[CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection]
+ ] = pydantic.Field(default=None)
+ """
+ The set of valid `CatalogCustomAttributeSelections`. Up to a maximum of 100
+ selections can be defined. Can be modified.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_custom_attribute_definition_selection_config_custom_attribute_selection.py b/src/square/types/catalog_custom_attribute_definition_selection_config_custom_attribute_selection.py
new file mode 100644
index 00000000..c48b3588
--- /dev/null
+++ b/src/square/types/catalog_custom_attribute_definition_selection_config_custom_attribute_selection.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection(UncheckedBaseModel):
+ """
+ A named selection for this `SELECTION`-type custom attribute definition.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique ID set by Square.
+ """
+
+ name: str = pydantic.Field()
+ """
+ Selection name, unique within `allowed_selections`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_custom_attribute_definition_seller_visibility.py b/src/square/types/catalog_custom_attribute_definition_seller_visibility.py
new file mode 100644
index 00000000..d56f41dd
--- /dev/null
+++ b/src/square/types/catalog_custom_attribute_definition_seller_visibility.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogCustomAttributeDefinitionSellerVisibility = typing.Union[
+ typing.Literal["SELLER_VISIBILITY_HIDDEN", "SELLER_VISIBILITY_READ_WRITE_VALUES"], typing.Any
+]
diff --git a/src/square/types/catalog_custom_attribute_definition_string_config.py b/src/square/types/catalog_custom_attribute_definition_string_config.py
new file mode 100644
index 00000000..14a89109
--- /dev/null
+++ b/src/square/types/catalog_custom_attribute_definition_string_config.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogCustomAttributeDefinitionStringConfig(UncheckedBaseModel):
+ """
+ Configuration associated with Custom Attribute Definitions of type `STRING`.
+ """
+
+ enforce_uniqueness: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If true, each Custom Attribute instance associated with this Custom Attribute
+ Definition must have a unique value within the seller's catalog. For
+ example, this may be used for a value like a SKU that should not be
+ duplicated within a seller's catalog. May not be modified after the
+ definition has been created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_custom_attribute_definition_type.py b/src/square/types/catalog_custom_attribute_definition_type.py
new file mode 100644
index 00000000..ce74f8ad
--- /dev/null
+++ b/src/square/types/catalog_custom_attribute_definition_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogCustomAttributeDefinitionType = typing.Union[
+ typing.Literal["STRING", "BOOLEAN", "NUMBER", "SELECTION"], typing.Any
+]
diff --git a/src/square/types/catalog_custom_attribute_value.py b/src/square/types/catalog_custom_attribute_value.py
new file mode 100644
index 00000000..5eca36ab
--- /dev/null
+++ b/src/square/types/catalog_custom_attribute_value.py
@@ -0,0 +1,69 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_custom_attribute_definition_type import CatalogCustomAttributeDefinitionType
+
+
+class CatalogCustomAttributeValue(UncheckedBaseModel):
+ """
+ An instance of a custom attribute. Custom attributes can be defined and
+ added to `ITEM` and `ITEM_VARIATION` type catalog objects.
+ [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes).
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the custom attribute.
+ """
+
+ string_value: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The string value of the custom attribute. Populated if `type` = `STRING`.
+ """
+
+ custom_attribute_definition_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) this value belongs to.
+ """
+
+ type: typing.Optional[CatalogCustomAttributeDefinitionType] = pydantic.Field(default=None)
+ """
+ A copy of type from the associated `CatalogCustomAttributeDefinition`.
+ See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values
+ """
+
+ number_value: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Populated if `type` = `NUMBER`. Contains a string
+ representation of a decimal number, using a `.` as the decimal separator.
+ """
+
+ boolean_value: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ A `true` or `false` value. Populated if `type` = `BOOLEAN`.
+ """
+
+ selection_uid_values: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ One or more choices from `allowed_selections`. Populated if `type` = `SELECTION`.
+ """
+
+ key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ If the associated `CatalogCustomAttributeDefinition` object is defined by another application, this key is prefixed by the defining application ID.
+ For example, if the CatalogCustomAttributeDefinition has a key attribute of "cocoa_brand" and the defining application ID is "abcd1234", this key is "abcd1234:cocoa_brand"
+ when the application making the request is different from the application defining the custom attribute definition. Otherwise, the key is simply "cocoa_brand".
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_discount.py b/src/square/types/catalog_discount.py
new file mode 100644
index 00000000..3aa239af
--- /dev/null
+++ b/src/square/types/catalog_discount.py
@@ -0,0 +1,85 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_discount_modify_tax_basis import CatalogDiscountModifyTaxBasis
+from .catalog_discount_type import CatalogDiscountType
+from .money import Money
+
+
+class CatalogDiscount(UncheckedBaseModel):
+ """
+ A discount applicable to items.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The discount name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
+ """
+
+ discount_type: typing.Optional[CatalogDiscountType] = pydantic.Field(default=None)
+ """
+ Indicates whether the discount is a fixed amount or percentage, or entered at the time of sale.
+ See [CatalogDiscountType](#type-catalogdiscounttype) for possible values
+ """
+
+ percentage: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The percentage of the discount as a string representation of a decimal number, using a `.` as the decimal
+ separator and without a `%` sign. A value of `7.5` corresponds to `7.5%`. Specify a percentage of `0` if `discount_type`
+ is `VARIABLE_PERCENTAGE`.
+
+ Do not use this field for amount-based or variable discounts.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of the discount. Specify an amount of `0` if `discount_type` is `VARIABLE_AMOUNT`.
+
+ Do not use this field for percentage-based or variable discounts.
+ """
+
+ pin_required: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether a mobile staff member needs to enter their PIN to apply the
+ discount to a payment in the Square Point of Sale app.
+ """
+
+ label_color: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The color of the discount display label in the Square Point of Sale app. This must be a valid hex color code.
+ """
+
+ modify_tax_basis: typing.Optional[CatalogDiscountModifyTaxBasis] = pydantic.Field(default=None)
+ """
+ Indicates whether this discount should reduce the price used to calculate tax.
+
+ Most discounts should use `MODIFY_TAX_BASIS`. However, in some circumstances taxes must
+ be calculated based on an item's price, ignoring a particular discount. For example,
+ in many US jurisdictions, a manufacturer coupon or instant rebate reduces the price a
+ customer pays but does not reduce the sale price used to calculate how much sales tax is
+ due. In this case, the discount representing that manufacturer coupon should have
+ `DO_NOT_MODIFY_TAX_BASIS` for this field.
+
+ If you are unsure whether you need to use this field, consult your tax professional.
+ See [CatalogDiscountModifyTaxBasis](#type-catalogdiscountmodifytaxbasis) for possible values
+ """
+
+ maximum_amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ For a percentage discount, the maximum absolute value of the discount. For example, if a
+ 50% discount has a `maximum_amount_money` of $20, a $100 purchase will yield a $20 discount,
+ not a $50 discount.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_discount_modify_tax_basis.py b/src/square/types/catalog_discount_modify_tax_basis.py
new file mode 100644
index 00000000..2e0b1885
--- /dev/null
+++ b/src/square/types/catalog_discount_modify_tax_basis.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogDiscountModifyTaxBasis = typing.Union[typing.Literal["MODIFY_TAX_BASIS", "DO_NOT_MODIFY_TAX_BASIS"], typing.Any]
diff --git a/src/square/types/catalog_discount_type.py b/src/square/types/catalog_discount_type.py
new file mode 100644
index 00000000..d4156094
--- /dev/null
+++ b/src/square/types/catalog_discount_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogDiscountType = typing.Union[
+ typing.Literal["FIXED_PERCENTAGE", "FIXED_AMOUNT", "VARIABLE_PERCENTAGE", "VARIABLE_AMOUNT"], typing.Any
+]
diff --git a/src/square/types/catalog_ecom_seo_data.py b/src/square/types/catalog_ecom_seo_data.py
new file mode 100644
index 00000000..af9947f3
--- /dev/null
+++ b/src/square/types/catalog_ecom_seo_data.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogEcomSeoData(UncheckedBaseModel):
+ """
+ SEO data for for a seller's Square Online store.
+ """
+
+ page_title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The SEO title used for the Square Online store.
+ """
+
+ page_description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The SEO description used for the Square Online store.
+ """
+
+ permalink: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The SEO permalink used for the Square Online store.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_id_mapping.py b/src/square/types/catalog_id_mapping.py
new file mode 100644
index 00000000..97d5d4a5
--- /dev/null
+++ b/src/square/types/catalog_id_mapping.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogIdMapping(UncheckedBaseModel):
+ """
+ A mapping between a temporary client-supplied ID and a permanent server-generated ID.
+
+ When calling [UpsertCatalogObject](api-endpoint:Catalog-UpsertCatalogObject) or
+ [BatchUpsertCatalogObjects](api-endpoint:Catalog-BatchUpsertCatalogObjects) to
+ create a [CatalogObject](entity:CatalogObject) instance, you can supply
+ a temporary ID for the to-be-created object, especially when the object is to be referenced
+ elsewhere in the same request body. This temporary ID can be any string unique within
+ the call, but must be prefixed by "#".
+
+ After the request is submitted and the object created, a permanent server-generated ID is assigned
+ to the new object. The permanent ID is unique across the Square catalog.
+ """
+
+ client_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The client-supplied temporary `#`-prefixed ID for a new `CatalogObject`.
+ """
+
+ object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The permanent ID for the CatalogObject created by the server.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_image.py b/src/square/types/catalog_image.py
new file mode 100644
index 00000000..94fef941
--- /dev/null
+++ b/src/square/types/catalog_image.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogImage(UncheckedBaseModel):
+ """
+ An image file to use in Square catalogs. It can be associated with
+ `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, and `CatalogModifierList` objects.
+ Only the images on items and item variations are exposed in Dashboard.
+ Only the first image on an item is displayed in Square Point of Sale (SPOS).
+ Images on items and variations are displayed through Square Online Store.
+ Images on other object types are for use by 3rd party application developers.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The internal name to identify this image in calls to the Square API.
+ This is a searchable attribute for use in applicable query filters
+ using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
+ It is not unique and should not be shown in a buyer facing context.
+ """
+
+ url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL of this image, generated by Square after an image is uploaded
+ using the [CreateCatalogImage](api-endpoint:Catalog-CreateCatalogImage) endpoint.
+ To modify the image, use the UpdateCatalogImage endpoint. Do not change the URL field.
+ """
+
+ caption: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A caption that describes what is shown in the image. Displayed in the
+ Square Online Store. This is a searchable attribute for use in applicable query filters
+ using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
+ """
+
+ photo_studio_order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The immutable order ID for this image object created by the Photo Studio service in Square Online Store.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_info_response.py b/src/square/types/catalog_info_response.py
new file mode 100644
index 00000000..2a8a909b
--- /dev/null
+++ b/src/square/types/catalog_info_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_info_response_limits import CatalogInfoResponseLimits
+from .error import Error
+from .standard_unit_description_group import StandardUnitDescriptionGroup
+
+
+class CatalogInfoResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ limits: typing.Optional[CatalogInfoResponseLimits] = pydantic.Field(default=None)
+ """
+ Limits that apply to this API.
+ """
+
+ standard_unit_description_group: typing.Optional[StandardUnitDescriptionGroup] = pydantic.Field(default=None)
+ """
+ Names and abbreviations for standard units.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_info_response_limits.py b/src/square/types/catalog_info_response_limits.py
new file mode 100644
index 00000000..4de62bb4
--- /dev/null
+++ b/src/square/types/catalog_info_response_limits.py
@@ -0,0 +1,84 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogInfoResponseLimits(UncheckedBaseModel):
+ batch_upsert_max_objects_per_batch: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of objects that may appear within a single batch in a
+ `/v2/catalog/batch-upsert` request.
+ """
+
+ batch_upsert_max_total_objects: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of objects that may appear across all batches in a
+ `/v2/catalog/batch-upsert` request.
+ """
+
+ batch_retrieve_max_object_ids: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of object IDs that may appear in a `/v2/catalog/batch-retrieve`
+ request.
+ """
+
+ search_max_page_limit: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of results that may be returned in a page of a
+ `/v2/catalog/search` response.
+ """
+
+ batch_delete_max_object_ids: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of object IDs that may be included in a single
+ `/v2/catalog/batch-delete` request.
+ """
+
+ update_item_taxes_max_item_ids: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of item IDs that may be included in a single
+ `/v2/catalog/update-item-taxes` request.
+ """
+
+ update_item_taxes_max_taxes_to_enable: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of tax IDs to be enabled that may be included in a single
+ `/v2/catalog/update-item-taxes` request.
+ """
+
+ update_item_taxes_max_taxes_to_disable: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of tax IDs to be disabled that may be included in a single
+ `/v2/catalog/update-item-taxes` request.
+ """
+
+ update_item_modifier_lists_max_item_ids: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of item IDs that may be included in a single
+ `/v2/catalog/update-item-modifier-lists` request.
+ """
+
+ update_item_modifier_lists_max_modifier_lists_to_enable: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of modifier list IDs to be enabled that may be included in
+ a single `/v2/catalog/update-item-modifier-lists` request.
+ """
+
+ update_item_modifier_lists_max_modifier_lists_to_disable: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of modifier list IDs to be disabled that may be included in
+ a single `/v2/catalog/update-item-modifier-lists` request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_item.py b/src/square/types/catalog_item.py
new file mode 100644
index 00000000..fb04ab58
--- /dev/null
+++ b/src/square/types/catalog_item.py
@@ -0,0 +1,250 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_ecom_seo_data import CatalogEcomSeoData
+from .catalog_item_food_and_beverage_details import CatalogItemFoodAndBeverageDetails
+from .catalog_item_modifier_list_info import CatalogItemModifierListInfo
+from .catalog_item_option_for_item import CatalogItemOptionForItem
+from .catalog_item_product_type import CatalogItemProductType
+
+
+class CatalogItem(UncheckedBaseModel):
+ """
+ A [CatalogObject](entity:CatalogObject) instance of the `ITEM` type, also referred to as an item, in the catalog.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The item's name. This is a searchable attribute for use in applicable query filters, its value must not be empty, and the length is of Unicode code points.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The item's description. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
+
+ Deprecated at 2022-07-20, this field is planned to retire in 6 months. You should migrate to use `description_html` to set the description
+ of the [CatalogItem](entity:CatalogItem) instance. The `description` and `description_html` field values are kept in sync. If you try to
+ set the both fields, the `description_html` text value overwrites the `description` value. Updates in one field are also reflected in the other,
+ except for when you use an early version before Square API 2022-07-20 and `description_html` is set to blank, setting the `description` value to null
+ does not nullify `description_html`.
+ """
+
+ abbreviation: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used.
+ This attribute is searchable, and its value length is of Unicode code points.
+ """
+
+ label_color: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code.
+ """
+
+ is_taxable: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`.
+ """
+
+ category_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the item's category, if any. Deprecated since 2023-12-13. Use `CatalogItem.categories`, instead.
+ """
+
+ buyer_facing_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The override to a product name to display to users
+ """
+
+ tax_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A set of IDs indicating the taxes enabled for
+ this item. When updating an item, any taxes listed here will be added to the item.
+ Taxes may also be added to or deleted from an item using `UpdateItemTaxes`.
+ """
+
+ modifier_list_info: typing.Optional[typing.List[CatalogItemModifierListInfo]] = pydantic.Field(default=None)
+ """
+ A set of `CatalogItemModifierListInfo` objects
+ representing the modifier lists that apply to this item, along with the overrides and min
+ and max limits that are specific to this item. Modifier lists
+ may also be added to or deleted from an item using `UpdateItemModifierLists`.
+ """
+
+ variations: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ A list of [CatalogItemVariation](entity:CatalogItemVariation) objects for this item. An item must have
+ at least one variation.
+ """
+
+ product_type: typing.Optional[CatalogItemProductType] = pydantic.Field(default=None)
+ """
+ The product type of the item. Once set, the `product_type` value cannot be modified.
+
+ Items of the `LEGACY_SQUARE_ONLINE_SERVICE` and `LEGACY_SQUARE_ONLINE_MEMBERSHIP` product types can be updated
+ but cannot be created using the API.
+ See [CatalogItemProductType](#type-catalogitemproducttype) for possible values
+ """
+
+ skip_modifier_screen: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If `false`, the Square Point of Sale app will present the `CatalogItem`'s
+ details screen immediately, allowing the merchant to choose `CatalogModifier`s
+ before adding the item to the cart. This is the default behavior.
+
+ If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected
+ modifiers, and merchants can edit modifiers by drilling down onto the item's details.
+
+ Third-party clients are encouraged to implement similar behaviors.
+ """
+
+ item_options: typing.Optional[typing.List[CatalogItemOptionForItem]] = pydantic.Field(default=None)
+ """
+ List of item options IDs for this item. Used to manage and group item
+ variations in a specified order.
+
+ Maximum: 6 item options.
+ """
+
+ ecom_uri: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Deprecated. A URI pointing to a published e-commerce product page for the Item.
+ """
+
+ ecom_image_uris: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Deprecated. A comma-separated list of encoded URIs pointing to a set of published e-commerce images for the Item.
+ """
+
+ image_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of images associated with this `CatalogItem` instance.
+ These images will be shown to customers in Square Online Store.
+ The first image will show up as the icon for this item in POS.
+ """
+
+ sort_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A name to sort the item by. If this name is unspecified, namely, the `sort_name` field is absent, the regular `name` field is used for sorting.
+ Its value must not be empty.
+
+ It is currently supported for sellers of the Japanese locale only.
+ """
+
+ categories: typing.Optional[typing.List["CatalogObjectCategory"]] = pydantic.Field(default=None)
+ """
+ The list of categories to which this item belongs. Each entry includes the category ID and an ordinal
+ value that determines the item's relative position within that category.
+ """
+
+ description_html: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The item's description as expressed in valid HTML elements. The length of this field value, including those of HTML tags,
+ is of Unicode points. With application query filters, the text values of the HTML elements and attributes are searchable. Invalid or
+ unsupported HTML elements or attributes are ignored.
+
+ Supported HTML elements include:
+ - `a`: Link. Supports linking to website URLs, email address, and telephone numbers.
+ - `b`, `strong`: Bold text
+ - `br`: Line break
+ - `code`: Computer code
+ - `div`: Section
+ - `h1-h6`: Headings
+ - `i`, `em`: Italics
+ - `li`: List element
+ - `ol`: Numbered list
+ - `p`: Paragraph
+ - `ul`: Bullet list
+ - `u`: Underline
+
+
+ Supported HTML attributes include:
+ - `align`: Alignment of the text content
+ - `href`: Link destination
+ - `rel`: Relationship between link's target and source
+ - `target`: Place to open the linked document
+ """
+
+ description_plaintext: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A server-generated plaintext version of the `description_html` field, without formatting tags.
+ """
+
+ kitchen_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ (Optional) Name that the restaurant wants to display to their kitchen workers
+ instead of the customer-facing name.
+ e.g., customer name might be "Big John's Mega Burger" and the
+ kitchen name is "12oz beef burger"
+ """
+
+ channels: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available.
+ This field is read only and cannot be edited.
+ """
+
+ is_archived: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether this item is archived (`true`) or not (`false`).
+ """
+
+ ecom_seo_data: typing.Optional[CatalogEcomSeoData] = pydantic.Field(default=None)
+ """
+ The SEO data for a seller's Square Online store.
+ """
+
+ food_and_beverage_details: typing.Optional[CatalogItemFoodAndBeverageDetails] = pydantic.Field(default=None)
+ """
+ The food and beverage-specific details for the `FOOD_AND_BEV` item.
+ """
+
+ reporting_category: typing.Optional["CatalogObjectCategory"] = pydantic.Field(default=None)
+ """
+ The item's reporting category.
+ """
+
+ is_alcoholic: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether this item is alcoholic (`true`) or not (`false`).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+from .catalog_category import CatalogCategory # noqa: E402, I001
+from .catalog_object_category import CatalogObjectCategory # noqa: E402, I001
+
+update_forward_refs(
+ CatalogItem,
+ CatalogCategory=CatalogCategory,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectCategory=CatalogObjectCategory,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/catalog_item_food_and_beverage_details.py b/src/square/types/catalog_item_food_and_beverage_details.py
new file mode 100644
index 00000000..c2a8c78c
--- /dev/null
+++ b/src/square/types/catalog_item_food_and_beverage_details.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_item_food_and_beverage_details_dietary_preference import (
+ CatalogItemFoodAndBeverageDetailsDietaryPreference,
+)
+from .catalog_item_food_and_beverage_details_ingredient import CatalogItemFoodAndBeverageDetailsIngredient
+
+
+class CatalogItemFoodAndBeverageDetails(UncheckedBaseModel):
+ """
+ The food and beverage-specific details of a `FOOD_AND_BEV` item.
+ """
+
+ calorie_count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The calorie count (in the unit of kcal) for the `FOOD_AND_BEV` type of items.
+ """
+
+ dietary_preferences: typing.Optional[typing.List[CatalogItemFoodAndBeverageDetailsDietaryPreference]] = (
+ pydantic.Field(default=None)
+ )
+ """
+ The dietary preferences for the `FOOD_AND_BEV` item.
+ """
+
+ ingredients: typing.Optional[typing.List[CatalogItemFoodAndBeverageDetailsIngredient]] = pydantic.Field(
+ default=None
+ )
+ """
+ The ingredients for the `FOOD_AND_BEV` type item.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_item_food_and_beverage_details_dietary_preference.py b/src/square/types/catalog_item_food_and_beverage_details_dietary_preference.py
new file mode 100644
index 00000000..9371dba5
--- /dev/null
+++ b/src/square/types/catalog_item_food_and_beverage_details_dietary_preference.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_item_food_and_beverage_details_dietary_preference_standard_dietary_preference import (
+ CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference,
+)
+from .catalog_item_food_and_beverage_details_dietary_preference_type import (
+ CatalogItemFoodAndBeverageDetailsDietaryPreferenceType,
+)
+
+
+class CatalogItemFoodAndBeverageDetailsDietaryPreference(UncheckedBaseModel):
+ """
+ Dietary preferences that can be assigned to an `FOOD_AND_BEV` item and its ingredients.
+ """
+
+ type: typing.Optional[CatalogItemFoodAndBeverageDetailsDietaryPreferenceType] = pydantic.Field(default=None)
+ """
+ The dietary preference type. Supported values include `STANDARD` and `CUSTOM` as specified in `FoodAndBeverageDetails.DietaryPreferenceType`.
+ See [DietaryPreferenceType](#type-dietarypreferencetype) for possible values
+ """
+
+ standard_name: typing.Optional[CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference] = (
+ pydantic.Field(default=None)
+ )
+ """
+ The name of the dietary preference from a standard pre-defined list. This should be null if it's a custom dietary preference.
+ See [StandardDietaryPreference](#type-standarddietarypreference) for possible values
+ """
+
+ custom_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of a user-defined custom dietary preference. This should be null if it's a standard dietary preference.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_item_food_and_beverage_details_dietary_preference_standard_dietary_preference.py b/src/square/types/catalog_item_food_and_beverage_details_dietary_preference_standard_dietary_preference.py
new file mode 100644
index 00000000..f23d0b67
--- /dev/null
+++ b/src/square/types/catalog_item_food_and_beverage_details_dietary_preference_standard_dietary_preference.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = typing.Union[
+ typing.Literal["DAIRY_FREE", "GLUTEN_FREE", "HALAL", "KOSHER", "NUT_FREE", "VEGAN", "VEGETARIAN"], typing.Any
+]
diff --git a/src/square/types/catalog_item_food_and_beverage_details_dietary_preference_type.py b/src/square/types/catalog_item_food_and_beverage_details_dietary_preference_type.py
new file mode 100644
index 00000000..524dbd7a
--- /dev/null
+++ b/src/square/types/catalog_item_food_and_beverage_details_dietary_preference_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogItemFoodAndBeverageDetailsDietaryPreferenceType = typing.Union[typing.Literal["STANDARD", "CUSTOM"], typing.Any]
diff --git a/src/square/types/catalog_item_food_and_beverage_details_ingredient.py b/src/square/types/catalog_item_food_and_beverage_details_ingredient.py
new file mode 100644
index 00000000..19cb1f5e
--- /dev/null
+++ b/src/square/types/catalog_item_food_and_beverage_details_ingredient.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_item_food_and_beverage_details_dietary_preference_type import (
+ CatalogItemFoodAndBeverageDetailsDietaryPreferenceType,
+)
+from .catalog_item_food_and_beverage_details_ingredient_standard_ingredient import (
+ CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient,
+)
+
+
+class CatalogItemFoodAndBeverageDetailsIngredient(UncheckedBaseModel):
+ """
+ Describes the ingredient used in a `FOOD_AND_BEV` item.
+ """
+
+ type: typing.Optional[CatalogItemFoodAndBeverageDetailsDietaryPreferenceType] = pydantic.Field(default=None)
+ """
+ The dietary preference type of the ingredient. Supported values include `STANDARD` and `CUSTOM` as specified in `FoodAndBeverageDetails.DietaryPreferenceType`.
+ See [DietaryPreferenceType](#type-dietarypreferencetype) for possible values
+ """
+
+ standard_name: typing.Optional[CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient] = pydantic.Field(
+ default=None
+ )
+ """
+ The name of the ingredient from a standard pre-defined list. This should be null if it's a custom dietary preference.
+ See [StandardIngredient](#type-standardingredient) for possible values
+ """
+
+ custom_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of a custom user-defined ingredient. This should be null if it's a standard dietary preference.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_item_food_and_beverage_details_ingredient_standard_ingredient.py b/src/square/types/catalog_item_food_and_beverage_details_ingredient_standard_ingredient.py
new file mode 100644
index 00000000..9812c925
--- /dev/null
+++ b/src/square/types/catalog_item_food_and_beverage_details_ingredient_standard_ingredient.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = typing.Union[
+ typing.Literal[
+ "CELERY",
+ "CRUSTACEANS",
+ "EGGS",
+ "FISH",
+ "GLUTEN",
+ "LUPIN",
+ "MILK",
+ "MOLLUSCS",
+ "MUSTARD",
+ "PEANUTS",
+ "SESAME",
+ "SOY",
+ "SULPHITES",
+ "TREE_NUTS",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/catalog_item_modifier_list_info.py b/src/square/types/catalog_item_modifier_list_info.py
new file mode 100644
index 00000000..0edf6935
--- /dev/null
+++ b/src/square/types/catalog_item_modifier_list_info.py
@@ -0,0 +1,100 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_modifier_override import CatalogModifierOverride
+from .catalog_modifier_toggle_override_type import CatalogModifierToggleOverrideType
+
+
+class CatalogItemModifierListInfo(UncheckedBaseModel):
+ """
+ Controls how a modifier list is applied to a specific item. This object allows for item-specific customization of modifier list behavior
+ and provides the ability to override global modifier list settings.
+ """
+
+ modifier_list_id: str = pydantic.Field()
+ """
+ The ID of the `CatalogModifierList` controlled by this `CatalogModifierListInfo`.
+ """
+
+ modifier_overrides: typing.Optional[typing.List[CatalogModifierOverride]] = pydantic.Field(default=None)
+ """
+ A set of `CatalogModifierOverride` objects that override default modifier settings for this item.
+ """
+
+ min_selected_modifiers: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The minimum number of modifiers that must be selected from this modifier list.
+ Values:
+
+ - 0: No selection is required.
+ - -1: Default value, the attribute was not set by the client. When `max_selected_modifiers` is
+ also -1, use the minimum and maximum selection values set on the `CatalogItemModifierList`.
+ - >0: The required minimum modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.
+ - < -1: Invalid. Treated as no selection required.
+ """
+
+ max_selected_modifiers: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of modifiers that can be selected.
+ Values:
+
+ - 0: No maximum limit.
+ - -1: Default value, the attribute was not set by the client. When `min_selected_modifiers` is
+ also -1, use the minimum and maximum selection values set on the `CatalogItemModifierList`.
+ - >0: The maximum total modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.
+ - < -1: Invalid. Treated as no maximum limit.
+ """
+
+ enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If `true`, enable this `CatalogModifierList`. The default value is `true`.
+ """
+
+ ordinal: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied
+ to a `CatalogItem` instance.
+ """
+
+ allow_quantities: typing.Optional[CatalogModifierToggleOverrideType] = pydantic.Field(default=None)
+ """
+ Controls whether multiple quantities of the same modifier can be selected for this item.
+ - `YES` means that every modifier in the `CatalogModifierList` can have multiple quantities
+ selected for this item.
+ - `NO` means that each modifier in the `CatalogModifierList` can be selected only once for this item.
+ - `NOT_SET` means that the `allow_quantities` setting on the `CatalogModifierList` is obeyed.
+ See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values
+ """
+
+ is_conversational: typing.Optional[CatalogModifierToggleOverrideType] = pydantic.Field(default=None)
+ """
+ Controls whether conversational mode is enabled for modifiers on this item.
+
+ - `YES` means conversational mode is enabled for every modifier in the `CatalogModifierList`.
+ - `NO` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`.
+ - `NOT_SET` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`.
+ See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values
+ """
+
+ hidden_from_customer_override: typing.Optional[CatalogModifierToggleOverrideType] = pydantic.Field(default=None)
+ """
+ Controls whether all modifiers for this item are hidden from customer receipts.
+ - `YES` means that all modifiers in the `CatalogModifierList` are hidden from customer
+ receipts for this item.
+ - `NO` means that all modifiers in the `CatalogModifierList` are visible on customer receipts for this item.
+ - `NOT_SET` means that the `hidden_from_customer` setting on the `CatalogModifierList` is obeyed.
+ See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_item_option.py b/src/square/types/catalog_item_option.py
new file mode 100644
index 00000000..2b8c1710
--- /dev/null
+++ b/src/square/types/catalog_item_option.py
@@ -0,0 +1,75 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogItemOption(UncheckedBaseModel):
+ """
+ A group of variations for a `CatalogItem`.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The item option's display name for the seller. Must be unique across
+ all item options. This is a searchable attribute for use in applicable query filters.
+ """
+
+ display_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The item option's display name for the customer. This is a searchable attribute for use in applicable query filters.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The item option's human-readable description. Displayed in the Square
+ Point of Sale app for the seller and in the Online Store or on receipts for
+ the buyer. This is a searchable attribute for use in applicable query filters.
+ """
+
+ show_colors: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If true, display colors for entries in `values` when present.
+ """
+
+ values: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ A list of CatalogObjects containing the
+ `CatalogItemOptionValue`s for this item.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ CatalogItemOption,
+ CatalogItem=CatalogItem,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/catalog_item_option_for_item.py b/src/square/types/catalog_item_option_for_item.py
new file mode 100644
index 00000000..109e10ee
--- /dev/null
+++ b/src/square/types/catalog_item_option_for_item.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogItemOptionForItem(UncheckedBaseModel):
+ """
+ An option that can be assigned to an item.
+ For example, a t-shirt item may offer a color option or a size option.
+ """
+
+ item_option_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique id of the item option, used to form the dimensions of the item option matrix in a specified order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_item_option_value.py b/src/square/types/catalog_item_option_value.py
new file mode 100644
index 00000000..e60f9004
--- /dev/null
+++ b/src/square/types/catalog_item_option_value.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogItemOptionValue(UncheckedBaseModel):
+ """
+ An enumerated value that can link a
+ `CatalogItemVariation` to an item option as one of
+ its item option values.
+ """
+
+ item_option_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique ID of the associated item option.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of this item option value. This is a searchable attribute for use in applicable query filters.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A human-readable description for the option value. This is a searchable attribute for use in applicable query filters.
+ """
+
+ color: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The HTML-supported hex color for the item option (e.g., "#ff8d4e85").
+ Only displayed if `show_colors` is enabled on the parent `ItemOption`. When
+ left unset, `color` defaults to white ("#ffffff") when `show_colors` is
+ enabled on the parent `ItemOption`.
+ """
+
+ ordinal: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Determines where this option value appears in a list of option values.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_item_option_value_for_item_variation.py b/src/square/types/catalog_item_option_value_for_item_variation.py
new file mode 100644
index 00000000..fe38369c
--- /dev/null
+++ b/src/square/types/catalog_item_option_value_for_item_variation.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogItemOptionValueForItemVariation(UncheckedBaseModel):
+ """
+ A `CatalogItemOptionValue` links an item variation to an item option as
+ an item option value. For example, a t-shirt item may offer a color option and
+ a size option. An item option value would represent each variation of t-shirt:
+ For example, "Color:Red, Size:Small" or "Color:Blue, Size:Medium".
+ """
+
+ item_option_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique id of an item option.
+ """
+
+ item_option_value_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique id of the selected value for the item option.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_item_product_type.py b/src/square/types/catalog_item_product_type.py
new file mode 100644
index 00000000..5c4e2791
--- /dev/null
+++ b/src/square/types/catalog_item_product_type.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogItemProductType = typing.Union[
+ typing.Literal[
+ "REGULAR",
+ "GIFT_CARD",
+ "APPOINTMENTS_SERVICE",
+ "FOOD_AND_BEV",
+ "EVENT",
+ "DIGITAL",
+ "DONATION",
+ "LEGACY_SQUARE_ONLINE_SERVICE",
+ "LEGACY_SQUARE_ONLINE_MEMBERSHIP",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/catalog_item_variation.py b/src/square/types/catalog_item_variation.py
new file mode 100644
index 00000000..d1f1be07
--- /dev/null
+++ b/src/square/types/catalog_item_variation.py
@@ -0,0 +1,201 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_item_option_value_for_item_variation import CatalogItemOptionValueForItemVariation
+from .catalog_item_variation_vendor_information import CatalogItemVariationVendorInformation
+from .catalog_pricing_type import CatalogPricingType
+from .catalog_stock_conversion import CatalogStockConversion
+from .inventory_alert_type import InventoryAlertType
+from .item_variation_location_overrides import ItemVariationLocationOverrides
+from .money import Money
+
+
+class CatalogItemVariation(UncheckedBaseModel):
+ """
+ An item variation, representing a product for sale, in the Catalog object model. Each [item](entity:CatalogItem) must have at least one
+ item variation and can have at most 250 item variations.
+
+ An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked
+ number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both
+ stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass
+ variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be
+ converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes
+ the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count
+ decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion.
+ """
+
+ item_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the `CatalogItem` associated with this item variation.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The item variation's name. This is a searchable attribute for use in applicable query filters.
+
+ Its value has a maximum length of 255 Unicode code points. However, when the parent [item](entity:CatalogItem)
+ uses [item options](entity:CatalogItemOption), this attribute is auto-generated, read-only, and can be
+ longer than 255 Unicode code points.
+ """
+
+ sku: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The item variation's SKU, if any. This is a searchable attribute for use in applicable query filters.
+ """
+
+ upc: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The universal product code (UPC) of the item variation, if any. This is a searchable attribute for use in applicable query filters.
+
+ The value of this attribute should be a number of 12-14 digits long. This restriction is enforced on the Square Seller Dashboard,
+ Square Point of Sale or Retail Point of Sale apps, where this attribute shows in the GTIN field. If a non-compliant UPC value is assigned
+ to this attribute using the API, the value is not editable on the Seller Dashboard, Square Point of Sale or Retail Point of Sale apps
+ unless it is updated to fit the expected format.
+ """
+
+ ordinal: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal
+ for each item variation within a parent `CatalogItem` is set according to the item variations's
+ position. On reads, the value is not guaranteed to be sequential or unique.
+ """
+
+ pricing_type: typing.Optional[CatalogPricingType] = pydantic.Field(default=None)
+ """
+ Indicates whether the item variation's price is fixed or determined at the time
+ of sale.
+ See [CatalogPricingType](#type-catalogpricingtype) for possible values
+ """
+
+ price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The item variation's price, if fixed pricing is used.
+ """
+
+ location_overrides: typing.Optional[typing.List[ItemVariationLocationOverrides]] = pydantic.Field(default=None)
+ """
+ Per-location price and inventory overrides.
+ """
+
+ track_inventory: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If `true`, inventory tracking is active for the variation at all locations by default.
+ This value can be overridden for specific locations using `ItemVariationLocationOverrides.track_inventory`.
+ If unset at both levels, inventory tracking is disabled.
+ """
+
+ inventory_alert_type: typing.Optional[InventoryAlertType] = pydantic.Field(default=None)
+ """
+ Indicates whether the item variation displays an alert when its inventory quantity is less than or equal
+ to its `inventory_alert_threshold`.
+
+ Deprecated because this field has never been global.
+ See [InventoryAlertType](#type-inventoryalerttype) for possible values
+ """
+
+ inventory_alert_threshold: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type`
+ is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. This value is always an integer.
+
+ Deprecated because this field has never been global.
+ """
+
+ user_data: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Arbitrary user metadata to associate with the item variation. This attribute value length is of Unicode code points.
+ """
+
+ service_duration: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ If the `CatalogItem` that owns this item variation is of type
+ `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For
+ example, a 30 minute appointment would have the value `1800000`, which is equal to
+ 30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second).
+ """
+
+ available_for_booking: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If the `CatalogItem` that owns this item variation is of type
+ `APPOINTMENTS_SERVICE`, a bool representing whether this service is available for booking.
+ """
+
+ item_option_values: typing.Optional[typing.List[CatalogItemOptionValueForItemVariation]] = pydantic.Field(
+ default=None
+ )
+ """
+ List of item option values associated with this item variation. Listed
+ in the same order as the item options of the parent item.
+ """
+
+ measurement_unit_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity
+ sold of this item variation. If left unset, the item will be sold in
+ whole quantities.
+ """
+
+ sellable: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether this variation can be sold. The inventory count of a sellable variation indicates
+ the number of units available for sale. When a variation is both stockable and sellable,
+ its sellable inventory count can be smaller than or equal to its stockable count.
+ """
+
+ stockable: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE).
+ When a variation is both stockable and sellable, the inventory count of a stockable variation keeps track of the number of units of this variation in stock
+ and is not an indicator of the number of units of the variation that can be sold.
+ """
+
+ image_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of images associated with this `CatalogItemVariation` instance.
+ These images will be shown to customers in Square Online Store.
+ """
+
+ team_member_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Tokens of employees that can perform the service represented by this variation. Only valid for
+ variations of type `APPOINTMENTS_SERVICE`.
+ """
+
+ stockable_conversion: typing.Optional[CatalogStockConversion] = pydantic.Field(default=None)
+ """
+ The unit conversion rule, as prescribed by the [CatalogStockConversion](entity:CatalogStockConversion) type,
+ that describes how this non-stockable (i.e., sellable/receivable) item variation is converted
+ to/from the stockable item variation sharing the same parent item. With the stock conversion,
+ you can accurately track inventory when an item variation is sold in one unit, but stocked in
+ another unit.
+ """
+
+ kitchen_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ (Optional) Name that the restaurant wants to display to their kitchen workers
+ instead of the customer-facing name.
+ e.g., customer name might be "Mega-Jumbo Triplesized" and the
+ kitchen name is "Large container"
+ """
+
+ vendor_information: typing.Optional[typing.List[CatalogItemVariationVendorInformation]] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of the vendor this product is purchased from.
+ This field can be set only if the seller has an active subscription
+ to either Square for Retail Premium or Square for Restaurants Premium.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_item_variation_vendor_information.py b/src/square/types/catalog_item_variation_vendor_information.py
new file mode 100644
index 00000000..dda6d346
--- /dev/null
+++ b/src/square/types/catalog_item_variation_vendor_information.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class CatalogItemVariationVendorInformation(UncheckedBaseModel):
+ """
+ Information about the vendor of an item variation.
+ """
+
+ vendor_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the [Vendor](entity:Vendor) linked to a default cost of this product.
+ When the product is added to a purchase order, the default cost is pre-filled.
+ This field is not validated. Clients should gracefully handle cases where the vendor_id
+ does not match any existing vendor.
+ """
+
+ vendor_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique identifier of this product in the specified vendor's' inventory system.
+ When the product is added to a purchase order, the vendor code is pre-filled based
+ on the selected vendor.
+ """
+
+ unit_cost_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The unit cost of the linked product, when purchased from the linked vendor.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_measurement_unit.py b/src/square/types/catalog_measurement_unit.py
new file mode 100644
index 00000000..77cfe4a8
--- /dev/null
+++ b/src/square/types/catalog_measurement_unit.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .measurement_unit import MeasurementUnit
+
+
+class CatalogMeasurementUnit(UncheckedBaseModel):
+ """
+ Represents the unit used to measure a `CatalogItemVariation` and
+ specifies the precision for decimal quantities.
+ """
+
+ measurement_unit: typing.Optional[MeasurementUnit] = pydantic.Field(default=None)
+ """
+ Indicates the unit used to measure the quantity of a catalog item variation.
+ """
+
+ precision: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ An integer between 0 and 5 that represents the maximum number of
+ positions allowed after the decimal in quantities measured with this unit.
+ For example:
+
+ - if the precision is 0, the quantity can be 1, 2, 3, etc.
+ - if the precision is 1, the quantity can be 0.1, 0.2, etc.
+ - if the precision is 2, the quantity can be 0.01, 0.12, etc.
+
+ Default: 3
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_modifier.py b/src/square/types/catalog_modifier.py
new file mode 100644
index 00000000..03584ba2
--- /dev/null
+++ b/src/square/types/catalog_modifier.py
@@ -0,0 +1,74 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .modifier_location_overrides import ModifierLocationOverrides
+from .money import Money
+
+
+class CatalogModifier(UncheckedBaseModel):
+ """
+ A modifier that can be applied to items at the time of sale. For example, a cheese modifier for a burger, or a flavor modifier for a serving of ice cream.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The modifier name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
+ """
+
+ price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The modifier price.
+ """
+
+ on_by_default: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ When `true`, this modifier is selected by default when displaying the modifier list.
+ This setting can be overridden at the item level using `CatalogModifierListInfo.modifier_overrides`.
+ """
+
+ ordinal: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Determines where this `CatalogModifier` appears in the `CatalogModifierList`.
+ """
+
+ modifier_list_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the `CatalogModifierList` associated with this modifier.
+ """
+
+ location_overrides: typing.Optional[typing.List[ModifierLocationOverrides]] = pydantic.Field(default=None)
+ """
+ Location-specific price overrides.
+ """
+
+ kitchen_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ (Optional) Name that the restaurant wants to display to their kitchen workers
+ instead of the customer-facing name.
+ e.g., customer name might be "Double Baconize" and the
+ kitchen name is "Add 2x bacon"
+ """
+
+ image_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the image associated with this `CatalogModifier` instance.
+ Currently this image is not displayed by Square, but is free to be displayed in 3rd party applications.
+ """
+
+ hidden_online: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ When `true`, this modifier is hidden from online ordering channels. This setting can be overridden at the item level using `CatalogModifierListInfo.modifier_overrides`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_modifier_list.py b/src/square/types/catalog_modifier_list.py
new file mode 100644
index 00000000..2035f446
--- /dev/null
+++ b/src/square/types/catalog_modifier_list.py
@@ -0,0 +1,163 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_modifier_list_modifier_type import CatalogModifierListModifierType
+from .catalog_modifier_list_selection_type import CatalogModifierListSelectionType
+
+
+class CatalogModifierList(UncheckedBaseModel):
+ """
+ A container for a list of modifiers, or a text-based modifier.
+ For text-based modifiers, this represents text configuration for an item. (For example, custom text to print on a t-shirt).
+ For non text-based modifiers, this represents a list of modifiers that can be applied to items at the time of sale.
+ (For example, a list of condiments for a hot dog, or a list of ice cream flavors).
+ Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of
+ Unicode code points.
+ """
+
+ ordinal: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances.
+ """
+
+ selection_type: typing.Optional[CatalogModifierListSelectionType] = pydantic.Field(default=None)
+ """
+ __Deprecated__: Indicates whether a single (`SINGLE`) modifier or multiple (`MULTIPLE`) modifiers can be selected. Use
+ `min_selected_modifiers` and `max_selected_modifiers` instead.
+ See [CatalogModifierListSelectionType](#type-catalogmodifierlistselectiontype) for possible values
+ """
+
+ modifiers: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`,
+ for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list
+ is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes:
+ ```
+ {
+ "id": "{{catalog_modifier_id}}",
+ "type": "MODIFIER",
+ "modifier_data": {{a CatalogModifier instance>}}
+ }
+ ```
+ """
+
+ image_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of images associated with this `CatalogModifierList` instance.
+ Currently these images are not displayed on Square products, but may be displayed in 3rd-party applications.
+ """
+
+ allow_quantities: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ When `true`, allows multiple quantities of the same modifier to be selected.
+ """
+
+ is_conversational: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ True if modifiers belonging to this list can be used conversationally.
+ """
+
+ modifier_type: typing.Optional[CatalogModifierListModifierType] = pydantic.Field(default=None)
+ """
+ The type of the modifier.
+
+ When this `modifier_type` value is `TEXT`, the `CatalogModifierList` represents a text-based modifier.
+ When this `modifier_type` value is `LIST`, the `CatalogModifierList` contains a list of `CatalogModifier` objects.
+ See [CatalogModifierListModifierType](#type-catalogmodifierlistmodifiertype) for possible values
+ """
+
+ max_length: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum length, in Unicode points, of the text string of the text-based modifier as represented by
+ this `CatalogModifierList` object with the `modifier_type` set to `TEXT`.
+ """
+
+ text_required: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based modifier
+ as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`.
+ """
+
+ internal_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note for internal use by the business.
+
+ For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!"
+ is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as
+ an instruction for the business to follow.
+
+ For non text-based modifiers, this `internal_name` attribute can be
+ used to include SKUs, internal codes, or supplemental descriptions for internal use.
+ """
+
+ min_selected_modifiers: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The minimum number of modifiers that must be selected from this list. The value can be overridden with `CatalogItemModifierListInfo`.
+
+ Values:
+
+ - 0: No selection is required.
+ - -1: Default value, the attribute was not set by the client. Treated as no selection required.
+ - >0: The required minimum modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.
+ - < -1: Invalid. Treated as no selection required.
+ """
+
+ max_selected_modifiers: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The maximum number of modifiers that must be selected from this list. The value can be overridden with `CatalogItemModifierListInfo`.
+
+ Values:
+
+ - 0: No maximum limit.
+ - -1: Default value, the attribute was not set by the client. Treated as no maximum limit.
+ - >0: The maximum total modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.
+ - < -1: Invalid. Treated as no maximum limit.
+ """
+
+ hidden_from_customer: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If `true`, modifiers from this list are hidden from customer receipts. The default value is `false`.
+ This setting can be overridden with `CatalogItemModifierListInfo.hidden_from_customer_override`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ CatalogModifierList,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/catalog_modifier_list_modifier_type.py b/src/square/types/catalog_modifier_list_modifier_type.py
new file mode 100644
index 00000000..9077a76b
--- /dev/null
+++ b/src/square/types/catalog_modifier_list_modifier_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogModifierListModifierType = typing.Union[typing.Literal["LIST", "TEXT"], typing.Any]
diff --git a/src/square/types/catalog_modifier_list_selection_type.py b/src/square/types/catalog_modifier_list_selection_type.py
new file mode 100644
index 00000000..8dbafe7a
--- /dev/null
+++ b/src/square/types/catalog_modifier_list_selection_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogModifierListSelectionType = typing.Union[typing.Literal["SINGLE", "MULTIPLE"], typing.Any]
diff --git a/src/square/types/catalog_modifier_override.py b/src/square/types/catalog_modifier_override.py
new file mode 100644
index 00000000..141bb027
--- /dev/null
+++ b/src/square/types/catalog_modifier_override.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_modifier_toggle_override_type import CatalogModifierToggleOverrideType
+
+
+class CatalogModifierOverride(UncheckedBaseModel):
+ """
+ Options to control how to override the default behavior of the specified modifier.
+ """
+
+ modifier_id: str = pydantic.Field()
+ """
+ The ID of the `CatalogModifier` whose default behavior is being overridden.
+ """
+
+ on_by_default: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ __Deprecated__: Use `on_by_default_override` instead.
+ """
+
+ hidden_online_override: typing.Optional[CatalogModifierToggleOverrideType] = pydantic.Field(default=None)
+ """
+ If `YES`, this setting overrides the `hidden_online` setting on the `CatalogModifier` object,
+ and the modifier is always hidden from online sales channels.
+ If `NO`, the modifier is not hidden. It is always visible in online sales channels for this catalog item.
+ `NOT_SET` means the `hidden_online` setting on the `CatalogModifier` object is obeyed.
+ See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values
+ """
+
+ on_by_default_override: typing.Optional[CatalogModifierToggleOverrideType] = pydantic.Field(default=None)
+ """
+ If `YES`, this setting overrides the `on_by_default` setting on the `CatalogModifier` object,
+ and the modifier is always selected by default for the catalog item.
+
+ If `NO`, the modifier is not selected by default for this catalog item.
+ `NOT_SET` means the `on_by_default` setting on the `CatalogModifier` object is obeyed.
+ See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_modifier_toggle_override_type.py b/src/square/types/catalog_modifier_toggle_override_type.py
new file mode 100644
index 00000000..40497f28
--- /dev/null
+++ b/src/square/types/catalog_modifier_toggle_override_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogModifierToggleOverrideType = typing.Union[typing.Literal["NO", "YES", "NOT_SET"], typing.Any]
diff --git a/src/square/types/catalog_object.py b/src/square/types/catalog_object.py
new file mode 100644
index 00000000..8b0b0f30
--- /dev/null
+++ b/src/square/types/catalog_object.py
@@ -0,0 +1,888 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata
+from .catalog_availability_period import CatalogAvailabilityPeriod
+from .catalog_custom_attribute_definition import CatalogCustomAttributeDefinition
+from .catalog_custom_attribute_value import CatalogCustomAttributeValue
+from .catalog_discount import CatalogDiscount
+from .catalog_image import CatalogImage
+from .catalog_item_option_value import CatalogItemOptionValue
+from .catalog_item_variation import CatalogItemVariation
+from .catalog_measurement_unit import CatalogMeasurementUnit
+from .catalog_modifier import CatalogModifier
+from .catalog_pricing_rule import CatalogPricingRule
+from .catalog_product_set import CatalogProductSet
+from .catalog_quick_amounts_settings import CatalogQuickAmountsSettings
+from .catalog_subscription_plan_variation import CatalogSubscriptionPlanVariation
+from .catalog_tax import CatalogTax
+from .catalog_time_period import CatalogTimePeriod
+from .catalog_v1id import CatalogV1Id
+
+
+class CatalogObject_Item(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["ITEM"] = "ITEM"
+ item_data: typing.Optional["CatalogItem"] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_Image(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["IMAGE"] = "IMAGE"
+ image_data: typing.Optional[CatalogImage] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_Category(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["CATEGORY"] = "CATEGORY"
+ id: typing.Optional[str] = None
+ ordinal: typing.Optional[int] = None
+ category_data: typing.Optional["CatalogCategory"] = None
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_ItemVariation(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["ITEM_VARIATION"] = "ITEM_VARIATION"
+ item_variation_data: typing.Optional[CatalogItemVariation] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_Tax(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["TAX"] = "TAX"
+ tax_data: typing.Optional[CatalogTax] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_Discount(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["DISCOUNT"] = "DISCOUNT"
+ discount_data: typing.Optional[CatalogDiscount] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_ModifierList(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["MODIFIER_LIST"] = "MODIFIER_LIST"
+ modifier_list_data: typing.Optional["CatalogModifierList"] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_Modifier(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["MODIFIER"] = "MODIFIER"
+ modifier_data: typing.Optional[CatalogModifier] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_PricingRule(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["PRICING_RULE"] = "PRICING_RULE"
+ pricing_rule_data: typing.Optional[CatalogPricingRule] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_ProductSet(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["PRODUCT_SET"] = "PRODUCT_SET"
+ product_set_data: typing.Optional[CatalogProductSet] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_TimePeriod(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["TIME_PERIOD"] = "TIME_PERIOD"
+ time_period_data: typing.Optional[CatalogTimePeriod] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_MeasurementUnit(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["MEASUREMENT_UNIT"] = "MEASUREMENT_UNIT"
+ measurement_unit_data: typing.Optional[CatalogMeasurementUnit] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_SubscriptionPlanVariation(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["SUBSCRIPTION_PLAN_VARIATION"] = "SUBSCRIPTION_PLAN_VARIATION"
+ subscription_plan_variation_data: typing.Optional[CatalogSubscriptionPlanVariation] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_ItemOption(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["ITEM_OPTION"] = "ITEM_OPTION"
+ item_option_data: typing.Optional["CatalogItemOption"] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_ItemOptionVal(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["ITEM_OPTION_VAL"] = "ITEM_OPTION_VAL"
+ item_option_value_data: typing.Optional[CatalogItemOptionValue] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_CustomAttributeDefinition(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["CUSTOM_ATTRIBUTE_DEFINITION"] = "CUSTOM_ATTRIBUTE_DEFINITION"
+ custom_attribute_definition_data: typing.Optional[CatalogCustomAttributeDefinition] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_QuickAmountsSettings(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["QUICK_AMOUNTS_SETTINGS"] = "QUICK_AMOUNTS_SETTINGS"
+ quick_amounts_settings_data: typing.Optional[CatalogQuickAmountsSettings] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_SubscriptionPlan(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["SUBSCRIPTION_PLAN"] = "SUBSCRIPTION_PLAN"
+ subscription_plan_data: typing.Optional["CatalogSubscriptionPlan"] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class CatalogObject_AvailabilityPeriod(UncheckedBaseModel):
+ """
+ The wrapper object for the catalog entries of a given object type.
+
+ Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.
+
+ For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.
+
+ In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.
+
+ For a more detailed discussion of the Catalog data model, please see the
+ [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide.
+ """
+
+ type: typing.Literal["AVAILABILITY_PERIOD"] = "AVAILABILITY_PERIOD"
+ availability_period_data: typing.Optional[CatalogAvailabilityPeriod] = None
+ id: str
+ updated_at: typing.Optional[str] = None
+ version: typing.Optional[int] = None
+ is_deleted: typing.Optional[bool] = None
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(alias="catalog_v1_ids"),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = None
+ present_at_location_ids: typing.Optional[typing.List[str]] = None
+ absent_at_location_ids: typing.Optional[typing.List[str]] = None
+ image_id: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+CatalogObject = typing_extensions.Annotated[
+ typing.Union[
+ CatalogObject_Item,
+ CatalogObject_Image,
+ CatalogObject_Category,
+ CatalogObject_ItemVariation,
+ CatalogObject_Tax,
+ CatalogObject_Discount,
+ CatalogObject_ModifierList,
+ CatalogObject_Modifier,
+ CatalogObject_PricingRule,
+ CatalogObject_ProductSet,
+ CatalogObject_TimePeriod,
+ CatalogObject_MeasurementUnit,
+ CatalogObject_SubscriptionPlanVariation,
+ CatalogObject_ItemOption,
+ CatalogObject_ItemOptionVal,
+ CatalogObject_CustomAttributeDefinition,
+ CatalogObject_QuickAmountsSettings,
+ CatalogObject_SubscriptionPlan,
+ CatalogObject_AvailabilityPeriod,
+ ],
+ UnionMetadata(discriminant="type"),
+]
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+from .catalog_category import CatalogCategory # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+
+update_forward_refs(
+ CatalogObject_Item,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
+update_forward_refs(CatalogObject_Category, CatalogCategory=CatalogCategory)
+update_forward_refs(
+ CatalogObject_ModifierList,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
+update_forward_refs(
+ CatalogObject_ItemOption,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
+update_forward_refs(
+ CatalogObject_SubscriptionPlan,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/catalog_object_availability_period.py b/src/square/types/catalog_object_availability_period.py
new file mode 100644
index 00000000..85898055
--- /dev/null
+++ b/src/square/types/catalog_object_availability_period.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_availability_period import CatalogAvailabilityPeriod
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectAvailabilityPeriod(CatalogObjectBase):
+ availability_period_data: typing.Optional[CatalogAvailabilityPeriod] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogAvailabilityPeriod`, set for CatalogObjects of type `AVAILABILITY_PERIOD`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_base.py b/src/square/types/catalog_object_base.py
new file mode 100644
index 00000000..c1b1359c
--- /dev/null
+++ b/src/square/types/catalog_object_base.py
@@ -0,0 +1,105 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_custom_attribute_value import CatalogCustomAttributeValue
+from .catalog_v1id import CatalogV1Id
+
+
+class CatalogObjectBase(UncheckedBaseModel):
+ id: str = pydantic.Field()
+ """
+ An identifier to reference this object in the catalog. When a new `CatalogObject`
+ is inserted, the client should set the id to a temporary identifier starting with
+ a "`#`" character. Other objects being inserted or updated within the same request
+ may use this identifier to refer to the new object.
+
+ When the server receives the new object, it will supply a unique identifier that
+ replaces the temporary identifier for all future references.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"`
+ would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the object. When updating an object, the version supplied
+ must match the version in the database, otherwise the write will be rejected as conflicting.
+ """
+
+ is_deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If `true`, the object has been deleted from the database. Must be `false` for new objects
+ being inserted. When deleted, the `updated_at` field will equal the deletion time.
+ """
+
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field(
+ default=None
+ )
+ """
+ A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair
+ is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute
+ value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition)
+ object defined by the application making the request.
+
+ If the `CatalogCustomAttributeDefinition` object is
+ defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by
+ the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of
+ `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"`
+ if the application making the request is different from the application defining the custom attribute definition.
+ Otherwise, the key used in the map is simply `"cocoa_brand"`.
+
+ Application-defined custom attributes are set at a global (location-independent) level.
+ Custom attribute values are intended to store additional information about a catalog object
+ or associations with an entity in another system. Do not use custom attributes
+ to store any sensitive information (personally identifiable information, card details, etc.).
+ """
+
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(
+ alias="catalog_v1_ids",
+ description="The Connect v1 IDs for this object at each location where it is present, where they\ndiffer from the object's Connect V2 ID. The field will only be present for objects that\nhave been created or modified by legacy APIs.",
+ ),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If `true`, this object is present at all locations (including future locations), except where specified in
+ the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations),
+ except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`.
+ """
+
+ present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of locations where the object is present, even if `present_at_all_locations` is `false`.
+ This can include locations that are deactivated.
+ """
+
+ absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of locations where the object is not present, even if `present_at_all_locations` is `true`.
+ This can include locations that are deactivated.
+ """
+
+ image_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Identifies the `CatalogImage` attached to this `CatalogObject`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_batch.py b/src/square/types/catalog_object_batch.py
new file mode 100644
index 00000000..6f6115bd
--- /dev/null
+++ b/src/square/types/catalog_object_batch.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogObjectBatch(UncheckedBaseModel):
+ """
+ A batch of catalog objects.
+ """
+
+ objects: typing.List["CatalogObject"] = pydantic.Field()
+ """
+ A list of CatalogObjects belonging to this batch.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ CatalogObjectBatch,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/catalog_object_category.py b/src/square/types/catalog_object_category.py
new file mode 100644
index 00000000..555f81c4
--- /dev/null
+++ b/src/square/types/catalog_object_category.py
@@ -0,0 +1,125 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_custom_attribute_value import CatalogCustomAttributeValue
+from .catalog_v1id import CatalogV1Id
+
+
+class CatalogObjectCategory(UncheckedBaseModel):
+ """
+ A category that can be assigned to an item or a parent category that can be assigned
+ to another category. For example, a clothing category can be assigned to a t-shirt item or
+ be made as the parent category to the pants category.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the object's category.
+ """
+
+ ordinal: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The position of this object within the specified category. When an item is assigned to a category,
+ the ordinal determines the item's position relative to other items in the same category. When used for a
+ parent category reference, the ordinal determines the category's position among its sibling categories.
+ """
+
+ type: typing.Optional[typing.Literal["CATEGORY"]] = None
+ category_data: typing.Optional["CatalogCategory"] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogCategory`, set for CatalogObjects of type `CATEGORY`.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"`
+ would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the object. When updating an object, the version supplied
+ must match the version in the database, otherwise the write will be rejected as conflicting.
+ """
+
+ is_deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If `true`, the object has been deleted from the database. Must be `false` for new objects
+ being inserted. When deleted, the `updated_at` field will equal the deletion time.
+ """
+
+ custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field(
+ default=None
+ )
+ """
+ A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair
+ is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute
+ value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition)
+ object defined by the application making the request.
+
+ If the `CatalogCustomAttributeDefinition` object is
+ defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by
+ the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of
+ `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"`
+ if the application making the request is different from the application defining the custom attribute definition.
+ Otherwise, the key used in the map is simply `"cocoa_brand"`.
+
+ Application-defined custom attributes are set at a global (location-independent) level.
+ Custom attribute values are intended to store additional information about a catalog object
+ or associations with an entity in another system. Do not use custom attributes
+ to store any sensitive information (personally identifiable information, card details, etc.).
+ """
+
+ catalog_v1ids: typing_extensions.Annotated[
+ typing.Optional[typing.List[CatalogV1Id]],
+ FieldMetadata(alias="catalog_v1_ids"),
+ pydantic.Field(
+ alias="catalog_v1_ids",
+ description="The Connect v1 IDs for this object at each location where it is present, where they\ndiffer from the object's Connect V2 ID. The field will only be present for objects that\nhave been created or modified by legacy APIs.",
+ ),
+ ] = None
+ present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If `true`, this object is present at all locations (including future locations), except where specified in
+ the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations),
+ except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`.
+ """
+
+ present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of locations where the object is present, even if `present_at_all_locations` is `false`.
+ This can include locations that are deactivated.
+ """
+
+ absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of locations where the object is not present, even if `present_at_all_locations` is `true`.
+ This can include locations that are deactivated.
+ """
+
+ image_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Identifies the `CatalogImage` attached to this `CatalogObject`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_category import CatalogCategory # noqa: E402, I001
+
+update_forward_refs(CatalogObjectCategory, CatalogCategory=CatalogCategory)
diff --git a/src/square/types/catalog_object_custom_attribute_definition.py b/src/square/types/catalog_object_custom_attribute_definition.py
new file mode 100644
index 00000000..d463ec0f
--- /dev/null
+++ b/src/square/types/catalog_object_custom_attribute_definition.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_custom_attribute_definition import CatalogCustomAttributeDefinition
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectCustomAttributeDefinition(CatalogObjectBase):
+ custom_attribute_definition_data: typing.Optional[CatalogCustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogCustomAttributeDefinition`, set for CatalogObjects of type `CUSTOM_ATTRIBUTE_DEFINITION`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_discount.py b/src/square/types/catalog_object_discount.py
new file mode 100644
index 00000000..d8db6a50
--- /dev/null
+++ b/src/square/types/catalog_object_discount.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_discount import CatalogDiscount
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectDiscount(CatalogObjectBase):
+ discount_data: typing.Optional[CatalogDiscount] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogDiscount`, set for CatalogObjects of type `DISCOUNT`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_image.py b/src/square/types/catalog_object_image.py
new file mode 100644
index 00000000..5e3977c8
--- /dev/null
+++ b/src/square/types/catalog_object_image.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_image import CatalogImage
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectImage(CatalogObjectBase):
+ image_data: typing.Optional[CatalogImage] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogImage`, set for CatalogObjects of type `IMAGE`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_item.py b/src/square/types/catalog_object_item.py
new file mode 100644
index 00000000..5e21a229
--- /dev/null
+++ b/src/square/types/catalog_object_item.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectItem(CatalogObjectBase):
+ item_data: typing.Optional["CatalogItem"] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogItem`, set for CatalogObjects of type `ITEM`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ CatalogObjectItem,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/catalog_object_item_option.py b/src/square/types/catalog_object_item_option.py
new file mode 100644
index 00000000..558cd34f
--- /dev/null
+++ b/src/square/types/catalog_object_item_option.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectItemOption(CatalogObjectBase):
+ item_option_data: typing.Optional["CatalogItemOption"] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogItemOption`, set for CatalogObjects of type `ITEM_OPTION`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ CatalogObjectItemOption,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/catalog_object_item_option_value.py b/src/square/types/catalog_object_item_option_value.py
new file mode 100644
index 00000000..7c0a4e27
--- /dev/null
+++ b/src/square/types/catalog_object_item_option_value.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_item_option_value import CatalogItemOptionValue
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectItemOptionValue(CatalogObjectBase):
+ item_option_value_data: typing.Optional[CatalogItemOptionValue] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogItemOptionValue`, set for CatalogObjects of type `ITEM_OPTION_VAL`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_item_variation.py b/src/square/types/catalog_object_item_variation.py
new file mode 100644
index 00000000..ab881326
--- /dev/null
+++ b/src/square/types/catalog_object_item_variation.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_item_variation import CatalogItemVariation
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectItemVariation(CatalogObjectBase):
+ item_variation_data: typing.Optional[CatalogItemVariation] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogItemVariation`, set for CatalogObjects of type `ITEM_VARIATION`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_measurement_unit.py b/src/square/types/catalog_object_measurement_unit.py
new file mode 100644
index 00000000..016db932
--- /dev/null
+++ b/src/square/types/catalog_object_measurement_unit.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_measurement_unit import CatalogMeasurementUnit
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectMeasurementUnit(CatalogObjectBase):
+ measurement_unit_data: typing.Optional[CatalogMeasurementUnit] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogMeasurementUnit`, set for CatalogObjects of type `MEASUREMENT_UNIT`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_modifier.py b/src/square/types/catalog_object_modifier.py
new file mode 100644
index 00000000..af659ddd
--- /dev/null
+++ b/src/square/types/catalog_object_modifier.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_modifier import CatalogModifier
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectModifier(CatalogObjectBase):
+ modifier_data: typing.Optional[CatalogModifier] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogModifier`, set for CatalogObjects of type `MODIFIER`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_modifier_list.py b/src/square/types/catalog_object_modifier_list.py
new file mode 100644
index 00000000..5f3a8516
--- /dev/null
+++ b/src/square/types/catalog_object_modifier_list.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectModifierList(CatalogObjectBase):
+ modifier_list_data: typing.Optional["CatalogModifierList"] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogModifierList`, set for CatalogObjects of type `MODIFIER_LIST`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ CatalogObjectModifierList,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/catalog_object_pricing_rule.py b/src/square/types/catalog_object_pricing_rule.py
new file mode 100644
index 00000000..43024e81
--- /dev/null
+++ b/src/square/types/catalog_object_pricing_rule.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_object_base import CatalogObjectBase
+from .catalog_pricing_rule import CatalogPricingRule
+
+
+class CatalogObjectPricingRule(CatalogObjectBase):
+ pricing_rule_data: typing.Optional[CatalogPricingRule] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogPricingRule`, set for CatalogObjects of type `PRICING_RULE`.
+ A `CatalogPricingRule` object often works with a `CatalogProductSet` object or a `CatalogTimePeriod` object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_product_set.py b/src/square/types/catalog_object_product_set.py
new file mode 100644
index 00000000..73833eb3
--- /dev/null
+++ b/src/square/types/catalog_object_product_set.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_object_base import CatalogObjectBase
+from .catalog_product_set import CatalogProductSet
+
+
+class CatalogObjectProductSet(CatalogObjectBase):
+ product_set_data: typing.Optional[CatalogProductSet] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogProductSet`, set for CatalogObjects of type `PRODUCT_SET`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_quick_amounts_settings.py b/src/square/types/catalog_object_quick_amounts_settings.py
new file mode 100644
index 00000000..7c923140
--- /dev/null
+++ b/src/square/types/catalog_object_quick_amounts_settings.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_object_base import CatalogObjectBase
+from .catalog_quick_amounts_settings import CatalogQuickAmountsSettings
+
+
+class CatalogObjectQuickAmountsSettings(CatalogObjectBase):
+ quick_amounts_settings_data: typing.Optional[CatalogQuickAmountsSettings] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogQuickAmountsSettings`, set for CatalogObjects of type `QUICK_AMOUNTS_SETTINGS`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_reference.py b/src/square/types/catalog_object_reference.py
new file mode 100644
index 00000000..306c8d91
--- /dev/null
+++ b/src/square/types/catalog_object_reference.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogObjectReference(UncheckedBaseModel):
+ """
+ A reference to a Catalog object at a specific version. In general this is
+ used as an entry point into a graph of catalog objects, where the objects exist
+ at a specific version.
+ """
+
+ object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the referenced object.
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_subscription_plan.py b/src/square/types/catalog_object_subscription_plan.py
new file mode 100644
index 00000000..f97ec8fc
--- /dev/null
+++ b/src/square/types/catalog_object_subscription_plan.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from .catalog_object_base import CatalogObjectBase
+
+
+class CatalogObjectSubscriptionPlan(CatalogObjectBase):
+ subscription_plan_data: typing.Optional["CatalogSubscriptionPlan"] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogSubscriptionPlan`, set for CatalogObjects of type `SUBSCRIPTION_PLAN`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ CatalogObjectSubscriptionPlan,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/catalog_object_subscription_plan_variation.py b/src/square/types/catalog_object_subscription_plan_variation.py
new file mode 100644
index 00000000..0911f231
--- /dev/null
+++ b/src/square/types/catalog_object_subscription_plan_variation.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_object_base import CatalogObjectBase
+from .catalog_subscription_plan_variation import CatalogSubscriptionPlanVariation
+
+
+class CatalogObjectSubscriptionPlanVariation(CatalogObjectBase):
+ subscription_plan_variation_data: typing.Optional[CatalogSubscriptionPlanVariation] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogSubscriptionPlanVariation`, set for CatalogObjects of type `SUBSCRIPTION_PLAN_VARIATION`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_tax.py b/src/square/types/catalog_object_tax.py
new file mode 100644
index 00000000..82d6fe8d
--- /dev/null
+++ b/src/square/types/catalog_object_tax.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_object_base import CatalogObjectBase
+from .catalog_tax import CatalogTax
+
+
+class CatalogObjectTax(CatalogObjectBase):
+ tax_data: typing.Optional[CatalogTax] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogTax`, set for CatalogObjects of type `TAX`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_time_period.py b/src/square/types/catalog_object_time_period.py
new file mode 100644
index 00000000..11e0a809
--- /dev/null
+++ b/src/square/types/catalog_object_time_period.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from .catalog_object_base import CatalogObjectBase
+from .catalog_time_period import CatalogTimePeriod
+
+
+class CatalogObjectTimePeriod(CatalogObjectBase):
+ time_period_data: typing.Optional[CatalogTimePeriod] = pydantic.Field(default=None)
+ """
+ Structured data for a `CatalogTimePeriod`, set for CatalogObjects of type `TIME_PERIOD`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_object_type.py b/src/square/types/catalog_object_type.py
new file mode 100644
index 00000000..0aa97f65
--- /dev/null
+++ b/src/square/types/catalog_object_type.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogObjectType = typing.Union[
+ typing.Literal[
+ "ITEM",
+ "IMAGE",
+ "CATEGORY",
+ "ITEM_VARIATION",
+ "TAX",
+ "DISCOUNT",
+ "MODIFIER_LIST",
+ "MODIFIER",
+ "PRICING_RULE",
+ "PRODUCT_SET",
+ "TIME_PERIOD",
+ "MEASUREMENT_UNIT",
+ "SUBSCRIPTION_PLAN_VARIATION",
+ "ITEM_OPTION",
+ "ITEM_OPTION_VAL",
+ "CUSTOM_ATTRIBUTE_DEFINITION",
+ "QUICK_AMOUNTS_SETTINGS",
+ "SUBSCRIPTION_PLAN",
+ "AVAILABILITY_PERIOD",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/catalog_pricing_rule.py b/src/square/types/catalog_pricing_rule.py
new file mode 100644
index 00000000..34d67f22
--- /dev/null
+++ b/src/square/types/catalog_pricing_rule.py
@@ -0,0 +1,118 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .exclude_strategy import ExcludeStrategy
+from .money import Money
+
+
+class CatalogPricingRule(UncheckedBaseModel):
+ """
+ Defines how discounts are automatically applied to a set of items that match the pricing rule
+ during the active time period.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ User-defined name for the pricing rule. For example, "Buy one get one
+ free" or "10% off".
+ """
+
+ time_period_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of unique IDs for the catalog time periods when
+ this pricing rule is in effect. If left unset, the pricing rule is always
+ in effect.
+ """
+
+ discount_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique ID for the `CatalogDiscount` to take off
+ the price of all matched items.
+ """
+
+ match_products_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique ID for the `CatalogProductSet` that will be matched by this rule. A match rule
+ matches within the entire cart, and can match multiple times. This field will always be set.
+ """
+
+ apply_products_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ __Deprecated__: Please use the `exclude_products_id` field to apply
+ an exclude set instead. Exclude sets allow better control over quantity
+ ranges and offer more flexibility for which matched items receive a discount.
+
+ `CatalogProductSet` to apply the pricing to.
+ An apply rule matches within the subset of the cart that fits the match rules (the match set).
+ An apply rule can only match once in the match set.
+ If not supplied, the pricing will be applied to all products in the match set.
+ Other products retain their base price, or a price generated by other rules.
+ """
+
+ exclude_products_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ `CatalogProductSet` to exclude from the pricing rule.
+ An exclude rule matches within the subset of the cart that fits the match rules (the match set).
+ An exclude rule can only match once in the match set.
+ If not supplied, the pricing will be applied to all products in the match set.
+ Other products retain their base price, or a price generated by other rules.
+ """
+
+ valid_from_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Represents the date the Pricing Rule is valid from. Represented in RFC 3339 full-date format (YYYY-MM-DD).
+ """
+
+ valid_from_local_time: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Represents the local time the pricing rule should be valid from. Represented in RFC 3339 partial-time format
+ (HH:MM:SS). Partial seconds will be truncated.
+ """
+
+ valid_until_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Represents the date the Pricing Rule is valid until. Represented in RFC 3339 full-date format (YYYY-MM-DD).
+ """
+
+ valid_until_local_time: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Represents the local time the pricing rule should be valid until. Represented in RFC 3339 partial-time format
+ (HH:MM:SS). Partial seconds will be truncated.
+ """
+
+ exclude_strategy: typing.Optional[ExcludeStrategy] = pydantic.Field(default=None)
+ """
+ If an `exclude_products_id` was given, controls which subset of matched
+ products is excluded from any discounts.
+
+ Default value: `LEAST_EXPENSIVE`
+ See [ExcludeStrategy](#type-excludestrategy) for possible values
+ """
+
+ minimum_order_subtotal_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The minimum order subtotal (before discounts or taxes are applied)
+ that must be met before this rule may be applied.
+ """
+
+ customer_group_ids_any: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of IDs of customer groups, the members of which are eligible for discounts specified in this pricing rule.
+ Notice that a group ID is generated by the Customers API.
+ If this field is not set, the specified discount applies to matched products sold to anyone whether the buyer
+ has a customer profile created or not. If this `customer_group_ids_any` field is set, the specified discount
+ applies only to matched products sold to customers belonging to the specified customer groups.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_pricing_type.py b/src/square/types/catalog_pricing_type.py
new file mode 100644
index 00000000..e81b7c9e
--- /dev/null
+++ b/src/square/types/catalog_pricing_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogPricingType = typing.Union[typing.Literal["FIXED_PRICING", "VARIABLE_PRICING"], typing.Any]
diff --git a/src/square/types/catalog_product_set.py b/src/square/types/catalog_product_set.py
new file mode 100644
index 00000000..3ebd03f3
--- /dev/null
+++ b/src/square/types/catalog_product_set.py
@@ -0,0 +1,83 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogProductSet(UncheckedBaseModel):
+ """
+ Represents a collection of catalog objects for the purpose of applying a
+ `PricingRule`. Including a catalog object will include all of its subtypes.
+ For example, including a category in a product set will include all of its
+ items and associated item variations in the product set. Including an item in
+ a product set will also include its item variations.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ User-defined name for the product set. For example, "Clearance Items"
+ or "Winter Sale Items".
+ """
+
+ product_ids_any: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Unique IDs for any `CatalogObject` included in this product set. Any
+ number of these catalog objects can be in an order for a pricing rule to apply.
+
+ This can be used with `product_ids_all` in a parent `CatalogProductSet` to
+ match groups of products for a bulk discount, such as a discount for an
+ entree and side combo.
+
+ Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set.
+
+ Max: 5000 catalog object IDs.
+ """
+
+ product_ids_all: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Unique IDs for any `CatalogObject` included in this product set.
+ All objects in this set must be included in an order for a pricing rule to apply.
+
+ Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set.
+
+ Max: 5000 catalog object IDs.
+ """
+
+ quantity_exact: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ If set, there must be exactly this many items from `products_any` or `products_all`
+ in the cart for the discount to apply.
+
+ Cannot be combined with either `quantity_min` or `quantity_max`.
+ """
+
+ quantity_min: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ If set, there must be at least this many items from `products_any` or `products_all`
+ in a cart for the discount to apply. See `quantity_exact`. Defaults to 0 if
+ `quantity_exact`, `quantity_min` and `quantity_max` are all unspecified.
+ """
+
+ quantity_max: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ If set, the pricing rule will apply to a maximum of this many items from
+ `products_any` or `products_all`.
+ """
+
+ all_products: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If set to `true`, the product set will include every item in the catalog.
+ Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query.py b/src/square/types/catalog_query.py
new file mode 100644
index 00000000..e7c8056e
--- /dev/null
+++ b/src/square/types/catalog_query.py
@@ -0,0 +1,118 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_query_exact import CatalogQueryExact
+from .catalog_query_item_variations_for_item_option_values import CatalogQueryItemVariationsForItemOptionValues
+from .catalog_query_items_for_item_options import CatalogQueryItemsForItemOptions
+from .catalog_query_items_for_modifier_list import CatalogQueryItemsForModifierList
+from .catalog_query_items_for_tax import CatalogQueryItemsForTax
+from .catalog_query_prefix import CatalogQueryPrefix
+from .catalog_query_range import CatalogQueryRange
+from .catalog_query_set import CatalogQuerySet
+from .catalog_query_sorted_attribute import CatalogQuerySortedAttribute
+from .catalog_query_text import CatalogQueryText
+
+
+class CatalogQuery(UncheckedBaseModel):
+ """
+ A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint.
+
+ Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
+ Any combination of the following types may be used together:
+ - [exact_query](entity:CatalogQueryExact)
+ - [prefix_query](entity:CatalogQueryPrefix)
+ - [range_query](entity:CatalogQueryRange)
+ - [sorted_attribute_query](entity:CatalogQuerySortedAttribute)
+ - [text_query](entity:CatalogQueryText)
+
+ All other query types cannot be combined with any others.
+
+ When a query filter is based on an attribute, the attribute must be searchable.
+ Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters.
+
+ Searchable attribute and objects queryable by searchable attributes:
+ - `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`, `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue`
+ - `description`: `CatalogItem`, `CatalogItemOptionValue`
+ - `abbreviation`: `CatalogItem`
+ - `upc`: `CatalogItemVariation`
+ - `sku`: `CatalogItemVariation`
+ - `caption`: `CatalogImage`
+ - `display_name`: `CatalogItemOption`
+
+ For example, to search for [CatalogItem](entity:CatalogItem) objects by searchable attributes, you can use
+ the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter.
+ """
+
+ sorted_attribute_query: typing.Optional[CatalogQuerySortedAttribute] = pydantic.Field(default=None)
+ """
+ A query expression to sort returned query result by the given attribute.
+ """
+
+ exact_query: typing.Optional[CatalogQueryExact] = pydantic.Field(default=None)
+ """
+ An exact query expression to return objects with attribute name and value
+ matching the specified attribute name and value exactly. Value matching is case insensitive.
+ """
+
+ set_query: typing.Optional[CatalogQuerySet] = pydantic.Field(default=None)
+ """
+ A set query expression to return objects with attribute name and value
+ matching the specified attribute name and any of the specified attribute values exactly.
+ Value matching is case insensitive.
+ """
+
+ prefix_query: typing.Optional[CatalogQueryPrefix] = pydantic.Field(default=None)
+ """
+ A prefix query expression to return objects with attribute values
+ that have a prefix matching the specified string value. Value matching is case insensitive.
+ """
+
+ range_query: typing.Optional[CatalogQueryRange] = pydantic.Field(default=None)
+ """
+ A range query expression to return objects with numeric values
+ that lie in the specified range.
+ """
+
+ text_query: typing.Optional[CatalogQueryText] = pydantic.Field(default=None)
+ """
+ A text query expression to return objects whose searchable attributes contain all of the given
+ keywords, irrespective of their order. For example, if a `CatalogItem` contains custom attribute values of
+ `{"name": "t-shirt"}` and `{"description": "Small, Purple"}`, the query filter of `{"keywords": ["shirt", "sma", "purp"]}`
+ returns this item.
+ """
+
+ items_for_tax_query: typing.Optional[CatalogQueryItemsForTax] = pydantic.Field(default=None)
+ """
+ A query expression to return items that have any of the specified taxes (as identified by the corresponding `CatalogTax` object IDs) enabled.
+ """
+
+ items_for_modifier_list_query: typing.Optional[CatalogQueryItemsForModifierList] = pydantic.Field(default=None)
+ """
+ A query expression to return items that have any of the given modifier list (as identified by the corresponding `CatalogModifierList`s IDs) enabled.
+ """
+
+ items_for_item_options_query: typing.Optional[CatalogQueryItemsForItemOptions] = pydantic.Field(default=None)
+ """
+ A query expression to return items that contains the specified item options (as identified the corresponding `CatalogItemOption` IDs).
+ """
+
+ item_variations_for_item_option_values_query: typing.Optional[CatalogQueryItemVariationsForItemOptionValues] = (
+ pydantic.Field(default=None)
+ )
+ """
+ A query expression to return item variations (of the [CatalogItemVariation](entity:CatalogItemVariation) type) that
+ contain all of the specified `CatalogItemOption` IDs.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query_exact.py b/src/square/types/catalog_query_exact.py
new file mode 100644
index 00000000..65e5c018
--- /dev/null
+++ b/src/square/types/catalog_query_exact.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogQueryExact(UncheckedBaseModel):
+ """
+ The query filter to return the search result by exact match of the specified attribute name and value.
+ """
+
+ attribute_name: str = pydantic.Field()
+ """
+ The name of the attribute to be searched. Matching of the attribute name is exact.
+ """
+
+ attribute_value: str = pydantic.Field()
+ """
+ The desired value of the search attribute. Matching of the attribute value is case insensitive and can be partial.
+ For example, if a specified value of "sma", objects with the named attribute value of "Small", "small" are both matched.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query_item_variations_for_item_option_values.py b/src/square/types/catalog_query_item_variations_for_item_option_values.py
new file mode 100644
index 00000000..64a6c4c6
--- /dev/null
+++ b/src/square/types/catalog_query_item_variations_for_item_option_values.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogQueryItemVariationsForItemOptionValues(UncheckedBaseModel):
+ """
+ The query filter to return the item variations containing the specified item option value IDs.
+ """
+
+ item_option_value_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A set of `CatalogItemOptionValue` IDs to be used to find associated
+ `CatalogItemVariation`s. All ItemVariations that contain all of the given
+ Item Option Values (in any order) will be returned.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query_items_for_item_options.py b/src/square/types/catalog_query_items_for_item_options.py
new file mode 100644
index 00000000..8d91fb60
--- /dev/null
+++ b/src/square/types/catalog_query_items_for_item_options.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogQueryItemsForItemOptions(UncheckedBaseModel):
+ """
+ The query filter to return the items containing the specified item option IDs.
+ """
+
+ item_option_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A set of `CatalogItemOption` IDs to be used to find associated
+ `CatalogItem`s. All Items that contain all of the given Item Options (in any order)
+ will be returned.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query_items_for_modifier_list.py b/src/square/types/catalog_query_items_for_modifier_list.py
new file mode 100644
index 00000000..316b120a
--- /dev/null
+++ b/src/square/types/catalog_query_items_for_modifier_list.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogQueryItemsForModifierList(UncheckedBaseModel):
+ """
+ The query filter to return the items containing the specified modifier list IDs.
+ """
+
+ modifier_list_ids: typing.List[str] = pydantic.Field()
+ """
+ A set of `CatalogModifierList` IDs to be used to find associated `CatalogItem`s.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query_items_for_tax.py b/src/square/types/catalog_query_items_for_tax.py
new file mode 100644
index 00000000..f11732a7
--- /dev/null
+++ b/src/square/types/catalog_query_items_for_tax.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogQueryItemsForTax(UncheckedBaseModel):
+ """
+ The query filter to return the items containing the specified tax IDs.
+ """
+
+ tax_ids: typing.List[str] = pydantic.Field()
+ """
+ A set of `CatalogTax` IDs to be used to find associated `CatalogItem`s.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query_prefix.py b/src/square/types/catalog_query_prefix.py
new file mode 100644
index 00000000..e899f8be
--- /dev/null
+++ b/src/square/types/catalog_query_prefix.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogQueryPrefix(UncheckedBaseModel):
+ """
+ The query filter to return the search result whose named attribute values are prefixed by the specified attribute value.
+ """
+
+ attribute_name: str = pydantic.Field()
+ """
+ The name of the attribute to be searched.
+ """
+
+ attribute_prefix: str = pydantic.Field()
+ """
+ The desired prefix of the search attribute value.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query_range.py b/src/square/types/catalog_query_range.py
new file mode 100644
index 00000000..ff28a911
--- /dev/null
+++ b/src/square/types/catalog_query_range.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogQueryRange(UncheckedBaseModel):
+ """
+ The query filter to return the search result whose named attribute values fall between the specified range.
+ """
+
+ attribute_name: str = pydantic.Field()
+ """
+ The name of the attribute to be searched.
+ """
+
+ attribute_min_value: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The desired minimum value for the search attribute (inclusive).
+ """
+
+ attribute_max_value: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The desired maximum value for the search attribute (inclusive).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query_set.py b/src/square/types/catalog_query_set.py
new file mode 100644
index 00000000..cfaa0400
--- /dev/null
+++ b/src/square/types/catalog_query_set.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogQuerySet(UncheckedBaseModel):
+ """
+ The query filter to return the search result(s) by exact match of the specified `attribute_name` and any of
+ the `attribute_values`.
+ """
+
+ attribute_name: str = pydantic.Field()
+ """
+ The name of the attribute to be searched. Matching of the attribute name is exact.
+ """
+
+ attribute_values: typing.List[str] = pydantic.Field()
+ """
+ The desired values of the search attribute. Matching of the attribute values is exact and case insensitive.
+ A maximum of 250 values may be searched in a request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query_sorted_attribute.py b/src/square/types/catalog_query_sorted_attribute.py
new file mode 100644
index 00000000..e0ce6246
--- /dev/null
+++ b/src/square/types/catalog_query_sorted_attribute.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .sort_order import SortOrder
+
+
+class CatalogQuerySortedAttribute(UncheckedBaseModel):
+ """
+ The query expression to specify the key to sort search results.
+ """
+
+ attribute_name: str = pydantic.Field()
+ """
+ The attribute whose value is used as the sort key.
+ """
+
+ initial_attribute_value: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The first attribute value to be returned by the query. Ascending sorts will return only
+ objects with this value or greater, while descending sorts will return only objects with this value
+ or less. If unset, start at the beginning (for ascending sorts) or end (for descending sorts).
+ """
+
+ sort_order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The desired sort order, `"ASC"` (ascending) or `"DESC"` (descending).
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_query_text.py b/src/square/types/catalog_query_text.py
new file mode 100644
index 00000000..c985a3f8
--- /dev/null
+++ b/src/square/types/catalog_query_text.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogQueryText(UncheckedBaseModel):
+ """
+ The query filter to return the search result whose searchable attribute values contain all of the specified keywords or tokens, independent of the token order or case.
+ """
+
+ keywords: typing.List[str] = pydantic.Field()
+ """
+ A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 alphanumeric characters are ignored.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_quick_amount.py b/src/square/types/catalog_quick_amount.py
new file mode 100644
index 00000000..34844197
--- /dev/null
+++ b/src/square/types/catalog_quick_amount.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_quick_amount_type import CatalogQuickAmountType
+from .money import Money
+
+
+class CatalogQuickAmount(UncheckedBaseModel):
+ """
+ Represents a Quick Amount in the Catalog.
+ """
+
+ type: CatalogQuickAmountType = pydantic.Field()
+ """
+ Represents the type of the Quick Amount.
+ See [CatalogQuickAmountType](#type-catalogquickamounttype) for possible values
+ """
+
+ amount: Money = pydantic.Field()
+ """
+ Represents the actual amount of the Quick Amount with Money type.
+ """
+
+ score: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Describes the ranking of the Quick Amount provided by machine learning model, in the range [0, 100].
+ MANUAL type amount will always have score = 100.
+ """
+
+ ordinal: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The order in which this Quick Amount should be displayed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_quick_amount_type.py b/src/square/types/catalog_quick_amount_type.py
new file mode 100644
index 00000000..81f85db2
--- /dev/null
+++ b/src/square/types/catalog_quick_amount_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogQuickAmountType = typing.Union[typing.Literal["QUICK_AMOUNT_TYPE_MANUAL", "QUICK_AMOUNT_TYPE_AUTO"], typing.Any]
diff --git a/src/square/types/catalog_quick_amounts_settings.py b/src/square/types/catalog_quick_amounts_settings.py
new file mode 100644
index 00000000..4fb7af27
--- /dev/null
+++ b/src/square/types/catalog_quick_amounts_settings.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_quick_amount import CatalogQuickAmount
+from .catalog_quick_amounts_settings_option import CatalogQuickAmountsSettingsOption
+
+
+class CatalogQuickAmountsSettings(UncheckedBaseModel):
+ """
+ A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts.
+ """
+
+ option: CatalogQuickAmountsSettingsOption = pydantic.Field()
+ """
+ Represents the option seller currently uses on Quick Amounts.
+ See [CatalogQuickAmountsSettingsOption](#type-catalogquickamountssettingsoption) for possible values
+ """
+
+ eligible_for_auto_amounts: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Represents location's eligibility for auto amounts
+ The boolean should be consistent with whether there are AUTO amounts in the `amounts`.
+ """
+
+ amounts: typing.Optional[typing.List[CatalogQuickAmount]] = pydantic.Field(default=None)
+ """
+ Represents a set of Quick Amounts at this location.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_quick_amounts_settings_option.py b/src/square/types/catalog_quick_amounts_settings_option.py
new file mode 100644
index 00000000..4228b002
--- /dev/null
+++ b/src/square/types/catalog_quick_amounts_settings_option.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CatalogQuickAmountsSettingsOption = typing.Union[typing.Literal["DISABLED", "MANUAL", "AUTO"], typing.Any]
diff --git a/src/square/types/catalog_stock_conversion.py b/src/square/types/catalog_stock_conversion.py
new file mode 100644
index 00000000..830af230
--- /dev/null
+++ b/src/square/types/catalog_stock_conversion.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogStockConversion(UncheckedBaseModel):
+ """
+ Represents the rule of conversion between a stockable [CatalogItemVariation](entity:CatalogItemVariation)
+ and a non-stockable sell-by or receive-by `CatalogItemVariation` that
+ share the same underlying stock.
+ """
+
+ stockable_item_variation_id: str = pydantic.Field()
+ """
+ References to the stockable [CatalogItemVariation](entity:CatalogItemVariation)
+ for this stock conversion. Selling, receiving or recounting the non-stockable `CatalogItemVariation`
+ defined with a stock conversion results in adjustments of this stockable `CatalogItemVariation`.
+ This immutable field must reference a stockable `CatalogItemVariation`
+ that shares the parent [CatalogItem](entity:CatalogItem) of the converted `CatalogItemVariation.`
+ """
+
+ stockable_quantity: str = pydantic.Field()
+ """
+ The quantity of the stockable item variation (as identified by `stockable_item_variation_id`)
+ equivalent to the non-stockable item variation quantity (as specified in `nonstockable_quantity`)
+ as defined by this stock conversion. It accepts a decimal number in a string format that can take
+ up to 10 digits before the decimal point and up to 5 digits after the decimal point.
+ """
+
+ nonstockable_quantity: str = pydantic.Field()
+ """
+ The converted equivalent quantity of the non-stockable [CatalogItemVariation](entity:CatalogItemVariation)
+ in its measurement unit. The `stockable_quantity` value and this `nonstockable_quantity` value together
+ define the conversion ratio between stockable item variation and the non-stockable item variation.
+ It accepts a decimal number in a string format that can take up to 10 digits before the decimal point
+ and up to 5 digits after the decimal point.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_subscription_plan.py b/src/square/types/catalog_subscription_plan.py
new file mode 100644
index 00000000..7815c7ba
--- /dev/null
+++ b/src/square/types/catalog_subscription_plan.py
@@ -0,0 +1,79 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .subscription_phase import SubscriptionPhase
+
+
+class CatalogSubscriptionPlan(UncheckedBaseModel):
+ """
+ Describes a subscription plan. A subscription plan represents what you want to sell in a subscription model, and includes references to each of the associated subscription plan variations.
+ For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations).
+ """
+
+ name: str = pydantic.Field()
+ """
+ The name of the plan.
+ """
+
+ phases: typing.Optional[typing.List[SubscriptionPhase]] = pydantic.Field(default=None)
+ """
+ A list of SubscriptionPhase containing the [SubscriptionPhase](entity:SubscriptionPhase) for this plan.
+ This field it required. Not including this field will throw a REQUIRED_FIELD_MISSING error
+ """
+
+ subscription_plan_variations: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ The list of subscription plan variations available for this product
+ """
+
+ eligible_item_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The list of IDs of `CatalogItems` that are eligible for subscription by this SubscriptionPlan's variations.
+ """
+
+ eligible_category_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The list of IDs of `CatalogCategory` that are eligible for subscription by this SubscriptionPlan's variations.
+ """
+
+ all_items: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If true, all items in the merchant's catalog are subscribable by this SubscriptionPlan.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ CatalogSubscriptionPlan,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+)
diff --git a/src/square/types/catalog_subscription_plan_variation.py b/src/square/types/catalog_subscription_plan_variation.py
new file mode 100644
index 00000000..59f262b0
--- /dev/null
+++ b/src/square/types/catalog_subscription_plan_variation.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .subscription_phase import SubscriptionPhase
+
+
+class CatalogSubscriptionPlanVariation(UncheckedBaseModel):
+ """
+ Describes a subscription plan variation. A subscription plan variation represents how the subscription for a product or service is sold.
+ For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations).
+ """
+
+ name: str = pydantic.Field()
+ """
+ The name of the plan variation.
+ """
+
+ phases: typing.List[SubscriptionPhase] = pydantic.Field()
+ """
+ A list containing each [SubscriptionPhase](entity:SubscriptionPhase) for this plan variation.
+ """
+
+ subscription_plan_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the subscription plan, if there is one.
+ """
+
+ monthly_billing_anchor_date: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The day of the month the billing period starts.
+ """
+
+ can_prorate: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether bills for this plan variation can be split for proration.
+ """
+
+ successor_plan_variation_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of a "successor" plan variation to this one. If the field is set, and this object is disabled at all
+ locations, it indicates that this variation is deprecated and the object identified by the successor ID be used in
+ its stead.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_tax.py b/src/square/types/catalog_tax.py
new file mode 100644
index 00000000..2720c96c
--- /dev/null
+++ b/src/square/types/catalog_tax.py
@@ -0,0 +1,63 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .tax_calculation_phase import TaxCalculationPhase
+from .tax_inclusion_type import TaxInclusionType
+
+
+class CatalogTax(UncheckedBaseModel):
+ """
+ A tax applicable to an item.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The tax's name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
+ """
+
+ calculation_phase: typing.Optional[TaxCalculationPhase] = pydantic.Field(default=None)
+ """
+ Whether the tax is calculated based on a payment's subtotal or total.
+ See [TaxCalculationPhase](#type-taxcalculationphase) for possible values
+ """
+
+ inclusion_type: typing.Optional[TaxInclusionType] = pydantic.Field(default=None)
+ """
+ Whether the tax is `ADDITIVE` or `INCLUSIVE`.
+ See [TaxInclusionType](#type-taxinclusiontype) for possible values
+ """
+
+ percentage: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The percentage of the tax in decimal form, using a `'.'` as the decimal separator and without a `'%'` sign.
+ A value of `7.5` corresponds to 7.5%. For a location-specific tax rate, contact the tax authority of the location or a tax consultant.
+ """
+
+ applies_to_custom_amounts: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If `true`, the fee applies to custom amounts entered into the Square Point of Sale
+ app that are not associated with a particular `CatalogItem`.
+ """
+
+ enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ A Boolean flag to indicate whether the tax is displayed as enabled (`true`) in the Square Point of Sale app or not (`false`).
+ """
+
+ applies_to_product_set_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of a `CatalogProductSet` object. If set, the tax is applicable to all products in the product set.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_time_period.py b/src/square/types/catalog_time_period.py
new file mode 100644
index 00000000..8029fb03
--- /dev/null
+++ b/src/square/types/catalog_time_period.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogTimePeriod(UncheckedBaseModel):
+ """
+ Represents a time period - either a single period or a repeating period.
+ """
+
+ event: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An iCalendar (RFC 5545) [event](https://tools.ietf.org/html/rfc5545#section-3.6.1), which
+ specifies the name, timing, duration and recurrence of this time period.
+
+ Example:
+
+ ```
+ DTSTART:20190707T180000
+ DURATION:P2H
+ RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR
+ ```
+
+ Only `SUMMARY`, `DTSTART`, `DURATION` and `RRULE` fields are supported.
+ `DTSTART` must be in local (unzoned) time format. Note that while `BEGIN:VEVENT`
+ and `END:VEVENT` is not required in the request. The response will always
+ include them.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_v1id.py b/src/square/types/catalog_v1id.py
new file mode 100644
index 00000000..9160eee5
--- /dev/null
+++ b/src/square/types/catalog_v1id.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogV1Id(UncheckedBaseModel):
+ """
+ A Square API V1 identifier of an item, including the object ID and its associated location ID.
+ """
+
+ catalog_v1id: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="catalog_v1_id"),
+ pydantic.Field(
+ alias="catalog_v1_id",
+ description="The ID for an object used in the Square API V1, if the object ID differs from the Square API V2 object ID.",
+ ),
+ ] = None
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the `Location` this Connect V1 ID is associated with.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_version_updated_event.py b/src/square/types/catalog_version_updated_event.py
new file mode 100644
index 00000000..7047e42c
--- /dev/null
+++ b/src/square/types/catalog_version_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_version_updated_event_data import CatalogVersionUpdatedEventData
+
+
+class CatalogVersionUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when the catalog is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CatalogVersionUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_version_updated_event_catalog_version.py b/src/square/types/catalog_version_updated_event_catalog_version.py
new file mode 100644
index 00000000..61f6df96
--- /dev/null
+++ b/src/square/types/catalog_version_updated_event_catalog_version.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CatalogVersionUpdatedEventCatalogVersion(UncheckedBaseModel):
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Last modification timestamp in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_version_updated_event_data.py b/src/square/types/catalog_version_updated_event_data.py
new file mode 100644
index 00000000..780a6b96
--- /dev/null
+++ b/src/square/types/catalog_version_updated_event_data.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_version_updated_event_object import CatalogVersionUpdatedEventObject
+
+
+class CatalogVersionUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type.
+ """
+
+ object: typing.Optional[CatalogVersionUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing fields and values relevant to the event. Is absent if affected object was deleted.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_version_updated_event_object.py b/src/square/types/catalog_version_updated_event_object.py
new file mode 100644
index 00000000..65320500
--- /dev/null
+++ b/src/square/types/catalog_version_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_version_updated_event_catalog_version import CatalogVersionUpdatedEventCatalogVersion
+
+
+class CatalogVersionUpdatedEventObject(UncheckedBaseModel):
+ catalog_version: typing.Optional[CatalogVersionUpdatedEventCatalogVersion] = pydantic.Field(default=None)
+ """
+ The version of the object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/category_path_to_root_node.py b/src/square/types/category_path_to_root_node.py
new file mode 100644
index 00000000..4f4833e7
--- /dev/null
+++ b/src/square/types/category_path_to_root_node.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CategoryPathToRootNode(UncheckedBaseModel):
+ """
+ A node in the path from a retrieved category to its root node.
+ """
+
+ category_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The category's ID.
+ """
+
+ category_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The category's name.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/change_billing_anchor_date_response.py b/src/square/types/change_billing_anchor_date_response.py
new file mode 100644
index 00000000..7fb14ecb
--- /dev/null
+++ b/src/square/types/change_billing_anchor_date_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription import Subscription
+from .subscription_action import SubscriptionAction
+
+
+class ChangeBillingAnchorDateResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a request to the
+ [ChangeBillingAnchorDate](api-endpoint:Subscriptions-ChangeBillingAnchorDate) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The specified subscription for updating billing anchor date.
+ """
+
+ actions: typing.Optional[typing.List[SubscriptionAction]] = pydantic.Field(default=None)
+ """
+ A list of a single billing anchor date change for the subscription.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/change_timing.py b/src/square/types/change_timing.py
new file mode 100644
index 00000000..372c8cd7
--- /dev/null
+++ b/src/square/types/change_timing.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ChangeTiming = typing.Union[typing.Literal["IMMEDIATE", "END_OF_BILLING_CYCLE"], typing.Any]
diff --git a/src/square/types/channel.py b/src/square/types/channel.py
new file mode 100644
index 00000000..4c34c585
--- /dev/null
+++ b/src/square/types/channel.py
@@ -0,0 +1,63 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .channel_status import ChannelStatus
+from .reference import Reference
+
+
+class Channel(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The channel's unique ID.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the merchant this channel belongs to.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the channel.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version number which is incremented each time an update is made to the channel.
+ """
+
+ reference: typing.Optional[Reference] = pydantic.Field(default=None)
+ """
+ Represents an entity the channel is associated with.
+ """
+
+ status: typing.Optional[ChannelStatus] = pydantic.Field(default=None)
+ """
+ Status of the channel.
+ See [Status](#type-status) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the channel was created, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the channel was last updated, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/channel_status.py b/src/square/types/channel_status.py
new file mode 100644
index 00000000..b3fd439d
--- /dev/null
+++ b/src/square/types/channel_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ChannelStatus = typing.Union[typing.Literal["ACTIVE", "INACTIVE"], typing.Any]
diff --git a/src/square/types/charge_request_additional_recipient.py b/src/square/types/charge_request_additional_recipient.py
new file mode 100644
index 00000000..b5392aa2
--- /dev/null
+++ b/src/square/types/charge_request_additional_recipient.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class ChargeRequestAdditionalRecipient(UncheckedBaseModel):
+ """
+ Represents an additional recipient (other than the merchant) entitled to a portion of the tender.
+ Support is currently limited to USD, CAD and GBP currencies
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The location ID for a recipient (other than the merchant) receiving a portion of the tender.
+ """
+
+ description: str = pydantic.Field()
+ """
+ The description of the additional recipient.
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount of money distributed to the recipient.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout.py b/src/square/types/checkout.py
new file mode 100644
index 00000000..484faea8
--- /dev/null
+++ b/src/square/types/checkout.py
@@ -0,0 +1,105 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .additional_recipient import AdditionalRecipient
+from .address import Address
+from .order import Order
+
+
+class Checkout(UncheckedBaseModel):
+ """
+ Square Checkout lets merchants accept online payments for supported
+ payment types using a checkout workflow hosted on squareup.com.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID generated by Square Checkout when a new checkout is requested.
+ """
+
+ checkout_page_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL that the buyer's browser should be redirected to after the
+ checkout is completed.
+ """
+
+ ask_for_shipping_address: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If `true`, Square Checkout will collect shipping information on your
+ behalf and store that information with the transaction information in your
+ Square Dashboard.
+
+ Default: `false`.
+ """
+
+ merchant_support_email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address to display on the Square Checkout confirmation page
+ and confirmation email that the buyer can use to contact the merchant.
+
+ If this value is not set, the confirmation page and email will display the
+ primary email address associated with the merchant's Square account.
+
+ Default: none; only exists if explicitly set.
+ """
+
+ pre_populate_buyer_email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ If provided, the buyer's email is pre-populated on the checkout page
+ as an editable text field.
+
+ Default: none; only exists if explicitly set.
+ """
+
+ pre_populate_shipping_address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ If provided, the buyer's shipping info is pre-populated on the
+ checkout page as editable text fields.
+
+ Default: none; only exists if explicitly set.
+ """
+
+ redirect_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL to redirect to after checkout is completed with `checkoutId`,
+ Square's `orderId`, `transactionId`, and `referenceId` appended as URL
+ parameters. For example, if the provided redirect_url is
+ `http://www.example.com/order-complete`, a successful transaction redirects
+ the customer to:
+
+ http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx
+
+ If you do not provide a redirect URL, Square Checkout will display an order
+ confirmation page on your behalf; however Square strongly recommends that
+ you provide a redirect URL so you can verify the transaction results and
+ finalize the order through your existing/normal confirmation workflow.
+ """
+
+ order: typing.Optional[Order] = pydantic.Field(default=None)
+ """
+ Order to be checked out.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the checkout was created, in RFC 3339 format.
+ """
+
+ additional_recipients: typing.Optional[typing.List[AdditionalRecipient]] = pydantic.Field(default=None)
+ """
+ Additional recipients (other than the merchant) receiving a portion of this checkout.
+ For example, fees assessed on the purchase by a third party integration.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_location_settings.py b/src/square/types/checkout_location_settings.py
new file mode 100644
index 00000000..c88d9c3f
--- /dev/null
+++ b/src/square/types/checkout_location_settings.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_location_settings_branding import CheckoutLocationSettingsBranding
+from .checkout_location_settings_coupons import CheckoutLocationSettingsCoupons
+from .checkout_location_settings_policy import CheckoutLocationSettingsPolicy
+from .checkout_location_settings_tipping import CheckoutLocationSettingsTipping
+
+
+class CheckoutLocationSettings(UncheckedBaseModel):
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location that these settings apply to.
+ """
+
+ customer_notes_enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether customers are allowed to leave notes at checkout.
+ """
+
+ policies: typing.Optional[typing.List[CheckoutLocationSettingsPolicy]] = pydantic.Field(default=None)
+ """
+ Policy information is displayed at the bottom of the checkout pages.
+ You can set a maximum of two policies.
+ """
+
+ branding: typing.Optional[CheckoutLocationSettingsBranding] = pydantic.Field(default=None)
+ """
+ The branding settings for this location.
+ """
+
+ tipping: typing.Optional[CheckoutLocationSettingsTipping] = pydantic.Field(default=None)
+ """
+ The tip settings for this location.
+ """
+
+ coupons: typing.Optional[CheckoutLocationSettingsCoupons] = pydantic.Field(default=None)
+ """
+ The coupon settings for this location.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the settings were last updated, in RFC 3339 format.
+ Examples for January 25th, 2020 6:25:34pm Pacific Standard Time:
+ UTC: 2020-01-26T02:25:34Z
+ Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_location_settings_branding.py b/src/square/types/checkout_location_settings_branding.py
new file mode 100644
index 00000000..50440f02
--- /dev/null
+++ b/src/square/types/checkout_location_settings_branding.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_location_settings_branding_button_shape import CheckoutLocationSettingsBrandingButtonShape
+from .checkout_location_settings_branding_header_type import CheckoutLocationSettingsBrandingHeaderType
+
+
+class CheckoutLocationSettingsBranding(UncheckedBaseModel):
+ header_type: typing.Optional[CheckoutLocationSettingsBrandingHeaderType] = pydantic.Field(default=None)
+ """
+ Show the location logo on the checkout page.
+ See [HeaderType](#type-headertype) for possible values
+ """
+
+ button_color: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The HTML-supported hex color for the button on the checkout page (for example, "#FFFFFF").
+ """
+
+ button_shape: typing.Optional[CheckoutLocationSettingsBrandingButtonShape] = pydantic.Field(default=None)
+ """
+ The shape of the button on the checkout page.
+ See [ButtonShape](#type-buttonshape) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_location_settings_branding_button_shape.py b/src/square/types/checkout_location_settings_branding_button_shape.py
new file mode 100644
index 00000000..2777f306
--- /dev/null
+++ b/src/square/types/checkout_location_settings_branding_button_shape.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CheckoutLocationSettingsBrandingButtonShape = typing.Union[typing.Literal["SQUARED", "ROUNDED", "PILL"], typing.Any]
diff --git a/src/square/types/checkout_location_settings_branding_header_type.py b/src/square/types/checkout_location_settings_branding_header_type.py
new file mode 100644
index 00000000..96f5d855
--- /dev/null
+++ b/src/square/types/checkout_location_settings_branding_header_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CheckoutLocationSettingsBrandingHeaderType = typing.Union[
+ typing.Literal["BUSINESS_NAME", "FRAMED_LOGO", "FULL_WIDTH_LOGO"], typing.Any
+]
diff --git a/src/square/types/checkout_location_settings_coupons.py b/src/square/types/checkout_location_settings_coupons.py
new file mode 100644
index 00000000..47a318ee
--- /dev/null
+++ b/src/square/types/checkout_location_settings_coupons.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CheckoutLocationSettingsCoupons(UncheckedBaseModel):
+ enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether coupons are enabled for this location.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_location_settings_policy.py b/src/square/types/checkout_location_settings_policy.py
new file mode 100644
index 00000000..4b93b8aa
--- /dev/null
+++ b/src/square/types/checkout_location_settings_policy.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CheckoutLocationSettingsPolicy(UncheckedBaseModel):
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID to identify the policy when making changes. You must set the UID for policy updates, but it’s optional when setting new policies.
+ """
+
+ title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The title of the policy. This is required when setting the description, though you can update it in a different request.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the policy.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_location_settings_tipping.py b/src/square/types/checkout_location_settings_tipping.py
new file mode 100644
index 00000000..1505e8f0
--- /dev/null
+++ b/src/square/types/checkout_location_settings_tipping.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class CheckoutLocationSettingsTipping(UncheckedBaseModel):
+ percentages: typing.Optional[typing.List[int]] = pydantic.Field(default=None)
+ """
+ Set three custom percentage amounts that buyers can select at checkout. If Smart Tip is enabled, this only applies to transactions totaling $10 or more.
+ """
+
+ smart_tipping_enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Enables Smart Tip Amounts. If Smart Tip Amounts is enabled, tipping works as follows:
+ If a transaction is less than $10, the available tipping options include No Tip, $1, $2, or $3.
+ If a transaction is $10 or more, the available tipping options include No Tip, 15%, 20%, or 25%.
+ You can set custom percentage amounts with the `percentages` field.
+ """
+
+ default_percent: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Set the pre-selected percentage amounts that appear at checkout. If Smart Tip is enabled, this only applies to transactions totaling $10 or more.
+ """
+
+ smart_tips: typing.Optional[typing.List[Money]] = pydantic.Field(default=None)
+ """
+ Show the Smart Tip Amounts for this location.
+ """
+
+ default_smart_tip: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ Set the pre-selected whole amount that appears at checkout when Smart Tip is enabled and the transaction amount is less than $10.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_merchant_settings.py b/src/square/types/checkout_merchant_settings.py
new file mode 100644
index 00000000..3bf647c7
--- /dev/null
+++ b/src/square/types/checkout_merchant_settings.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_merchant_settings_payment_methods import CheckoutMerchantSettingsPaymentMethods
+
+
+class CheckoutMerchantSettings(UncheckedBaseModel):
+ payment_methods: typing.Optional[CheckoutMerchantSettingsPaymentMethods] = pydantic.Field(default=None)
+ """
+ The set of payment methods accepted for the merchant's account.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the settings were last updated, in RFC 3339 format.
+ Examples for January 25th, 2020 6:25:34pm Pacific Standard Time:
+ UTC: 2020-01-26T02:25:34Z
+ Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_merchant_settings_payment_methods.py b/src/square/types/checkout_merchant_settings_payment_methods.py
new file mode 100644
index 00000000..954e9c5d
--- /dev/null
+++ b/src/square/types/checkout_merchant_settings_payment_methods.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_merchant_settings_payment_methods_afterpay_clearpay import (
+ CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay,
+)
+from .checkout_merchant_settings_payment_methods_payment_method import (
+ CheckoutMerchantSettingsPaymentMethodsPaymentMethod,
+)
+
+
+class CheckoutMerchantSettingsPaymentMethods(UncheckedBaseModel):
+ apple_pay: typing.Optional[CheckoutMerchantSettingsPaymentMethodsPaymentMethod] = None
+ google_pay: typing.Optional[CheckoutMerchantSettingsPaymentMethodsPaymentMethod] = None
+ cash_app: typing.Optional[CheckoutMerchantSettingsPaymentMethodsPaymentMethod] = None
+ afterpay_clearpay: typing.Optional[CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay.py b/src/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay.py
new file mode 100644
index 00000000..55cc6dee
--- /dev/null
+++ b/src/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range import (
+ CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange,
+)
+
+
+class CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay(UncheckedBaseModel):
+ """
+ The settings allowed for AfterpayClearpay.
+ """
+
+ order_eligibility_range: typing.Optional[CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange] = (
+ pydantic.Field(default=None)
+ )
+ """
+ Afterpay is shown as an option for order totals falling within the configured range.
+ """
+
+ item_eligibility_range: typing.Optional[CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange] = (
+ pydantic.Field(default=None)
+ )
+ """
+ Afterpay is shown as an option for item totals falling within the configured range.
+ """
+
+ enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the payment method is enabled for the account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range.py b/src/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range.py
new file mode 100644
index 00000000..e29473d4
--- /dev/null
+++ b/src/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange(UncheckedBaseModel):
+ """
+ A range of purchase price that qualifies.
+ """
+
+ min: Money
+ max: Money
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_merchant_settings_payment_methods_payment_method.py b/src/square/types/checkout_merchant_settings_payment_methods_payment_method.py
new file mode 100644
index 00000000..5236d208
--- /dev/null
+++ b/src/square/types/checkout_merchant_settings_payment_methods_payment_method.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CheckoutMerchantSettingsPaymentMethodsPaymentMethod(UncheckedBaseModel):
+ """
+ The settings allowed for a payment method.
+ """
+
+ enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the payment method is enabled for the account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_options.py b/src/square/types/checkout_options.py
new file mode 100644
index 00000000..68822035
--- /dev/null
+++ b/src/square/types/checkout_options.py
@@ -0,0 +1,86 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .accepted_payment_methods import AcceptedPaymentMethods
+from .custom_field import CustomField
+from .money import Money
+from .shipping_fee import ShippingFee
+
+
+class CheckoutOptions(UncheckedBaseModel):
+ allow_tipping: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the payment allows tipping.
+ """
+
+ custom_fields: typing.Optional[typing.List[CustomField]] = pydantic.Field(default=None)
+ """
+ The custom fields requesting information from the buyer.
+ """
+
+ subscription_plan_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the subscription plan for the buyer to pay and subscribe.
+ For more information, see [Subscription Plan Checkout](https://developer.squareup.com/docs/checkout-api/subscription-plan-checkout).
+ """
+
+ redirect_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The confirmation page URL to redirect the buyer to after Square processes the payment.
+ """
+
+ merchant_support_email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address that buyers can use to contact the seller.
+ """
+
+ ask_for_shipping_address: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether to include the address fields in the payment form.
+ """
+
+ accepted_payment_methods: typing.Optional[AcceptedPaymentMethods] = pydantic.Field(default=None)
+ """
+ The methods allowed for buyers during checkout.
+ """
+
+ app_fee_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money that the developer is taking as a fee for facilitating the payment on behalf of the seller.
+
+ The amount cannot be more than 90% of the total amount of the payment.
+
+ The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-monetary-amounts).
+
+ The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller. For more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/collect-fees/additional-considerations#permissions).
+ """
+
+ shipping_fee: typing.Optional[ShippingFee] = pydantic.Field(default=None)
+ """
+ The fee associated with shipping to be applied to the `Order` as a service charge.
+ """
+
+ enable_coupon: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether to include the `Add coupon` section for the buyer to provide a Square marketing coupon in the payment form.
+ """
+
+ enable_loyalty: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether to include the `REWARDS` section for the buyer to opt in to loyalty, redeem rewards in the payment form, or both.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/checkout_options_payment_type.py b/src/square/types/checkout_options_payment_type.py
new file mode 100644
index 00000000..a07788f0
--- /dev/null
+++ b/src/square/types/checkout_options_payment_type.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CheckoutOptionsPaymentType = typing.Union[
+ typing.Literal[
+ "CARD_PRESENT",
+ "MANUAL_CARD_ENTRY",
+ "FELICA_ID",
+ "FELICA_QUICPAY",
+ "FELICA_TRANSPORTATION_GROUP",
+ "FELICA_ALL",
+ "PAYPAY",
+ "QR_CODE",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/clearpay_details.py b/src/square/types/clearpay_details.py
new file mode 100644
index 00000000..e85b7e5d
--- /dev/null
+++ b/src/square/types/clearpay_details.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class ClearpayDetails(UncheckedBaseModel):
+ """
+ Additional details about Clearpay payments.
+ """
+
+ email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Email address on the buyer's Clearpay account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/clone_order_response.py b/src/square/types/clone_order_response.py
new file mode 100644
index 00000000..ee7c6bc6
--- /dev/null
+++ b/src/square/types/clone_order_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .order import Order
+
+
+class CloneOrderResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CloneOrder](api-endpoint:Orders-CloneOrder) endpoint.
+ """
+
+ order: typing.Optional[Order] = pydantic.Field(default=None)
+ """
+ The cloned order.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/collected_data.py b/src/square/types/collected_data.py
new file mode 100644
index 00000000..cc00127d
--- /dev/null
+++ b/src/square/types/collected_data.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CollectedData(UncheckedBaseModel):
+ input_text: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The buyer's input text.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/complete_payment_response.py b/src/square/types/complete_payment_response.py
new file mode 100644
index 00000000..72e4db75
--- /dev/null
+++ b/src/square/types/complete_payment_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment import Payment
+
+
+class CompletePaymentResponse(UncheckedBaseModel):
+ """
+ Defines the response returned by[CompletePayment](api-endpoint:Payments-CompletePayment).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ payment: typing.Optional[Payment] = pydantic.Field(default=None)
+ """
+ The successfully completed payment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/component.py b/src/square/types/component.py
new file mode 100644
index 00000000..7c8f6e53
--- /dev/null
+++ b/src/square/types/component.py
@@ -0,0 +1,60 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .component_component_type import ComponentComponentType
+from .device_component_details_application_details import DeviceComponentDetailsApplicationDetails
+from .device_component_details_battery_details import DeviceComponentDetailsBatteryDetails
+from .device_component_details_card_reader_details import DeviceComponentDetailsCardReaderDetails
+from .device_component_details_ethernet_details import DeviceComponentDetailsEthernetDetails
+from .device_component_details_wi_fi_details import DeviceComponentDetailsWiFiDetails
+
+
+class Component(UncheckedBaseModel):
+ """
+ The wrapper object for the component entries of a given component type.
+ """
+
+ type: ComponentComponentType = pydantic.Field()
+ """
+ The type of this component. Each component type has expected properties expressed
+ in a structured format within its corresponding `*_details` field.
+ See [ComponentType](#type-componenttype) for possible values
+ """
+
+ application_details: typing.Optional[DeviceComponentDetailsApplicationDetails] = pydantic.Field(default=None)
+ """
+ Structured data for an `Application`, set for Components of type `APPLICATION`.
+ """
+
+ card_reader_details: typing.Optional[DeviceComponentDetailsCardReaderDetails] = pydantic.Field(default=None)
+ """
+ Structured data for a `CardReader`, set for Components of type `CARD_READER`.
+ """
+
+ battery_details: typing.Optional[DeviceComponentDetailsBatteryDetails] = pydantic.Field(default=None)
+ """
+ Structured data for a `Battery`, set for Components of type `BATTERY`.
+ """
+
+ wifi_details: typing.Optional[DeviceComponentDetailsWiFiDetails] = pydantic.Field(default=None)
+ """
+ Structured data for a `WiFi` interface, set for Components of type `WIFI`.
+ """
+
+ ethernet_details: typing.Optional[DeviceComponentDetailsEthernetDetails] = pydantic.Field(default=None)
+ """
+ Structured data for an `Ethernet` interface, set for Components of type `ETHERNET`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/component_component_type.py b/src/square/types/component_component_type.py
new file mode 100644
index 00000000..29f26bf6
--- /dev/null
+++ b/src/square/types/component_component_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ComponentComponentType = typing.Union[
+ typing.Literal["APPLICATION", "CARD_READER", "BATTERY", "WIFI", "ETHERNET", "PRINTER"], typing.Any
+]
diff --git a/src/square/types/confirmation_decision.py b/src/square/types/confirmation_decision.py
new file mode 100644
index 00000000..46832250
--- /dev/null
+++ b/src/square/types/confirmation_decision.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class ConfirmationDecision(UncheckedBaseModel):
+ has_agreed: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ The buyer's decision to the displayed terms.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/confirmation_options.py b/src/square/types/confirmation_options.py
new file mode 100644
index 00000000..de1814ca
--- /dev/null
+++ b/src/square/types/confirmation_options.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .confirmation_decision import ConfirmationDecision
+
+
+class ConfirmationOptions(UncheckedBaseModel):
+ title: str = pydantic.Field()
+ """
+ The title text to display in the confirmation screen flow on the Terminal.
+ """
+
+ body: str = pydantic.Field()
+ """
+ The agreement details to display in the confirmation flow on the Terminal.
+ """
+
+ agree_button_text: str = pydantic.Field()
+ """
+ The button text to display indicating the customer agrees to the displayed terms.
+ """
+
+ disagree_button_text: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The button text to display indicating the customer does not agree to the displayed terms.
+ """
+
+ decision: typing.Optional[ConfirmationDecision] = pydantic.Field(default=None)
+ """
+ The result of the buyer’s actions when presented with the confirmation screen.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/coordinates.py b/src/square/types/coordinates.py
new file mode 100644
index 00000000..2c0a2162
--- /dev/null
+++ b/src/square/types/coordinates.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class Coordinates(UncheckedBaseModel):
+ """
+ Latitude and longitude coordinates.
+ """
+
+ latitude: typing.Optional[float] = pydantic.Field(default=None)
+ """
+ The latitude of the coordinate expressed in degrees.
+ """
+
+ longitude: typing.Optional[float] = pydantic.Field(default=None)
+ """
+ The longitude of the coordinate expressed in degrees.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/country.py b/src/square/types/country.py
new file mode 100644
index 00000000..ba9f3091
--- /dev/null
+++ b/src/square/types/country.py
@@ -0,0 +1,259 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+Country = typing.Union[
+ typing.Literal[
+ "ZZ",
+ "AD",
+ "AE",
+ "AF",
+ "AG",
+ "AI",
+ "AL",
+ "AM",
+ "AO",
+ "AQ",
+ "AR",
+ "AS",
+ "AT",
+ "AU",
+ "AW",
+ "AX",
+ "AZ",
+ "BA",
+ "BB",
+ "BD",
+ "BE",
+ "BF",
+ "BG",
+ "BH",
+ "BI",
+ "BJ",
+ "BL",
+ "BM",
+ "BN",
+ "BO",
+ "BQ",
+ "BR",
+ "BS",
+ "BT",
+ "BV",
+ "BW",
+ "BY",
+ "BZ",
+ "CA",
+ "CC",
+ "CD",
+ "CF",
+ "CG",
+ "CH",
+ "CI",
+ "CK",
+ "CL",
+ "CM",
+ "CN",
+ "CO",
+ "CR",
+ "CU",
+ "CV",
+ "CW",
+ "CX",
+ "CY",
+ "CZ",
+ "DE",
+ "DJ",
+ "DK",
+ "DM",
+ "DO",
+ "DZ",
+ "EC",
+ "EE",
+ "EG",
+ "EH",
+ "ER",
+ "ES",
+ "ET",
+ "FI",
+ "FJ",
+ "FK",
+ "FM",
+ "FO",
+ "FR",
+ "GA",
+ "GB",
+ "GD",
+ "GE",
+ "GF",
+ "GG",
+ "GH",
+ "GI",
+ "GL",
+ "GM",
+ "GN",
+ "GP",
+ "GQ",
+ "GR",
+ "GS",
+ "GT",
+ "GU",
+ "GW",
+ "GY",
+ "HK",
+ "HM",
+ "HN",
+ "HR",
+ "HT",
+ "HU",
+ "ID",
+ "IE",
+ "IL",
+ "IM",
+ "IN",
+ "IO",
+ "IQ",
+ "IR",
+ "IS",
+ "IT",
+ "JE",
+ "JM",
+ "JO",
+ "JP",
+ "KE",
+ "KG",
+ "KH",
+ "KI",
+ "KM",
+ "KN",
+ "KP",
+ "KR",
+ "KW",
+ "KY",
+ "KZ",
+ "LA",
+ "LB",
+ "LC",
+ "LI",
+ "LK",
+ "LR",
+ "LS",
+ "LT",
+ "LU",
+ "LV",
+ "LY",
+ "MA",
+ "MC",
+ "MD",
+ "ME",
+ "MF",
+ "MG",
+ "MH",
+ "MK",
+ "ML",
+ "MM",
+ "MN",
+ "MO",
+ "MP",
+ "MQ",
+ "MR",
+ "MS",
+ "MT",
+ "MU",
+ "MV",
+ "MW",
+ "MX",
+ "MY",
+ "MZ",
+ "NA",
+ "NC",
+ "NE",
+ "NF",
+ "NG",
+ "NI",
+ "NL",
+ "NO",
+ "NP",
+ "NR",
+ "NU",
+ "NZ",
+ "OM",
+ "PA",
+ "PE",
+ "PF",
+ "PG",
+ "PH",
+ "PK",
+ "PL",
+ "PM",
+ "PN",
+ "PR",
+ "PS",
+ "PT",
+ "PW",
+ "PY",
+ "QA",
+ "RE",
+ "RO",
+ "RS",
+ "RU",
+ "RW",
+ "SA",
+ "SB",
+ "SC",
+ "SD",
+ "SE",
+ "SG",
+ "SH",
+ "SI",
+ "SJ",
+ "SK",
+ "SL",
+ "SM",
+ "SN",
+ "SO",
+ "SR",
+ "SS",
+ "ST",
+ "SV",
+ "SX",
+ "SY",
+ "SZ",
+ "TC",
+ "TD",
+ "TF",
+ "TG",
+ "TH",
+ "TJ",
+ "TK",
+ "TL",
+ "TM",
+ "TN",
+ "TO",
+ "TR",
+ "TT",
+ "TV",
+ "TW",
+ "TZ",
+ "UA",
+ "UG",
+ "UM",
+ "US",
+ "UY",
+ "UZ",
+ "VA",
+ "VC",
+ "VE",
+ "VG",
+ "VI",
+ "VN",
+ "VU",
+ "WF",
+ "WS",
+ "YE",
+ "YT",
+ "ZA",
+ "ZM",
+ "ZW",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/create_bank_account_response.py b/src/square/types/create_bank_account_response.py
new file mode 100644
index 00000000..b7cd46f4
--- /dev/null
+++ b/src/square/types/create_bank_account_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account import BankAccount
+from .error import Error
+
+
+class CreateBankAccountResponse(UncheckedBaseModel):
+ """
+ Response object returned by CreateBankAccount.
+ """
+
+ bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None)
+ """
+ The 'BankAccount' that was created.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_booking_custom_attribute_definition_response.py b/src/square/types/create_booking_custom_attribute_definition_response.py
new file mode 100644
index 00000000..b2f1ad24
--- /dev/null
+++ b/src/square/types/create_booking_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class CreateBookingCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a [CreateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-CreateBookingCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The newly created custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_booking_response.py b/src/square/types/create_booking_response.py
new file mode 100644
index 00000000..ff23b8e5
--- /dev/null
+++ b/src/square/types/create_booking_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking import Booking
+from .error import Error
+
+
+class CreateBookingResponse(UncheckedBaseModel):
+ booking: typing.Optional[Booking] = pydantic.Field(default=None)
+ """
+ The booking that was created.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_break_type_response.py b/src/square/types/create_break_type_response.py
new file mode 100644
index 00000000..c94f0be0
--- /dev/null
+++ b/src/square/types/create_break_type_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .break_type import BreakType
+from .error import Error
+
+
+class CreateBreakTypeResponse(UncheckedBaseModel):
+ """
+ The response to the request to create a `BreakType`. The response contains
+ the created `BreakType` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ break_type: typing.Optional[BreakType] = pydantic.Field(default=None)
+ """
+ The `BreakType` that was created by the request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_card_response.py b/src/square/types/create_card_response.py
new file mode 100644
index 00000000..df743a3c
--- /dev/null
+++ b/src/square/types/create_card_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+from .error import Error
+
+
+class CreateCardResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CreateCard](api-endpoint:Cards-CreateCard) endpoint.
+
+ Note: if there are errors processing the request, the card field will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors resulting from the request.
+ """
+
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The card created by the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_catalog_image_request.py b/src/square/types/create_catalog_image_request.py
new file mode 100644
index 00000000..c4790aab
--- /dev/null
+++ b/src/square/types/create_catalog_image_request.py
@@ -0,0 +1,73 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CreateCatalogImageRequest(UncheckedBaseModel):
+ idempotency_key: str = pydantic.Field()
+ """
+ A unique string that identifies this CreateCatalogImage request.
+ Keys can be any valid string but must be unique for every CreateCatalogImage request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+ """
+
+ object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique ID of the `CatalogObject` to attach this `CatalogImage` object to. Leave this
+ field empty to create unattached images, for example if you are building an integration
+ where an image can be attached to catalog items at a later time.
+ """
+
+ image: "CatalogObject" = pydantic.Field()
+ """
+ The new `CatalogObject` of the `IMAGE` type, namely, a `CatalogImage` object, to encapsulate the specified image file.
+ """
+
+ is_primary: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If this is set to `true`, the image created will be the primary, or first image of the object referenced by `object_id`.
+ If the `CatalogObject` already has a primary `CatalogImage`, setting this field to `true` will replace the primary image.
+ If this is set to `false` and you use the Square API version 2021-12-15 or later, the image id will be appended to the list of `image_ids` on the object.
+
+ With Square API version 2021-12-15 or later, the default value is `false`. Otherwise, the effective default value is `true`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ CreateCatalogImageRequest,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/create_catalog_image_response.py b/src/square/types/create_catalog_image_response.py
new file mode 100644
index 00000000..5f1a32c0
--- /dev/null
+++ b/src/square/types/create_catalog_image_response.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class CreateCatalogImageResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ image: typing.Optional["CatalogObject"] = pydantic.Field(default=None)
+ """
+ The newly created `CatalogImage` including a Square-generated
+ URL for the encapsulated image file.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ CreateCatalogImageResponse,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/create_checkout_response.py b/src/square/types/create_checkout_response.py
new file mode 100644
index 00000000..e7ba21a4
--- /dev/null
+++ b/src/square/types/create_checkout_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout import Checkout
+from .error import Error
+
+
+class CreateCheckoutResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `CreateCheckout` endpoint.
+ """
+
+ checkout: typing.Optional[Checkout] = pydantic.Field(default=None)
+ """
+ The newly created `checkout` object associated with the provided idempotency key.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_customer_card_response.py b/src/square/types/create_customer_card_response.py
new file mode 100644
index 00000000..cc103bea
--- /dev/null
+++ b/src/square/types/create_customer_card_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+from .error import Error
+
+
+class CreateCustomerCardResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `CreateCustomerCard` endpoint.
+
+ Either `errors` or `card` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The created card on file.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_customer_custom_attribute_definition_response.py b/src/square/types/create_customer_custom_attribute_definition_response.py
new file mode 100644
index 00000000..a71577f1
--- /dev/null
+++ b/src/square/types/create_customer_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class CreateCustomerCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The new custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_customer_group_response.py b/src/square/types/create_customer_group_response.py
new file mode 100644
index 00000000..cff01a58
--- /dev/null
+++ b/src/square/types/create_customer_group_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_group import CustomerGroup
+from .error import Error
+
+
+class CreateCustomerGroupResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CreateCustomerGroup](api-endpoint:CustomerGroups-CreateCustomerGroup) endpoint.
+
+ Either `errors` or `group` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ group: typing.Optional[CustomerGroup] = pydantic.Field(default=None)
+ """
+ The successfully created customer group.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_customer_response.py b/src/square/types/create_customer_response.py
new file mode 100644
index 00000000..6dbdda2f
--- /dev/null
+++ b/src/square/types/create_customer_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer import Customer
+from .error import Error
+
+
+class CreateCustomerResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CreateCustomer](api-endpoint:Customers-CreateCustomer) or
+ [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint.
+
+ Either `errors` or `customer` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ customer: typing.Optional[Customer] = pydantic.Field(default=None)
+ """
+ The created customer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_device_code_response.py b/src/square/types/create_device_code_response.py
new file mode 100644
index 00000000..af3e9ecd
--- /dev/null
+++ b/src/square/types/create_device_code_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_code import DeviceCode
+from .error import Error
+
+
+class CreateDeviceCodeResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ device_code: typing.Optional[DeviceCode] = pydantic.Field(default=None)
+ """
+ The created DeviceCode object containing the device code string.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_dispute_evidence_file_request.py b/src/square/types/create_dispute_evidence_file_request.py
new file mode 100644
index 00000000..cfc343e2
--- /dev/null
+++ b/src/square/types/create_dispute_evidence_file_request.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence_type import DisputeEvidenceType
+
+
+class CreateDisputeEvidenceFileRequest(UncheckedBaseModel):
+ """
+ Defines the parameters for a `CreateDisputeEvidenceFile` request.
+ """
+
+ idempotency_key: str = pydantic.Field()
+ """
+ A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
+ """
+
+ evidence_type: typing.Optional[DisputeEvidenceType] = pydantic.Field(default=None)
+ """
+ The type of evidence you are uploading.
+ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
+ """
+
+ content_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The MIME type of the uploaded file.
+ The type can be image/heic, image/heif, image/jpeg, application/pdf, image/png, or image/tiff.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_dispute_evidence_file_response.py b/src/square/types/create_dispute_evidence_file_response.py
new file mode 100644
index 00000000..87bf0c4a
--- /dev/null
+++ b/src/square/types/create_dispute_evidence_file_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence import DisputeEvidence
+from .error import Error
+
+
+class CreateDisputeEvidenceFileResponse(UncheckedBaseModel):
+ """
+ Defines the fields in a `CreateDisputeEvidenceFile` response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ evidence: typing.Optional[DisputeEvidence] = pydantic.Field(default=None)
+ """
+ The metadata of the newly uploaded dispute evidence.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_dispute_evidence_text_response.py b/src/square/types/create_dispute_evidence_text_response.py
new file mode 100644
index 00000000..8aeab84e
--- /dev/null
+++ b/src/square/types/create_dispute_evidence_text_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence import DisputeEvidence
+from .error import Error
+
+
+class CreateDisputeEvidenceTextResponse(UncheckedBaseModel):
+ """
+ Defines the fields in a `CreateDisputeEvidenceText` response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ evidence: typing.Optional[DisputeEvidence] = pydantic.Field(default=None)
+ """
+ The newly uploaded dispute evidence metadata.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_gift_card_activity_response.py b/src/square/types/create_gift_card_activity_response.py
new file mode 100644
index 00000000..4348b663
--- /dev/null
+++ b/src/square/types/create_gift_card_activity_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .gift_card_activity import GiftCardActivity
+
+
+class CreateGiftCardActivityResponse(UncheckedBaseModel):
+ """
+ A response that contains a `GiftCardActivity` that was created.
+ The response might contain a set of `Error` objects if the request resulted in errors.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card_activity: typing.Optional[GiftCardActivity] = pydantic.Field(default=None)
+ """
+ The gift card activity that was created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_gift_card_response.py b/src/square/types/create_gift_card_response.py
new file mode 100644
index 00000000..b1ddefe5
--- /dev/null
+++ b/src/square/types/create_gift_card_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .gift_card import GiftCard
+
+
+class CreateGiftCardResponse(UncheckedBaseModel):
+ """
+ A response that contains a `GiftCard`. The response might contain a set of `Error` objects if the request
+ resulted in errors.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing.Optional[GiftCard] = pydantic.Field(default=None)
+ """
+ The new gift card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_inventory_adjustment_reason_response.py b/src/square/types/create_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..ab5f8680
--- /dev/null
+++ b/src/square/types/create_inventory_adjustment_reason_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class CreateInventoryAdjustmentReasonResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing.Optional[InventoryAdjustmentReason] = pydantic.Field(default=None)
+ """
+ The successfully created inventory adjustment reason.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_invoice_attachment_request_data.py b/src/square/types/create_invoice_attachment_request_data.py
new file mode 100644
index 00000000..80c65953
--- /dev/null
+++ b/src/square/types/create_invoice_attachment_request_data.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CreateInvoiceAttachmentRequestData(UncheckedBaseModel):
+ """
+ Represents a [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) request.
+ """
+
+ idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique string that identifies the `CreateInvoiceAttachment` request.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the attachment to display on the invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_invoice_attachment_response.py b/src/square/types/create_invoice_attachment_response.py
new file mode 100644
index 00000000..9717b07a
--- /dev/null
+++ b/src/square/types/create_invoice_attachment_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .invoice_attachment import InvoiceAttachment
+
+
+class CreateInvoiceAttachmentResponse(UncheckedBaseModel):
+ """
+ Represents a [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) response.
+ """
+
+ attachment: typing.Optional[InvoiceAttachment] = pydantic.Field(default=None)
+ """
+ Metadata about the attachment that was added to the invoice.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_invoice_response.py b/src/square/types/create_invoice_response.py
new file mode 100644
index 00000000..db58eda9
--- /dev/null
+++ b/src/square/types/create_invoice_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .invoice import Invoice
+
+
+class CreateInvoiceResponse(UncheckedBaseModel):
+ """
+ The response returned by the `CreateInvoice` request.
+ """
+
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The newly created invoice.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_job_response.py b/src/square/types/create_job_response.py
new file mode 100644
index 00000000..ad7a58da
--- /dev/null
+++ b/src/square/types/create_job_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .job import Job
+
+
+class CreateJobResponse(UncheckedBaseModel):
+ """
+ Represents a [CreateJob](api-endpoint:Team-CreateJob) response. Either `job` or `errors`
+ is present in the response.
+ """
+
+ job: typing.Optional[Job] = pydantic.Field(default=None)
+ """
+ The new job.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_location_custom_attribute_definition_response.py b/src/square/types/create_location_custom_attribute_definition_response.py
new file mode 100644
index 00000000..ae7e3772
--- /dev/null
+++ b/src/square/types/create_location_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class CreateLocationCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The new custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_location_response.py b/src/square/types/create_location_response.py
new file mode 100644
index 00000000..ed516c6f
--- /dev/null
+++ b/src/square/types/create_location_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .location import Location
+
+
+class CreateLocationResponse(UncheckedBaseModel):
+ """
+ The response object returned by the [CreateLocation](api-endpoint:Locations-CreateLocation) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about [errors](https://developer.squareup.com/docs/build-basics/handling-errors) encountered during the request.
+ """
+
+ location: typing.Optional[Location] = pydantic.Field(default=None)
+ """
+ The newly created `Location` object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_loyalty_account_response.py b/src/square/types/create_loyalty_account_response.py
new file mode 100644
index 00000000..4a2c977c
--- /dev/null
+++ b/src/square/types/create_loyalty_account_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_account import LoyaltyAccount
+
+
+class CreateLoyaltyAccountResponse(UncheckedBaseModel):
+ """
+ A response that includes loyalty account created.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_account: typing.Optional[LoyaltyAccount] = pydantic.Field(default=None)
+ """
+ The newly created loyalty account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_loyalty_promotion_response.py b/src/square/types/create_loyalty_promotion_response.py
new file mode 100644
index 00000000..43dc8204
--- /dev/null
+++ b/src/square/types/create_loyalty_promotion_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_promotion import LoyaltyPromotion
+
+
+class CreateLoyaltyPromotionResponse(UncheckedBaseModel):
+ """
+ Represents a [CreateLoyaltyPromotion](api-endpoint:Loyalty-CreateLoyaltyPromotion) response.
+ Either `loyalty_promotion` or `errors` is present in the response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_promotion: typing.Optional[LoyaltyPromotion] = pydantic.Field(default=None)
+ """
+ The new loyalty promotion.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_loyalty_reward_response.py b/src/square/types/create_loyalty_reward_response.py
new file mode 100644
index 00000000..3e778ff6
--- /dev/null
+++ b/src/square/types/create_loyalty_reward_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_reward import LoyaltyReward
+
+
+class CreateLoyaltyRewardResponse(UncheckedBaseModel):
+ """
+ A response that includes the loyalty reward created.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ reward: typing.Optional[LoyaltyReward] = pydantic.Field(default=None)
+ """
+ The loyalty reward created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_merchant_custom_attribute_definition_response.py b/src/square/types/create_merchant_custom_attribute_definition_response.py
new file mode 100644
index 00000000..5d5ebe1c
--- /dev/null
+++ b/src/square/types/create_merchant_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class CreateMerchantCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The new custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_order_custom_attribute_definition_response.py b/src/square/types/create_order_custom_attribute_definition_response.py
new file mode 100644
index 00000000..8a9eb385
--- /dev/null
+++ b/src/square/types/create_order_custom_attribute_definition_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class CreateOrderCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a response from creating an order custom attribute definition.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The new custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_order_request.py b/src/square/types/create_order_request.py
new file mode 100644
index 00000000..ee417de4
--- /dev/null
+++ b/src/square/types/create_order_request.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order import Order
+
+
+class CreateOrderRequest(UncheckedBaseModel):
+ order: typing.Optional[Order] = pydantic.Field(default=None)
+ """
+ The order to create. If this field is set, the only other top-level field that can be
+ set is the `idempotency_key`.
+ """
+
+ idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A value you specify that uniquely identifies this
+ order among orders you have created.
+
+ If you are unsure whether a particular order was created successfully,
+ you can try it again with the same idempotency key without
+ worrying about creating duplicate orders.
+
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_order_response.py b/src/square/types/create_order_response.py
new file mode 100644
index 00000000..1ad91085
--- /dev/null
+++ b/src/square/types/create_order_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .order import Order
+
+
+class CreateOrderResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `CreateOrder` endpoint.
+
+ Either `errors` or `order` is present in a given response, but never both.
+ """
+
+ order: typing.Optional[Order] = pydantic.Field(default=None)
+ """
+ The newly created order.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_payment_link_response.py b/src/square/types/create_payment_link_response.py
new file mode 100644
index 00000000..f2dbaca6
--- /dev/null
+++ b/src/square/types/create_payment_link_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment_link import PaymentLink
+from .payment_link_related_resources import PaymentLinkRelatedResources
+
+
+class CreatePaymentLinkResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ payment_link: typing.Optional[PaymentLink] = pydantic.Field(default=None)
+ """
+ The created payment link.
+ """
+
+ related_resources: typing.Optional[PaymentLinkRelatedResources] = pydantic.Field(default=None)
+ """
+ The list of related objects.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+update_forward_refs(CreatePaymentLinkResponse)
diff --git a/src/square/types/create_payment_response.py b/src/square/types/create_payment_response.py
new file mode 100644
index 00000000..2419cb95
--- /dev/null
+++ b/src/square/types/create_payment_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment import Payment
+
+
+class CreatePaymentResponse(UncheckedBaseModel):
+ """
+ Defines the response returned by [CreatePayment](api-endpoint:Payments-CreatePayment).
+
+ If there are errors processing the request, the `payment` field might not be
+ present, or it might be present with a status of `FAILED`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ payment: typing.Optional[Payment] = pydantic.Field(default=None)
+ """
+ The newly created payment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_scheduled_shift_response.py b/src/square/types/create_scheduled_shift_response.py
new file mode 100644
index 00000000..352519a6
--- /dev/null
+++ b/src/square/types/create_scheduled_shift_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .scheduled_shift import ScheduledShift
+
+
+class CreateScheduledShiftResponse(UncheckedBaseModel):
+ """
+ Represents a [CreateScheduledShift](api-endpoint:Labor-CreateScheduledShift) response.
+ Either `scheduled_shift` or `errors` is present in the response.
+ """
+
+ scheduled_shift: typing.Optional[ScheduledShift] = pydantic.Field(default=None)
+ """
+ The new scheduled shift. To make the shift public, call
+ [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) or
+ [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_shift_response.py b/src/square/types/create_shift_response.py
new file mode 100644
index 00000000..e3d90e21
--- /dev/null
+++ b/src/square/types/create_shift_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .shift import Shift
+
+
+class CreateShiftResponse(UncheckedBaseModel):
+ """
+ The response to a request to create a `Shift`. The response contains
+ the created `Shift` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ shift: typing.Optional[Shift] = pydantic.Field(default=None)
+ """
+ The `Shift` that was created on the request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_subscription_response.py b/src/square/types/create_subscription_response.py
new file mode 100644
index 00000000..40e3039b
--- /dev/null
+++ b/src/square/types/create_subscription_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription import Subscription
+
+
+class CreateSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response from the
+ [CreateSubscription](api-endpoint:Subscriptions-CreateSubscription) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The newly created subscription.
+
+ For more information, see
+ [Subscription object](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#subscription-object).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_team_member_request.py b/src/square/types/create_team_member_request.py
new file mode 100644
index 00000000..90b202e7
--- /dev/null
+++ b/src/square/types/create_team_member_request.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member import TeamMember
+
+
+class CreateTeamMemberRequest(UncheckedBaseModel):
+ """
+ Represents a create request for a `TeamMember` object.
+ """
+
+ idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique string that identifies this `CreateTeamMember` request.
+ Keys can be any valid string, but must be unique for every request.
+ For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
+
+ The minimum length is 1 and the maximum length is 45.
+ """
+
+ team_member: typing.Optional[TeamMember] = pydantic.Field(default=None)
+ """
+ **Required** The data used to create the `TeamMember` object. If you include `wage_setting`, you must provide
+ `job_id` for each job assignment. To get job IDs, call [ListJobs](api-endpoint:Team-ListJobs).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_team_member_response.py b/src/square/types/create_team_member_response.py
new file mode 100644
index 00000000..4caa65d4
--- /dev/null
+++ b/src/square/types/create_team_member_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .team_member import TeamMember
+
+
+class CreateTeamMemberResponse(UncheckedBaseModel):
+ """
+ Represents a response from a create request containing the created `TeamMember` object or error messages.
+ """
+
+ team_member: typing.Optional[TeamMember] = pydantic.Field(default=None)
+ """
+ The successfully created `TeamMember` object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_terminal_action_response.py b/src/square/types/create_terminal_action_response.py
new file mode 100644
index 00000000..a169832b
--- /dev/null
+++ b/src/square/types/create_terminal_action_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_action import TerminalAction
+
+
+class CreateTerminalActionResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ action: typing.Optional[TerminalAction] = pydantic.Field(default=None)
+ """
+ The created `TerminalAction`
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_terminal_checkout_response.py b/src/square/types/create_terminal_checkout_response.py
new file mode 100644
index 00000000..3fcee09a
--- /dev/null
+++ b/src/square/types/create_terminal_checkout_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_checkout import TerminalCheckout
+
+
+class CreateTerminalCheckoutResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ checkout: typing.Optional[TerminalCheckout] = pydantic.Field(default=None)
+ """
+ The created `TerminalCheckout`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_terminal_refund_response.py b/src/square/types/create_terminal_refund_response.py
new file mode 100644
index 00000000..240d8872
--- /dev/null
+++ b/src/square/types/create_terminal_refund_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_refund import TerminalRefund
+
+
+class CreateTerminalRefundResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ refund: typing.Optional[TerminalRefund] = pydantic.Field(default=None)
+ """
+ The created `TerminalRefund`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_timecard_response.py b/src/square/types/create_timecard_response.py
new file mode 100644
index 00000000..f2ebe487
--- /dev/null
+++ b/src/square/types/create_timecard_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .timecard import Timecard
+
+
+class CreateTimecardResponse(UncheckedBaseModel):
+ """
+ The response to a request to create a `Timecard`. The response contains
+ the created `Timecard` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ timecard: typing.Optional[Timecard] = pydantic.Field(default=None)
+ """
+ The `Timecard` that was created on the request.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_transfer_order_data.py b/src/square/types/create_transfer_order_data.py
new file mode 100644
index 00000000..4ef6be5c
--- /dev/null
+++ b/src/square/types/create_transfer_order_data.py
@@ -0,0 +1,63 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .create_transfer_order_line_data import CreateTransferOrderLineData
+
+
+class CreateTransferOrderData(UncheckedBaseModel):
+ """
+ Data for creating a new transfer order to move [CatalogItemVariation](entity:CatalogItemVariation)s
+ between [Location](entity:Location)s. Used with the [CreateTransferOrder](api-endpoint:TransferOrders-CreateTransferOrder)
+ endpoint.
+ """
+
+ source_location_id: str = pydantic.Field()
+ """
+ The source [Location](entity:Location) that will send the items. Must be an active location
+ in your Square account with sufficient inventory of the requested items.
+ """
+
+ destination_location_id: str = pydantic.Field()
+ """
+ The destination [Location](entity:Location) that will receive the items. Must be an active location
+ in your Square account
+ """
+
+ expected_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Expected transfer date in RFC 3339 format (e.g. "2023-10-01T12:00:00Z").
+ """
+
+ notes: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional notes about the transfer
+ """
+
+ tracking_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional shipment tracking number
+ """
+
+ created_by_team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the [TeamMember](entity:TeamMember) creating this transfer order. Used for tracking
+ and auditing purposes.
+ """
+
+ line_items: typing.Optional[typing.List[CreateTransferOrderLineData]] = pydantic.Field(default=None)
+ """
+ List of [CatalogItemVariation](entity:CatalogItemVariation)s to transfer, including quantities
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_transfer_order_line_data.py b/src/square/types/create_transfer_order_line_data.py
new file mode 100644
index 00000000..7f874371
--- /dev/null
+++ b/src/square/types/create_transfer_order_line_data.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CreateTransferOrderLineData(UncheckedBaseModel):
+ """
+ Data for creating a new transfer order line item. Each line item specifies a
+ [CatalogItemVariation](entity:CatalogItemVariation) and quantity to transfer.
+ """
+
+ item_variation_id: str = pydantic.Field()
+ """
+ ID of the [CatalogItemVariation](entity:CatalogItemVariation) to transfer. Must reference a valid
+ item variation in the [Catalog](api:Catalog). The item variation must be:
+ - Active and available for sale
+ - Enabled for inventory tracking
+ - Available at the source location
+ """
+
+ quantity_ordered: str = pydantic.Field()
+ """
+ Total quantity ordered
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_transfer_order_response.py b/src/square/types/create_transfer_order_response.py
new file mode 100644
index 00000000..d76169c5
--- /dev/null
+++ b/src/square/types/create_transfer_order_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .transfer_order import TransferOrder
+
+
+class CreateTransferOrderResponse(UncheckedBaseModel):
+ """
+ Response for creating a transfer order.
+ """
+
+ transfer_order: typing.Optional[TransferOrder] = pydantic.Field(default=None)
+ """
+ The created transfer order
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_vendor_response.py b/src/square/types/create_vendor_response.py
new file mode 100644
index 00000000..42b56a1f
--- /dev/null
+++ b/src/square/types/create_vendor_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .vendor import Vendor
+
+
+class CreateVendorResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [CreateVendor](api-endpoint:Vendors-CreateVendor).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ vendor: typing.Optional[Vendor] = pydantic.Field(default=None)
+ """
+ The successfully created [Vendor](entity:Vendor) object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/create_webhook_subscription_response.py b/src/square/types/create_webhook_subscription_response.py
new file mode 100644
index 00000000..57e826c4
--- /dev/null
+++ b/src/square/types/create_webhook_subscription_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .webhook_subscription import WebhookSubscription
+
+
+class CreateWebhookSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) endpoint.
+
+ Note: if there are errors processing the request, the [Subscription](entity:WebhookSubscription) will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ subscription: typing.Optional[WebhookSubscription] = pydantic.Field(default=None)
+ """
+ The new [Subscription](entity:WebhookSubscription).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cube.py b/src/square/types/cube.py
new file mode 100644
index 00000000..5b9c9f2b
--- /dev/null
+++ b/src/square/types/cube.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .cube_join import CubeJoin
+from .cube_type import CubeType
+from .dimension import Dimension
+from .folder import Folder
+from .hierarchy import Hierarchy
+from .measure import Measure
+from .nested_folder import NestedFolder
+from .segment import Segment
+
+
+class Cube(UncheckedBaseModel):
+ name: str
+ title: typing.Optional[str] = None
+ type: CubeType
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = None
+ description: typing.Optional[str] = None
+ measures: typing.List[Measure]
+ dimensions: typing.List[Dimension]
+ segments: typing.List[Segment]
+ joins: typing.Optional[typing.List[CubeJoin]] = None
+ folders: typing.Optional[typing.List[Folder]] = None
+ nested_folders: typing_extensions.Annotated[
+ typing.Optional[typing.List[NestedFolder]],
+ FieldMetadata(alias="nestedFolders"),
+ pydantic.Field(alias="nestedFolders"),
+ ] = None
+ hierarchies: typing.Optional[typing.List[Hierarchy]] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cube_join.py b/src/square/types/cube_join.py
new file mode 100644
index 00000000..48196606
--- /dev/null
+++ b/src/square/types/cube_join.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CubeJoin(UncheckedBaseModel):
+ name: str
+ relationship: str
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/cube_type.py b/src/square/types/cube_type.py
new file mode 100644
index 00000000..e771d193
--- /dev/null
+++ b/src/square/types/cube_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CubeType = typing.Union[typing.Literal["cube", "view"], typing.Any]
diff --git a/src/square/types/currency.py b/src/square/types/currency.py
new file mode 100644
index 00000000..cdfedb33
--- /dev/null
+++ b/src/square/types/currency.py
@@ -0,0 +1,192 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+Currency = typing.Union[
+ typing.Literal[
+ "UNKNOWN_CURRENCY",
+ "AED",
+ "AFN",
+ "ALL",
+ "AMD",
+ "ANG",
+ "AOA",
+ "ARS",
+ "AUD",
+ "AWG",
+ "AZN",
+ "BAM",
+ "BBD",
+ "BDT",
+ "BGN",
+ "BHD",
+ "BIF",
+ "BMD",
+ "BND",
+ "BOB",
+ "BOV",
+ "BRL",
+ "BSD",
+ "BTN",
+ "BWP",
+ "BYR",
+ "BZD",
+ "CAD",
+ "CDF",
+ "CHE",
+ "CHF",
+ "CHW",
+ "CLF",
+ "CLP",
+ "CNY",
+ "COP",
+ "COU",
+ "CRC",
+ "CUC",
+ "CUP",
+ "CVE",
+ "CZK",
+ "DJF",
+ "DKK",
+ "DOP",
+ "DZD",
+ "EGP",
+ "ERN",
+ "ETB",
+ "EUR",
+ "FJD",
+ "FKP",
+ "GBP",
+ "GEL",
+ "GHS",
+ "GIP",
+ "GMD",
+ "GNF",
+ "GTQ",
+ "GYD",
+ "HKD",
+ "HNL",
+ "HRK",
+ "HTG",
+ "HUF",
+ "IDR",
+ "ILS",
+ "INR",
+ "IQD",
+ "IRR",
+ "ISK",
+ "JMD",
+ "JOD",
+ "JPY",
+ "KES",
+ "KGS",
+ "KHR",
+ "KMF",
+ "KPW",
+ "KRW",
+ "KWD",
+ "KYD",
+ "KZT",
+ "LAK",
+ "LBP",
+ "LKR",
+ "LRD",
+ "LSL",
+ "LTL",
+ "LVL",
+ "LYD",
+ "MAD",
+ "MDL",
+ "MGA",
+ "MKD",
+ "MMK",
+ "MNT",
+ "MOP",
+ "MRO",
+ "MUR",
+ "MVR",
+ "MWK",
+ "MXN",
+ "MXV",
+ "MYR",
+ "MZN",
+ "NAD",
+ "NGN",
+ "NIO",
+ "NOK",
+ "NPR",
+ "NZD",
+ "OMR",
+ "PAB",
+ "PEN",
+ "PGK",
+ "PHP",
+ "PKR",
+ "PLN",
+ "PYG",
+ "QAR",
+ "RON",
+ "RSD",
+ "RUB",
+ "RWF",
+ "SAR",
+ "SBD",
+ "SCR",
+ "SDG",
+ "SEK",
+ "SGD",
+ "SHP",
+ "SLL",
+ "SLE",
+ "SOS",
+ "SRD",
+ "SSP",
+ "STD",
+ "SVC",
+ "SYP",
+ "SZL",
+ "THB",
+ "TJS",
+ "TMT",
+ "TND",
+ "TOP",
+ "TRY",
+ "TTD",
+ "TWD",
+ "TZS",
+ "UAH",
+ "UGX",
+ "USD",
+ "USN",
+ "USS",
+ "UYI",
+ "UYU",
+ "UZS",
+ "VEF",
+ "VND",
+ "VUV",
+ "WST",
+ "XAF",
+ "XAG",
+ "XAU",
+ "XBA",
+ "XBB",
+ "XBC",
+ "XBD",
+ "XCD",
+ "XDR",
+ "XOF",
+ "XPD",
+ "XPF",
+ "XPT",
+ "XTS",
+ "XXX",
+ "YER",
+ "ZAR",
+ "ZMK",
+ "ZMW",
+ "BTC",
+ "XUS",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/custom_attribute.py b/src/square/types/custom_attribute.py
new file mode 100644
index 00000000..7aa30cf7
--- /dev/null
+++ b/src/square/types/custom_attribute.py
@@ -0,0 +1,81 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .custom_attribute_definition_visibility import CustomAttributeDefinitionVisibility
+
+
+class CustomAttribute(UncheckedBaseModel):
+ """
+ A custom attribute value. Each custom attribute value has a corresponding
+ `CustomAttributeDefinition` object.
+ """
+
+ key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The identifier
+ of the custom attribute definition and its corresponding custom attributes. This value
+ can be a simple key, which is the key that is provided when the custom attribute definition
+ is created, or a qualified key, if the requesting
+ application is not the definition owner. The qualified key consists of the application ID
+ of the custom attribute definition owner
+ followed by the simple key that was provided when the definition was created. It has the
+ format application_id:simple key.
+
+ The value for a simple key can contain up to 60 alphanumeric characters, periods (.),
+ underscores (_), and hyphens (-).
+ """
+
+ value: typing.Optional[typing.Any] = pydantic.Field(default=None)
+ """
+ The value assigned to the custom attribute. It is validated against the custom
+ attribute definition's schema on write operations. For more information about custom
+ attribute values,
+ see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview).
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Read only. The current version of the custom attribute. This field is incremented when the custom attribute is changed.
+ When updating an existing custom attribute value, you can provide this field
+ and specify the current version of the custom attribute to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency).
+ This field can also be used to enforce strong consistency for reads. For more information about strong consistency for reads,
+ see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview).
+ """
+
+ visibility: typing.Optional[CustomAttributeDefinitionVisibility] = pydantic.Field(default=None)
+ """
+ A copy of the `visibility` field value for the associated custom attribute definition.
+ See [CustomAttributeDefinitionVisibility](#type-customattributedefinitionvisibility) for possible values
+ """
+
+ definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ A copy of the associated custom attribute definition object. This field is only set when
+ the optional field is specified on the request.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the custom attribute was created or was most recently
+ updated, in RFC 3339 format.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the custom attribute was created, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/custom_attribute_definition.py b/src/square/types/custom_attribute_definition.py
new file mode 100644
index 00000000..050a0af0
--- /dev/null
+++ b/src/square/types/custom_attribute_definition.py
@@ -0,0 +1,99 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_visibility import CustomAttributeDefinitionVisibility
+
+
+class CustomAttributeDefinition(UncheckedBaseModel):
+ """
+ Represents a definition for custom attribute values. A custom attribute definition
+ specifies the key, visibility, schema, and other properties for a custom attribute.
+ """
+
+ key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The identifier
+ of the custom attribute definition and its corresponding custom attributes. This value
+ can be a simple key, which is the key that is provided when the custom attribute definition
+ is created, or a qualified key, if the requesting
+ application is not the definition owner. The qualified key consists of the application ID
+ of the custom attribute definition owner
+ followed by the simple key that was provided when the definition was created. It has the
+ format application_id:simple key.
+
+ The value for a simple key can contain up to 60 alphanumeric characters, periods (.),
+ underscores (_), and hyphens (-).
+
+ This field can not be changed
+ after the custom attribute definition is created. This field is required when creating
+ a definition and must be unique per application, seller, and resource type.
+ """
+
+ schema_: typing_extensions.Annotated[
+ typing.Optional[typing.Dict[str, typing.Any]],
+ FieldMetadata(alias="schema"),
+ pydantic.Field(
+ alias="schema",
+ description="The JSON schema for the custom attribute definition, which determines the data type of the corresponding custom attributes. For more information,\nsee [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). This field is required when creating a definition.",
+ ),
+ ] = None
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the custom attribute definition for API and seller-facing UI purposes. The name must
+ be unique within the seller and application pair. This field is required if the
+ `visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Seller-oriented description of the custom attribute definition, including any constraints
+ that the seller should observe. May be displayed as a tooltip in Square UIs. This field is
+ required if the `visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ visibility: typing.Optional[CustomAttributeDefinitionVisibility] = pydantic.Field(default=None)
+ """
+ Specifies how the custom attribute definition and its values should be shared with
+ the seller and other applications. If no value is specified, the value defaults to `VISIBILITY_HIDDEN`.
+ See [Visibility](#type-visibility) for possible values
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Read only. The current version of the custom attribute definition.
+ The value is incremented each time the custom attribute definition is updated.
+ When updating a custom attribute definition, you can provide this field
+ and specify the current version of the custom attribute definition to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency).
+
+ On writes, this field must be set to the latest version. Stale writes are rejected.
+
+ This field can also be used to enforce strong consistency for reads. For more information about strong consistency for reads,
+ see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview).
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the custom attribute definition was created or most recently updated,
+ in RFC 3339 format.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the custom attribute definition was created, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/custom_attribute_definition_event_data.py b/src/square/types/custom_attribute_definition_event_data.py
new file mode 100644
index 00000000..9bb86f37
--- /dev/null
+++ b/src/square/types/custom_attribute_definition_event_data.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data_object import CustomAttributeDefinitionEventDataObject
+
+
+class CustomAttributeDefinitionEventData(UncheckedBaseModel):
+ """
+ Represents an object in the CustomAttributeDefinition event notification
+ payload that contains the affected custom attribute definition.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `"custom_attribute_definition"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[CustomAttributeDefinitionEventDataObject] = pydantic.Field(default=None)
+ """
+ An object containing the custom attribute definition.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/custom_attribute_definition_event_data_object.py b/src/square/types/custom_attribute_definition_event_data_object.py
new file mode 100644
index 00000000..295c2d57
--- /dev/null
+++ b/src/square/types/custom_attribute_definition_event_data_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+
+
+class CustomAttributeDefinitionEventDataObject(UncheckedBaseModel):
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The custom attribute definition.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/custom_attribute_definition_visibility.py b/src/square/types/custom_attribute_definition_visibility.py
new file mode 100644
index 00000000..b0874bf9
--- /dev/null
+++ b/src/square/types/custom_attribute_definition_visibility.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CustomAttributeDefinitionVisibility = typing.Union[
+ typing.Literal["VISIBILITY_HIDDEN", "VISIBILITY_READ_ONLY", "VISIBILITY_READ_WRITE_VALUES"], typing.Any
+]
diff --git a/src/square/types/custom_attribute_event_data.py b/src/square/types/custom_attribute_event_data.py
new file mode 100644
index 00000000..f290a54f
--- /dev/null
+++ b/src/square/types/custom_attribute_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data_object import CustomAttributeEventDataObject
+
+
+class CustomAttributeEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `"custom_attribute"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[CustomAttributeEventDataObject] = pydantic.Field(default=None)
+ """
+ An object containing the custom attribute.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/custom_attribute_event_data_object.py b/src/square/types/custom_attribute_event_data_object.py
new file mode 100644
index 00000000..3fe4e446
--- /dev/null
+++ b/src/square/types/custom_attribute_event_data_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+
+
+class CustomAttributeEventDataObject(UncheckedBaseModel):
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The custom attribute.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/custom_attribute_filter.py b/src/square/types/custom_attribute_filter.py
new file mode 100644
index 00000000..22021796
--- /dev/null
+++ b/src/square/types/custom_attribute_filter.py
@@ -0,0 +1,67 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .range import Range
+
+
+class CustomAttributeFilter(UncheckedBaseModel):
+ """
+ Supported custom attribute query expressions for calling the
+ [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems)
+ endpoint to search for items or item variations.
+ """
+
+ custom_attribute_definition_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A query expression to filter items or item variations by matching their custom attributes'
+ `custom_attribute_definition_id` property value against the the specified id.
+ Exactly one of `custom_attribute_definition_id` or `key` must be specified.
+ """
+
+ key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A query expression to filter items or item variations by matching their custom attributes'
+ `key` property value against the specified key.
+ Exactly one of `custom_attribute_definition_id` or `key` must be specified.
+ """
+
+ string_filter: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A query expression to filter items or item variations by matching their custom attributes'
+ `string_value` property value against the specified text.
+ Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified.
+ """
+
+ number_filter: typing.Optional[Range] = pydantic.Field(default=None)
+ """
+ A query expression to filter items or item variations with their custom attributes
+ containing a number value within the specified range.
+ Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified.
+ """
+
+ selection_uids_filter: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A query expression to filter items or item variations by matching their custom attributes'
+ `selection_uid_values` values against the specified selection uids.
+ Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified.
+ """
+
+ bool_filter: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ A query expression to filter items or item variations by matching their custom attributes'
+ `boolean_value` property values against the specified Boolean expression.
+ Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/custom_field.py b/src/square/types/custom_field.py
new file mode 100644
index 00000000..90d49ad3
--- /dev/null
+++ b/src/square/types/custom_field.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomField(UncheckedBaseModel):
+ """
+ Describes a custom form field to add to the checkout page to collect more information from buyers during checkout.
+ For more information,
+ see [Specify checkout options](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#specify-checkout-options-1).
+ """
+
+ title: str = pydantic.Field()
+ """
+ The title of the custom field.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/custom_numeric_format.py b/src/square/types/custom_numeric_format.py
new file mode 100644
index 00000000..e3d7a269
--- /dev/null
+++ b/src/square/types/custom_numeric_format.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomNumericFormat(UncheckedBaseModel):
+ """
+ Custom numeric format for numeric measures and dimensions
+ """
+
+ type: typing.Literal["custom-numeric"] = pydantic.Field(default="custom-numeric")
+ """
+ Type of the format (must be 'custom-numeric')
+ """
+
+ value: str = pydantic.Field()
+ """
+ d3-format specifier string (e.g., '.2f', ',.0f', '$,.2f', '.0%', '.2s'). See https://d3js.org/d3-format
+ """
+
+ alias: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the predefined format (e.g., 'percent_2', 'currency_1'). Present only when a named format was used.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/custom_time_format.py b/src/square/types/custom_time_format.py
new file mode 100644
index 00000000..409da8f7
--- /dev/null
+++ b/src/square/types/custom_time_format.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomTimeFormat(UncheckedBaseModel):
+ """
+ Custom time format for time dimensions
+ """
+
+ type: typing.Literal["custom-time"] = pydantic.Field(default="custom-time")
+ """
+ Type of the format (must be 'custom-time')
+ """
+
+ value: str = pydantic.Field()
+ """
+ POSIX strftime format string (IEEE Std 1003.1 / POSIX.1) with d3-time-format extensions (e.g., '%Y-%m-%d', '%d/%m/%Y %H:%M:%S'). See https://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html and https://d3js.org/d3-time-format
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer.py b/src/square/types/customer.py
new file mode 100644
index 00000000..5f6b89c5
--- /dev/null
+++ b/src/square/types/customer.py
@@ -0,0 +1,128 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .customer_creation_source import CustomerCreationSource
+from .customer_preferences import CustomerPreferences
+from .customer_tax_ids import CustomerTaxIds
+
+
+class Customer(UncheckedBaseModel):
+ """
+ Represents a Square customer profile in the Customer Directory of a Square seller.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique Square-assigned ID for the customer profile.
+
+ If you need this ID for an API request, use the ID returned when you created the customer profile or call the [SearchCustomers](api-endpoint:Customers-SearchCustomers)
+ or [ListCustomers](api-endpoint:Customers-ListCustomers) endpoint.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the customer profile was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the customer profile was last updated, in RFC 3339 format.
+ """
+
+ given_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The given name (that is, the first name) associated with the customer profile.
+ """
+
+ family_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The family name (that is, the last name) associated with the customer profile.
+ """
+
+ nickname: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A nickname for the customer profile.
+ """
+
+ company_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A business name associated with the customer profile.
+ """
+
+ email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address associated with the customer profile.
+ """
+
+ address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The physical address associated with the customer profile.
+ """
+
+ phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The phone number associated with the customer profile.
+ """
+
+ birthday: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The birthday associated with the customer profile, in `YYYY-MM-DD` format. For example, `1998-09-21`
+ represents September 21, 1998, and `0000-09-21` represents September 21 (without a birth year).
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional second ID used to associate the customer profile with an
+ entity in another system.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A custom note associated with the customer profile.
+ """
+
+ preferences: typing.Optional[CustomerPreferences] = pydantic.Field(default=None)
+ """
+ Represents general customer preferences.
+ """
+
+ creation_source: typing.Optional[CustomerCreationSource] = pydantic.Field(default=None)
+ """
+ The method used to create the customer profile.
+ See [CustomerCreationSource](#type-customercreationsource) for possible values
+ """
+
+ group_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of [customer groups](entity:CustomerGroup) the customer belongs to.
+ """
+
+ segment_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of [customer segments](entity:CustomerSegment) the customer belongs to.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The Square-assigned version number of the customer profile. The version number is incremented each time an update is committed to the customer profile, except for changes to customer segment membership.
+ """
+
+ tax_ids: typing.Optional[CustomerTaxIds] = pydantic.Field(default=None)
+ """
+ The tax ID associated with the customer profile. This field is present only for customers of sellers in EU countries or the United Kingdom.
+ For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_address_filter.py b/src/square/types/customer_address_filter.py
new file mode 100644
index 00000000..05648134
--- /dev/null
+++ b/src/square/types/customer_address_filter.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .country import Country
+from .customer_text_filter import CustomerTextFilter
+
+
+class CustomerAddressFilter(UncheckedBaseModel):
+ """
+ The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue](entity:CustomerCustomAttributeFilterValue) filter when
+ searching by an `Address`-type custom attribute.
+ """
+
+ postal_code: typing.Optional[CustomerTextFilter] = pydantic.Field(default=None)
+ """
+ The postal code to search for. Only an `exact` match is supported.
+ """
+
+ country: typing.Optional[Country] = pydantic.Field(default=None)
+ """
+ The country code to search for.
+ See [Country](#type-country) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_created_event.py b/src/square/types/customer_created_event.py
new file mode 100644
index 00000000..3e5a0491
--- /dev/null
+++ b/src/square/types/customer_created_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_created_event_data import CustomerCreatedEventData
+
+
+class CustomerCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [customer](entity:Customer) is created. Subscribe to this event to track customer profiles affected by a merge operation.
+ For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks).
+
+ The `customer` object in the event notification does not include the `segment_ids` field.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this object, the value is `customer.created`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomerCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_created_event_data.py b/src/square/types/customer_created_event_data.py
new file mode 100644
index 00000000..c381c2a2
--- /dev/null
+++ b/src/square/types/customer_created_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_created_event_object import CustomerCreatedEventObject
+
+
+class CustomerCreatedEventData(UncheckedBaseModel):
+ """
+ The data associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `customer`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the new customer.
+ """
+
+ object: typing.Optional[CustomerCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the new customer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_created_event_event_context.py b/src/square/types/customer_created_event_event_context.py
new file mode 100644
index 00000000..73ff66c9
--- /dev/null
+++ b/src/square/types/customer_created_event_event_context.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_created_event_event_context_merge import CustomerCreatedEventEventContextMerge
+
+
+class CustomerCreatedEventEventContext(UncheckedBaseModel):
+ """
+ Information about the change that triggered the event.
+ """
+
+ merge: typing.Optional[CustomerCreatedEventEventContextMerge] = pydantic.Field(default=None)
+ """
+ Information about the merge operation associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_created_event_event_context_merge.py b/src/square/types/customer_created_event_event_context_merge.py
new file mode 100644
index 00000000..a6d14910
--- /dev/null
+++ b/src/square/types/customer_created_event_event_context_merge.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerCreatedEventEventContextMerge(UncheckedBaseModel):
+ """
+ Information about a merge operation, which creates a new customer using aggregated properties from two or more existing customers.
+ """
+
+ from_customer_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of the existing customers that were merged and then deleted.
+ """
+
+ to_customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the new customer created by the merge.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_created_event_object.py b/src/square/types/customer_created_event_object.py
new file mode 100644
index 00000000..0847af26
--- /dev/null
+++ b/src/square/types/customer_created_event_object.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer import Customer
+from .customer_created_event_event_context import CustomerCreatedEventEventContext
+
+
+class CustomerCreatedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the customer associated with the event.
+ """
+
+ customer: typing.Optional[Customer] = pydantic.Field(default=None)
+ """
+ The new customer.
+ """
+
+ event_context: typing.Optional[CustomerCreatedEventEventContext] = pydantic.Field(default=None)
+ """
+ Information about the change that triggered the event. This field is returned only if the customer is created by a merge operation.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_creation_source.py b/src/square/types/customer_creation_source.py
new file mode 100644
index 00000000..c269509e
--- /dev/null
+++ b/src/square/types/customer_creation_source.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CustomerCreationSource = typing.Union[
+ typing.Literal[
+ "OTHER",
+ "APPOINTMENTS",
+ "COUPON",
+ "DELETION_RECOVERY",
+ "DIRECTORY",
+ "EGIFTING",
+ "EMAIL_COLLECTION",
+ "FEEDBACK",
+ "IMPORT",
+ "INVOICES",
+ "LOYALTY",
+ "MARKETING",
+ "MERGE",
+ "ONLINE_STORE",
+ "INSTANT_PROFILE",
+ "TERMINAL",
+ "THIRD_PARTY",
+ "THIRD_PARTY_IMPORT",
+ "UNMERGE_RECOVERY",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/customer_creation_source_filter.py b/src/square/types/customer_creation_source_filter.py
new file mode 100644
index 00000000..9f46f06b
--- /dev/null
+++ b/src/square/types/customer_creation_source_filter.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_creation_source import CustomerCreationSource
+from .customer_inclusion_exclusion import CustomerInclusionExclusion
+
+
+class CustomerCreationSourceFilter(UncheckedBaseModel):
+ """
+ The creation source filter.
+
+ If one or more creation sources are set, customer profiles are included in,
+ or excluded from, the result if they match at least one of the filter criteria.
+ """
+
+ values: typing.Optional[typing.List[CustomerCreationSource]] = pydantic.Field(default=None)
+ """
+ The list of creation sources used as filtering criteria.
+ See [CustomerCreationSource](#type-customercreationsource) for possible values
+ """
+
+ rule: typing.Optional[CustomerInclusionExclusion] = pydantic.Field(default=None)
+ """
+ Indicates whether a customer profile matching the filter criteria
+ should be included in the result or excluded from the result.
+
+ Default: `INCLUDE`.
+ See [CustomerInclusionExclusion](#type-customerinclusionexclusion) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_created_event.py b/src/square/types/customer_custom_attribute_definition_created_event.py
new file mode 100644
index 00000000..2a3fa28c
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_created_event.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ is created by the subscribing application.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.owned.created](webhook:customer.custom_attribute_definition.owned.created).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_created_public_event.py b/src/square/types/customer_custom_attribute_definition_created_public_event.py
new file mode 100644
index 00000000..9edae7fe
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_created_public_event.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionCreatedPublicEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to all applications is created. A notification is sent when any application creates a custom
+ attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.visible.created](webhook:customer.custom_attribute_definition.visible.created),
+ which applies to custom attribute definitions that are visible to the subscribing application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.public.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_deleted_event.py b/src/square/types/customer_custom_attribute_definition_deleted_event.py
new file mode 100644
index 00000000..3d7228c7
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_deleted_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is deleted. A custom attribute definition can only be deleted by
+ the application that created it.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.owned.deleted](webhook:customer.custom_attribute_definition.owned.deleted).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_deleted_public_event.py b/src/square/types/customer_custom_attribute_definition_deleted_public_event.py
new file mode 100644
index 00000000..a320cf9a
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_deleted_public_event.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionDeletedPublicEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to all applications is deleted. A notification is sent when any application deletes a custom
+ attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.visible.deleted](webhook:customer.custom_attribute_definition.visible.deleted),
+ which applies to custom attribute definitions that are visible to the subscribing application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.public.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_owned_created_event.py b/src/square/types/customer_custom_attribute_definition_owned_created_event.py
new file mode 100644
index 00000000..5edcedb4
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_owned_created_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionOwnedCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ is created by the subscribing application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.owned.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_owned_deleted_event.py b/src/square/types/customer_custom_attribute_definition_owned_deleted_event.py
new file mode 100644
index 00000000..4cb2c8dd
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_owned_deleted_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionOwnedDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is deleted. A custom attribute definition can only be deleted by
+ the application that created it.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.owned.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_owned_updated_event.py b/src/square/types/customer_custom_attribute_definition_owned_updated_event.py
new file mode 100644
index 00000000..bdbfb501
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_owned_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionOwnedUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is updated. A custom attribute definition can only be updated by
+ the application that created it.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.owned.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_updated_event.py b/src/square/types/customer_custom_attribute_definition_updated_event.py
new file mode 100644
index 00000000..9fa11287
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_updated_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is updated. A custom attribute definition can only be updated by
+ the application that created it.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.owned.updated](webhook:customer.custom_attribute_definition.owned.updated).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_updated_public_event.py b/src/square/types/customer_custom_attribute_definition_updated_public_event.py
new file mode 100644
index 00000000..72e63a22
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_updated_public_event.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionUpdatedPublicEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to all applications is updated. A notification is sent when any application updates a custom
+ attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ This event is replaced by
+ [customer.custom_attribute_definition.visible.updated](webhook:customer.custom_attribute_definition.visible.updated),
+ which applies to custom attribute definitions that are visible to the subscribing application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.public.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_visible_created_event.py b/src/square/types/customer_custom_attribute_definition_visible_created_event.py
new file mode 100644
index 00000000..3a31af0f
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_visible_created_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionVisibleCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is created. A notification is sent when your application
+ creates a custom attribute definition or another application creates a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.visible.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_visible_deleted_event.py b/src/square/types/customer_custom_attribute_definition_visible_deleted_event.py
new file mode 100644
index 00000000..11dac80c
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_visible_deleted_event.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionVisibleDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is deleted. A custom attribute definition can only be deleted
+ by the application that created it. A notification is sent when your application deletes a custom attribute
+ definition or when another application deletes a custom attribute definition whose `visibility` is
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.visible.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_definition_visible_updated_event.py b/src/square/types/customer_custom_attribute_definition_visible_updated_event.py
new file mode 100644
index 00000000..eafe63ae
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_definition_visible_updated_event.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class CustomerCustomAttributeDefinitionVisibleUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is updated. A custom attribute definition can only be updated
+ by the application that created it. A notification is sent when your application updates a custom
+ attribute definition or when another application updates a custom attribute definition whose `visibility` is
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute_definition.visible.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_deleted_event.py b/src/square/types/customer_custom_attribute_deleted_event.py
new file mode 100644
index 00000000..8cbea39a
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_deleted_event.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class CustomerCustomAttributeDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) owned by the
+ subscribing application is deleted. Custom attributes are owned by the application that created the
+ corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose
+ `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application.
+
+ This event is replaced by
+ [customer.custom_attribute.owned.deleted](webhook:customer.custom_attribute.owned.deleted).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_deleted_public_event.py b/src/square/types/customer_custom_attribute_deleted_public_event.py
new file mode 100644
index 00000000..a57168ce
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_deleted_public_event.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class CustomerCustomAttributeDeletedPublicEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) that is visible
+ to all applications is deleted. A notification is sent when any application deletes a custom attribute
+ whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ This event is replaced by
+ [customer.custom_attribute.visible.deleted](webhook:customer.custom_attribute.visible.deleted),
+ which applies to custom attributes that are visible to the subscribing application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute.public.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_filter.py b/src/square/types/customer_custom_attribute_filter.py
new file mode 100644
index 00000000..eab42ed6
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_filter.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_custom_attribute_filter_value import CustomerCustomAttributeFilterValue
+from .time_range import TimeRange
+
+
+class CustomerCustomAttributeFilter(UncheckedBaseModel):
+ """
+ The custom attribute filter. Use this filter in a set of [custom attribute filters](entity:CustomerCustomAttributeFilters) to search
+ based on the value or last updated date of a customer-related [custom attribute](entity:CustomAttribute).
+ """
+
+ key: str = pydantic.Field()
+ """
+ The `key` of the [custom attribute](entity:CustomAttribute) to filter by. The key is the identifier of the custom attribute
+ (and the corresponding custom attribute definition) and can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes).
+ """
+
+ filter: typing.Optional[CustomerCustomAttributeFilterValue] = pydantic.Field(default=None)
+ """
+ A filter that corresponds to the data type of the target custom attribute. For example, provide the `phone` filter to
+ search based on the value of a `PhoneNumber`-type custom attribute. The data type is specified by the schema field of the custom attribute definition,
+ which can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes).
+
+ You must provide this `filter` field, the `updated_at` field, or both.
+ """
+
+ updated_at: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ The date range for when the custom attribute was last updated. The date range can include `start_at`, `end_at`, or
+ both. Range boundaries are inclusive. Dates are specified as RFC 3339 timestamps.
+
+ You must provide this `updated_at` field, the `filter` field, or both.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_filter_value.py b/src/square/types/customer_custom_attribute_filter_value.py
new file mode 100644
index 00000000..ee798673
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_filter_value.py
@@ -0,0 +1,109 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_address_filter import CustomerAddressFilter
+from .customer_text_filter import CustomerTextFilter
+from .filter_value import FilterValue
+from .float_number_range import FloatNumberRange
+from .time_range import TimeRange
+
+
+class CustomerCustomAttributeFilterValue(UncheckedBaseModel):
+ """
+ A type-specific filter used in a [custom attribute filter](entity:CustomerCustomAttributeFilter) to search based on the value
+ of a customer-related [custom attribute](entity:CustomAttribute).
+ """
+
+ email: typing.Optional[CustomerTextFilter] = pydantic.Field(default=None)
+ """
+ A filter for a query based on the value of an `Email`-type custom attribute. This filter is case-insensitive and can
+ include `exact` or `fuzzy`, but not both.
+
+ For an `exact` match, provide the complete email address.
+
+ For a `fuzzy` match, provide a query expression containing one or more query tokens to match against the email address. Square removes
+ any punctuation (including periods (.), underscores (_), and the @ symbol) and tokenizes the email addresses on spaces. A match is found
+ if a tokenized email address contains all the tokens in the search query, irrespective of the token order. For example, `Steven gmail`
+ matches steven.jones@gmail.com and mygmail@stevensbakery.com.
+ """
+
+ phone: typing.Optional[CustomerTextFilter] = pydantic.Field(default=None)
+ """
+ A filter for a query based on the value of a `PhoneNumber`-type custom attribute. This filter is case-insensitive and
+ can include `exact` or `fuzzy`, but not both.
+
+ For an `exact` match, provide the complete phone number. This is always an E.164-compliant phone number that starts
+ with the + sign followed by the country code and subscriber number. For example, the format for a US phone number is +12061112222.
+
+ For a `fuzzy` match, provide a query expression containing one or more query tokens to match against the phone number.
+ Square removes any punctuation and tokenizes the expression on spaces. A match is found if a tokenized phone number contains
+ all the tokens in the search query, irrespective of the token order. For example, `415 123 45` is tokenized to `415`, `123`, and `45`,
+ which matches +14151234567 and +12345674158, but does not match +1234156780. Similarly, the expression `415` matches
+ +14151234567, +12345674158, and +1234156780.
+ """
+
+ text: typing.Optional[CustomerTextFilter] = pydantic.Field(default=None)
+ """
+ A filter for a query based on the value of a `String`-type custom attribute. This filter is case-insensitive and
+ can include `exact` or `fuzzy`, but not both.
+
+ For an `exact` match, provide the complete string.
+
+ For a `fuzzy` match, provide a query expression containing one or more query tokens in any order that contain complete words
+ to match against the string. Square tokenizes the expression using a grammar-based tokenizer. For example, the expressions `quick brown`,
+ `brown quick`, and `quick fox` match "The quick brown fox jumps over the lazy dog". However, `quick foxes` and `qui` do not match.
+ """
+
+ selection: typing.Optional[FilterValue] = pydantic.Field(default=None)
+ """
+ A filter for a query based on the display name for a `Selection`-type custom attribute value. This filter is case-sensitive
+ and can contain `any`, `all`, or both. The `none` condition is not supported.
+
+ Provide the display name of each item that you want to search for. To find the display names for the selection, use the
+ [Customer Custom Attributes API](api:CustomerCustomAttributes) to retrieve the corresponding custom attribute definition
+ and then check the `schema.items.names` field. For more information, see
+ [Search based on selection](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#custom-attribute-value-filter-selection).
+
+ Note that when a `Selection`-type custom attribute is assigned to a customer profile, the custom attribute value is a list of one
+ or more UUIDs (sourced from the `schema.items.enum` field) that map to the item names. These UUIDs are unique per seller.
+ """
+
+ date: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ A filter for a query based on the value of a `Date`-type custom attribute.
+
+ Provide a date range for this filter using `start_at`, `end_at`, or both. Range boundaries are inclusive. Dates can be specified
+ in `YYYY-MM-DD` format or as RFC 3339 timestamps.
+ """
+
+ number: typing.Optional[FloatNumberRange] = pydantic.Field(default=None)
+ """
+ A filter for a query based on the value of a `Number`-type custom attribute, which can be an integer or a decimal with up to
+ 5 digits of precision.
+
+ Provide a numerical range for this filter using `start_at`, `end_at`, or both. Range boundaries are inclusive. Numbers are specified
+ as decimals or integers. The absolute value of range boundaries must not exceed `(2^63-1)/10^5`, or 92233720368547.
+ """
+
+ boolean: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ A filter for a query based on the value of a `Boolean`-type custom attribute.
+ """
+
+ address: typing.Optional[CustomerAddressFilter] = pydantic.Field(default=None)
+ """
+ A filter for a query based on the value of an `Address`-type custom attribute. The filter can include `postal_code`, `country`, or both.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_filters.py b/src/square/types/customer_custom_attribute_filters.py
new file mode 100644
index 00000000..ab5f0da4
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_filters.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_custom_attribute_filter import CustomerCustomAttributeFilter
+
+
+class CustomerCustomAttributeFilters(UncheckedBaseModel):
+ """
+ The custom attribute filters in a set of [customer filters](entity:CustomerFilter) used in a search query. Use this filter
+ to search based on [custom attributes](entity:CustomAttribute) that are assigned to customer profiles. For more information, see
+ [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute).
+ """
+
+ filters: typing.Optional[typing.List[CustomerCustomAttributeFilter]] = pydantic.Field(default=None)
+ """
+ The custom attribute filters. Each filter must specify `key` and include the `filter` field with a type-specific filter,
+ the `updated_at` field, or both. The provided keys must be unique within the list of custom attribute filters.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_owned_deleted_event.py b/src/square/types/customer_custom_attribute_owned_deleted_event.py
new file mode 100644
index 00000000..6d79c1c4
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_owned_deleted_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class CustomerCustomAttributeOwnedDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) owned by the
+ subscribing application is deleted. Custom attributes are owned by the application that created the
+ corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose
+ `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute.owned.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_owned_updated_event.py b/src/square/types/customer_custom_attribute_owned_updated_event.py
new file mode 100644
index 00000000..3a3cf342
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_owned_updated_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class CustomerCustomAttributeOwnedUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) owned by the
+ subscribing application is created or updated. Custom attributes are owned by the application that created
+ the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose
+ `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute.owned.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_updated_event.py b/src/square/types/customer_custom_attribute_updated_event.py
new file mode 100644
index 00000000..12d25228
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_updated_event.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class CustomerCustomAttributeUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) owned by the
+ subscribing application is created or updated. Custom attributes are owned by the application that created
+ the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose
+ `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application.
+
+ This event is replaced by
+ [customer.custom_attribute.owned.updated](webhook:customer.custom_attribute.owned.updated).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_updated_public_event.py b/src/square/types/customer_custom_attribute_updated_public_event.py
new file mode 100644
index 00000000..830f911b
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_updated_public_event.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class CustomerCustomAttributeUpdatedPublicEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) that is visible
+ to all applications is created or updated. A notification is sent when any application creates or updates
+ a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+
+ This event is replaced by
+ [customer.custom_attribute.visible.updated](webhook:customer.custom_attribute.visible.updated),
+ which applies to custom attributes that are visible to the subscribing application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute.public.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_visible_deleted_event.py b/src/square/types/customer_custom_attribute_visible_deleted_event.py
new file mode 100644
index 00000000..095b9f5a
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_visible_deleted_event.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class CustomerCustomAttributeVisibleDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) that is visible to the
+ subscribing application is deleted. A notification is sent when:
+ - Your application deletes a custom attribute owned by your application, regardless of the `visibility` setting.
+ - Any application deletes a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY`
+ or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application, but those set to
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be deleted by the owner. Custom attributes are owned
+ by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute.visible.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_custom_attribute_visible_updated_event.py b/src/square/types/customer_custom_attribute_visible_updated_event.py
new file mode 100644
index 00000000..e6d2dce8
--- /dev/null
+++ b/src/square/types/customer_custom_attribute_visible_updated_event.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class CustomerCustomAttributeVisibleUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a customer [custom attribute](entity:CustomAttribute) that is visible to the
+ subscribing application is created or updated. A notification is sent when:
+ - Your application creates or updates a custom attribute owned by your application, regardless of the `visibility` setting.
+ - Any application creates or updates a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY`
+ or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application, but those set to
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be created or updated by the owner. Custom attributes are owned
+ by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"customer.custom_attribute.visible.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_deleted_event.py b/src/square/types/customer_deleted_event.py
new file mode 100644
index 00000000..5d4ba073
--- /dev/null
+++ b/src/square/types/customer_deleted_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_deleted_event_data import CustomerDeletedEventData
+
+
+class CustomerDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a [customer](entity:Customer) is deleted. For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks).
+
+ The `customer` object in the event notification does not include the following fields: `group_ids` and `segment_ids`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this object, the value is `customer.deleted`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomerDeletedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_deleted_event_data.py b/src/square/types/customer_deleted_event_data.py
new file mode 100644
index 00000000..a065be13
--- /dev/null
+++ b/src/square/types/customer_deleted_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_deleted_event_object import CustomerDeletedEventObject
+
+
+class CustomerDeletedEventData(UncheckedBaseModel):
+ """
+ The data associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `customer`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the deleted customer.
+ """
+
+ object: typing.Optional[CustomerDeletedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the deleted customer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_deleted_event_event_context.py b/src/square/types/customer_deleted_event_event_context.py
new file mode 100644
index 00000000..1ab32dba
--- /dev/null
+++ b/src/square/types/customer_deleted_event_event_context.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_deleted_event_event_context_merge import CustomerDeletedEventEventContextMerge
+
+
+class CustomerDeletedEventEventContext(UncheckedBaseModel):
+ """
+ Information about the change that triggered the event.
+ """
+
+ merge: typing.Optional[CustomerDeletedEventEventContextMerge] = pydantic.Field(default=None)
+ """
+ Information about the merge operation associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_deleted_event_event_context_merge.py b/src/square/types/customer_deleted_event_event_context_merge.py
new file mode 100644
index 00000000..8299bfd2
--- /dev/null
+++ b/src/square/types/customer_deleted_event_event_context_merge.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerDeletedEventEventContextMerge(UncheckedBaseModel):
+ """
+ Information about a merge operation, which creates a new customer using aggregated properties from two or more existing customers.
+ """
+
+ from_customer_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of the existing customers that were merged and then deleted.
+ """
+
+ to_customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the new customer created by the merge.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_deleted_event_object.py b/src/square/types/customer_deleted_event_object.py
new file mode 100644
index 00000000..efeace43
--- /dev/null
+++ b/src/square/types/customer_deleted_event_object.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer import Customer
+from .customer_deleted_event_event_context import CustomerDeletedEventEventContext
+
+
+class CustomerDeletedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the customer associated with the event.
+ """
+
+ customer: typing.Optional[Customer] = pydantic.Field(default=None)
+ """
+ The deleted customer.
+ """
+
+ event_context: typing.Optional[CustomerDeletedEventEventContext] = pydantic.Field(default=None)
+ """
+ Information about the change that triggered the event. This field is returned only if the customer is deleted by a merge operation.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_details.py b/src/square/types/customer_details.py
new file mode 100644
index 00000000..b67c6433
--- /dev/null
+++ b/src/square/types/customer_details.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerDetails(UncheckedBaseModel):
+ """
+ Details about the customer making the payment.
+ """
+
+ customer_initiated: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the customer initiated the payment.
+ """
+
+ seller_keyed_in: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates that the seller keyed in payment details on behalf of the customer.
+ This is used to flag a payment as Mail Order / Telephone Order (MOTO).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_filter.py b/src/square/types/customer_filter.py
new file mode 100644
index 00000000..6e50ed08
--- /dev/null
+++ b/src/square/types/customer_filter.py
@@ -0,0 +1,157 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_creation_source_filter import CustomerCreationSourceFilter
+from .customer_custom_attribute_filters import CustomerCustomAttributeFilters
+from .customer_text_filter import CustomerTextFilter
+from .filter_value import FilterValue
+from .time_range import TimeRange
+
+
+class CustomerFilter(UncheckedBaseModel):
+ """
+ Represents the filtering criteria in a [search query](entity:CustomerQuery) that defines how to filter
+ customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results.
+ """
+
+ creation_source: typing.Optional[CustomerCreationSourceFilter] = pydantic.Field(default=None)
+ """
+ A filter to select customers based on their creation source.
+ """
+
+ created_at: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ A filter to select customers based on when they were created.
+ """
+
+ updated_at: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ A filter to select customers based on when they were last updated.
+ """
+
+ email_address: typing.Optional[CustomerTextFilter] = pydantic.Field(default=None)
+ """
+ A filter to [select customers by their email address](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-email-address)
+ visible to the seller.
+ This filter is case-insensitive.
+
+ For [exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-email-address), this
+ filter causes the search to return customer profiles
+ whose `email_address` field value are identical to the email address provided
+ in the query.
+
+ For [fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-email-address),
+ this filter causes the search to return customer profiles
+ whose `email_address` field value has a token-wise partial match against the filtering
+ expression in the query. For example, with `Steven gmail` provided in a search
+ query, the search returns customers whose email address is `steven.johnson@gmail.com`
+ or `mygmail@stevensbakery.com`. Square removes any punctuation (including periods (.),
+ underscores (_), and the @ symbol) and tokenizes the email addresses on spaces. A match is
+ found if a tokenized email address contains all the tokens in the search query,
+ irrespective of the token order.
+ """
+
+ phone_number: typing.Optional[CustomerTextFilter] = pydantic.Field(default=None)
+ """
+ A filter to [select customers by their phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-phone-number)
+ visible to the seller.
+
+ For [exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-phone-number),
+ this filter returns customers whose phone number matches the specified query expression. The number in the query must be of an
+ E.164-compliant form. In particular, it must include the leading `+` sign followed by a country code and then a subscriber number.
+ For example, the standard E.164 form of a US phone number is `+12062223333` and an E.164-compliant variation is `+1 (206) 222-3333`.
+ To match the query expression, stored customer phone numbers are converted to the standard E.164 form.
+
+ For [fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-phone-number),
+ this filter returns customers whose phone number matches the token or tokens provided in the query expression. For example, with `415`
+ provided in a search query, the search returns customers with the phone numbers `+1-415-212-1200`, `+1-212-415-1234`, and `+1 (551) 234-1567`.
+ Similarly, a search query of `415 123` returns customers with the phone numbers `+1-212-415-1234` and `+1 (551) 234-1567` but not
+ `+1-212-415-1200`. A match is found if a tokenized phone number contains all the tokens in the search query, irrespective of the token order.
+ """
+
+ reference_id: typing.Optional[CustomerTextFilter] = pydantic.Field(default=None)
+ """
+ A filter to [select customers by their reference IDs](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-reference-id).
+ This filter is case-insensitive.
+
+ [Exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-reference-id)
+ of a customer's reference ID against a query's reference ID is evaluated as an
+ exact match between two strings, character by character in the given order.
+
+ [Fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-reference-id)
+ of stored reference IDs against queried reference IDs works
+ exactly the same as fuzzy matching on email addresses. Non-alphanumeric characters
+ are replaced by spaces to tokenize stored and queried reference IDs. A match is found
+ if a tokenized stored reference ID contains all tokens specified in any order in the query. For example,
+ a query of `NYC M` matches customer profiles with the `reference_id` value of `NYC_M_35_JOHNSON`
+ and `NYC_27_MURRAY`.
+ """
+
+ group_ids: typing.Optional[FilterValue] = pydantic.Field(default=None)
+ """
+ A filter to select customers based on the [groups](entity:CustomerGroup) they belong to.
+ Group membership is controlled by sellers and developers.
+
+ The `group_ids` filter has the following syntax:
+ ```
+ "group_ids": {
+ "any": ["{group_a_id}", "{group_b_id}", ...],
+ "all": ["{group_1_id}", "{group_2_id}", ...],
+ "none": ["{group_i_id}", "{group_ii_id}", ...]
+ }
+ ```
+
+ You can use any combination of the `any`, `all`, and `none` fields in the filter.
+ With `any`, the search returns customers in groups `a` or `b` or any other group specified in the list.
+ With `all`, the search returns customers in groups `1` and `2` and all other groups specified in the list.
+ With `none`, the search returns customers not in groups `i` or `ii` or any other group specified in the list.
+
+ If any of the search conditions are not met, including when an invalid or non-existent group ID is provided,
+ the result is an empty object (`{}`).
+ """
+
+ custom_attribute: typing.Optional[CustomerCustomAttributeFilters] = pydantic.Field(default=None)
+ """
+ A filter to select customers based on one or more custom attributes.
+ This filter can contain up to 10 custom attribute filters. Each custom attribute filter specifies filtering criteria for a target custom
+ attribute. If multiple custom attribute filters are provided, they are combined as an `AND` operation.
+
+ To be valid for a search, the custom attributes must be visible to the requesting application. For more information, including example queries,
+ see [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute).
+
+ Square returns matching customer profiles, which do not contain custom attributes. To retrieve customer-related custom attributes,
+ use the [Customer Custom Attributes API](api:CustomerCustomAttributes). For example, you can call
+ [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) using a customer ID from the result set.
+ """
+
+ segment_ids: typing.Optional[FilterValue] = pydantic.Field(default=None)
+ """
+ A filter to select customers based on the [segments](entity:CustomerSegment) they belong to.
+ Segment membership is dynamic and adjusts automatically based on whether customers meet the segment criteria.
+
+ You can provide up to three segment IDs in the filter, using any combination of the `all`, `any`, and `none` fields.
+ For the following example, the results include customers who belong to both segment A and segment B but do not belong to segment C.
+
+ ```
+ "segment_ids": {
+ "all": ["{segment_A_id}", "{segment_B_id}"],
+ "none": ["{segment_C_id}"]
+ }
+ ```
+
+ If an invalid or non-existent segment ID is provided in the filter, Square stops processing the request
+ and returns a `400 BAD_REQUEST` error that includes the segment ID.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_group.py b/src/square/types/customer_group.py
new file mode 100644
index 00000000..99e33f18
--- /dev/null
+++ b/src/square/types/customer_group.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerGroup(UncheckedBaseModel):
+ """
+ Represents a group of customer profiles.
+
+ Customer groups can be created, be modified, and have their membership defined using
+ the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique Square-generated ID for the customer group.
+ """
+
+ name: str = pydantic.Field()
+ """
+ The name of the customer group.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the customer group was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the customer group was last updated, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_inclusion_exclusion.py b/src/square/types/customer_inclusion_exclusion.py
new file mode 100644
index 00000000..49d66f0e
--- /dev/null
+++ b/src/square/types/customer_inclusion_exclusion.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CustomerInclusionExclusion = typing.Union[typing.Literal["INCLUDE", "EXCLUDE"], typing.Any]
diff --git a/src/square/types/customer_preferences.py b/src/square/types/customer_preferences.py
new file mode 100644
index 00000000..a41c9529
--- /dev/null
+++ b/src/square/types/customer_preferences.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerPreferences(UncheckedBaseModel):
+ """
+ Represents communication preferences for the customer profile.
+ """
+
+ email_unsubscribed: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the customer has unsubscribed from marketing campaign emails. A value of `true` means that the customer chose to opt out of email marketing from the current Square seller or from all Square sellers. This value is read-only from the Customers API.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_query.py b/src/square/types/customer_query.py
new file mode 100644
index 00000000..c661fbaf
--- /dev/null
+++ b/src/square/types/customer_query.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_filter import CustomerFilter
+from .customer_sort import CustomerSort
+
+
+class CustomerQuery(UncheckedBaseModel):
+ """
+ Represents filtering and sorting criteria for a [SearchCustomers](api-endpoint:Customers-SearchCustomers) request.
+ """
+
+ filter: typing.Optional[CustomerFilter] = pydantic.Field(default=None)
+ """
+ The filtering criteria for the search query. A query can contain multiple filters in any combination.
+ Multiple filters are combined as `AND` statements.
+
+ __Note:__ Combining multiple filters as `OR` statements is not supported. Instead, send multiple single-filter
+ searches and join the result sets.
+ """
+
+ sort: typing.Optional[CustomerSort] = pydantic.Field(default=None)
+ """
+ Sorting criteria for query results. The default behavior is to sort
+ customers alphabetically by `given_name` and `family_name`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_segment.py b/src/square/types/customer_segment.py
new file mode 100644
index 00000000..7b56625d
--- /dev/null
+++ b/src/square/types/customer_segment.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerSegment(UncheckedBaseModel):
+ """
+ Represents a group of customer profiles that match one or more predefined filter criteria.
+
+ Segments (also known as Smart Groups) are defined and created within the Customer Directory in the
+ Square Seller Dashboard or Point of Sale.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique Square-generated ID for the segment.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the segment.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the segment was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the segment was last updated, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_sort.py b/src/square/types/customer_sort.py
new file mode 100644
index 00000000..f9ecc310
--- /dev/null
+++ b/src/square/types/customer_sort.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_sort_field import CustomerSortField
+from .sort_order import SortOrder
+
+
+class CustomerSort(UncheckedBaseModel):
+ """
+ Represents the sorting criteria in a [search query](entity:CustomerQuery) that defines how to sort
+ customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results.
+ """
+
+ field: typing.Optional[CustomerSortField] = pydantic.Field(default=None)
+ """
+ Indicates the fields to use as the sort key, which is either the default set of fields or `created_at`.
+
+ The default value is `DEFAULT`.
+ See [CustomerSortField](#type-customersortfield) for possible values
+ """
+
+ order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ Indicates the order in which results should be sorted based on the
+ sort field value. Strings use standard alphabetic comparison
+ to determine order. Strings representing numbers are sorted as strings.
+
+ The default value is `ASC`.
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_sort_field.py b/src/square/types/customer_sort_field.py
new file mode 100644
index 00000000..17fc0c6f
--- /dev/null
+++ b/src/square/types/customer_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CustomerSortField = typing.Union[typing.Literal["DEFAULT", "CREATED_AT"], typing.Any]
diff --git a/src/square/types/customer_tax_ids.py b/src/square/types/customer_tax_ids.py
new file mode 100644
index 00000000..24f26508
--- /dev/null
+++ b/src/square/types/customer_tax_ids.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerTaxIds(UncheckedBaseModel):
+ """
+ Represents the tax ID associated with a [customer profile](entity:Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom.
+ For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
+ """
+
+ eu_vat: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The EU VAT identification number for the customer. For example, `IE3426675K`. The ID can contain alphanumeric characters only.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_text_filter.py b/src/square/types/customer_text_filter.py
new file mode 100644
index 00000000..281a03c7
--- /dev/null
+++ b/src/square/types/customer_text_filter.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerTextFilter(UncheckedBaseModel):
+ """
+ A filter to select customers based on exact or fuzzy matching of
+ customer attributes against a specified query. Depending on the customer attributes,
+ the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both.
+ """
+
+ exact: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Use the exact filter to select customers whose attributes match exactly the specified query.
+ """
+
+ fuzzy: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Use the fuzzy filter to select customers whose attributes match the specified query
+ in a fuzzy manner. When the fuzzy option is used, search queries are tokenized, and then
+ each query token must be matched somewhere in the searched attribute. For single token queries,
+ this is effectively the same behavior as a partial match operation.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_updated_event.py b/src/square/types/customer_updated_event.py
new file mode 100644
index 00000000..04190025
--- /dev/null
+++ b/src/square/types/customer_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_updated_event_data import CustomerUpdatedEventData
+
+
+class CustomerUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [customer](entity:Customer) is updated. For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks).
+
+ Updates to the 'segment_ids' customer field does not invoke a `customer.updated` event. In addition, the `customer` object in the event notification does not include this field.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this object, the value is `customer.updated`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the event, which is used for [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomerUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_updated_event_data.py b/src/square/types/customer_updated_event_data.py
new file mode 100644
index 00000000..27d91793
--- /dev/null
+++ b/src/square/types/customer_updated_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_updated_event_object import CustomerUpdatedEventObject
+
+
+class CustomerUpdatedEventData(UncheckedBaseModel):
+ """
+ The data associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `customer`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the updated customer.
+ """
+
+ object: typing.Optional[CustomerUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the updated customer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/customer_updated_event_object.py b/src/square/types/customer_updated_event_object.py
new file mode 100644
index 00000000..96efe62c
--- /dev/null
+++ b/src/square/types/customer_updated_event_object.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer import Customer
+
+
+class CustomerUpdatedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the customer associated with the event.
+ """
+
+ customer: typing.Optional[Customer] = pydantic.Field(default=None)
+ """
+ The updated customer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/data_collection_options.py b/src/square/types/data_collection_options.py
new file mode 100644
index 00000000..c1947bee
--- /dev/null
+++ b/src/square/types/data_collection_options.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .collected_data import CollectedData
+from .data_collection_options_input_type import DataCollectionOptionsInputType
+
+
+class DataCollectionOptions(UncheckedBaseModel):
+ title: str = pydantic.Field()
+ """
+ The title text to display in the data collection flow on the Terminal.
+ """
+
+ body: str = pydantic.Field()
+ """
+ The body text to display under the title in the data collection screen flow on the
+ Terminal.
+ """
+
+ input_type: DataCollectionOptionsInputType = pydantic.Field()
+ """
+ Represents the type of the input text.
+ See [InputType](#type-inputtype) for possible values
+ """
+
+ collected_data: typing.Optional[CollectedData] = pydantic.Field(default=None)
+ """
+ The buyer’s input text from the data collection screen.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/data_collection_options_input_type.py b/src/square/types/data_collection_options_input_type.py
new file mode 100644
index 00000000..341ce49b
--- /dev/null
+++ b/src/square/types/data_collection_options_input_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DataCollectionOptionsInputType = typing.Union[typing.Literal["EMAIL", "PHONE_NUMBER"], typing.Any]
diff --git a/src/square/types/date_range.py b/src/square/types/date_range.py
new file mode 100644
index 00000000..9f56f1ff
--- /dev/null
+++ b/src/square/types/date_range.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class DateRange(UncheckedBaseModel):
+ """
+ A range defined by two dates. Used for filtering a query for Connect v2
+ objects that have date properties.
+ """
+
+ start_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601
+ extended format for calendar dates.
+ The beginning of a date range (inclusive).
+ """
+
+ end_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601
+ extended format for calendar dates.
+ The end of a date range (inclusive).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/day_of_week.py b/src/square/types/day_of_week.py
new file mode 100644
index 00000000..93d23f41
--- /dev/null
+++ b/src/square/types/day_of_week.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DayOfWeek = typing.Union[typing.Literal["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"], typing.Any]
diff --git a/src/square/types/delete_booking_custom_attribute_definition_response.py b/src/square/types/delete_booking_custom_attribute_definition_response.py
new file mode 100644
index 00000000..efb04830
--- /dev/null
+++ b/src/square/types/delete_booking_custom_attribute_definition_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteBookingCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a [DeleteBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttributeDefinition) response
+ containing error messages when errors occurred during the request. The successful response does not contain any payload.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_booking_custom_attribute_response.py b/src/square/types/delete_booking_custom_attribute_response.py
new file mode 100644
index 00000000..93cfef6d
--- /dev/null
+++ b/src/square/types/delete_booking_custom_attribute_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteBookingCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a [DeleteBookingCustomAttribute](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttribute) response.
+ Either an empty object `{}` (for a successful deletion) or `errors` is present in the response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_break_type_response.py b/src/square/types/delete_break_type_response.py
new file mode 100644
index 00000000..dc138912
--- /dev/null
+++ b/src/square/types/delete_break_type_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteBreakTypeResponse(UncheckedBaseModel):
+ """
+ The response to a request to delete a `BreakType`. The response might contain a set
+ of `Error` objects if the request resulted in errors.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_catalog_object_response.py b/src/square/types/delete_catalog_object_response.py
new file mode 100644
index 00000000..e0a9a464
--- /dev/null
+++ b/src/square/types/delete_catalog_object_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteCatalogObjectResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ deleted_object_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of all catalog objects deleted by this request.
+ Multiple IDs may be returned when associated objects are also deleted, for example
+ a catalog item variation will be deleted (and its ID included in this field)
+ when its parent catalog item is deleted.
+ """
+
+ deleted_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ of this deletion in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_customer_card_response.py b/src/square/types/delete_customer_card_response.py
new file mode 100644
index 00000000..ad02e8e7
--- /dev/null
+++ b/src/square/types/delete_customer_card_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteCustomerCardResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `DeleteCustomerCard` endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_customer_custom_attribute_definition_response.py b/src/square/types/delete_customer_custom_attribute_definition_response.py
new file mode 100644
index 00000000..5c808299
--- /dev/null
+++ b/src/square/types/delete_customer_custom_attribute_definition_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteCustomerCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a response from a delete request containing error messages if there are any.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_customer_custom_attribute_response.py b/src/square/types/delete_customer_custom_attribute_response.py
new file mode 100644
index 00000000..8fc2f14e
--- /dev/null
+++ b/src/square/types/delete_customer_custom_attribute_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteCustomerCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a [DeleteCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-DeleteCustomerCustomAttribute) response.
+ Either an empty object `{}` (for a successful deletion) or `errors` is present in the response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_customer_group_response.py b/src/square/types/delete_customer_group_response.py
new file mode 100644
index 00000000..0dcb60a9
--- /dev/null
+++ b/src/square/types/delete_customer_group_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteCustomerGroupResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [DeleteCustomerGroup](api-endpoint:CustomerGroups-DeleteCustomerGroup) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_customer_response.py b/src/square/types/delete_customer_response.py
new file mode 100644
index 00000000..1939c491
--- /dev/null
+++ b/src/square/types/delete_customer_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteCustomerResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `DeleteCustomer` endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_dispute_evidence_response.py b/src/square/types/delete_dispute_evidence_response.py
new file mode 100644
index 00000000..97316658
--- /dev/null
+++ b/src/square/types/delete_dispute_evidence_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteDisputeEvidenceResponse(UncheckedBaseModel):
+ """
+ Defines the fields in a `DeleteDisputeEvidence` response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_inventory_adjustment_reason_response.py b/src/square/types/delete_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..cc770575
--- /dev/null
+++ b/src/square/types/delete_inventory_adjustment_reason_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class DeleteInventoryAdjustmentReasonResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [DeleteInventoryAdjustmentReason](api-endpoint:Inventory-DeleteInventoryAdjustmentReason).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing.Optional[InventoryAdjustmentReason] = pydantic.Field(default=None)
+ """
+ The successfully soft-deleted inventory adjustment reason.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_invoice_attachment_response.py b/src/square/types/delete_invoice_attachment_response.py
new file mode 100644
index 00000000..aad64e4b
--- /dev/null
+++ b/src/square/types/delete_invoice_attachment_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteInvoiceAttachmentResponse(UncheckedBaseModel):
+ """
+ Represents a [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_invoice_response.py b/src/square/types/delete_invoice_response.py
new file mode 100644
index 00000000..81a83ba0
--- /dev/null
+++ b/src/square/types/delete_invoice_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteInvoiceResponse(UncheckedBaseModel):
+ """
+ Describes a `DeleteInvoice` response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_location_custom_attribute_definition_response.py b/src/square/types/delete_location_custom_attribute_definition_response.py
new file mode 100644
index 00000000..ecc4f370
--- /dev/null
+++ b/src/square/types/delete_location_custom_attribute_definition_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteLocationCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a response from a delete request containing error messages if there are any.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_location_custom_attribute_response.py b/src/square/types/delete_location_custom_attribute_response.py
new file mode 100644
index 00000000..a354271d
--- /dev/null
+++ b/src/square/types/delete_location_custom_attribute_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteLocationCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a [DeleteLocationCustomAttribute](api-endpoint:LocationCustomAttributes-DeleteLocationCustomAttribute) response.
+ Either an empty object `{}` (for a successful deletion) or `errors` is present in the response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_loyalty_reward_response.py b/src/square/types/delete_loyalty_reward_response.py
new file mode 100644
index 00000000..fda4898c
--- /dev/null
+++ b/src/square/types/delete_loyalty_reward_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteLoyaltyRewardResponse(UncheckedBaseModel):
+ """
+ A response returned by the API call.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_merchant_custom_attribute_definition_response.py b/src/square/types/delete_merchant_custom_attribute_definition_response.py
new file mode 100644
index 00000000..97bcff02
--- /dev/null
+++ b/src/square/types/delete_merchant_custom_attribute_definition_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteMerchantCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a response from a delete request containing error messages if there are any.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_merchant_custom_attribute_response.py b/src/square/types/delete_merchant_custom_attribute_response.py
new file mode 100644
index 00000000..7c19340f
--- /dev/null
+++ b/src/square/types/delete_merchant_custom_attribute_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteMerchantCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a [DeleteMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-DeleteMerchantCustomAttribute) response.
+ Either an empty object `{}` (for a successful deletion) or `errors` is present in the response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_order_custom_attribute_definition_response.py b/src/square/types/delete_order_custom_attribute_definition_response.py
new file mode 100644
index 00000000..553295be
--- /dev/null
+++ b/src/square/types/delete_order_custom_attribute_definition_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteOrderCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a response from deleting an order custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_order_custom_attribute_response.py b/src/square/types/delete_order_custom_attribute_response.py
new file mode 100644
index 00000000..a62455d7
--- /dev/null
+++ b/src/square/types/delete_order_custom_attribute_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteOrderCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a response from deleting an order custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_payment_link_response.py b/src/square/types/delete_payment_link_response.py
new file mode 100644
index 00000000..c8842937
--- /dev/null
+++ b/src/square/types/delete_payment_link_response.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeletePaymentLinkResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = None
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the link that is deleted.
+ """
+
+ cancelled_order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the order that is canceled. When a payment link is deleted, Square updates the
+ the `state` (of the order that the checkout link created) to CANCELED.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_shift_response.py b/src/square/types/delete_shift_response.py
new file mode 100644
index 00000000..fbc6ef08
--- /dev/null
+++ b/src/square/types/delete_shift_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteShiftResponse(UncheckedBaseModel):
+ """
+ The response to a request to delete a `Shift`. The response might contain a set of
+ `Error` objects if the request resulted in errors.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_snippet_response.py b/src/square/types/delete_snippet_response.py
new file mode 100644
index 00000000..c120080d
--- /dev/null
+++ b/src/square/types/delete_snippet_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteSnippetResponse(UncheckedBaseModel):
+ """
+ Represents a `DeleteSnippet` response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_subscription_action_response.py b/src/square/types/delete_subscription_action_response.py
new file mode 100644
index 00000000..2076315c
--- /dev/null
+++ b/src/square/types/delete_subscription_action_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription import Subscription
+
+
+class DeleteSubscriptionActionResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response of the [DeleteSubscriptionAction](api-endpoint:Subscriptions-DeleteSubscriptionAction)
+ endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The subscription that has the specified action deleted.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_timecard_response.py b/src/square/types/delete_timecard_response.py
new file mode 100644
index 00000000..e44b2b15
--- /dev/null
+++ b/src/square/types/delete_timecard_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteTimecardResponse(UncheckedBaseModel):
+ """
+ The response to a request to delete a `Timecard`. The response might contain a set of
+ `Error` objects if the request resulted in errors.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_transfer_order_response.py b/src/square/types/delete_transfer_order_response.py
new file mode 100644
index 00000000..71e147e4
--- /dev/null
+++ b/src/square/types/delete_transfer_order_response.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteTransferOrderResponse(UncheckedBaseModel):
+ """
+ Response for deleting a transfer order
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_webhook_subscription_response.py b/src/square/types/delete_webhook_subscription_response.py
new file mode 100644
index 00000000..7a474a72
--- /dev/null
+++ b/src/square/types/delete_webhook_subscription_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DeleteWebhookSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [DeleteWebhookSubscription](api-endpoint:WebhookSubscriptions-DeleteWebhookSubscription) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/destination.py b/src/square/types/destination.py
new file mode 100644
index 00000000..77bf3f22
--- /dev/null
+++ b/src/square/types/destination.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .destination_type import DestinationType
+
+
+class Destination(UncheckedBaseModel):
+ """
+ Information about the destination against which the payout was made.
+ """
+
+ type: typing.Optional[DestinationType] = pydantic.Field(default=None)
+ """
+ Type of the destination such as a bank account or debit card.
+ See [DestinationType](#type-destinationtype) for possible values
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Square issued unique ID (also known as the instrument ID) associated with this destination.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/destination_details.py b/src/square/types/destination_details.py
new file mode 100644
index 00000000..5e73c64d
--- /dev/null
+++ b/src/square/types/destination_details.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .destination_details_card_refund_details import DestinationDetailsCardRefundDetails
+from .destination_details_cash_refund_details import DestinationDetailsCashRefundDetails
+from .destination_details_external_refund_details import DestinationDetailsExternalRefundDetails
+
+
+class DestinationDetails(UncheckedBaseModel):
+ """
+ Details about a refund's destination.
+ """
+
+ card_details: typing.Optional[DestinationDetailsCardRefundDetails] = pydantic.Field(default=None)
+ """
+ Details about a card refund. Only populated if the destination_type is `CARD`.
+ """
+
+ cash_details: typing.Optional[DestinationDetailsCashRefundDetails] = pydantic.Field(default=None)
+ """
+ Details about a cash refund. Only populated if the destination_type is `CASH`.
+ """
+
+ external_details: typing.Optional[DestinationDetailsExternalRefundDetails] = pydantic.Field(default=None)
+ """
+ Details about an external refund. Only populated if the destination_type is `EXTERNAL`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/destination_details_card_refund_details.py b/src/square/types/destination_details_card_refund_details.py
new file mode 100644
index 00000000..d40edbb7
--- /dev/null
+++ b/src/square/types/destination_details_card_refund_details.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+
+
+class DestinationDetailsCardRefundDetails(UncheckedBaseModel):
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The card's non-confidential details.
+ """
+
+ entry_method: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The method used to enter the card's details for the refund. The method can be
+ `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
+ """
+
+ auth_result_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The authorization code provided by the issuer when a refund is approved.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/destination_details_cash_refund_details.py b/src/square/types/destination_details_cash_refund_details.py
new file mode 100644
index 00000000..e9648eeb
--- /dev/null
+++ b/src/square/types/destination_details_cash_refund_details.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class DestinationDetailsCashRefundDetails(UncheckedBaseModel):
+ """
+ Stores details about a cash refund. Contains only non-confidential information.
+ """
+
+ seller_supplied_money: Money = pydantic.Field()
+ """
+ The amount and currency of the money supplied by the seller.
+ """
+
+ change_back_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of change due back to the seller.
+ This read-only field is calculated
+ from the `amount_money` and `seller_supplied_money` fields.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/destination_details_external_refund_details.py b/src/square/types/destination_details_external_refund_details.py
new file mode 100644
index 00000000..7642a756
--- /dev/null
+++ b/src/square/types/destination_details_external_refund_details.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class DestinationDetailsExternalRefundDetails(UncheckedBaseModel):
+ """
+ Stores details about an external refund. Contains only non-confidential information.
+ """
+
+ type: str = pydantic.Field()
+ """
+ The type of external refund the seller paid to the buyer. It can be one of the
+ following:
+ - CHECK - Refunded using a physical check.
+ - BANK_TRANSFER - Refunded using external bank transfer.
+ - OTHER\\_GIFT\\_CARD - Refunded using a non-Square gift card.
+ - CRYPTO - Refunded using a crypto currency.
+ - SQUARE_CASH - Refunded using Square Cash App.
+ - SOCIAL - Refunded using peer-to-peer payment applications.
+ - EXTERNAL - A third-party application gathered this refund outside of Square.
+ - EMONEY - Refunded using an E-money provider.
+ - CARD - A credit or debit card that Square does not support.
+ - STORED_BALANCE - Use for house accounts, store credit, and so forth.
+ - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals
+ - OTHER - A type not listed here.
+ """
+
+ source: str = pydantic.Field()
+ """
+ A description of the external refund source. For example,
+ "Food Delivery Service".
+ """
+
+ source_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An ID to associate the refund to its originating source.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/destination_type.py b/src/square/types/destination_type.py
new file mode 100644
index 00000000..f7545c63
--- /dev/null
+++ b/src/square/types/destination_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DestinationType = typing.Union[
+ typing.Literal["BANK_ACCOUNT", "CARD", "SQUARE_BALANCE", "SQUARE_STORED_BALANCE"], typing.Any
+]
diff --git a/src/square/types/device.py b/src/square/types/device.py
new file mode 100644
index 00000000..ef89542f
--- /dev/null
+++ b/src/square/types/device.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .component import Component
+from .device_attributes import DeviceAttributes
+from .device_status import DeviceStatus
+
+
+class Device(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A synthetic identifier for the device. The identifier includes a standardized prefix and
+ is otherwise an opaque id generated from key device fields.
+ """
+
+ attributes: DeviceAttributes = pydantic.Field()
+ """
+ A collection of DeviceAttributes representing the device.
+ """
+
+ components: typing.Optional[typing.List[Component]] = pydantic.Field(default=None)
+ """
+ A list of components applicable to the device.
+ """
+
+ status: typing.Optional[DeviceStatus] = pydantic.Field(default=None)
+ """
+ The current status of the device.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_attributes.py b/src/square/types/device_attributes.py
new file mode 100644
index 00000000..98f9d927
--- /dev/null
+++ b/src/square/types/device_attributes.py
@@ -0,0 +1,62 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_attributes_device_type import DeviceAttributesDeviceType
+
+
+class DeviceAttributes(UncheckedBaseModel):
+ type: DeviceAttributesDeviceType = pydantic.Field()
+ """
+ The device type.
+ See [DeviceType](#type-devicetype) for possible values
+ """
+
+ manufacturer: str = pydantic.Field()
+ """
+ The maker of the device.
+ """
+
+ model: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The specific model of the device.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A seller-specified name for the device.
+ """
+
+ manufacturers_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The manufacturer-supplied identifier for the device (where available). In many cases,
+ this identifier will be a serial number.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The RFC 3339-formatted value of the most recent update to the device information.
+ (Could represent any field update on the device.)
+ """
+
+ version: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The current version of software installed on the device.
+ """
+
+ merchant_token: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The merchant_token identifying the merchant controlling the device.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_attributes_device_type.py b/src/square/types/device_attributes_device_type.py
new file mode 100644
index 00000000..b1126743
--- /dev/null
+++ b/src/square/types/device_attributes_device_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DeviceAttributesDeviceType = typing.Union[typing.Literal["TERMINAL", "HANDHELD"], typing.Any]
diff --git a/src/square/types/device_checkout_options.py b/src/square/types/device_checkout_options.py
new file mode 100644
index 00000000..7bd1deda
--- /dev/null
+++ b/src/square/types/device_checkout_options.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .tip_settings import TipSettings
+
+
+class DeviceCheckoutOptions(UncheckedBaseModel):
+ device_id: str = pydantic.Field()
+ """
+ The unique ID of the device intended for this `TerminalCheckout`.
+ A list of `DeviceCode` objects can be retrieved from the /v2/devices/codes endpoint.
+ Match a `DeviceCode.device_id` value with `device_id` to get the associated device code.
+ """
+
+ skip_receipt_screen: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Instructs the device to skip the receipt screen. Defaults to false.
+ """
+
+ collect_signature: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates that signature collection is desired during checkout. Defaults to false.
+ """
+
+ tip_settings: typing.Optional[TipSettings] = pydantic.Field(default=None)
+ """
+ Tip-specific settings.
+ """
+
+ show_itemized_cart: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Show the itemization screen prior to taking a payment. This field is only meaningful when the
+ checkout includes an order ID. Defaults to true.
+ """
+
+ allow_auto_card_surcharge: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout.
+ If true, ACS is applied based on Dashboard configuration.
+ If false, ACS is not applied regardless of that configuration.
+ For more information, see [Add a Card Surcharge](https://developer.squareup.com/docs/terminal-api/additional-payment-checkout-features#add-a-card-surcharge).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_code.py b/src/square/types/device_code.py
new file mode 100644
index 00000000..7cecc1b7
--- /dev/null
+++ b/src/square/types/device_code.py
@@ -0,0 +1,76 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_code_status import DeviceCodeStatus
+from .product_type import ProductType
+
+
+class DeviceCode(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique id for this device code.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional user-defined name for the device code.
+ """
+
+ code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique code that can be used to login.
+ """
+
+ device_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique id of the device that used this code. Populated when the device is paired up.
+ """
+
+ product_type: ProductType = pydantic.Field(default="TERMINAL_API")
+ """
+ The targeting product type of the device code.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The location assigned to this code.
+ """
+
+ status: typing.Optional[DeviceCodeStatus] = pydantic.Field(default=None)
+ """
+ The pairing status of the device code.
+ See [DeviceCodeStatus](#type-devicecodestatus) for possible values
+ """
+
+ pair_by: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When this DeviceCode will expire and no longer login. Timestamp in RFC 3339 format.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When this DeviceCode was created. Timestamp in RFC 3339 format.
+ """
+
+ status_changed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When this DeviceCode's status was last changed. Timestamp in RFC 3339 format.
+ """
+
+ paired_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When this DeviceCode was paired. Timestamp in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_code_paired_event.py b/src/square/types/device_code_paired_event.py
new file mode 100644
index 00000000..248cae92
--- /dev/null
+++ b/src/square/types/device_code_paired_event.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_code_paired_event_data import DeviceCodePairedEventData
+
+
+class DeviceCodePairedEvent(UncheckedBaseModel):
+ """
+ Published when a Square Terminal has been paired with a
+ Terminal API client and the device_id of the paired Square Terminal is
+ available.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"device.code.paired"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing.Optional[DeviceCodePairedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_code_paired_event_data.py b/src/square/types/device_code_paired_event_data.py
new file mode 100644
index 00000000..43d47c29
--- /dev/null
+++ b/src/square/types/device_code_paired_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_code_paired_event_object import DeviceCodePairedEventObject
+
+
+class DeviceCodePairedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the paired object’s type, `"device_code"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the paired device code.
+ """
+
+ object: typing.Optional[DeviceCodePairedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the paired device code.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_code_paired_event_object.py b/src/square/types/device_code_paired_event_object.py
new file mode 100644
index 00000000..ec08ce88
--- /dev/null
+++ b/src/square/types/device_code_paired_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_code import DeviceCode
+
+
+class DeviceCodePairedEventObject(UncheckedBaseModel):
+ device_code: typing.Optional[DeviceCode] = pydantic.Field(default=None)
+ """
+ The created terminal checkout
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_code_status.py b/src/square/types/device_code_status.py
new file mode 100644
index 00000000..03c97af9
--- /dev/null
+++ b/src/square/types/device_code_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DeviceCodeStatus = typing.Union[typing.Literal["UNKNOWN", "UNPAIRED", "PAIRED", "EXPIRED"], typing.Any]
diff --git a/src/square/types/device_component_details_application_details.py b/src/square/types/device_component_details_application_details.py
new file mode 100644
index 00000000..5139c80b
--- /dev/null
+++ b/src/square/types/device_component_details_application_details.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .application_type import ApplicationType
+
+
+class DeviceComponentDetailsApplicationDetails(UncheckedBaseModel):
+ application_type: typing.Optional[ApplicationType] = pydantic.Field(default=None)
+ """
+ The type of application.
+ See [ApplicationType](#type-applicationtype) for possible values
+ """
+
+ version: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The version of the application.
+ """
+
+ session_location: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The location_id of the session for the application.
+ """
+
+ device_code_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the device code that was used to log in to the device.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_component_details_battery_details.py b/src/square/types/device_component_details_battery_details.py
new file mode 100644
index 00000000..1549f5a2
--- /dev/null
+++ b/src/square/types/device_component_details_battery_details.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_component_details_external_power import DeviceComponentDetailsExternalPower
+
+
+class DeviceComponentDetailsBatteryDetails(UncheckedBaseModel):
+ visible_percent: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The battery charge percentage as displayed on the device.
+ """
+
+ external_power: typing.Optional[DeviceComponentDetailsExternalPower] = pydantic.Field(default=None)
+ """
+ The status of external_power.
+ See [ExternalPower](#type-externalpower) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_component_details_card_reader_details.py b/src/square/types/device_component_details_card_reader_details.py
new file mode 100644
index 00000000..5aa48e58
--- /dev/null
+++ b/src/square/types/device_component_details_card_reader_details.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class DeviceComponentDetailsCardReaderDetails(UncheckedBaseModel):
+ version: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The version of the card reader.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_component_details_ethernet_details.py b/src/square/types/device_component_details_ethernet_details.py
new file mode 100644
index 00000000..75157df5
--- /dev/null
+++ b/src/square/types/device_component_details_ethernet_details.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class DeviceComponentDetailsEthernetDetails(UncheckedBaseModel):
+ active: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ A boolean to represent whether the Ethernet interface is currently active.
+ """
+
+ ip_address_v4: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The string representation of the device’s IPv4 address.
+ """
+
+ mac_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The mac address of the device in this network.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_component_details_external_power.py b/src/square/types/device_component_details_external_power.py
new file mode 100644
index 00000000..12242af5
--- /dev/null
+++ b/src/square/types/device_component_details_external_power.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DeviceComponentDetailsExternalPower = typing.Union[
+ typing.Literal["AVAILABLE_CHARGING", "AVAILABLE_NOT_IN_USE", "UNAVAILABLE", "AVAILABLE_INSUFFICIENT"], typing.Any
+]
diff --git a/src/square/types/device_component_details_measurement.py b/src/square/types/device_component_details_measurement.py
new file mode 100644
index 00000000..c3633d70
--- /dev/null
+++ b/src/square/types/device_component_details_measurement.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class DeviceComponentDetailsMeasurement(UncheckedBaseModel):
+ """
+ A value qualified by unit of measure.
+ """
+
+ value: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Value of measure.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_component_details_wi_fi_details.py b/src/square/types/device_component_details_wi_fi_details.py
new file mode 100644
index 00000000..1215c547
--- /dev/null
+++ b/src/square/types/device_component_details_wi_fi_details.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_component_details_measurement import DeviceComponentDetailsMeasurement
+
+
+class DeviceComponentDetailsWiFiDetails(UncheckedBaseModel):
+ active: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ A boolean to represent whether the WiFI interface is currently active.
+ """
+
+ ssid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the connected WIFI network.
+ """
+
+ ip_address_v4: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The string representation of the device’s IPv4 address.
+ """
+
+ secure_connection: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The security protocol for a secure connection (e.g. WPA2). None provided if the connection
+ is unsecured.
+ """
+
+ signal_strength: typing.Optional[DeviceComponentDetailsMeasurement] = pydantic.Field(default=None)
+ """
+ A representation of signal strength of the WIFI network connection.
+ """
+
+ mac_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The mac address of the device in this network.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_created_event.py b/src/square/types/device_created_event.py
new file mode 100644
index 00000000..4606a2a6
--- /dev/null
+++ b/src/square/types/device_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_created_event_data import DeviceCreatedEventData
+
+
+class DeviceCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a Device is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The merchant the newly created device belongs to.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents. The value is `"device.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A UUID that uniquely identifies this device creation event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the device creation event was first created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[DeviceCreatedEventData] = pydantic.Field(default=None)
+ """
+ The metadata associated with the device creation event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_created_event_data.py b/src/square/types/device_created_event_data.py
new file mode 100644
index 00000000..d6f841f6
--- /dev/null
+++ b/src/square/types/device_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_created_event_object import DeviceCreatedEventObject
+
+
+class DeviceCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `"device"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the device.
+ """
+
+ object: typing.Optional[DeviceCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created device.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_created_event_object.py b/src/square/types/device_created_event_object.py
new file mode 100644
index 00000000..605a2f0d
--- /dev/null
+++ b/src/square/types/device_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device import Device
+
+
+class DeviceCreatedEventObject(UncheckedBaseModel):
+ device: typing.Optional[Device] = pydantic.Field(default=None)
+ """
+ The created device.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_details.py b/src/square/types/device_details.py
new file mode 100644
index 00000000..e2eceead
--- /dev/null
+++ b/src/square/types/device_details.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class DeviceDetails(UncheckedBaseModel):
+ """
+ Details about the device that took the payment.
+ """
+
+ device_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-issued ID of the device.
+ """
+
+ device_installation_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-issued installation ID for the device.
+ """
+
+ device_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the device set by the seller.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_metadata.py b/src/square/types/device_metadata.py
new file mode 100644
index 00000000..4feade1d
--- /dev/null
+++ b/src/square/types/device_metadata.py
@@ -0,0 +1,82 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class DeviceMetadata(UncheckedBaseModel):
+ battery_percentage: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Terminal’s remaining battery percentage, between 1-100.
+ """
+
+ charging_state: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The current charging state of the Terminal.
+ Options: `CHARGING`, `NOT_CHARGING`
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller business location associated with the Terminal.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square merchant account that is currently signed-in to the Terminal.
+ """
+
+ network_connection_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Terminal’s current network connection type.
+ Options: `WIFI`, `ETHERNET`
+ """
+
+ payment_region: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The country in which the Terminal is authorized to take payments.
+ """
+
+ serial_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique identifier assigned to the Terminal, which can be found on the lower back
+ of the device.
+ """
+
+ os_version: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The current version of the Terminal’s operating system.
+ """
+
+ app_version: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The current version of the application running on the Terminal.
+ """
+
+ wifi_network_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the Wi-Fi network to which the Terminal is connected.
+ """
+
+ wifi_network_strength: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The signal strength of the Wi-FI network connection.
+ Options: `POOR`, `FAIR`, `GOOD`, `EXCELLENT`
+ """
+
+ ip_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The IP address of the Terminal.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_status.py b/src/square/types/device_status.py
new file mode 100644
index 00000000..b7be916e
--- /dev/null
+++ b/src/square/types/device_status.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_status_category import DeviceStatusCategory
+
+
+class DeviceStatus(UncheckedBaseModel):
+ category: typing.Optional[DeviceStatusCategory] = pydantic.Field(default=None)
+ """
+ Category of the device status.
+ See [Category](#type-category) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_status_category.py b/src/square/types/device_status_category.py
new file mode 100644
index 00000000..579bda24
--- /dev/null
+++ b/src/square/types/device_status_category.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DeviceStatusCategory = typing.Union[typing.Literal["AVAILABLE", "NEEDS_ATTENTION", "OFFLINE"], typing.Any]
diff --git a/src/square/types/digital_wallet_details.py b/src/square/types/digital_wallet_details.py
new file mode 100644
index 00000000..6950d5c4
--- /dev/null
+++ b/src/square/types/digital_wallet_details.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .cash_app_details import CashAppDetails
+from .error import Error
+from .lightning_details import LightningDetails
+
+
+class DigitalWalletDetails(UncheckedBaseModel):
+ """
+ Additional details about `WALLET` type payments. Contains only non-confidential information.
+ """
+
+ status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The status of the `WALLET` payment. The status can be `AUTHORIZED`, `CAPTURED`, `VOIDED`, or
+ `FAILED`.
+ """
+
+ brand: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The brand used for the `WALLET` payment. The brand can be `CASH_APP`, `PAYPAY`, `ALIPAY`,
+ `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY`, `LIGHTNING` or `UNKNOWN`.
+ """
+
+ cash_app_details: typing.Optional[CashAppDetails] = pydantic.Field(default=None)
+ """
+ Brand-specific details for payments with the `brand` of `CASH_APP`.
+ """
+
+ lightning_details: typing.Optional[LightningDetails] = pydantic.Field(default=None)
+ """
+ Brand-specific details for payments with the `brand` of `LIGHTNING`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the payment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dimension.py b/src/square/types/dimension.py
new file mode 100644
index 00000000..a4a6e999
--- /dev/null
+++ b/src/square/types/dimension.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dimension_granularity import DimensionGranularity
+from .dimension_order import DimensionOrder
+from .format import Format
+from .format_description import FormatDescription
+
+
+class Dimension(UncheckedBaseModel):
+ name: str
+ title: typing.Optional[str] = None
+ short_title: typing_extensions.Annotated[
+ typing.Optional[str], FieldMetadata(alias="shortTitle"), pydantic.Field(alias="shortTitle")
+ ] = None
+ description: typing.Optional[str] = None
+ type: str
+ alias_member: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="aliasMember"),
+ pydantic.Field(
+ alias="aliasMember",
+ description="When dimension is defined in View, it keeps the original path: Cube.dimension",
+ ),
+ ] = None
+ granularities: typing.Optional[typing.List[DimensionGranularity]] = None
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = None
+ format: typing.Optional[Format] = None
+ format_description: typing_extensions.Annotated[
+ typing.Optional[FormatDescription],
+ FieldMetadata(alias="formatDescription"),
+ pydantic.Field(alias="formatDescription"),
+ ] = None
+ currency: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ISO 4217 currency code in uppercase (3 characters, e.g. USD, EUR)
+ """
+
+ order: typing.Optional[DimensionOrder] = None
+ key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Key reference for the dimension
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dimension_granularity.py b/src/square/types/dimension_granularity.py
new file mode 100644
index 00000000..236d9a82
--- /dev/null
+++ b/src/square/types/dimension_granularity.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class DimensionGranularity(UncheckedBaseModel):
+ name: str
+ title: str
+ interval: typing.Optional[str] = None
+ sql: typing.Optional[str] = None
+ offset: typing.Optional[str] = None
+ origin: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dimension_order.py b/src/square/types/dimension_order.py
new file mode 100644
index 00000000..4062fa7a
--- /dev/null
+++ b/src/square/types/dimension_order.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DimensionOrder = typing.Union[typing.Literal["asc", "desc"], typing.Any]
diff --git a/src/square/types/disable_bank_account_response.py b/src/square/types/disable_bank_account_response.py
new file mode 100644
index 00000000..f084c0dc
--- /dev/null
+++ b/src/square/types/disable_bank_account_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account import BankAccount
+from .error import Error
+
+
+class DisableBankAccountResponse(UncheckedBaseModel):
+ """
+ Response object returned by `DisableBankAccount`.
+ """
+
+ bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None)
+ """
+ The disabled 'BankAccount'
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/disable_card_response.py b/src/square/types/disable_card_response.py
new file mode 100644
index 00000000..e079b1be
--- /dev/null
+++ b/src/square/types/disable_card_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+from .error import Error
+
+
+class DisableCardResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [DisableCard](api-endpoint:Cards-DisableCard) endpoint.
+
+ Note: if there are errors processing the request, the card field will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The retrieved card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/disable_events_response.py b/src/square/types/disable_events_response.py
new file mode 100644
index 00000000..a89801d1
--- /dev/null
+++ b/src/square/types/disable_events_response.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class DisableEventsResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [DisableEvents](api-endpoint:Events-DisableEvents) endpoint.
+
+ Note: if there are errors processing the request, the events field will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dismiss_terminal_action_response.py b/src/square/types/dismiss_terminal_action_response.py
new file mode 100644
index 00000000..7a8a757d
--- /dev/null
+++ b/src/square/types/dismiss_terminal_action_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_action import TerminalAction
+
+
+class DismissTerminalActionResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ action: typing.Optional[TerminalAction] = pydantic.Field(default=None)
+ """
+ Current state of the action to be dismissed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dismiss_terminal_checkout_response.py b/src/square/types/dismiss_terminal_checkout_response.py
new file mode 100644
index 00000000..795b93ca
--- /dev/null
+++ b/src/square/types/dismiss_terminal_checkout_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_checkout import TerminalCheckout
+
+
+class DismissTerminalCheckoutResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ checkout: typing.Optional[TerminalCheckout] = pydantic.Field(default=None)
+ """
+ Current state of the checkout to be dismissed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dismiss_terminal_refund_response.py b/src/square/types/dismiss_terminal_refund_response.py
new file mode 100644
index 00000000..ab0af9ca
--- /dev/null
+++ b/src/square/types/dismiss_terminal_refund_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_refund import TerminalRefund
+
+
+class DismissTerminalRefundResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ refund: typing.Optional[TerminalRefund] = pydantic.Field(default=None)
+ """
+ Current state of the refund to be dismissed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute.py b/src/square/types/dispute.py
new file mode 100644
index 00000000..5bac4a57
--- /dev/null
+++ b/src/square/types/dispute.py
@@ -0,0 +1,111 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card_brand import CardBrand
+from .dispute_reason import DisputeReason
+from .dispute_state import DisputeState
+from .disputed_payment import DisputedPayment
+from .money import Money
+
+
+class Dispute(UncheckedBaseModel):
+ """
+ Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank.
+ """
+
+ dispute_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for this `Dispute`, generated by Square.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for this `Dispute`, generated by Square.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The disputed amount, which can be less than the total transaction amount.
+ For instance, if multiple items were purchased but the cardholder only initiates a dispute over some of the items.
+ """
+
+ reason: typing.Optional[DisputeReason] = pydantic.Field(default=None)
+ """
+ The reason why the cardholder initiated the dispute.
+ See [DisputeReason](#type-disputereason) for possible values
+ """
+
+ state: typing.Optional[DisputeState] = pydantic.Field(default=None)
+ """
+ The current state of this dispute.
+ See [DisputeState](#type-disputestate) for possible values
+ """
+
+ due_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The deadline by which the seller must respond to the dispute, in [RFC 3339 format](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates).
+ """
+
+ disputed_payment: typing.Optional[DisputedPayment] = pydantic.Field(default=None)
+ """
+ The payment challenged in this dispute.
+ """
+
+ evidence_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of the evidence associated with the dispute.
+ """
+
+ card_brand: typing.Optional[CardBrand] = pydantic.Field(default=None)
+ """
+ The card brand used in the disputed payment.
+ See [CardBrand](#type-cardbrand) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the dispute was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the dispute was last updated, in RFC 3339 format.
+ """
+
+ brand_dispute_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the dispute in the card brand system, generated by the card brand.
+ """
+
+ reported_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the dispute was reported, in RFC 3339 format.
+ """
+
+ reported_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the dispute was reported, in RFC 3339 format.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The current version of the `Dispute`.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location where the dispute originated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_created_event.py b/src/square/types/dispute_created_event.py
new file mode 100644
index 00000000..5e08797d
--- /dev/null
+++ b/src/square/types/dispute_created_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_created_event_data import DisputeCreatedEventData
+
+
+class DisputeCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Dispute](entity:Dispute) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[DisputeCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_created_event_data.py b/src/square/types/dispute_created_event_data.py
new file mode 100644
index 00000000..4f0d3c6b
--- /dev/null
+++ b/src/square/types/dispute_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_created_event_object import DisputeCreatedEventObject
+
+
+class DisputeCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing.Optional[DisputeCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing fields and values relevant to the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_created_event_object.py b/src/square/types/dispute_created_event_object.py
new file mode 100644
index 00000000..25bbf23d
--- /dev/null
+++ b/src/square/types/dispute_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+
+
+class DisputeCreatedEventObject(UncheckedBaseModel):
+ object: typing.Optional[Dispute] = pydantic.Field(default=None)
+ """
+ The dispute object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence.py b/src/square/types/dispute_evidence.py
new file mode 100644
index 00000000..6a77a2ea
--- /dev/null
+++ b/src/square/types/dispute_evidence.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence_file import DisputeEvidenceFile
+from .dispute_evidence_type import DisputeEvidenceType
+
+
+class DisputeEvidence(UncheckedBaseModel):
+ evidence_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the evidence.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the evidence.
+ """
+
+ dispute_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the dispute the evidence is associated with.
+ """
+
+ evidence_file: typing.Optional[DisputeEvidenceFile] = pydantic.Field(default=None)
+ """
+ Image, PDF, TXT
+ """
+
+ evidence_text: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Raw text
+ """
+
+ uploaded_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the evidence was uploaded, in RFC 3339 format.
+ """
+
+ evidence_type: typing.Optional[DisputeEvidenceType] = pydantic.Field(default=None)
+ """
+ The type of the evidence.
+ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_added_event.py b/src/square/types/dispute_evidence_added_event.py
new file mode 100644
index 00000000..98717c54
--- /dev/null
+++ b/src/square/types/dispute_evidence_added_event.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence_added_event_data import DisputeEvidenceAddedEventData
+
+
+class DisputeEvidenceAddedEvent(UncheckedBaseModel):
+ """
+ Published when evidence is added to a [Dispute](entity:Dispute)
+ from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app,
+ or by calling either [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) or [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[DisputeEvidenceAddedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_added_event_data.py b/src/square/types/dispute_evidence_added_event_data.py
new file mode 100644
index 00000000..803af88b
--- /dev/null
+++ b/src/square/types/dispute_evidence_added_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence_added_event_object import DisputeEvidenceAddedEventObject
+
+
+class DisputeEvidenceAddedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing.Optional[DisputeEvidenceAddedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing fields and values relevant to the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_added_event_object.py b/src/square/types/dispute_evidence_added_event_object.py
new file mode 100644
index 00000000..ad5ccc25
--- /dev/null
+++ b/src/square/types/dispute_evidence_added_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+
+
+class DisputeEvidenceAddedEventObject(UncheckedBaseModel):
+ object: typing.Optional[Dispute] = pydantic.Field(default=None)
+ """
+ The dispute object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_created_event.py b/src/square/types/dispute_evidence_created_event.py
new file mode 100644
index 00000000..3f80b747
--- /dev/null
+++ b/src/square/types/dispute_evidence_created_event.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence_created_event_data import DisputeEvidenceCreatedEventData
+
+
+class DisputeEvidenceCreatedEvent(UncheckedBaseModel):
+ """
+ Published when evidence is added to a [Dispute](entity:Dispute)
+ from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app,
+ or by calling either [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) or [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[DisputeEvidenceCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_created_event_data.py b/src/square/types/dispute_evidence_created_event_data.py
new file mode 100644
index 00000000..2db83cf3
--- /dev/null
+++ b/src/square/types/dispute_evidence_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence_created_event_object import DisputeEvidenceCreatedEventObject
+
+
+class DisputeEvidenceCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing.Optional[DisputeEvidenceCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing fields and values relevant to the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_created_event_object.py b/src/square/types/dispute_evidence_created_event_object.py
new file mode 100644
index 00000000..13b3028a
--- /dev/null
+++ b/src/square/types/dispute_evidence_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+
+
+class DisputeEvidenceCreatedEventObject(UncheckedBaseModel):
+ object: typing.Optional[Dispute] = pydantic.Field(default=None)
+ """
+ The dispute object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_deleted_event.py b/src/square/types/dispute_evidence_deleted_event.py
new file mode 100644
index 00000000..869f4808
--- /dev/null
+++ b/src/square/types/dispute_evidence_deleted_event.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence_deleted_event_data import DisputeEvidenceDeletedEventData
+
+
+class DisputeEvidenceDeletedEvent(UncheckedBaseModel):
+ """
+ Published when evidence is removed from a [Dispute](entity:Dispute)
+ from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app,
+ or by calling [DeleteDisputeEvidence](api-endpoint:Disputes-DeleteDisputeEvidence).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[DisputeEvidenceDeletedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_deleted_event_data.py b/src/square/types/dispute_evidence_deleted_event_data.py
new file mode 100644
index 00000000..ac2f1932
--- /dev/null
+++ b/src/square/types/dispute_evidence_deleted_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence_deleted_event_object import DisputeEvidenceDeletedEventObject
+
+
+class DisputeEvidenceDeletedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing.Optional[DisputeEvidenceDeletedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing fields and values relevant to the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_deleted_event_object.py b/src/square/types/dispute_evidence_deleted_event_object.py
new file mode 100644
index 00000000..cfb2d197
--- /dev/null
+++ b/src/square/types/dispute_evidence_deleted_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+
+
+class DisputeEvidenceDeletedEventObject(UncheckedBaseModel):
+ object: typing.Optional[Dispute] = pydantic.Field(default=None)
+ """
+ The dispute object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_file.py b/src/square/types/dispute_evidence_file.py
new file mode 100644
index 00000000..d9391a16
--- /dev/null
+++ b/src/square/types/dispute_evidence_file.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class DisputeEvidenceFile(UncheckedBaseModel):
+ """
+ A file to be uploaded as dispute evidence.
+ """
+
+ filename: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The file name including the file extension. For example: "receipt.tiff".
+ """
+
+ filetype: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Dispute evidence files must be application/pdf, image/heic, image/heif, image/jpeg, image/png, or image/tiff formats.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_removed_event.py b/src/square/types/dispute_evidence_removed_event.py
new file mode 100644
index 00000000..0783e0cc
--- /dev/null
+++ b/src/square/types/dispute_evidence_removed_event.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence_removed_event_data import DisputeEvidenceRemovedEventData
+
+
+class DisputeEvidenceRemovedEvent(UncheckedBaseModel):
+ """
+ Published when evidence is removed from a [Dispute](entity:Dispute)
+ from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app,
+ or by calling [DeleteDisputeEvidence](api-endpoint:Disputes-DeleteDisputeEvidence).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[DisputeEvidenceRemovedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_removed_event_data.py b/src/square/types/dispute_evidence_removed_event_data.py
new file mode 100644
index 00000000..bdd0b85c
--- /dev/null
+++ b/src/square/types/dispute_evidence_removed_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence_removed_event_object import DisputeEvidenceRemovedEventObject
+
+
+class DisputeEvidenceRemovedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing.Optional[DisputeEvidenceRemovedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing fields and values relevant to the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_removed_event_object.py b/src/square/types/dispute_evidence_removed_event_object.py
new file mode 100644
index 00000000..842bf9ba
--- /dev/null
+++ b/src/square/types/dispute_evidence_removed_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+
+
+class DisputeEvidenceRemovedEventObject(UncheckedBaseModel):
+ object: typing.Optional[Dispute] = pydantic.Field(default=None)
+ """
+ The dispute object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_evidence_type.py b/src/square/types/dispute_evidence_type.py
new file mode 100644
index 00000000..1a58bd85
--- /dev/null
+++ b/src/square/types/dispute_evidence_type.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DisputeEvidenceType = typing.Union[
+ typing.Literal[
+ "GENERIC_EVIDENCE",
+ "ONLINE_OR_APP_ACCESS_LOG",
+ "AUTHORIZATION_DOCUMENTATION",
+ "CANCELLATION_OR_REFUND_DOCUMENTATION",
+ "CARDHOLDER_COMMUNICATION",
+ "CARDHOLDER_INFORMATION",
+ "PURCHASE_ACKNOWLEDGEMENT",
+ "DUPLICATE_CHARGE_DOCUMENTATION",
+ "PRODUCT_OR_SERVICE_DESCRIPTION",
+ "RECEIPT",
+ "SERVICE_RECEIVED_DOCUMENTATION",
+ "PROOF_OF_DELIVERY_DOCUMENTATION",
+ "RELATED_TRANSACTION_DOCUMENTATION",
+ "REBUTTAL_EXPLANATION",
+ "TRACKING_NUMBER",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/dispute_reason.py b/src/square/types/dispute_reason.py
new file mode 100644
index 00000000..a7288b88
--- /dev/null
+++ b/src/square/types/dispute_reason.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DisputeReason = typing.Union[
+ typing.Literal[
+ "AMOUNT_DIFFERS",
+ "CANCELLED",
+ "DUPLICATE",
+ "NO_KNOWLEDGE",
+ "NOT_AS_DESCRIBED",
+ "NOT_RECEIVED",
+ "PAID_BY_OTHER_MEANS",
+ "CUSTOMER_REQUESTS_CREDIT",
+ "EMV_LIABILITY_SHIFT",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/dispute_state.py b/src/square/types/dispute_state.py
new file mode 100644
index 00000000..b88129b7
--- /dev/null
+++ b/src/square/types/dispute_state.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+DisputeState = typing.Union[
+ typing.Literal[
+ "INQUIRY_EVIDENCE_REQUIRED",
+ "INQUIRY_PROCESSING",
+ "INQUIRY_CLOSED",
+ "EVIDENCE_REQUIRED",
+ "PROCESSING",
+ "WON",
+ "LOST",
+ "ACCEPTED",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/dispute_state_changed_event.py b/src/square/types/dispute_state_changed_event.py
new file mode 100644
index 00000000..3f6d8a7e
--- /dev/null
+++ b/src/square/types/dispute_state_changed_event.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_state_changed_event_data import DisputeStateChangedEventData
+
+
+class DisputeStateChangedEvent(UncheckedBaseModel):
+ """
+ Published when the state of a [Dispute](entity:Dispute) changes.
+ This includes the dispute resolution (WON, LOST) reported by the bank. The event
+ data includes details of what changed.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[DisputeStateChangedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_state_changed_event_data.py b/src/square/types/dispute_state_changed_event_data.py
new file mode 100644
index 00000000..37c6e938
--- /dev/null
+++ b/src/square/types/dispute_state_changed_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_state_changed_event_object import DisputeStateChangedEventObject
+
+
+class DisputeStateChangedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing.Optional[DisputeStateChangedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing fields and values relevant to the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_state_changed_event_object.py b/src/square/types/dispute_state_changed_event_object.py
new file mode 100644
index 00000000..1efce6ae
--- /dev/null
+++ b/src/square/types/dispute_state_changed_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+
+
+class DisputeStateChangedEventObject(UncheckedBaseModel):
+ object: typing.Optional[Dispute] = pydantic.Field(default=None)
+ """
+ The dispute object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_state_updated_event.py b/src/square/types/dispute_state_updated_event.py
new file mode 100644
index 00000000..770fa7d4
--- /dev/null
+++ b/src/square/types/dispute_state_updated_event.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_state_updated_event_data import DisputeStateUpdatedEventData
+
+
+class DisputeStateUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when the state of a [Dispute](entity:Dispute) changes.
+ This includes the dispute resolution (WON, LOST) reported by the bank. The event
+ data includes details of what changed.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[DisputeStateUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_state_updated_event_data.py b/src/square/types/dispute_state_updated_event_data.py
new file mode 100644
index 00000000..d409dac7
--- /dev/null
+++ b/src/square/types/dispute_state_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_state_updated_event_object import DisputeStateUpdatedEventObject
+
+
+class DisputeStateUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected dispute's type.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected dispute.
+ """
+
+ object: typing.Optional[DisputeStateUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing fields and values relevant to the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/dispute_state_updated_event_object.py b/src/square/types/dispute_state_updated_event_object.py
new file mode 100644
index 00000000..713a16cf
--- /dev/null
+++ b/src/square/types/dispute_state_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+
+
+class DisputeStateUpdatedEventObject(UncheckedBaseModel):
+ object: typing.Optional[Dispute] = pydantic.Field(default=None)
+ """
+ The dispute object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/disputed_payment.py b/src/square/types/disputed_payment.py
new file mode 100644
index 00000000..180513d8
--- /dev/null
+++ b/src/square/types/disputed_payment.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class DisputedPayment(UncheckedBaseModel):
+ """
+ The payment the cardholder disputed.
+ """
+
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Square-generated unique ID of the payment being disputed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/ecom_visibility.py b/src/square/types/ecom_visibility.py
new file mode 100644
index 00000000..281f205c
--- /dev/null
+++ b/src/square/types/ecom_visibility.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+EcomVisibility = typing.Union[typing.Literal["UNINDEXED", "UNAVAILABLE", "HIDDEN", "VISIBLE"], typing.Any]
diff --git a/src/square/types/electronic_money_details.py b/src/square/types/electronic_money_details.py
new file mode 100644
index 00000000..11f47e77
--- /dev/null
+++ b/src/square/types/electronic_money_details.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .felica_details import FelicaDetails
+
+
+class ElectronicMoneyDetails(UncheckedBaseModel):
+ """
+ Details specific to electronic money payments.
+ """
+
+ felica_details: typing.Optional[FelicaDetails] = pydantic.Field(default=None)
+ """
+ Details specific to FeliCa payments.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/employee.py b/src/square/types/employee.py
new file mode 100644
index 00000000..edf17f94
--- /dev/null
+++ b/src/square/types/employee.py
@@ -0,0 +1,78 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .employee_status import EmployeeStatus
+
+
+class Employee(UncheckedBaseModel):
+ """
+ An employee object that is used by the external API.
+
+ DEPRECATED at version 2020-08-26. Replaced by [TeamMember](entity:TeamMember).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ UUID for this object.
+ """
+
+ first_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The employee's first name.
+ """
+
+ last_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The employee's last name.
+ """
+
+ email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The employee's email address
+ """
+
+ phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The employee's phone number in E.164 format, i.e. "+12125554250"
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of location IDs where this employee has access to.
+ """
+
+ status: typing.Optional[EmployeeStatus] = pydantic.Field(default=None)
+ """
+ Specifies the status of the employees being fetched.
+ See [EmployeeStatus](#type-employeestatus) for possible values
+ """
+
+ is_owner: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether this employee is the owner of the merchant. Each merchant
+ has one owner employee, and that employee has full authority over
+ the account.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A read-only timestamp in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A read-only timestamp in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/employee_status.py b/src/square/types/employee_status.py
new file mode 100644
index 00000000..b86d6598
--- /dev/null
+++ b/src/square/types/employee_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+EmployeeStatus = typing.Union[typing.Literal["ACTIVE", "INACTIVE"], typing.Any]
diff --git a/src/square/types/employee_wage.py b/src/square/types/employee_wage.py
new file mode 100644
index 00000000..6e57c69e
--- /dev/null
+++ b/src/square/types/employee_wage.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class EmployeeWage(UncheckedBaseModel):
+ """
+ The hourly wage rate that an employee earns on a `Shift` for doing the job specified by the `title` property of this object. Deprecated at version 2020-08-26. Use [TeamMemberWage](entity:TeamMemberWage).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The UUID for this object.
+ """
+
+ employee_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `Employee` that this wage is assigned to.
+ """
+
+ title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The job title that this wage relates to.
+ """
+
+ hourly_rate: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ Can be a custom-set hourly wage or the calculated effective hourly
+ wage based on the annual wage and hours worked per week.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/enable_events_response.py b/src/square/types/enable_events_response.py
new file mode 100644
index 00000000..bcb4d43c
--- /dev/null
+++ b/src/square/types/enable_events_response.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class EnableEventsResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [EnableEvents](api-endpoint:Events-EnableEvents) endpoint.
+
+ Note: if there are errors processing the request, the events field will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/error.py b/src/square/types/error.py
new file mode 100644
index 00000000..dc72150a
--- /dev/null
+++ b/src/square/types/error.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error_category import ErrorCategory
+from .error_code import ErrorCode
+
+
+class Error(UncheckedBaseModel):
+ """
+ Represents an error encountered during a request to the Connect API.
+
+ See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information.
+ """
+
+ category: ErrorCategory = pydantic.Field()
+ """
+ The high-level category for the error.
+ See [ErrorCategory](#type-errorcategory) for possible values
+ """
+
+ code: ErrorCode = pydantic.Field()
+ """
+ The specific code of the error.
+ See [ErrorCode](#type-errorcode) for possible values
+ """
+
+ detail: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A human-readable description of the error for debugging purposes.
+ """
+
+ field: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the field provided in the original request (if any) that
+ the error pertains to.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/error_category.py b/src/square/types/error_category.py
new file mode 100644
index 00000000..6830fea8
--- /dev/null
+++ b/src/square/types/error_category.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ErrorCategory = typing.Union[
+ typing.Literal[
+ "API_ERROR",
+ "AUTHENTICATION_ERROR",
+ "INVALID_REQUEST_ERROR",
+ "RATE_LIMIT_ERROR",
+ "PAYMENT_METHOD_ERROR",
+ "REFUND_ERROR",
+ "MERCHANT_SUBSCRIPTION_ERROR",
+ "EXTERNAL_VENDOR_ERROR",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/error_code.py b/src/square/types/error_code.py
new file mode 100644
index 00000000..326c4878
--- /dev/null
+++ b/src/square/types/error_code.py
@@ -0,0 +1,164 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ErrorCode = typing.Union[
+ typing.Literal[
+ "INTERNAL_SERVER_ERROR",
+ "UNAUTHORIZED",
+ "ACCESS_TOKEN_EXPIRED",
+ "ACCESS_TOKEN_REVOKED",
+ "CLIENT_DISABLED",
+ "FORBIDDEN",
+ "INSUFFICIENT_SCOPES",
+ "APPLICATION_DISABLED",
+ "V1_APPLICATION",
+ "V1_ACCESS_TOKEN",
+ "CARD_PROCESSING_NOT_ENABLED",
+ "MERCHANT_SUBSCRIPTION_NOT_FOUND",
+ "BAD_REQUEST",
+ "MISSING_REQUIRED_PARAMETER",
+ "INCORRECT_TYPE",
+ "INVALID_TIME",
+ "INVALID_TIME_RANGE",
+ "INVALID_VALUE",
+ "INVALID_CURSOR",
+ "UNKNOWN_QUERY_PARAMETER",
+ "CONFLICTING_PARAMETERS",
+ "EXPECTED_JSON_BODY",
+ "INVALID_SORT_ORDER",
+ "VALUE_REGEX_MISMATCH",
+ "VALUE_TOO_SHORT",
+ "VALUE_TOO_LONG",
+ "VALUE_TOO_LOW",
+ "VALUE_TOO_HIGH",
+ "VALUE_EMPTY",
+ "ARRAY_LENGTH_TOO_LONG",
+ "ARRAY_LENGTH_TOO_SHORT",
+ "ARRAY_EMPTY",
+ "EXPECTED_BOOLEAN",
+ "EXPECTED_INTEGER",
+ "EXPECTED_FLOAT",
+ "EXPECTED_STRING",
+ "EXPECTED_OBJECT",
+ "EXPECTED_ARRAY",
+ "EXPECTED_MAP",
+ "EXPECTED_BASE64_ENCODED_BYTE_ARRAY",
+ "INVALID_ARRAY_VALUE",
+ "INVALID_ENUM_VALUE",
+ "INVALID_CONTENT_TYPE",
+ "INVALID_FORM_VALUE",
+ "CUSTOMER_NOT_FOUND",
+ "ONE_INSTRUMENT_EXPECTED",
+ "NO_FIELDS_SET",
+ "TOO_MANY_MAP_ENTRIES",
+ "MAP_KEY_LENGTH_TOO_SHORT",
+ "MAP_KEY_LENGTH_TOO_LONG",
+ "CUSTOMER_MISSING_NAME",
+ "CUSTOMER_MISSING_EMAIL",
+ "INVALID_PAUSE_LENGTH",
+ "INVALID_DATE",
+ "UNSUPPORTED_COUNTRY",
+ "UNSUPPORTED_CURRENCY",
+ "APPLE_TTP_PIN_TOKEN",
+ "CARD_EXPIRED",
+ "INVALID_EXPIRATION",
+ "INVALID_EXPIRATION_YEAR",
+ "INVALID_EXPIRATION_DATE",
+ "UNSUPPORTED_CARD_BRAND",
+ "UNSUPPORTED_ENTRY_METHOD",
+ "INVALID_ENCRYPTED_CARD",
+ "INVALID_CARD",
+ "PAYMENT_AMOUNT_MISMATCH",
+ "GENERIC_DECLINE",
+ "CVV_FAILURE",
+ "ADDRESS_VERIFICATION_FAILURE",
+ "INVALID_ACCOUNT",
+ "CURRENCY_MISMATCH",
+ "INSUFFICIENT_FUNDS",
+ "INSUFFICIENT_PERMISSIONS",
+ "CARDHOLDER_INSUFFICIENT_PERMISSIONS",
+ "INVALID_LOCATION",
+ "TRANSACTION_LIMIT",
+ "VOICE_FAILURE",
+ "PAN_FAILURE",
+ "EXPIRATION_FAILURE",
+ "CARD_NOT_SUPPORTED",
+ "READER_DECLINED",
+ "INVALID_PIN",
+ "MISSING_PIN",
+ "MISSING_ACCOUNT_TYPE",
+ "INVALID_POSTAL_CODE",
+ "INVALID_FEES",
+ "MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED",
+ "PAYMENT_LIMIT_EXCEEDED",
+ "GIFT_CARD_AVAILABLE_AMOUNT",
+ "ACCOUNT_UNUSABLE",
+ "BUYER_REFUSED_PAYMENT",
+ "DELAYED_TRANSACTION_EXPIRED",
+ "DELAYED_TRANSACTION_CANCELED",
+ "DELAYED_TRANSACTION_CAPTURED",
+ "DELAYED_TRANSACTION_FAILED",
+ "CARD_TOKEN_EXPIRED",
+ "CARD_TOKEN_USED",
+ "AMOUNT_TOO_HIGH",
+ "UNSUPPORTED_INSTRUMENT_TYPE",
+ "REFUND_AMOUNT_INVALID",
+ "REFUND_ALREADY_PENDING",
+ "PAYMENT_NOT_REFUNDABLE",
+ "PAYMENT_NOT_REFUNDABLE_DUE_TO_DISPUTE",
+ "REFUND_ERROR_PAYMENT_NEEDS_COMPLETION",
+ "REFUND_DECLINED",
+ "INSUFFICIENT_PERMISSIONS_FOR_REFUND",
+ "INVALID_CARD_DATA",
+ "SOURCE_USED",
+ "SOURCE_EXPIRED",
+ "UNSUPPORTED_LOYALTY_REWARD_TIER",
+ "LOCATION_MISMATCH",
+ "ORDER_UNPAID_NOT_RETURNABLE",
+ "PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED",
+ "IDEMPOTENCY_KEY_REUSED",
+ "UNEXPECTED_VALUE",
+ "SANDBOX_NOT_SUPPORTED",
+ "INVALID_EMAIL_ADDRESS",
+ "INVALID_PHONE_NUMBER",
+ "CHECKOUT_EXPIRED",
+ "BAD_CERTIFICATE",
+ "INVALID_SQUARE_VERSION_FORMAT",
+ "API_VERSION_INCOMPATIBLE",
+ "CARD_PRESENCE_REQUIRED",
+ "UNSUPPORTED_SOURCE_TYPE",
+ "CARD_MISMATCH",
+ "PLAID_ERROR",
+ "PLAID_ERROR_ITEM_LOGIN_REQUIRED",
+ "PLAID_ERROR_RATE_LIMIT",
+ "PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET",
+ "CARD_DECLINED",
+ "VERIFY_CVV_FAILURE",
+ "VERIFY_AVS_FAILURE",
+ "CARD_DECLINED_CALL_ISSUER",
+ "CARD_DECLINED_VERIFICATION_REQUIRED",
+ "BAD_EXPIRATION",
+ "CHIP_INSERTION_REQUIRED",
+ "ALLOWABLE_PIN_TRIES_EXCEEDED",
+ "RESERVATION_DECLINED",
+ "UNKNOWN_BODY_PARAMETER",
+ "NOT_FOUND",
+ "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND",
+ "METHOD_NOT_ALLOWED",
+ "NOT_ACCEPTABLE",
+ "REQUEST_TIMEOUT",
+ "CONFLICT",
+ "GONE",
+ "REQUEST_ENTITY_TOO_LARGE",
+ "UNSUPPORTED_MEDIA_TYPE",
+ "UNPROCESSABLE_ENTITY",
+ "RATE_LIMITED",
+ "NOT_IMPLEMENTED",
+ "BAD_GATEWAY",
+ "SERVICE_UNAVAILABLE",
+ "TEMPORARY_ERROR",
+ "GATEWAY_TIMEOUT",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/event.py b/src/square/types/event.py
new file mode 100644
index 00000000..e4938454
--- /dev/null
+++ b/src/square/types/event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .event_data import EventData
+
+
+class Event(UncheckedBaseModel):
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[EventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/event_data.py b/src/square/types/event_data.py
new file mode 100644
index 00000000..f552902c
--- /dev/null
+++ b/src/square/types/event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class EventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the affected object’s type.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected object.
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ This is true if the affected object has been deleted; otherwise, it's absent.
+ """
+
+ object: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
+ """
+ An object containing fields and values relevant to the event. It is absent if the affected object has been deleted.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/event_metadata.py b/src/square/types/event_metadata.py
new file mode 100644
index 00000000..d102f5e2
--- /dev/null
+++ b/src/square/types/event_metadata.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class EventMetadata(UncheckedBaseModel):
+ """
+ Contains metadata about a particular [Event](entity:Event).
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ api_version: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The API version of the event. This corresponds to the default API version of the developer application at the time when the event was created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/event_type_metadata.py b/src/square/types/event_type_metadata.py
new file mode 100644
index 00000000..b1bbcbc6
--- /dev/null
+++ b/src/square/types/event_type_metadata.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class EventTypeMetadata(UncheckedBaseModel):
+ """
+ Contains the metadata of a webhook event type.
+ """
+
+ event_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The event type.
+ """
+
+ api_version_introduced: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The API version at which the event type was introduced.
+ """
+
+ release_status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The release status of the event type.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/exclude_strategy.py b/src/square/types/exclude_strategy.py
new file mode 100644
index 00000000..270d9c32
--- /dev/null
+++ b/src/square/types/exclude_strategy.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ExcludeStrategy = typing.Union[
+ typing.Literal["LEAST_EXPENSIVE", "MOST_EXPENSIVE", "MOST_EXPENSIVE_LOWEST_VALUE"], typing.Any
+]
diff --git a/src/square/types/external_payment_details.py b/src/square/types/external_payment_details.py
new file mode 100644
index 00000000..1eff2b2f
--- /dev/null
+++ b/src/square/types/external_payment_details.py
@@ -0,0 +1,59 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class ExternalPaymentDetails(UncheckedBaseModel):
+ """
+ Stores details about an external payment. Contains only non-confidential information.
+ For more information, see
+ [Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments).
+ """
+
+ type: str = pydantic.Field()
+ """
+ The type of external payment the seller received. It can be one of the following:
+ - CHECK - Paid using a physical check.
+ - BANK_TRANSFER - Paid using external bank transfer.
+ - OTHER\\_GIFT\\_CARD - Paid using a non-Square gift card.
+ - CRYPTO - Paid using a crypto currency.
+ - SQUARE_CASH - Paid using Square Cash App.
+ - SOCIAL - Paid using peer-to-peer payment applications.
+ - EXTERNAL - A third-party application gathered this payment outside of Square.
+ - EMONEY - Paid using an E-money provider.
+ - CARD - A credit or debit card that Square does not support.
+ - STORED_BALANCE - Use for house accounts, store credit, and so forth.
+ - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals
+ - OTHER - A type not listed here.
+ """
+
+ source: str = pydantic.Field()
+ """
+ A description of the external payment source. For example,
+ "Food Delivery Service".
+ """
+
+ source_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An ID to associate the payment to its originating source.
+ """
+
+ source_fee_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The fees paid to the source. The `amount_money` minus this field is
+ the net amount seller receives.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/felica_details.py b/src/square/types/felica_details.py
new file mode 100644
index 00000000..eda9ee2a
--- /dev/null
+++ b/src/square/types/felica_details.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .felica_details_felica_brand import FelicaDetailsFelicaBrand
+
+
+class FelicaDetails(UncheckedBaseModel):
+ """
+ Details for Felica payments.
+ """
+
+ terminal_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The terminal id for a Felica payment.
+ """
+
+ felica_masked_card_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The masked card number for a Felica payment.
+ """
+
+ felica_brand: typing.Optional[FelicaDetailsFelicaBrand] = pydantic.Field(default=None)
+ """
+ The Felica sub-brand of the payment.
+ See [FelicaBrand](#type-felicabrand) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/felica_details_felica_brand.py b/src/square/types/felica_details_felica_brand.py
new file mode 100644
index 00000000..fd6d3f15
--- /dev/null
+++ b/src/square/types/felica_details_felica_brand.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+FelicaDetailsFelicaBrand = typing.Union[
+ typing.Literal["UNKNOWN", "FELICA_ID", "FELICA_TRANSPORTATION", "FELICA_QP"], typing.Any
+]
diff --git a/src/square/types/filter_value.py b/src/square/types/filter_value.py
new file mode 100644
index 00000000..d7bede8d
--- /dev/null
+++ b/src/square/types/filter_value.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class FilterValue(UncheckedBaseModel):
+ """
+ A filter to select resources based on an exact field value. For any given
+ value, the value can only be in one property. Depending on the field, either
+ all properties can be set or only a subset will be available.
+
+ Refer to the documentation of the field.
+ """
+
+ all_: typing_extensions.Annotated[
+ typing.Optional[typing.List[str]],
+ FieldMetadata(alias="all"),
+ pydantic.Field(alias="all", description="A list of terms that must be present on the field of the resource."),
+ ] = None
+ any: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of terms where at least one of them must be present on the
+ field of the resource.
+ """
+
+ none: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of terms that must not be present on the field the resource
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/float_number_range.py b/src/square/types/float_number_range.py
new file mode 100644
index 00000000..26822706
--- /dev/null
+++ b/src/square/types/float_number_range.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class FloatNumberRange(UncheckedBaseModel):
+ """
+ Specifies a decimal number range.
+ """
+
+ start_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A decimal value indicating where the range starts.
+ """
+
+ end_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A decimal value indicating where the range ends.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/folder.py b/src/square/types/folder.py
new file mode 100644
index 00000000..01d458a5
--- /dev/null
+++ b/src/square/types/folder.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class Folder(UncheckedBaseModel):
+ name: str
+ members: typing.List[str]
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/format.py b/src/square/types/format.py
new file mode 100644
index 00000000..7532e4b8
--- /dev/null
+++ b/src/square/types/format.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .custom_numeric_format import CustomNumericFormat
+from .custom_time_format import CustomTimeFormat
+from .link_format import LinkFormat
+from .simple_format import SimpleFormat
+
+Format = typing.Union[SimpleFormat, LinkFormat, CustomTimeFormat, CustomNumericFormat]
diff --git a/src/square/types/format_description.py b/src/square/types/format_description.py
new file mode 100644
index 00000000..17fc5f1a
--- /dev/null
+++ b/src/square/types/format_description.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class FormatDescription(UncheckedBaseModel):
+ """
+ Resolved format description with the predefined name and d3-format specifier
+ """
+
+ name: str = pydantic.Field()
+ """
+ Predefined format name (e.g., 'percent_2', 'currency_1') or a base name like 'number', or 'custom' for ad-hoc specifiers
+ """
+
+ specifier: str = pydantic.Field()
+ """
+ d3-format specifier string (e.g., '.2f', ',.0f', '$,.2f'). See https://d3js.org/d3-format
+ """
+
+ currency: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ISO 4217 currency code in uppercase (e.g. USD, EUR). Present when a currency format is used.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/fulfillment.py b/src/square/types/fulfillment.py
new file mode 100644
index 00000000..340091ca
--- /dev/null
+++ b/src/square/types/fulfillment.py
@@ -0,0 +1,124 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .fulfillment_delivery_details import FulfillmentDeliveryDetails
+from .fulfillment_fulfillment_entry import FulfillmentFulfillmentEntry
+from .fulfillment_fulfillment_line_item_application import FulfillmentFulfillmentLineItemApplication
+from .fulfillment_in_store_details import FulfillmentInStoreDetails
+from .fulfillment_pickup_details import FulfillmentPickupDetails
+from .fulfillment_shipment_details import FulfillmentShipmentDetails
+from .fulfillment_state import FulfillmentState
+from .fulfillment_type import FulfillmentType
+
+
+class Fulfillment(UncheckedBaseModel):
+ """
+ Contains details about how to fulfill this order.
+ Orders can only be created with at most one fulfillment using the API.
+ However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the fulfillment only within this order.
+ """
+
+ type: typing.Optional[FulfillmentType] = pydantic.Field(default=None)
+ """
+ The type of the fulfillment.
+ See [FulfillmentType](#type-fulfillmenttype) for possible values
+ """
+
+ state: typing.Optional[FulfillmentState] = pydantic.Field(default=None)
+ """
+ The state of the fulfillment.
+ See [FulfillmentState](#type-fulfillmentstate) for possible values
+ """
+
+ line_item_application: typing.Optional[FulfillmentFulfillmentLineItemApplication] = pydantic.Field(default=None)
+ """
+ Describes what order line items this fulfillment applies to.
+ It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries.
+ See [FulfillmentFulfillmentLineItemApplication](#type-fulfillmentfulfillmentlineitemapplication) for possible values
+ """
+
+ entries: typing.Optional[typing.List[FulfillmentFulfillmentEntry]] = pydantic.Field(default=None)
+ """
+ A list of entries pertaining to the fulfillment of an order. Each entry must reference
+ a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to
+ fulfill.
+
+ Multiple entries can reference the same line item `uid`, as long as the total quantity among
+ all fulfillment entries referencing a single line item does not exceed the quantity of the
+ order's line item itself.
+
+ An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`,
+ `CANCELED`, or `FAILED`. Fulfillments can be created and completed independently
+ before order completion.
+ """
+
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
+ """
+ Application-defined data attached to this fulfillment. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ pickup_details: typing.Optional[FulfillmentPickupDetails] = pydantic.Field(default=None)
+ """
+ Contains details for a pickup fulfillment. These details are required when the fulfillment
+ type is `PICKUP`.
+ """
+
+ shipment_details: typing.Optional[FulfillmentShipmentDetails] = pydantic.Field(default=None)
+ """
+ Contains details for a shipment fulfillment. These details are required when the fulfillment type
+ is `SHIPMENT`.
+
+ A shipment fulfillment's relationship to fulfillment `state`:
+ `PROPOSED`: A shipment is requested.
+ `RESERVED`: Fulfillment in progress. Shipment processing.
+ `PREPARED`: Shipment packaged. Shipping label created.
+ `COMPLETED`: Package has been shipped.
+ `CANCELED`: Shipment has been canceled.
+ `FAILED`: Shipment has failed.
+ """
+
+ delivery_details: typing.Optional[FulfillmentDeliveryDetails] = pydantic.Field(default=None)
+ """
+ Describes delivery details of an order fulfillment.
+ """
+
+ in_store_details: typing.Optional[FulfillmentInStoreDetails] = pydantic.Field(default=None)
+ """
+ Contains details for an in-store fulfillment. These details are required when the fulfillment
+ type is `IN_STORE`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/fulfillment_delivery_details.py b/src/square/types/fulfillment_delivery_details.py
new file mode 100644
index 00000000..2b652078
--- /dev/null
+++ b/src/square/types/fulfillment_delivery_details.py
@@ -0,0 +1,195 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .fulfillment_delivery_details_order_fulfillment_delivery_details_schedule_type import (
+ FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType,
+)
+from .fulfillment_recipient import FulfillmentRecipient
+
+
+class FulfillmentDeliveryDetails(UncheckedBaseModel):
+ """
+ Describes delivery details of an order fulfillment.
+ """
+
+ recipient: typing.Optional[FulfillmentRecipient] = pydantic.Field(default=None)
+ """
+ The contact information for the person to receive the fulfillment.
+ """
+
+ schedule_type: typing.Optional[FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType] = (
+ pydantic.Field(default=None)
+ )
+ """
+ Indicates the fulfillment delivery schedule type. If `SCHEDULED`, then
+ `deliver_at` is required. The default is `SCHEDULED`.
+ See [OrderFulfillmentDeliveryDetailsScheduleType](#type-orderfulfillmentdeliverydetailsscheduletype) for possible values
+ """
+
+ placed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was placed.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+
+ Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z".
+ """
+
+ deliver_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ that represents the start of the delivery period.
+ The application can set this field while the fulfillment `state` is
+ `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the
+ terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`).
+
+ The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+
+ For fulfillments with the schedule type `ASAP`, this is automatically set
+ to the current time plus `prep_time_duration`, if available.
+ """
+
+ prep_time_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ needed to prepare and deliver this fulfillment.
+ The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse
+ "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.
+ """
+
+ delivery_window_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ after `deliver_at` in which to deliver the order.
+ Applications can set this field when the fulfillment `state` is
+ `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state
+ such as `COMPLETED`, `CANCELED`, and `FAILED`).
+
+ The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse
+ "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Provides additional instructions about the delivery fulfillment.
+ It is displayed in the Square Point of Sale application and set by the API.
+ """
+
+ completed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicates when the seller completed the fulfillment.
+ This field is automatically set when fulfillment `state` changes to `COMPLETED`.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ in_progress_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicates when the seller started processing the fulfillment.
+ This field is automatically set when the fulfillment `state` changes to `RESERVED`.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ rejected_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was rejected. This field is
+ automatically set when the fulfillment `state` changes to `FAILED`.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ ready_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the seller marked the fulfillment as ready for
+ courier pickup. This field is automatically set when the fulfillment `state` changes
+ to PREPARED.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ delivered_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was delivered to the recipient.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ canceled_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was canceled. This field is automatically
+ set when the fulfillment `state` changes to `CANCELED`.
+
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ cancel_reason: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The delivery cancellation reason. Max length: 100 characters.
+ """
+
+ courier_pickup_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when an order can be picked up by the courier for delivery.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ courier_pickup_window_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ after `courier_pickup_at` in which the courier should pick up the order.
+ The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse
+ "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.
+ """
+
+ is_no_contact_delivery: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the delivery is preferred to be no contact.
+ """
+
+ dropoff_notes: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note to provide additional instructions about how to deliver the order.
+ """
+
+ courier_provider_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the courier provider.
+ """
+
+ courier_support_phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The support phone number of the courier.
+ """
+
+ square_delivery_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The identifier for the delivery created by Square.
+ """
+
+ external_delivery_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The identifier for the delivery created by the third-party courier service.
+ """
+
+ managed_delivery: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ The flag to indicate the delivery is managed by a third party (ie DoorDash), which means
+ we may not receive all recipient information for PII purposes.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/fulfillment_delivery_details_order_fulfillment_delivery_details_schedule_type.py b/src/square/types/fulfillment_delivery_details_order_fulfillment_delivery_details_schedule_type.py
new file mode 100644
index 00000000..a4c286f1
--- /dev/null
+++ b/src/square/types/fulfillment_delivery_details_order_fulfillment_delivery_details_schedule_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType = typing.Union[
+ typing.Literal["SCHEDULED", "ASAP"], typing.Any
+]
diff --git a/src/square/types/fulfillment_fulfillment_entry.py b/src/square/types/fulfillment_fulfillment_entry.py
new file mode 100644
index 00000000..43dc3c08
--- /dev/null
+++ b/src/square/types/fulfillment_fulfillment_entry.py
@@ -0,0 +1,65 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class FulfillmentFulfillmentEntry(UncheckedBaseModel):
+ """
+ Links an order line item to a fulfillment. Each entry must reference
+ a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to
+ fulfill.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the fulfillment entry only within this order.
+ """
+
+ line_item_uid: str = pydantic.Field()
+ """
+ The `uid` from the order line item.
+ """
+
+ quantity: str = pydantic.Field()
+ """
+ The quantity of the line item being fulfilled, formatted as a decimal number.
+ For example, `"3"`.
+
+ Fulfillments for line items with a `quantity_unit` can have non-integer quantities.
+ For example, `"1.70000"`.
+ """
+
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
+ """
+ Application-defined data attached to this fulfillment entry. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/fulfillment_fulfillment_line_item_application.py b/src/square/types/fulfillment_fulfillment_line_item_application.py
new file mode 100644
index 00000000..3440f67c
--- /dev/null
+++ b/src/square/types/fulfillment_fulfillment_line_item_application.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+FulfillmentFulfillmentLineItemApplication = typing.Union[typing.Literal["ALL", "ENTRY_LIST"], typing.Any]
diff --git a/src/square/types/fulfillment_in_store_details.py b/src/square/types/fulfillment_in_store_details.py
new file mode 100644
index 00000000..6b50f164
--- /dev/null
+++ b/src/square/types/fulfillment_in_store_details.py
@@ -0,0 +1,72 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .fulfillment_recipient import FulfillmentRecipient
+
+
+class FulfillmentInStoreDetails(UncheckedBaseModel):
+ """
+ Contains the details necessary to fulfill an in-store order.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note to provide additional instructions about the in-store fulfillment
+ displayed in the Square Point of Sale application and set by the API.
+ """
+
+ recipient: typing.Optional[FulfillmentRecipient] = pydantic.Field(default=None)
+ """
+ Information about the person to receive this in-store fulfillment.
+ """
+
+ placed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ completed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was completed. This field is automatically set when the
+ fulfillment `state` changes to `COMPLETED`. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ in_progress_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicates when the seller started processing the fulfillment.
+ This field is automatically set when the fulfillment `state` changes to `RESERVED`.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ prepared_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was moved to the `PREPARED` state, which indicates that the
+ fulfillment is ready. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ canceled_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was canceled. This field is automatically set when the
+ fulfillment `state` changes to `CANCELED`. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/fulfillment_pickup_details.py b/src/square/types/fulfillment_pickup_details.py
new file mode 100644
index 00000000..fc378083
--- /dev/null
+++ b/src/square/types/fulfillment_pickup_details.py
@@ -0,0 +1,155 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .fulfillment_pickup_details_curbside_pickup_details import FulfillmentPickupDetailsCurbsidePickupDetails
+from .fulfillment_pickup_details_schedule_type import FulfillmentPickupDetailsScheduleType
+from .fulfillment_recipient import FulfillmentRecipient
+
+
+class FulfillmentPickupDetails(UncheckedBaseModel):
+ """
+ Contains details necessary to fulfill a pickup order.
+ """
+
+ recipient: typing.Optional[FulfillmentRecipient] = pydantic.Field(default=None)
+ """
+ Information about the person to pick up this fulfillment from a physical
+ location.
+ """
+
+ expires_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when this fulfillment expires if it is not marked in progress. The timestamp must be
+ in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set
+ up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order
+ are automatically completed.
+ """
+
+ auto_complete_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ after which an in-progress pickup fulfillment is automatically moved
+ to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "PT4H" for 4 hours).
+
+ If not set, this pickup fulfillment remains in progress until it is canceled or completed.
+ """
+
+ schedule_type: typing.Optional[FulfillmentPickupDetailsScheduleType] = pydantic.Field(default=None)
+ """
+ The schedule type of the pickup fulfillment. Defaults to `SCHEDULED`.
+ See [FulfillmentPickupDetailsScheduleType](#type-fulfillmentpickupdetailsscheduletype) for possible values
+ """
+
+ pickup_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g.,
+ "2016-09-04T23:59:33.123Z".
+
+ For fulfillments with the schedule type `ASAP`, this is automatically set
+ to the current time plus `prep_time_duration`, if available.
+ """
+
+ pickup_window_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ in which the order should be picked up after the `pickup_at` timestamp.
+ The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse
+ "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.
+
+ Can be used as an informational guideline for merchants.
+ """
+
+ prep_time_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ needed to prepare this fulfillment.
+ The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse
+ "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note to provide additional instructions about the pickup
+ fulfillment displayed in the Square Point of Sale application and set by the API.
+ """
+
+ placed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ accepted_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ rejected_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ ready_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ expired_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment expired. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ picked_up_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ canceled_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ cancel_reason: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A description of why the pickup was canceled. The maximum length: 100 characters.
+ """
+
+ is_curbside_pickup: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup.
+ """
+
+ curbside_pickup_details: typing.Optional[FulfillmentPickupDetailsCurbsidePickupDetails] = pydantic.Field(
+ default=None
+ )
+ """
+ Specific details for curbside pickup. These details can only be populated if `is_curbside_pickup` is set to `true`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/fulfillment_pickup_details_curbside_pickup_details.py b/src/square/types/fulfillment_pickup_details_curbside_pickup_details.py
new file mode 100644
index 00000000..7e13579c
--- /dev/null
+++ b/src/square/types/fulfillment_pickup_details_curbside_pickup_details.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class FulfillmentPickupDetailsCurbsidePickupDetails(UncheckedBaseModel):
+ """
+ Specific details for curbside pickup.
+ """
+
+ curbside_details: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Specific details for curbside pickup, such as parking number and vehicle model.
+ """
+
+ buyer_arrived_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/fulfillment_pickup_details_schedule_type.py b/src/square/types/fulfillment_pickup_details_schedule_type.py
new file mode 100644
index 00000000..45662f4c
--- /dev/null
+++ b/src/square/types/fulfillment_pickup_details_schedule_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+FulfillmentPickupDetailsScheduleType = typing.Union[typing.Literal["SCHEDULED", "ASAP"], typing.Any]
diff --git a/src/square/types/fulfillment_recipient.py b/src/square/types/fulfillment_recipient.py
new file mode 100644
index 00000000..63f773bf
--- /dev/null
+++ b/src/square/types/fulfillment_recipient.py
@@ -0,0 +1,67 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+
+
+class FulfillmentRecipient(UncheckedBaseModel):
+ """
+ Information about the fulfillment recipient.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the customer associated with the fulfillment.
+
+ If `customer_id` is provided, the fulfillment recipient's `display_name`,
+ `email_address`, and `phone_number` are automatically populated from the
+ targeted customer profile. If these fields are set in the request, the request
+ values override the information from the customer profile. If the
+ targeted customer profile does not contain the necessary information and
+ these fields are left unset, the request results in an error.
+ """
+
+ display_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The display name of the fulfillment recipient. This field is required.
+
+ If provided, the display name overrides the corresponding customer profile value
+ indicated by `customer_id`.
+ """
+
+ email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address of the fulfillment recipient.
+
+ If provided, the email address overrides the corresponding customer profile value
+ indicated by `customer_id`.
+ """
+
+ phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The phone number of the fulfillment recipient. This field is required.
+
+ If provided, the phone number overrides the corresponding customer profile value
+ indicated by `customer_id`.
+ """
+
+ address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The address of the fulfillment recipient. This field is required.
+
+ If provided, the address overrides the corresponding customer profile value
+ indicated by `customer_id`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/fulfillment_shipment_details.py b/src/square/types/fulfillment_shipment_details.py
new file mode 100644
index 00000000..781c03d5
--- /dev/null
+++ b/src/square/types/fulfillment_shipment_details.py
@@ -0,0 +1,114 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .fulfillment_recipient import FulfillmentRecipient
+
+
+class FulfillmentShipmentDetails(UncheckedBaseModel):
+ """
+ Contains the details necessary to fulfill a shipment order.
+ """
+
+ recipient: typing.Optional[FulfillmentRecipient] = pydantic.Field(default=None)
+ """
+ Information about the person to receive this shipment fulfillment.
+ """
+
+ carrier: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS).
+ """
+
+ shipping_note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note with additional information for the shipping carrier.
+ """
+
+ shipping_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A description of the type of shipping product purchased from the carrier
+ (such as First Class, Priority, or Express).
+ """
+
+ tracking_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The reference number provided by the carrier to track the shipment's progress.
+ """
+
+ tracking_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A link to the tracking webpage on the carrier's website.
+ """
+
+ placed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the shipment was requested. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ in_progress_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation
+ of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ packaged_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the
+ fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ expected_shipped_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the shipment is expected to be delivered to the shipping carrier.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ shipped_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that
+ the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ canceled_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating the shipment was canceled.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ cancel_reason: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A description of why the shipment was canceled.
+ """
+
+ failed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ failure_reason: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A description of why the shipment failed to be completed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/fulfillment_state.py b/src/square/types/fulfillment_state.py
new file mode 100644
index 00000000..f6978207
--- /dev/null
+++ b/src/square/types/fulfillment_state.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+FulfillmentState = typing.Union[
+ typing.Literal["PROPOSED", "RESERVED", "PREPARED", "COMPLETED", "CANCELED", "FAILED"], typing.Any
+]
diff --git a/src/square/types/fulfillment_type.py b/src/square/types/fulfillment_type.py
new file mode 100644
index 00000000..74d1995d
--- /dev/null
+++ b/src/square/types/fulfillment_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+FulfillmentType = typing.Union[typing.Literal["PICKUP", "SHIPMENT", "DELIVERY", "IN_STORE"], typing.Any]
diff --git a/src/square/types/get_bank_account_by_v1id_response.py b/src/square/types/get_bank_account_by_v1id_response.py
new file mode 100644
index 00000000..425a958d
--- /dev/null
+++ b/src/square/types/get_bank_account_by_v1id_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account import BankAccount
+from .error import Error
+
+
+class GetBankAccountByV1IdResponse(UncheckedBaseModel):
+ """
+ Response object returned by GetBankAccountByV1Id.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None)
+ """
+ The requested `BankAccount` object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_bank_account_response.py b/src/square/types/get_bank_account_response.py
new file mode 100644
index 00000000..81cfb0b4
--- /dev/null
+++ b/src/square/types/get_bank_account_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account import BankAccount
+from .error import Error
+
+
+class GetBankAccountResponse(UncheckedBaseModel):
+ """
+ Response object returned by `GetBankAccount`.
+ """
+
+ bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None)
+ """
+ The requested `BankAccount` object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_booking_request.py b/src/square/types/get_booking_request.py
new file mode 100644
index 00000000..bbdd6929
--- /dev/null
+++ b/src/square/types/get_booking_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetBookingRequest = typing.Any
diff --git a/src/square/types/get_booking_response.py b/src/square/types/get_booking_response.py
new file mode 100644
index 00000000..ff400562
--- /dev/null
+++ b/src/square/types/get_booking_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking import Booking
+from .error import Error
+
+
+class GetBookingResponse(UncheckedBaseModel):
+ booking: typing.Optional[Booking] = pydantic.Field(default=None)
+ """
+ The booking that was requested.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_break_type_response.py b/src/square/types/get_break_type_response.py
new file mode 100644
index 00000000..d2e6be67
--- /dev/null
+++ b/src/square/types/get_break_type_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .break_type import BreakType
+from .error import Error
+
+
+class GetBreakTypeResponse(UncheckedBaseModel):
+ """
+ The response to a request to get a `BreakType`. The response contains
+ the requested `BreakType` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ break_type: typing.Optional[BreakType] = pydantic.Field(default=None)
+ """
+ The response object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_business_booking_profile_request.py b/src/square/types/get_business_booking_profile_request.py
new file mode 100644
index 00000000..54cc04a8
--- /dev/null
+++ b/src/square/types/get_business_booking_profile_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetBusinessBookingProfileRequest = typing.Any
diff --git a/src/square/types/get_business_booking_profile_response.py b/src/square/types/get_business_booking_profile_response.py
new file mode 100644
index 00000000..07b1b002
--- /dev/null
+++ b/src/square/types/get_business_booking_profile_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .business_booking_profile import BusinessBookingProfile
+from .error import Error
+
+
+class GetBusinessBookingProfileResponse(UncheckedBaseModel):
+ business_booking_profile: typing.Optional[BusinessBookingProfile] = pydantic.Field(default=None)
+ """
+ The seller's booking profile.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_card_request.py b/src/square/types/get_card_request.py
new file mode 100644
index 00000000..edf428d3
--- /dev/null
+++ b/src/square/types/get_card_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetCardRequest = typing.Any
diff --git a/src/square/types/get_card_response.py b/src/square/types/get_card_response.py
new file mode 100644
index 00000000..e0db0941
--- /dev/null
+++ b/src/square/types/get_card_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+from .error import Error
+
+
+class GetCardResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RetrieveCard](api-endpoint:Cards-RetrieveCard) endpoint.
+
+ Note: if there are errors processing the request, the card field will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The retrieved card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_cash_drawer_shift_response.py b/src/square/types/get_cash_drawer_shift_response.py
new file mode 100644
index 00000000..fbc923aa
--- /dev/null
+++ b/src/square/types/get_cash_drawer_shift_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .cash_drawer_shift import CashDrawerShift
+from .error import Error
+
+
+class GetCashDrawerShiftResponse(UncheckedBaseModel):
+ cash_drawer_shift: typing.Optional[CashDrawerShift] = pydantic.Field(default=None)
+ """
+ The cash drawer shift queried for.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_catalog_object_response.py b/src/square/types/get_catalog_object_response.py
new file mode 100644
index 00000000..93545680
--- /dev/null
+++ b/src/square/types/get_catalog_object_response.py
@@ -0,0 +1,60 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class GetCatalogObjectResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ object: typing.Optional["CatalogObject"] = pydantic.Field(default=None)
+ """
+ The `CatalogObject`s returned.
+ """
+
+ related_objects: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ A list of `CatalogObject`s referenced by the object in the `object` field.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ GetCatalogObjectResponse,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/get_customer_custom_attribute_definition_response.py b/src/square/types/get_customer_custom_attribute_definition_response.py
new file mode 100644
index 00000000..6694089a
--- /dev/null
+++ b/src/square/types/get_customer_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class GetCustomerCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_customer_custom_attribute_response.py b/src/square/types/get_customer_custom_attribute_response.py
new file mode 100644
index 00000000..767a1e9d
--- /dev/null
+++ b/src/square/types/get_customer_custom_attribute_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class GetCustomerCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute. If `with_definition` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_customer_group_request.py b/src/square/types/get_customer_group_request.py
new file mode 100644
index 00000000..e720526f
--- /dev/null
+++ b/src/square/types/get_customer_group_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetCustomerGroupRequest = typing.Any
diff --git a/src/square/types/get_customer_group_response.py b/src/square/types/get_customer_group_response.py
new file mode 100644
index 00000000..761f6a00
--- /dev/null
+++ b/src/square/types/get_customer_group_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_group import CustomerGroup
+from .error import Error
+
+
+class GetCustomerGroupResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RetrieveCustomerGroup](api-endpoint:CustomerGroups-RetrieveCustomerGroup) endpoint.
+
+ Either `errors` or `group` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ group: typing.Optional[CustomerGroup] = pydantic.Field(default=None)
+ """
+ The retrieved customer group.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_customer_request.py b/src/square/types/get_customer_request.py
new file mode 100644
index 00000000..a0295d25
--- /dev/null
+++ b/src/square/types/get_customer_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetCustomerRequest = typing.Any
diff --git a/src/square/types/get_customer_response.py b/src/square/types/get_customer_response.py
new file mode 100644
index 00000000..fc85b0e2
--- /dev/null
+++ b/src/square/types/get_customer_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer import Customer
+from .error import Error
+
+
+class GetCustomerResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `RetrieveCustomer` endpoint.
+
+ Either `errors` or `customer` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ customer: typing.Optional[Customer] = pydantic.Field(default=None)
+ """
+ The requested customer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_customer_segment_request.py b/src/square/types/get_customer_segment_request.py
new file mode 100644
index 00000000..94551e4b
--- /dev/null
+++ b/src/square/types/get_customer_segment_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetCustomerSegmentRequest = typing.Any
diff --git a/src/square/types/get_customer_segment_response.py b/src/square/types/get_customer_segment_response.py
new file mode 100644
index 00000000..15fa22b6
--- /dev/null
+++ b/src/square/types/get_customer_segment_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_segment import CustomerSegment
+from .error import Error
+
+
+class GetCustomerSegmentResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body for requests to the `RetrieveCustomerSegment` endpoint.
+
+ Either `errors` or `segment` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ segment: typing.Optional[CustomerSegment] = pydantic.Field(default=None)
+ """
+ The retrieved customer segment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_device_code_response.py b/src/square/types/get_device_code_response.py
new file mode 100644
index 00000000..3ead359e
--- /dev/null
+++ b/src/square/types/get_device_code_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_code import DeviceCode
+from .error import Error
+
+
+class GetDeviceCodeResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ device_code: typing.Optional[DeviceCode] = pydantic.Field(default=None)
+ """
+ The queried DeviceCode.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_device_response.py b/src/square/types/get_device_response.py
new file mode 100644
index 00000000..6f1b1b27
--- /dev/null
+++ b/src/square/types/get_device_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device import Device
+from .error import Error
+
+
+class GetDeviceResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ device: typing.Optional[Device] = pydantic.Field(default=None)
+ """
+ The requested `Device`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_dispute_evidence_request.py b/src/square/types/get_dispute_evidence_request.py
new file mode 100644
index 00000000..dc44679c
--- /dev/null
+++ b/src/square/types/get_dispute_evidence_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetDisputeEvidenceRequest = typing.Any
diff --git a/src/square/types/get_dispute_evidence_response.py b/src/square/types/get_dispute_evidence_response.py
new file mode 100644
index 00000000..32d0ecad
--- /dev/null
+++ b/src/square/types/get_dispute_evidence_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence import DisputeEvidence
+from .error import Error
+
+
+class GetDisputeEvidenceResponse(UncheckedBaseModel):
+ """
+ Defines the fields in a `RetrieveDisputeEvidence` response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ evidence: typing.Optional[DisputeEvidence] = pydantic.Field(default=None)
+ """
+ Metadata about the dispute evidence file.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_dispute_request.py b/src/square/types/get_dispute_request.py
new file mode 100644
index 00000000..cf91a4c3
--- /dev/null
+++ b/src/square/types/get_dispute_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetDisputeRequest = typing.Any
diff --git a/src/square/types/get_dispute_response.py b/src/square/types/get_dispute_response.py
new file mode 100644
index 00000000..19446348
--- /dev/null
+++ b/src/square/types/get_dispute_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+from .error import Error
+
+
+class GetDisputeResponse(UncheckedBaseModel):
+ """
+ Defines fields in a `RetrieveDispute` response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ dispute: typing.Optional[Dispute] = pydantic.Field(default=None)
+ """
+ Details about the requested `Dispute`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_employee_request.py b/src/square/types/get_employee_request.py
new file mode 100644
index 00000000..8b9ca75c
--- /dev/null
+++ b/src/square/types/get_employee_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetEmployeeRequest = typing.Any
diff --git a/src/square/types/get_employee_response.py b/src/square/types/get_employee_response.py
new file mode 100644
index 00000000..b77ac9ac
--- /dev/null
+++ b/src/square/types/get_employee_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .employee import Employee
+from .error import Error
+
+
+class GetEmployeeResponse(UncheckedBaseModel):
+ employee: typing.Optional[Employee] = None
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_employee_wage_response.py b/src/square/types/get_employee_wage_response.py
new file mode 100644
index 00000000..27ecb32d
--- /dev/null
+++ b/src/square/types/get_employee_wage_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .employee_wage import EmployeeWage
+from .error import Error
+
+
+class GetEmployeeWageResponse(UncheckedBaseModel):
+ """
+ A response to a request to get an `EmployeeWage`. The response contains
+ the requested `EmployeeWage` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ employee_wage: typing.Optional[EmployeeWage] = pydantic.Field(default=None)
+ """
+ The requested `EmployeeWage` object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_gift_card_from_gan_response.py b/src/square/types/get_gift_card_from_gan_response.py
new file mode 100644
index 00000000..d216a685
--- /dev/null
+++ b/src/square/types/get_gift_card_from_gan_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .gift_card import GiftCard
+
+
+class GetGiftCardFromGanResponse(UncheckedBaseModel):
+ """
+ A response that contains a `GiftCard`. This response might contain a set of `Error` objects
+ if the request resulted in errors.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing.Optional[GiftCard] = pydantic.Field(default=None)
+ """
+ A gift card that was fetched, if present. It returns empty if an error occurred.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_gift_card_from_nonce_response.py b/src/square/types/get_gift_card_from_nonce_response.py
new file mode 100644
index 00000000..a6d8c783
--- /dev/null
+++ b/src/square/types/get_gift_card_from_nonce_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .gift_card import GiftCard
+
+
+class GetGiftCardFromNonceResponse(UncheckedBaseModel):
+ """
+ A response that contains a `GiftCard` object. If the request resulted in errors,
+ the response contains a set of `Error` objects.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing.Optional[GiftCard] = pydantic.Field(default=None)
+ """
+ The retrieved gift card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_gift_card_request.py b/src/square/types/get_gift_card_request.py
new file mode 100644
index 00000000..5e378b06
--- /dev/null
+++ b/src/square/types/get_gift_card_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetGiftCardRequest = typing.Any
diff --git a/src/square/types/get_gift_card_response.py b/src/square/types/get_gift_card_response.py
new file mode 100644
index 00000000..65b0cd3e
--- /dev/null
+++ b/src/square/types/get_gift_card_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .gift_card import GiftCard
+
+
+class GetGiftCardResponse(UncheckedBaseModel):
+ """
+ A response that contains a `GiftCard`. The response might contain a set of `Error` objects
+ if the request resulted in errors.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing.Optional[GiftCard] = pydantic.Field(default=None)
+ """
+ The gift card retrieved.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_inventory_adjustment_request.py b/src/square/types/get_inventory_adjustment_request.py
new file mode 100644
index 00000000..58d4e171
--- /dev/null
+++ b/src/square/types/get_inventory_adjustment_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetInventoryAdjustmentRequest = typing.Any
diff --git a/src/square/types/get_inventory_adjustment_response.py b/src/square/types/get_inventory_adjustment_response.py
new file mode 100644
index 00000000..d593f6d2
--- /dev/null
+++ b/src/square/types/get_inventory_adjustment_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment import InventoryAdjustment
+
+
+class GetInventoryAdjustmentResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ adjustment: typing.Optional[InventoryAdjustment] = pydantic.Field(default=None)
+ """
+ The requested [InventoryAdjustment](entity:InventoryAdjustment).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_inventory_changes_response.py b/src/square/types/get_inventory_changes_response.py
new file mode 100644
index 00000000..56302240
--- /dev/null
+++ b/src/square/types/get_inventory_changes_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_change import InventoryChange
+
+
+class GetInventoryChangesResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ changes: typing.Optional[typing.List[InventoryChange]] = pydantic.Field(default=None)
+ """
+ The set of inventory changes for the requested object and locations.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_inventory_count_response.py b/src/square/types/get_inventory_count_response.py
new file mode 100644
index 00000000..1e14ebb2
--- /dev/null
+++ b/src/square/types/get_inventory_count_response.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_count import InventoryCount
+
+
+class GetInventoryCountResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ counts: typing.Optional[typing.List[InventoryCount]] = pydantic.Field(default=None)
+ """
+ The current calculated inventory counts for the requested object and
+ locations.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_inventory_physical_count_request.py b/src/square/types/get_inventory_physical_count_request.py
new file mode 100644
index 00000000..57760a05
--- /dev/null
+++ b/src/square/types/get_inventory_physical_count_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetInventoryPhysicalCountRequest = typing.Any
diff --git a/src/square/types/get_inventory_physical_count_response.py b/src/square/types/get_inventory_physical_count_response.py
new file mode 100644
index 00000000..33df9926
--- /dev/null
+++ b/src/square/types/get_inventory_physical_count_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_physical_count import InventoryPhysicalCount
+
+
+class GetInventoryPhysicalCountResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ count: typing.Optional[InventoryPhysicalCount] = pydantic.Field(default=None)
+ """
+ The requested [InventoryPhysicalCount](entity:InventoryPhysicalCount).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_inventory_transfer_request.py b/src/square/types/get_inventory_transfer_request.py
new file mode 100644
index 00000000..ffb0d737
--- /dev/null
+++ b/src/square/types/get_inventory_transfer_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetInventoryTransferRequest = typing.Any
diff --git a/src/square/types/get_inventory_transfer_response.py b/src/square/types/get_inventory_transfer_response.py
new file mode 100644
index 00000000..50df7f75
--- /dev/null
+++ b/src/square/types/get_inventory_transfer_response.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetInventoryTransferResponse = typing.Any
diff --git a/src/square/types/get_invoice_response.py b/src/square/types/get_invoice_response.py
new file mode 100644
index 00000000..21ca0730
--- /dev/null
+++ b/src/square/types/get_invoice_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .invoice import Invoice
+
+
+class GetInvoiceResponse(UncheckedBaseModel):
+ """
+ Describes a `GetInvoice` response.
+ """
+
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The invoice requested.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_location_request.py b/src/square/types/get_location_request.py
new file mode 100644
index 00000000..d42756c0
--- /dev/null
+++ b/src/square/types/get_location_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetLocationRequest = typing.Any
diff --git a/src/square/types/get_location_response.py b/src/square/types/get_location_response.py
new file mode 100644
index 00000000..30bcf202
--- /dev/null
+++ b/src/square/types/get_location_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .location import Location
+
+
+class GetLocationResponse(UncheckedBaseModel):
+ """
+ Defines the fields that the [RetrieveLocation](api-endpoint:Locations-RetrieveLocation)
+ endpoint returns in a response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ location: typing.Optional[Location] = pydantic.Field(default=None)
+ """
+ The requested location.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_loyalty_account_request.py b/src/square/types/get_loyalty_account_request.py
new file mode 100644
index 00000000..91099540
--- /dev/null
+++ b/src/square/types/get_loyalty_account_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetLoyaltyAccountRequest = typing.Any
diff --git a/src/square/types/get_loyalty_account_response.py b/src/square/types/get_loyalty_account_response.py
new file mode 100644
index 00000000..a491a413
--- /dev/null
+++ b/src/square/types/get_loyalty_account_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_account import LoyaltyAccount
+
+
+class GetLoyaltyAccountResponse(UncheckedBaseModel):
+ """
+ A response that includes the loyalty account.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_account: typing.Optional[LoyaltyAccount] = pydantic.Field(default=None)
+ """
+ The loyalty account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_loyalty_program_request.py b/src/square/types/get_loyalty_program_request.py
new file mode 100644
index 00000000..d079e21a
--- /dev/null
+++ b/src/square/types/get_loyalty_program_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetLoyaltyProgramRequest = typing.Any
diff --git a/src/square/types/get_loyalty_program_response.py b/src/square/types/get_loyalty_program_response.py
new file mode 100644
index 00000000..d900be87
--- /dev/null
+++ b/src/square/types/get_loyalty_program_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_program import LoyaltyProgram
+
+
+class GetLoyaltyProgramResponse(UncheckedBaseModel):
+ """
+ A response that contains the loyalty program.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ program: typing.Optional[LoyaltyProgram] = pydantic.Field(default=None)
+ """
+ The loyalty program that was requested.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_loyalty_promotion_request.py b/src/square/types/get_loyalty_promotion_request.py
new file mode 100644
index 00000000..520df014
--- /dev/null
+++ b/src/square/types/get_loyalty_promotion_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetLoyaltyPromotionRequest = typing.Any
diff --git a/src/square/types/get_loyalty_promotion_response.py b/src/square/types/get_loyalty_promotion_response.py
new file mode 100644
index 00000000..96205394
--- /dev/null
+++ b/src/square/types/get_loyalty_promotion_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_promotion import LoyaltyPromotion
+
+
+class GetLoyaltyPromotionResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveLoyaltyPromotionPromotions](api-endpoint:Loyalty-RetrieveLoyaltyPromotion) response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_promotion: typing.Optional[LoyaltyPromotion] = pydantic.Field(default=None)
+ """
+ The retrieved loyalty promotion.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_loyalty_reward_request.py b/src/square/types/get_loyalty_reward_request.py
new file mode 100644
index 00000000..af544cf5
--- /dev/null
+++ b/src/square/types/get_loyalty_reward_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetLoyaltyRewardRequest = typing.Any
diff --git a/src/square/types/get_loyalty_reward_response.py b/src/square/types/get_loyalty_reward_response.py
new file mode 100644
index 00000000..8da7c923
--- /dev/null
+++ b/src/square/types/get_loyalty_reward_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_reward import LoyaltyReward
+
+
+class GetLoyaltyRewardResponse(UncheckedBaseModel):
+ """
+ A response that includes the loyalty reward.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ reward: typing.Optional[LoyaltyReward] = pydantic.Field(default=None)
+ """
+ The loyalty reward retrieved.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_merchant_request.py b/src/square/types/get_merchant_request.py
new file mode 100644
index 00000000..31660385
--- /dev/null
+++ b/src/square/types/get_merchant_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetMerchantRequest = typing.Any
diff --git a/src/square/types/get_merchant_response.py b/src/square/types/get_merchant_response.py
new file mode 100644
index 00000000..31bf69a4
--- /dev/null
+++ b/src/square/types/get_merchant_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .merchant import Merchant
+
+
+class GetMerchantResponse(UncheckedBaseModel):
+ """
+ The response object returned by the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ merchant: typing.Optional[Merchant] = pydantic.Field(default=None)
+ """
+ The requested `Merchant` object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_order_request.py b/src/square/types/get_order_request.py
new file mode 100644
index 00000000..68e52624
--- /dev/null
+++ b/src/square/types/get_order_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetOrderRequest = typing.Any
diff --git a/src/square/types/get_order_response.py b/src/square/types/get_order_response.py
new file mode 100644
index 00000000..d1c77c66
--- /dev/null
+++ b/src/square/types/get_order_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .order import Order
+
+
+class GetOrderResponse(UncheckedBaseModel):
+ order: typing.Optional[Order] = pydantic.Field(default=None)
+ """
+ The requested order.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_payment_link_request.py b/src/square/types/get_payment_link_request.py
new file mode 100644
index 00000000..c0a0874a
--- /dev/null
+++ b/src/square/types/get_payment_link_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetPaymentLinkRequest = typing.Any
diff --git a/src/square/types/get_payment_link_response.py b/src/square/types/get_payment_link_response.py
new file mode 100644
index 00000000..16683513
--- /dev/null
+++ b/src/square/types/get_payment_link_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment_link import PaymentLink
+
+
+class GetPaymentLinkResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ payment_link: typing.Optional[PaymentLink] = pydantic.Field(default=None)
+ """
+ The payment link that is retrieved.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_payment_refund_response.py b/src/square/types/get_payment_refund_response.py
new file mode 100644
index 00000000..19e44c62
--- /dev/null
+++ b/src/square/types/get_payment_refund_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment_refund import PaymentRefund
+
+
+class GetPaymentRefundResponse(UncheckedBaseModel):
+ """
+ Defines the response returned by [GetRefund](api-endpoint:Refunds-GetPaymentRefund).
+
+ Note: If there are errors processing the request, the refund field might not be
+ present or it might be present in a FAILED state.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ refund: typing.Optional[PaymentRefund] = pydantic.Field(default=None)
+ """
+ The requested `PaymentRefund`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_payment_response.py b/src/square/types/get_payment_response.py
new file mode 100644
index 00000000..fddbd224
--- /dev/null
+++ b/src/square/types/get_payment_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment import Payment
+
+
+class GetPaymentResponse(UncheckedBaseModel):
+ """
+ Defines the response returned by [GetPayment](api-endpoint:Payments-GetPayment).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ payment: typing.Optional[Payment] = pydantic.Field(default=None)
+ """
+ The requested `Payment`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_payout_response.py b/src/square/types/get_payout_response.py
new file mode 100644
index 00000000..737b8bdf
--- /dev/null
+++ b/src/square/types/get_payout_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payout import Payout
+
+
+class GetPayoutResponse(UncheckedBaseModel):
+ payout: typing.Optional[Payout] = pydantic.Field(default=None)
+ """
+ The requested payout.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_shift_response.py b/src/square/types/get_shift_response.py
new file mode 100644
index 00000000..f593773e
--- /dev/null
+++ b/src/square/types/get_shift_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .shift import Shift
+
+
+class GetShiftResponse(UncheckedBaseModel):
+ """
+ A response to a request to get a `Shift`. The response contains
+ the requested `Shift` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ shift: typing.Optional[Shift] = pydantic.Field(default=None)
+ """
+ The requested `Shift`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_snippet_request.py b/src/square/types/get_snippet_request.py
new file mode 100644
index 00000000..b7771d81
--- /dev/null
+++ b/src/square/types/get_snippet_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetSnippetRequest = typing.Any
diff --git a/src/square/types/get_snippet_response.py b/src/square/types/get_snippet_response.py
new file mode 100644
index 00000000..f5811cae
--- /dev/null
+++ b/src/square/types/get_snippet_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .snippet import Snippet
+
+
+class GetSnippetResponse(UncheckedBaseModel):
+ """
+ Represents a `RetrieveSnippet` response. The response can include either `snippet` or `errors`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ snippet: typing.Optional[Snippet] = pydantic.Field(default=None)
+ """
+ The retrieved snippet.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_subscription_response.py b/src/square/types/get_subscription_response.py
new file mode 100644
index 00000000..5ecc82a0
--- /dev/null
+++ b/src/square/types/get_subscription_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription import Subscription
+
+
+class GetSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response from the
+ [RetrieveSubscription](api-endpoint:Subscriptions-RetrieveSubscription) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The subscription retrieved.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_team_member_booking_profile_request.py b/src/square/types/get_team_member_booking_profile_request.py
new file mode 100644
index 00000000..fa1fe13f
--- /dev/null
+++ b/src/square/types/get_team_member_booking_profile_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetTeamMemberBookingProfileRequest = typing.Any
diff --git a/src/square/types/get_team_member_booking_profile_response.py b/src/square/types/get_team_member_booking_profile_response.py
new file mode 100644
index 00000000..7dde96a1
--- /dev/null
+++ b/src/square/types/get_team_member_booking_profile_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .team_member_booking_profile import TeamMemberBookingProfile
+
+
+class GetTeamMemberBookingProfileResponse(UncheckedBaseModel):
+ team_member_booking_profile: typing.Optional[TeamMemberBookingProfile] = pydantic.Field(default=None)
+ """
+ The returned team member booking profile.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_team_member_request.py b/src/square/types/get_team_member_request.py
new file mode 100644
index 00000000..41b8fcf1
--- /dev/null
+++ b/src/square/types/get_team_member_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetTeamMemberRequest = typing.Any
diff --git a/src/square/types/get_team_member_response.py b/src/square/types/get_team_member_response.py
new file mode 100644
index 00000000..72958031
--- /dev/null
+++ b/src/square/types/get_team_member_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .team_member import TeamMember
+
+
+class GetTeamMemberResponse(UncheckedBaseModel):
+ """
+ Represents a response from a retrieve request containing a `TeamMember` object or error messages.
+ """
+
+ team_member: typing.Optional[TeamMember] = pydantic.Field(default=None)
+ """
+ The successfully retrieved `TeamMember` object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_team_member_wage_response.py b/src/square/types/get_team_member_wage_response.py
new file mode 100644
index 00000000..885da26b
--- /dev/null
+++ b/src/square/types/get_team_member_wage_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .team_member_wage import TeamMemberWage
+
+
+class GetTeamMemberWageResponse(UncheckedBaseModel):
+ """
+ A response to a request to get a `TeamMemberWage`. The response contains
+ the requested `TeamMemberWage` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ team_member_wage: typing.Optional[TeamMemberWage] = pydantic.Field(default=None)
+ """
+ The requested `TeamMemberWage` object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_terminal_action_response.py b/src/square/types/get_terminal_action_response.py
new file mode 100644
index 00000000..89438e58
--- /dev/null
+++ b/src/square/types/get_terminal_action_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_action import TerminalAction
+
+
+class GetTerminalActionResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ action: typing.Optional[TerminalAction] = pydantic.Field(default=None)
+ """
+ The requested `TerminalAction`
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_terminal_checkout_response.py b/src/square/types/get_terminal_checkout_response.py
new file mode 100644
index 00000000..8f490965
--- /dev/null
+++ b/src/square/types/get_terminal_checkout_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_checkout import TerminalCheckout
+
+
+class GetTerminalCheckoutResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ checkout: typing.Optional[TerminalCheckout] = pydantic.Field(default=None)
+ """
+ The requested `TerminalCheckout`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_terminal_refund_response.py b/src/square/types/get_terminal_refund_response.py
new file mode 100644
index 00000000..b32b5d0d
--- /dev/null
+++ b/src/square/types/get_terminal_refund_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_refund import TerminalRefund
+
+
+class GetTerminalRefundResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ refund: typing.Optional[TerminalRefund] = pydantic.Field(default=None)
+ """
+ The requested `Refund`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_transaction_request.py b/src/square/types/get_transaction_request.py
new file mode 100644
index 00000000..06c29bef
--- /dev/null
+++ b/src/square/types/get_transaction_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetTransactionRequest = typing.Any
diff --git a/src/square/types/get_transaction_response.py b/src/square/types/get_transaction_response.py
new file mode 100644
index 00000000..fef6cd76
--- /dev/null
+++ b/src/square/types/get_transaction_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .transaction import Transaction
+
+
+class GetTransactionResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RetrieveTransaction](api-endpoint:Transactions-RetrieveTransaction) endpoint.
+
+ One of `errors` or `transaction` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ transaction: typing.Optional[Transaction] = pydantic.Field(default=None)
+ """
+ The requested transaction.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_vendor_request.py b/src/square/types/get_vendor_request.py
new file mode 100644
index 00000000..e6864ab9
--- /dev/null
+++ b/src/square/types/get_vendor_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetVendorRequest = typing.Any
diff --git a/src/square/types/get_vendor_response.py b/src/square/types/get_vendor_response.py
new file mode 100644
index 00000000..2bbad87c
--- /dev/null
+++ b/src/square/types/get_vendor_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .vendor import Vendor
+
+
+class GetVendorResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [RetrieveVendor](api-endpoint:Vendors-RetrieveVendor).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ vendor: typing.Optional[Vendor] = pydantic.Field(default=None)
+ """
+ The successfully retrieved [Vendor](entity:Vendor) object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_wage_setting_request.py b/src/square/types/get_wage_setting_request.py
new file mode 100644
index 00000000..32607311
--- /dev/null
+++ b/src/square/types/get_wage_setting_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetWageSettingRequest = typing.Any
diff --git a/src/square/types/get_wage_setting_response.py b/src/square/types/get_wage_setting_response.py
new file mode 100644
index 00000000..ee7ac012
--- /dev/null
+++ b/src/square/types/get_wage_setting_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .wage_setting import WageSetting
+
+
+class GetWageSettingResponse(UncheckedBaseModel):
+ """
+ Represents a response from a retrieve request containing the specified `WageSetting` object or error messages.
+ """
+
+ wage_setting: typing.Optional[WageSetting] = pydantic.Field(default=None)
+ """
+ The successfully retrieved `WageSetting` object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/get_webhook_subscription_request.py b/src/square/types/get_webhook_subscription_request.py
new file mode 100644
index 00000000..b5a574d8
--- /dev/null
+++ b/src/square/types/get_webhook_subscription_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetWebhookSubscriptionRequest = typing.Any
diff --git a/src/square/types/get_webhook_subscription_response.py b/src/square/types/get_webhook_subscription_response.py
new file mode 100644
index 00000000..c05d9cf5
--- /dev/null
+++ b/src/square/types/get_webhook_subscription_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .webhook_subscription import WebhookSubscription
+
+
+class GetWebhookSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RetrieveWebhookSubscription](api-endpoint:WebhookSubscriptions-RetrieveWebhookSubscription) endpoint.
+
+ Note: if there are errors processing the request, the [Subscription](entity:WebhookSubscription) will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ subscription: typing.Optional[WebhookSubscription] = pydantic.Field(default=None)
+ """
+ The requested [Subscription](entity:WebhookSubscription).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card.py b/src/square/types/gift_card.py
new file mode 100644
index 00000000..1b19a2e8
--- /dev/null
+++ b/src/square/types/gift_card.py
@@ -0,0 +1,74 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_gan_source import GiftCardGanSource
+from .gift_card_status import GiftCardStatus
+from .gift_card_type import GiftCardType
+from .money import Money
+
+
+class GiftCard(UncheckedBaseModel):
+ """
+ Represents a Square gift card.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the gift card.
+ """
+
+ type: GiftCardType = pydantic.Field()
+ """
+ The gift card type.
+ See [Type](#type-type) for possible values
+ """
+
+ gan_source: typing.Optional[GiftCardGanSource] = pydantic.Field(default=None)
+ """
+ The source that generated the gift card account number (GAN). The default value is `SQUARE`.
+ See [GANSource](#type-gansource) for possible values
+ """
+
+ state: typing.Optional[GiftCardStatus] = pydantic.Field(default=None)
+ """
+ The current gift card state.
+ See [Status](#type-status) for possible values
+ """
+
+ balance_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The current gift card balance. This balance is always greater than or equal to zero.
+ """
+
+ gan: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The gift card account number (GAN). Buyers can use the GAN to make purchases or check
+ the gift card balance.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the gift card was created, in RFC 3339 format.
+ In the case of a digital gift card, it is the time when you create a card
+ (using the Square Point of Sale application, Seller Dashboard, or Gift Cards API).
+ In the case of a plastic gift card, it is the time when Square associates the card with the
+ seller at the time of activation.
+ """
+
+ customer_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of the [customer profiles](entity:Customer) to whom this gift card is linked.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity.py b/src/square/types/gift_card_activity.py
new file mode 100644
index 00000000..48e89983
--- /dev/null
+++ b/src/square/types/gift_card_activity.py
@@ -0,0 +1,180 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_activate import GiftCardActivityActivate
+from .gift_card_activity_adjust_decrement import GiftCardActivityAdjustDecrement
+from .gift_card_activity_adjust_increment import GiftCardActivityAdjustIncrement
+from .gift_card_activity_block import GiftCardActivityBlock
+from .gift_card_activity_clear_balance import GiftCardActivityClearBalance
+from .gift_card_activity_deactivate import GiftCardActivityDeactivate
+from .gift_card_activity_import import GiftCardActivityImport
+from .gift_card_activity_import_reversal import GiftCardActivityImportReversal
+from .gift_card_activity_load import GiftCardActivityLoad
+from .gift_card_activity_redeem import GiftCardActivityRedeem
+from .gift_card_activity_refund import GiftCardActivityRefund
+from .gift_card_activity_transfer_balance_from import GiftCardActivityTransferBalanceFrom
+from .gift_card_activity_transfer_balance_to import GiftCardActivityTransferBalanceTo
+from .gift_card_activity_type import GiftCardActivityType
+from .gift_card_activity_unblock import GiftCardActivityUnblock
+from .gift_card_activity_unlinked_activity_refund import GiftCardActivityUnlinkedActivityRefund
+from .money import Money
+
+
+class GiftCardActivity(UncheckedBaseModel):
+ """
+ Represents an action performed on a [gift card](entity:GiftCard) that affects its state or balance.
+ A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity
+ includes a `redeem_activity_details` field that contains information about the redemption.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the gift card activity.
+ """
+
+ type: GiftCardActivityType = pydantic.Field()
+ """
+ The type of gift card activity.
+ See [Type](#type-type) for possible values
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The ID of the [business location](entity:Location) where the activity occurred.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the gift card activity was created, in RFC 3339 format.
+ """
+
+ gift_card_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The gift card ID. When creating a gift card activity, `gift_card_id` is not required if
+ `gift_card_gan` is specified.
+ """
+
+ gift_card_gan: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The gift card account number (GAN). When creating a gift card activity, `gift_card_gan`
+ is not required if `gift_card_id` is specified.
+ """
+
+ gift_card_balance_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The final balance on the gift card after the action is completed.
+ """
+
+ load_activity_details: typing.Optional[GiftCardActivityLoad] = pydantic.Field(default=None)
+ """
+ Additional details about a `LOAD` activity, which is used to reload money onto a gift card.
+ """
+
+ activate_activity_details: typing.Optional[GiftCardActivityActivate] = pydantic.Field(default=None)
+ """
+ Additional details about an `ACTIVATE` activity, which is used to activate a gift card with
+ an initial balance.
+ """
+
+ redeem_activity_details: typing.Optional[GiftCardActivityRedeem] = pydantic.Field(default=None)
+ """
+ Additional details about a `REDEEM` activity, which is used to redeem a gift card for a purchase.
+
+ For applications that process payments using the Square Payments API, Square creates a `REDEEM` activity that
+ updates the gift card balance after the corresponding [CreatePayment](api-endpoint:Payments-CreatePayment)
+ request is completed. Applications that use a custom payment processing system must call
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) to create the `REDEEM` activity.
+ """
+
+ clear_balance_activity_details: typing.Optional[GiftCardActivityClearBalance] = pydantic.Field(default=None)
+ """
+ Additional details about a `CLEAR_BALANCE` activity, which is used to set the balance of a gift card to zero.
+ """
+
+ deactivate_activity_details: typing.Optional[GiftCardActivityDeactivate] = pydantic.Field(default=None)
+ """
+ Additional details about a `DEACTIVATE` activity, which is used to deactivate a gift card.
+ """
+
+ adjust_increment_activity_details: typing.Optional[GiftCardActivityAdjustIncrement] = pydantic.Field(default=None)
+ """
+ Additional details about an `ADJUST_INCREMENT` activity, which is used to add money to a gift card
+ outside of a typical `ACTIVATE`, `LOAD`, or `REFUND` activity flow.
+ """
+
+ adjust_decrement_activity_details: typing.Optional[GiftCardActivityAdjustDecrement] = pydantic.Field(default=None)
+ """
+ Additional details about an `ADJUST_DECREMENT` activity, which is used to deduct money from a gift
+ card outside of a typical `REDEEM` activity flow.
+ """
+
+ refund_activity_details: typing.Optional[GiftCardActivityRefund] = pydantic.Field(default=None)
+ """
+ Additional details about a `REFUND` activity, which is used to add money to a gift card when
+ refunding a payment.
+
+ For applications that refund payments to a gift card using the Square Refunds API, Square automatically
+ creates a `REFUND` activity that updates the gift card balance after a [RefundPayment](api-endpoint:Refunds-RefundPayment)
+ request is completed. Applications that use a custom processing system must call
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) to create the `REFUND` activity.
+ """
+
+ unlinked_activity_refund_activity_details: typing.Optional[GiftCardActivityUnlinkedActivityRefund] = pydantic.Field(
+ default=None
+ )
+ """
+ Additional details about an `UNLINKED_ACTIVITY_REFUND` activity. This activity is used to add money
+ to a gift card when refunding a payment that was processed using a custom payment processing system
+ and not linked to the gift card.
+ """
+
+ import_activity_details: typing.Optional[GiftCardActivityImport] = pydantic.Field(default=None)
+ """
+ Additional details about an `IMPORT` activity, which Square uses to import a third-party
+ gift card with a balance.
+ """
+
+ block_activity_details: typing.Optional[GiftCardActivityBlock] = pydantic.Field(default=None)
+ """
+ Additional details about a `BLOCK` activity, which Square uses to temporarily block a gift card.
+ """
+
+ unblock_activity_details: typing.Optional[GiftCardActivityUnblock] = pydantic.Field(default=None)
+ """
+ Additional details about an `UNBLOCK` activity, which Square uses to unblock a gift card.
+ """
+
+ import_reversal_activity_details: typing.Optional[GiftCardActivityImportReversal] = pydantic.Field(default=None)
+ """
+ Additional details about an `IMPORT_REVERSAL` activity, which Square uses to reverse the
+ import of a third-party gift card.
+ """
+
+ transfer_balance_to_activity_details: typing.Optional[GiftCardActivityTransferBalanceTo] = pydantic.Field(
+ default=None
+ )
+ """
+ Additional details about a `TRANSFER_BALANCE_TO` activity, which Square uses to add money to
+ a gift card as the result of a transfer from another gift card.
+ """
+
+ transfer_balance_from_activity_details: typing.Optional[GiftCardActivityTransferBalanceFrom] = pydantic.Field(
+ default=None
+ )
+ """
+ Additional details about a `TRANSFER_BALANCE_FROM` activity, which Square uses to deduct money from
+ a gift as the result of a transfer to another gift card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_activate.py b/src/square/types/gift_card_activity_activate.py
new file mode 100644
index 00000000..17eb514e
--- /dev/null
+++ b/src/square/types/gift_card_activity_activate.py
@@ -0,0 +1,70 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class GiftCardActivityActivate(UncheckedBaseModel):
+ """
+ Represents details about an `ACTIVATE` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount added to the gift card. This value is a positive integer.
+
+ Applications that use a custom order processing system must specify this amount in the
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item.
+
+ Applications that use the Square Orders API to process orders must specify the order ID
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ line_item_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The UID of the `GIFT_CARD` line item in the order that represents the gift card purchase.
+
+ Applications that use the Square Orders API to process orders must specify the line item UID
+ in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A client-specified ID that associates the gift card activity with an entity in another system.
+
+ Applications that use a custom order processing system can use this field to track information
+ related to an order or payment.
+ """
+
+ buyer_payment_instrument_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The payment instrument IDs used to process the gift card purchase, such as a credit card ID
+ or bank account ID.
+
+ Applications that use a custom order processing system must specify payment instrument IDs in
+ the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ Square uses this information to perform compliance checks.
+
+ For applications that use the Square Orders API to process payments, Square has the necessary
+ instrument IDs to perform compliance checks.
+
+ Each buyer payment instrument ID can contain a maximum of 255 characters.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_adjust_decrement.py b/src/square/types/gift_card_activity_adjust_decrement.py
new file mode 100644
index 00000000..64b2891d
--- /dev/null
+++ b/src/square/types/gift_card_activity_adjust_decrement.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_adjust_decrement_reason import GiftCardActivityAdjustDecrementReason
+from .money import Money
+
+
+class GiftCardActivityAdjustDecrement(UncheckedBaseModel):
+ """
+ Represents details about an `ADJUST_DECREMENT` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount deducted from the gift card balance. This value is a positive integer.
+ """
+
+ reason: GiftCardActivityAdjustDecrementReason = pydantic.Field()
+ """
+ The reason the gift card balance was adjusted.
+ See [Reason](#type-reason) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_adjust_decrement_reason.py b/src/square/types/gift_card_activity_adjust_decrement_reason.py
new file mode 100644
index 00000000..e949c560
--- /dev/null
+++ b/src/square/types/gift_card_activity_adjust_decrement_reason.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardActivityAdjustDecrementReason = typing.Union[
+ typing.Literal["SUSPICIOUS_ACTIVITY", "BALANCE_ACCIDENTALLY_INCREASED", "SUPPORT_ISSUE", "PURCHASE_WAS_REFUNDED"],
+ typing.Any,
+]
diff --git a/src/square/types/gift_card_activity_adjust_increment.py b/src/square/types/gift_card_activity_adjust_increment.py
new file mode 100644
index 00000000..6b3468c0
--- /dev/null
+++ b/src/square/types/gift_card_activity_adjust_increment.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_adjust_increment_reason import GiftCardActivityAdjustIncrementReason
+from .money import Money
+
+
+class GiftCardActivityAdjustIncrement(UncheckedBaseModel):
+ """
+ Represents details about an `ADJUST_INCREMENT` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount added to the gift card balance. This value is a positive integer.
+ """
+
+ reason: GiftCardActivityAdjustIncrementReason = pydantic.Field()
+ """
+ The reason the gift card balance was adjusted.
+ See [Reason](#type-reason) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_adjust_increment_reason.py b/src/square/types/gift_card_activity_adjust_increment_reason.py
new file mode 100644
index 00000000..b7b0a9e1
--- /dev/null
+++ b/src/square/types/gift_card_activity_adjust_increment_reason.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardActivityAdjustIncrementReason = typing.Union[
+ typing.Literal["COMPLIMENTARY", "SUPPORT_ISSUE", "TRANSACTION_VOIDED"], typing.Any
+]
diff --git a/src/square/types/gift_card_activity_block.py b/src/square/types/gift_card_activity_block.py
new file mode 100644
index 00000000..e392e569
--- /dev/null
+++ b/src/square/types/gift_card_activity_block.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_block_reason import GiftCardActivityBlockReason
+
+
+class GiftCardActivityBlock(UncheckedBaseModel):
+ """
+ Represents details about a `BLOCK` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ reason: GiftCardActivityBlockReason = pydantic.Field(default="CHARGEBACK_BLOCK")
+ """
+ The reason the gift card was blocked.
+ See [Reason](#type-reason) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_block_reason.py b/src/square/types/gift_card_activity_block_reason.py
new file mode 100644
index 00000000..07867b8b
--- /dev/null
+++ b/src/square/types/gift_card_activity_block_reason.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardActivityBlockReason = typing.Literal["CHARGEBACK_BLOCK"]
diff --git a/src/square/types/gift_card_activity_clear_balance.py b/src/square/types/gift_card_activity_clear_balance.py
new file mode 100644
index 00000000..ec7c63bf
--- /dev/null
+++ b/src/square/types/gift_card_activity_clear_balance.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_clear_balance_reason import GiftCardActivityClearBalanceReason
+
+
+class GiftCardActivityClearBalance(UncheckedBaseModel):
+ """
+ Represents details about a `CLEAR_BALANCE` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ reason: GiftCardActivityClearBalanceReason = pydantic.Field()
+ """
+ The reason the gift card balance was cleared.
+ See [Reason](#type-reason) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_clear_balance_reason.py b/src/square/types/gift_card_activity_clear_balance_reason.py
new file mode 100644
index 00000000..a0af17c2
--- /dev/null
+++ b/src/square/types/gift_card_activity_clear_balance_reason.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardActivityClearBalanceReason = typing.Union[
+ typing.Literal["SUSPICIOUS_ACTIVITY", "REUSE_GIFTCARD", "UNKNOWN_REASON"], typing.Any
+]
diff --git a/src/square/types/gift_card_activity_created_event.py b/src/square/types/gift_card_activity_created_event.py
new file mode 100644
index 00000000..68bca0ae
--- /dev/null
+++ b/src/square/types/gift_card_activity_created_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_created_event_data import GiftCardActivityCreatedEventData
+
+
+class GiftCardActivityCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [gift card activity](entity:GiftCardActivity) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `gift_card.activity.created`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[GiftCardActivityCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_created_event_data.py b/src/square/types/gift_card_activity_created_event_data.py
new file mode 100644
index 00000000..35e23e07
--- /dev/null
+++ b/src/square/types/gift_card_activity_created_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_created_event_object import GiftCardActivityCreatedEventObject
+
+
+class GiftCardActivityCreatedEventData(UncheckedBaseModel):
+ """
+ Represents the data associated with a `gift_card.activity.created` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `gift_card_activity`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the new gift card activity.
+ """
+
+ object: typing.Optional[GiftCardActivityCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the new gift card activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_created_event_object.py b/src/square/types/gift_card_activity_created_event_object.py
new file mode 100644
index 00000000..8de1921c
--- /dev/null
+++ b/src/square/types/gift_card_activity_created_event_object.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity import GiftCardActivity
+
+
+class GiftCardActivityCreatedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the gift card activity associated with a
+ `gift_card.activity.created` event.
+ """
+
+ gift_card_activity: typing.Optional[GiftCardActivity] = pydantic.Field(default=None)
+ """
+ The new gift card activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_deactivate.py b/src/square/types/gift_card_activity_deactivate.py
new file mode 100644
index 00000000..bc290906
--- /dev/null
+++ b/src/square/types/gift_card_activity_deactivate.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_deactivate_reason import GiftCardActivityDeactivateReason
+
+
+class GiftCardActivityDeactivate(UncheckedBaseModel):
+ """
+ Represents details about a `DEACTIVATE` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ reason: GiftCardActivityDeactivateReason = pydantic.Field()
+ """
+ The reason the gift card was deactivated.
+ See [Reason](#type-reason) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_deactivate_reason.py b/src/square/types/gift_card_activity_deactivate_reason.py
new file mode 100644
index 00000000..5c66dbd0
--- /dev/null
+++ b/src/square/types/gift_card_activity_deactivate_reason.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardActivityDeactivateReason = typing.Union[
+ typing.Literal["SUSPICIOUS_ACTIVITY", "UNKNOWN_REASON", "CHARGEBACK_DEACTIVATE"], typing.Any
+]
diff --git a/src/square/types/gift_card_activity_import.py b/src/square/types/gift_card_activity_import.py
new file mode 100644
index 00000000..1f144cd3
--- /dev/null
+++ b/src/square/types/gift_card_activity_import.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class GiftCardActivityImport(UncheckedBaseModel):
+ """
+ Represents details about an `IMPORT` [gift card activity type](entity:GiftCardActivityType).
+ This activity type is used when Square imports a third-party gift card, in which case the
+ `gan_source` of the gift card is set to `OTHER`.
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The balance amount on the imported gift card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_import_reversal.py b/src/square/types/gift_card_activity_import_reversal.py
new file mode 100644
index 00000000..59e7a9b2
--- /dev/null
+++ b/src/square/types/gift_card_activity_import_reversal.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class GiftCardActivityImportReversal(UncheckedBaseModel):
+ """
+ Represents details about an `IMPORT_REVERSAL` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount of money cleared from the third-party gift card when
+ the import was reversed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_load.py b/src/square/types/gift_card_activity_load.py
new file mode 100644
index 00000000..aaf1ed1b
--- /dev/null
+++ b/src/square/types/gift_card_activity_load.py
@@ -0,0 +1,70 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class GiftCardActivityLoad(UncheckedBaseModel):
+ """
+ Represents details about a `LOAD` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount added to the gift card. This value is a positive integer.
+
+ Applications that use a custom order processing system must specify this amount in the
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item.
+
+ Applications that use the Square Orders API to process orders must specify the order ID in the
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ line_item_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The UID of the `GIFT_CARD` line item in the order that represents the additional funds for the gift card.
+
+ Applications that use the Square Orders API to process orders must specify the line item UID
+ in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A client-specified ID that associates the gift card activity with an entity in another system.
+
+ Applications that use a custom order processing system can use this field to track information related to
+ an order or payment.
+ """
+
+ buyer_payment_instrument_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The payment instrument IDs used to process the order for the additional funds, such as a credit card ID
+ or bank account ID.
+
+ Applications that use a custom order processing system must specify payment instrument IDs in
+ the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ Square uses this information to perform compliance checks.
+
+ For applications that use the Square Orders API to process payments, Square has the necessary
+ instrument IDs to perform compliance checks.
+
+ Each buyer payment instrument ID can contain a maximum of 255 characters.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_redeem.py b/src/square/types/gift_card_activity_redeem.py
new file mode 100644
index 00000000..47f1019f
--- /dev/null
+++ b/src/square/types/gift_card_activity_redeem.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_redeem_status import GiftCardActivityRedeemStatus
+from .money import Money
+
+
+class GiftCardActivityRedeem(UncheckedBaseModel):
+ """
+ Represents details about a `REDEEM` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount deducted from the gift card for the redemption. This value is a positive integer.
+
+ Applications that use a custom payment processing system must specify this amount in the
+ [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
+ """
+
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment that represents the gift card redemption. Square populates this field
+ if the payment was processed by Square.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A client-specified ID that associates the gift card activity with an entity in another system.
+
+ Applications that use a custom payment processing system can use this field to track information
+ related to an order or payment.
+ """
+
+ status: typing.Optional[GiftCardActivityRedeemStatus] = pydantic.Field(default=None)
+ """
+ The status of the gift card redemption. Gift cards redeemed from Square Point of Sale or the
+ Square Seller Dashboard use a two-state process: `PENDING`
+ to `COMPLETED` or `PENDING` to `CANCELED`. Gift cards redeemed using the Gift Card Activities API
+ always have a `COMPLETED` status.
+ See [Status](#type-status) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_redeem_status.py b/src/square/types/gift_card_activity_redeem_status.py
new file mode 100644
index 00000000..32d7cb69
--- /dev/null
+++ b/src/square/types/gift_card_activity_redeem_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardActivityRedeemStatus = typing.Union[typing.Literal["PENDING", "COMPLETED", "CANCELED"], typing.Any]
diff --git a/src/square/types/gift_card_activity_refund.py b/src/square/types/gift_card_activity_refund.py
new file mode 100644
index 00000000..1a251cd6
--- /dev/null
+++ b/src/square/types/gift_card_activity_refund.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class GiftCardActivityRefund(UncheckedBaseModel):
+ """
+ Represents details about a `REFUND` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ redeem_activity_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the refunded `REDEEM` gift card activity. Square populates this field if the
+ `payment_id` in the corresponding [RefundPayment](api-endpoint:Refunds-RefundPayment) request
+ represents a gift card redemption.
+
+ For applications that use a custom payment processing system, this field is required when creating
+ a `REFUND` activity. The provided `REDEEM` activity ID must be linked to the same gift card.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount added to the gift card for the refund. This value is a positive integer.
+
+ This field is required when creating a `REFUND` activity. The amount can represent a full or partial refund.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A client-specified ID that associates the gift card activity with an entity in another system.
+ """
+
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the refunded payment. Square populates this field if the refund is for a
+ payment processed by Square. This field matches the `payment_id` in the corresponding
+ [RefundPayment](api-endpoint:Refunds-RefundPayment) request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_transfer_balance_from.py b/src/square/types/gift_card_activity_transfer_balance_from.py
new file mode 100644
index 00000000..9ee41f35
--- /dev/null
+++ b/src/square/types/gift_card_activity_transfer_balance_from.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class GiftCardActivityTransferBalanceFrom(UncheckedBaseModel):
+ """
+ Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ transfer_to_gift_card_id: str = pydantic.Field()
+ """
+ The ID of the gift card to which the specified amount was transferred.
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount deducted from the gift card for the transfer. This value is a positive integer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_transfer_balance_to.py b/src/square/types/gift_card_activity_transfer_balance_to.py
new file mode 100644
index 00000000..36eba2c1
--- /dev/null
+++ b/src/square/types/gift_card_activity_transfer_balance_to.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class GiftCardActivityTransferBalanceTo(UncheckedBaseModel):
+ """
+ Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ transfer_from_gift_card_id: str = pydantic.Field()
+ """
+ The ID of the gift card from which the specified amount was transferred.
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount added to the gift card balance for the transfer. This value is a positive integer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_type.py b/src/square/types/gift_card_activity_type.py
new file mode 100644
index 00000000..0885d6f5
--- /dev/null
+++ b/src/square/types/gift_card_activity_type.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardActivityType = typing.Union[
+ typing.Literal[
+ "ACTIVATE",
+ "LOAD",
+ "REDEEM",
+ "CLEAR_BALANCE",
+ "DEACTIVATE",
+ "ADJUST_INCREMENT",
+ "ADJUST_DECREMENT",
+ "REFUND",
+ "UNLINKED_ACTIVITY_REFUND",
+ "IMPORT",
+ "BLOCK",
+ "UNBLOCK",
+ "IMPORT_REVERSAL",
+ "TRANSFER_BALANCE_FROM",
+ "TRANSFER_BALANCE_TO",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/gift_card_activity_unblock.py b/src/square/types/gift_card_activity_unblock.py
new file mode 100644
index 00000000..7656c4bc
--- /dev/null
+++ b/src/square/types/gift_card_activity_unblock.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_unblock_reason import GiftCardActivityUnblockReason
+
+
+class GiftCardActivityUnblock(UncheckedBaseModel):
+ """
+ Represents details about an `UNBLOCK` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ reason: GiftCardActivityUnblockReason = pydantic.Field(default="CHARGEBACK_UNBLOCK")
+ """
+ The reason the gift card was unblocked.
+ See [Reason](#type-reason) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_unblock_reason.py b/src/square/types/gift_card_activity_unblock_reason.py
new file mode 100644
index 00000000..ed2a5ee2
--- /dev/null
+++ b/src/square/types/gift_card_activity_unblock_reason.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardActivityUnblockReason = typing.Literal["CHARGEBACK_UNBLOCK"]
diff --git a/src/square/types/gift_card_activity_unlinked_activity_refund.py b/src/square/types/gift_card_activity_unlinked_activity_refund.py
new file mode 100644
index 00000000..9ae68f5a
--- /dev/null
+++ b/src/square/types/gift_card_activity_unlinked_activity_refund.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class GiftCardActivityUnlinkedActivityRefund(UncheckedBaseModel):
+ """
+ Represents details about an `UNLINKED_ACTIVITY_REFUND` [gift card activity type](entity:GiftCardActivityType).
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount added to the gift card for the refund. This value is a positive integer.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A client-specified ID that associates the gift card activity with an entity in another system.
+ """
+
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the refunded payment. This field is not used starting in Square version 2022-06-16.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_updated_event.py b/src/square/types/gift_card_activity_updated_event.py
new file mode 100644
index 00000000..166cd4d4
--- /dev/null
+++ b/src/square/types/gift_card_activity_updated_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_updated_event_data import GiftCardActivityUpdatedEventData
+
+
+class GiftCardActivityUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [gift card activity](entity:GiftCardActivity) is updated.
+ Subscribe to this event to be notified about the following changes:
+ - An update to the `REDEEM` activity for a gift card redemption made from a Square product (such as Square Point of Sale).
+ These redemptions are initially assigned a `PENDING` state, but then change to a `COMPLETED` or `CANCELED` state.
+ - An update to the `IMPORT` activity for an imported gift card when the balance is later adjusted by Square.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `gift_card.activity.updated`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[GiftCardActivityUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_updated_event_data.py b/src/square/types/gift_card_activity_updated_event_data.py
new file mode 100644
index 00000000..d513e19c
--- /dev/null
+++ b/src/square/types/gift_card_activity_updated_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity_updated_event_object import GiftCardActivityUpdatedEventObject
+
+
+class GiftCardActivityUpdatedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `gift_card.activity.updated` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `gift_card_activity`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the updated gift card activity.
+ """
+
+ object: typing.Optional[GiftCardActivityUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the updated gift card activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_activity_updated_event_object.py b/src/square/types/gift_card_activity_updated_event_object.py
new file mode 100644
index 00000000..cab7586f
--- /dev/null
+++ b/src/square/types/gift_card_activity_updated_event_object.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_activity import GiftCardActivity
+
+
+class GiftCardActivityUpdatedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the gift card activity associated with a
+ `gift_card.activity.updated` event.
+ """
+
+ gift_card_activity: typing.Optional[GiftCardActivity] = pydantic.Field(default=None)
+ """
+ The updated gift card activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_created_event.py b/src/square/types/gift_card_created_event.py
new file mode 100644
index 00000000..983c92a7
--- /dev/null
+++ b/src/square/types/gift_card_created_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_created_event_data import GiftCardCreatedEventData
+
+
+class GiftCardCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [gift card](entity:GiftCard) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `gift_card.created`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[GiftCardCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_created_event_data.py b/src/square/types/gift_card_created_event_data.py
new file mode 100644
index 00000000..56dfb7df
--- /dev/null
+++ b/src/square/types/gift_card_created_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_created_event_object import GiftCardCreatedEventObject
+
+
+class GiftCardCreatedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `gift_card.created` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `gift_card`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the new gift card.
+ """
+
+ object: typing.Optional[GiftCardCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the new gift card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_created_event_object.py b/src/square/types/gift_card_created_event_object.py
new file mode 100644
index 00000000..d86dfc11
--- /dev/null
+++ b/src/square/types/gift_card_created_event_object.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card import GiftCard
+
+
+class GiftCardCreatedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the gift card associated with a `gift_card.created` event.
+ """
+
+ gift_card: typing.Optional[GiftCard] = pydantic.Field(default=None)
+ """
+ The new gift card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_customer_linked_event.py b/src/square/types/gift_card_customer_linked_event.py
new file mode 100644
index 00000000..4cb250e8
--- /dev/null
+++ b/src/square/types/gift_card_customer_linked_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_customer_linked_event_data import GiftCardCustomerLinkedEventData
+
+
+class GiftCardCustomerLinkedEvent(UncheckedBaseModel):
+ """
+ Published when a [customer](entity:Customer) is linked to a [gift card](entity:GiftCard).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `gift_card.customer_linked`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[GiftCardCustomerLinkedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_customer_linked_event_data.py b/src/square/types/gift_card_customer_linked_event_data.py
new file mode 100644
index 00000000..0427fe4f
--- /dev/null
+++ b/src/square/types/gift_card_customer_linked_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_customer_linked_event_object import GiftCardCustomerLinkedEventObject
+
+
+class GiftCardCustomerLinkedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `gift_card.customer_linked` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `gift_card`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the updated gift card.
+ """
+
+ object: typing.Optional[GiftCardCustomerLinkedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the updated gift card and the ID of the linked customer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_customer_linked_event_object.py b/src/square/types/gift_card_customer_linked_event_object.py
new file mode 100644
index 00000000..dfbe7480
--- /dev/null
+++ b/src/square/types/gift_card_customer_linked_event_object.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card import GiftCard
+
+
+class GiftCardCustomerLinkedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the gift card and customer ID associated with a
+ `gift_card.customer_linked` event.
+ """
+
+ gift_card: typing.Optional[GiftCard] = pydantic.Field(default=None)
+ """
+ The gift card with the updated `customer_ids` field.
+ """
+
+ linked_customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the linked [customer](entity:Customer).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_customer_unlinked_event.py b/src/square/types/gift_card_customer_unlinked_event.py
new file mode 100644
index 00000000..16e5bf57
--- /dev/null
+++ b/src/square/types/gift_card_customer_unlinked_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_customer_unlinked_event_data import GiftCardCustomerUnlinkedEventData
+
+
+class GiftCardCustomerUnlinkedEvent(UncheckedBaseModel):
+ """
+ Published when a [customer](entity:Customer) is unlinked from a [gift card](entity:GiftCard).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `gift_card.customer_unlinked`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[GiftCardCustomerUnlinkedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_customer_unlinked_event_data.py b/src/square/types/gift_card_customer_unlinked_event_data.py
new file mode 100644
index 00000000..02a0fe06
--- /dev/null
+++ b/src/square/types/gift_card_customer_unlinked_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_customer_unlinked_event_object import GiftCardCustomerUnlinkedEventObject
+
+
+class GiftCardCustomerUnlinkedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `gift_card.customer_unlinked` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `gift_card`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the updated gift card.
+ """
+
+ object: typing.Optional[GiftCardCustomerUnlinkedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the updated gift card and the ID of the unlinked customer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_customer_unlinked_event_object.py b/src/square/types/gift_card_customer_unlinked_event_object.py
new file mode 100644
index 00000000..579f99b0
--- /dev/null
+++ b/src/square/types/gift_card_customer_unlinked_event_object.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card import GiftCard
+
+
+class GiftCardCustomerUnlinkedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the gift card and the customer ID associated with a
+ `gift_card.customer_linked` event.
+ """
+
+ gift_card: typing.Optional[GiftCard] = pydantic.Field(default=None)
+ """
+ The gift card with the updated `customer_ids` field.
+ The field is removed if the gift card is not linked to any customers.
+ """
+
+ unlinked_customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the unlinked [customer](entity:Customer).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_gan_source.py b/src/square/types/gift_card_gan_source.py
new file mode 100644
index 00000000..3827bb92
--- /dev/null
+++ b/src/square/types/gift_card_gan_source.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardGanSource = typing.Union[typing.Literal["SQUARE", "OTHER"], typing.Any]
diff --git a/src/square/types/gift_card_status.py b/src/square/types/gift_card_status.py
new file mode 100644
index 00000000..1c6ec066
--- /dev/null
+++ b/src/square/types/gift_card_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardStatus = typing.Union[typing.Literal["ACTIVE", "DEACTIVATED", "BLOCKED", "PENDING"], typing.Any]
diff --git a/src/square/types/gift_card_type.py b/src/square/types/gift_card_type.py
new file mode 100644
index 00000000..af61ea9c
--- /dev/null
+++ b/src/square/types/gift_card_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GiftCardType = typing.Union[typing.Literal["PHYSICAL", "DIGITAL"], typing.Any]
diff --git a/src/square/types/gift_card_updated_event.py b/src/square/types/gift_card_updated_event.py
new file mode 100644
index 00000000..ff62ab28
--- /dev/null
+++ b/src/square/types/gift_card_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_updated_event_data import GiftCardUpdatedEventData
+
+
+class GiftCardUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [gift card](entity:GiftCard) is updated. This includes
+ changes to the state, balance, and customer association.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. For this event, the value is `gift_card.updated`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID of the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[GiftCardUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_updated_event_data.py b/src/square/types/gift_card_updated_event_data.py
new file mode 100644
index 00000000..a3d45414
--- /dev/null
+++ b/src/square/types/gift_card_updated_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card_updated_event_object import GiftCardUpdatedEventObject
+
+
+class GiftCardUpdatedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `gift_card.updated` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `gift_card`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the updated gift card.
+ """
+
+ object: typing.Optional[GiftCardUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the updated gift card.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/gift_card_updated_event_object.py b/src/square/types/gift_card_updated_event_object.py
new file mode 100644
index 00000000..a2d90ee3
--- /dev/null
+++ b/src/square/types/gift_card_updated_event_object.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .gift_card import GiftCard
+
+
+class GiftCardUpdatedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the gift card associated with a `gift_card.updated` event.
+ """
+
+ gift_card: typing.Optional[GiftCard] = pydantic.Field(default=None)
+ """
+ The gift card with the updated `balance_money`, `state`, or `customer_ids` field.
+ Some events can affect both `balance_money` and `state`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/hierarchy.py b/src/square/types/hierarchy.py
new file mode 100644
index 00000000..ea084b6e
--- /dev/null
+++ b/src/square/types/hierarchy.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class Hierarchy(UncheckedBaseModel):
+ name: str
+ alias_member: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="aliasMember"),
+ pydantic.Field(
+ alias="aliasMember",
+ description="When hierarchy is defined in Cube, it keeps the original path: Cube.hierarchy",
+ ),
+ ] = None
+ title: typing.Optional[str] = None
+ levels: typing.List[str]
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_adjustment.py b/src/square/types/inventory_adjustment.py
new file mode 100644
index 00000000..34f9a1dc
--- /dev/null
+++ b/src/square/types/inventory_adjustment.py
@@ -0,0 +1,184 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_adjustment_group import InventoryAdjustmentGroup
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonId
+from .inventory_state import InventoryState
+from .money import Money
+from .source_application import SourceApplication
+
+
+class InventoryAdjustment(UncheckedBaseModel):
+ """
+ Represents a change in state or quantity of product inventory at a
+ particular time and location.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID generated by Square for the
+ `InventoryAdjustment`.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional ID provided by the application to tie the
+ `InventoryAdjustment` to an external
+ system.
+ """
+
+ from_state: typing.Optional[InventoryState] = pydantic.Field(default=None)
+ """
+ The [inventory state](entity:InventoryState) of the related quantity
+ of items before the adjustment.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ to_state: typing.Optional[InventoryState] = pydantic.Field(default=None)
+ """
+ The [inventory state](entity:InventoryState) of the related quantity
+ of items after the adjustment.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ from_location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Location](entity:Location) where the related
+ quantity of items is being tracked before the adjustment.
+ """
+
+ to_location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Location](entity:Location) where the related
+ quantity of items is being tracked after the adjustment.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the
+ [CatalogObject](entity:CatalogObject) being tracked.
+ """
+
+ catalog_object_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.
+
+ The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
+ In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
+ """
+
+ quantity: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The number of items affected by the adjustment as a decimal string.
+ Can support up to 5 digits after the decimal point.
+ """
+
+ total_price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total price paid for goods associated with the
+ adjustment. Present if and only if `to_state` is `SOLD`. Always
+ non-negative.
+ """
+
+ occurred_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A client-generated RFC 3339-formatted timestamp that indicates when
+ the inventory adjustment took place. For inventory adjustment updates, the `occurred_at`
+ timestamp cannot be older than 24 hours or in the future relative to the
+ time of the request.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An RFC 3339-formatted timestamp that indicates when the inventory adjustment is received.
+ """
+
+ source: typing.Optional[SourceApplication] = pydantic.Field(default=None)
+ """
+ Information about the application that caused the
+ inventory adjustment.
+ """
+
+ employee_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Employee](entity:Employee) responsible for the
+ inventory adjustment.
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
+ inventory adjustment.
+ """
+
+ transaction_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Transaction](entity:Transaction) that
+ caused the adjustment. Only relevant for payment-related state
+ transitions.
+ """
+
+ refund_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Refund](entity:Refund) that
+ caused the adjustment. Only relevant for refund-related state
+ transitions.
+ """
+
+ purchase_order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the purchase order that caused the
+ adjustment. Only relevant for state transitions from the Square for Retail
+ app.
+ """
+
+ goods_receipt_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the goods receipt that caused the
+ adjustment. Only relevant for state transitions from the Square for Retail
+ app.
+ """
+
+ adjustment_group: typing.Optional[InventoryAdjustmentGroup] = pydantic.Field(default=None)
+ """
+ An adjustment group bundling the related adjustments of item variations through stock conversions in a single inventory event.
+ """
+
+ cost_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount paid by the merchant to the supplying vendor for these units of the product.
+ This field is only applicable for stock receive adjustments that introduce stock into the system (from_state is NONE or UNLINKED_RETURN).
+ May be empty.
+ This field will only accept writes if the merchant has an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
+
+ vendor_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the Vendor from which the merchant purchased this product.
+ This field is only applicable for stock receive adjustments that introduce stock into the system (from_state is NONE or UNLINKED_RETURN).
+ This field will only accept writes if the merchant has an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
+
+ physical_count_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the InventoryPhysicalCount (recount) that generated this adjustment, if applicable.
+ The quantity of an adjustment generated by a physical count cannot be edited.
+ """
+
+ reason_id: typing.Optional[InventoryAdjustmentReasonId] = pydantic.Field(default=None)
+ """
+ Identifies the reason for this inventory adjustment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_adjustment_group.py b/src/square/types/inventory_adjustment_group.py
new file mode 100644
index 00000000..a78346fe
--- /dev/null
+++ b/src/square/types/inventory_adjustment_group.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_state import InventoryState
+
+
+class InventoryAdjustmentGroup(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID generated by Square for the
+ `InventoryAdjustmentGroup`.
+ """
+
+ root_adjustment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The inventory adjustment of the composed variation.
+ """
+
+ from_state: typing.Optional[InventoryState] = pydantic.Field(default=None)
+ """
+ Representative `from_state` for adjustments within the group. For example, for a group adjustment from `IN_STOCK` to `SOLD`,
+ there can be two component adjustments in the group: one from `IN_STOCK`to `COMPOSED` and the other one from `COMPOSED` to `SOLD`.
+ Here, the representative `from_state` for the `InventoryAdjustmentGroup` is `IN_STOCK`.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ to_state: typing.Optional[InventoryState] = pydantic.Field(default=None)
+ """
+ Representative `to_state` for adjustments within group. For example, for a group adjustment from `IN_STOCK` to `SOLD`,
+ the two component adjustments in the group can be from `IN_STOCK` to `COMPOSED` and from `COMPOSED` to `SOLD`.
+ Here, the representative `to_state` of the `InventoryAdjustmentGroup` is `SOLD`.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_adjustment_reason.py b/src/square/types/inventory_adjustment_reason.py
new file mode 100644
index 00000000..dd870522
--- /dev/null
+++ b/src/square/types/inventory_adjustment_reason.py
@@ -0,0 +1,69 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_adjustment_reason_direction import InventoryAdjustmentReasonDirection
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonId
+
+
+class InventoryAdjustmentReason(UncheckedBaseModel):
+ """
+ Represents an inventory adjustment reason.
+ """
+
+ id: InventoryAdjustmentReasonId = pydantic.Field()
+ """
+ The identifier for this inventory adjustment reason.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The seller-facing name for a custom inventory adjustment reason. This
+ field is empty for standard and system-generated adjustment reasons.
+ """
+
+ direction: typing.Optional[InventoryAdjustmentReasonDirection] = pydantic.Field(default=None)
+ """
+ Indicates whether this inventory adjustment reason increases or
+ decreases inventory. This field is set for custom reasons and for standard
+ seller-selectable reasons. It is empty for system-generated inventory
+ events.
+ See [Direction](#type-direction) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An RFC 3339-formatted timestamp that indicates when the custom
+ adjustment reason was created. This field is empty for standard
+ adjustment reasons.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An RFC 3339-formatted timestamp that indicates when the custom
+ adjustment reason was last updated. This field is empty for standard
+ adjustment reasons.
+ """
+
+ is_deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether this custom inventory adjustment reason has been
+ deleted. Deleted custom reasons can still be retrieved by ID, but are
+ omitted from list responses unless deleted reasons are explicitly included.
+ To restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+ This field is always `false` for standard and system-generated adjustment
+ reasons.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_adjustment_reason_direction.py b/src/square/types/inventory_adjustment_reason_direction.py
new file mode 100644
index 00000000..29a7d971
--- /dev/null
+++ b/src/square/types/inventory_adjustment_reason_direction.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InventoryAdjustmentReasonDirection = typing.Union[typing.Literal["INCREASE", "DECREASE"], typing.Any]
diff --git a/src/square/types/inventory_adjustment_reason_id.py b/src/square/types/inventory_adjustment_reason_id.py
new file mode 100644
index 00000000..96d2860d
--- /dev/null
+++ b/src/square/types/inventory_adjustment_reason_id.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_adjustment_reason_id_type import InventoryAdjustmentReasonIdType
+
+
+class InventoryAdjustmentReasonId(UncheckedBaseModel):
+ """
+ Identifies a standard or custom inventory adjustment reason.
+ """
+
+ type: InventoryAdjustmentReasonIdType = pydantic.Field()
+ """
+ The adjustment reason type.
+ See [Type](#type-type) for possible values
+ """
+
+ custom_reason_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the custom adjustment reason. This field
+ is only set when `type` is `CUSTOM`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_adjustment_reason_id_type.py b/src/square/types/inventory_adjustment_reason_id_type.py
new file mode 100644
index 00000000..f43ca7a0
--- /dev/null
+++ b/src/square/types/inventory_adjustment_reason_id_type.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InventoryAdjustmentReasonIdType = typing.Union[
+ typing.Literal[
+ "RECEIVED",
+ "DAMAGED",
+ "THEFT",
+ "LOST",
+ "RETURNED",
+ "SPOILAGE_WASTE",
+ "SAMPLES_PROMOTIONAL",
+ "INTERNAL_USE",
+ "VENDOR_RETURN",
+ "PRODUCTION_WASTE",
+ "SALE",
+ "RECOUNT",
+ "TRANSFER",
+ "IN_TRANSIT",
+ "CANCELED_SALE",
+ "CUSTOM",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/inventory_alert_type.py b/src/square/types/inventory_alert_type.py
new file mode 100644
index 00000000..f0af0e89
--- /dev/null
+++ b/src/square/types/inventory_alert_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InventoryAlertType = typing.Union[typing.Literal["NONE", "LOW_QUANTITY"], typing.Any]
diff --git a/src/square/types/inventory_change.py b/src/square/types/inventory_change.py
new file mode 100644
index 00000000..e2a8439b
--- /dev/null
+++ b/src/square/types/inventory_change.py
@@ -0,0 +1,57 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_measurement_unit import CatalogMeasurementUnit
+from .inventory_adjustment import InventoryAdjustment
+from .inventory_change_type import InventoryChangeType
+from .inventory_physical_count import InventoryPhysicalCount
+
+
+class InventoryChange(UncheckedBaseModel):
+ """
+ Represents a single physical count, inventory, adjustment, or transfer
+ that is part of the history of inventory changes for a particular
+ [CatalogObject](entity:CatalogObject) instance.
+ """
+
+ type: typing.Optional[InventoryChangeType] = pydantic.Field(default=None)
+ """
+ Indicates how the inventory change is applied. See
+ [InventoryChangeType](entity:InventoryChangeType) for all possible values.
+ See [InventoryChangeType](#type-inventorychangetype) for possible values
+ """
+
+ physical_count: typing.Optional[InventoryPhysicalCount] = pydantic.Field(default=None)
+ """
+ Contains details about the physical count when `type` is
+ `PHYSICAL_COUNT`, and is unset for all other change types.
+ """
+
+ adjustment: typing.Optional[InventoryAdjustment] = pydantic.Field(default=None)
+ """
+ Contains details about the inventory adjustment when `type` is
+ `ADJUSTMENT`, and is unset for all other change types.
+ """
+
+ measurement_unit: typing.Optional[CatalogMeasurementUnit] = pydantic.Field(default=None)
+ """
+ The [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change.
+ """
+
+ measurement_unit_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_change_type.py b/src/square/types/inventory_change_type.py
new file mode 100644
index 00000000..81e3c3ac
--- /dev/null
+++ b/src/square/types/inventory_change_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InventoryChangeType = typing.Union[typing.Literal["PHYSICAL_COUNT", "ADJUSTMENT"], typing.Any]
diff --git a/src/square/types/inventory_count.py b/src/square/types/inventory_count.py
new file mode 100644
index 00000000..289485f8
--- /dev/null
+++ b/src/square/types/inventory_count.py
@@ -0,0 +1,74 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_state import InventoryState
+
+
+class InventoryCount(UncheckedBaseModel):
+ """
+ Represents Square-estimated quantity of items in a particular state at a
+ particular seller location based on the known history of physical counts and
+ inventory adjustments. The absence of an inventory count indicates that the
+ catalog object hasn't interacted with the given inventory state at the given location.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the
+ [CatalogObject](entity:CatalogObject) being tracked.
+ """
+
+ catalog_object_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.
+
+ The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
+ In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
+ """
+
+ state: typing.Optional[InventoryState] = pydantic.Field(default=None)
+ """
+ The current [inventory state](entity:InventoryState) for the related
+ quantity of items.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Location](entity:Location) where the related
+ quantity of items is being tracked.
+ """
+
+ quantity: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The number of items affected by the estimated count as a decimal string.
+ Can support up to 5 digits after the decimal point.
+ """
+
+ calculated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An RFC 3339-formatted timestamp that indicates when the most recent physical count or adjustment affecting
+ the estimated count is received.
+ """
+
+ is_estimated: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the inventory count is for composed variation (TRUE) or not (FALSE). If true, the inventory count will not be present in the response of
+ any of these endpoints: [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory),
+ [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges),
+ [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts), and
+ [RetrieveInventoryChanges](api-endpoint:Inventory-RetrieveInventoryChanges).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_count_updated_event.py b/src/square/types/inventory_count_updated_event.py
new file mode 100644
index 00000000..b086f1aa
--- /dev/null
+++ b/src/square/types/inventory_count_updated_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_count_updated_event_data import InventoryCountUpdatedEventData
+
+
+class InventoryCountUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when the quantity is updated for a
+ [CatalogItemVariation](entity:CatalogItemVariation).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[InventoryCountUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_count_updated_event_data.py b/src/square/types/inventory_count_updated_event_data.py
new file mode 100644
index 00000000..9f82e78f
--- /dev/null
+++ b/src/square/types/inventory_count_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_count_updated_event_object import InventoryCountUpdatedEventObject
+
+
+class InventoryCountUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type. For this event, the value is `inventory_counts`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected object.
+ """
+
+ object: typing.Optional[InventoryCountUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing fields and values relevant to the event. Is absent if affected object was deleted.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_count_updated_event_object.py b/src/square/types/inventory_count_updated_event_object.py
new file mode 100644
index 00000000..6037dd71
--- /dev/null
+++ b/src/square/types/inventory_count_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_count import InventoryCount
+
+
+class InventoryCountUpdatedEventObject(UncheckedBaseModel):
+ inventory_counts: typing.Optional[typing.List[InventoryCount]] = pydantic.Field(default=None)
+ """
+ The inventory counts.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_physical_count.py b/src/square/types/inventory_physical_count.py
new file mode 100644
index 00000000..816bbeaf
--- /dev/null
+++ b/src/square/types/inventory_physical_count.py
@@ -0,0 +1,111 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_state import InventoryState
+from .source_application import SourceApplication
+
+
+class InventoryPhysicalCount(UncheckedBaseModel):
+ """
+ Represents the quantity of an item variation that is physically present
+ at a specific location, verified by a seller or a seller's employee. For example,
+ a physical count might come from an employee counting the item variations on
+ hand or from syncing with an external system.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique Square-generated ID for the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount).
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional ID provided by the application to tie the
+ [InventoryPhysicalCount](entity:InventoryPhysicalCount) to an external
+ system.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the
+ [CatalogObject](entity:CatalogObject) being tracked.
+ """
+
+ catalog_object_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.
+
+ The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
+ In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
+ """
+
+ state: typing.Optional[InventoryState] = pydantic.Field(default=None)
+ """
+ The current [inventory state](entity:InventoryState) for the related
+ quantity of items.
+ See [InventoryState](#type-inventorystate) for possible values
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Location](entity:Location) where the related
+ quantity of items is being tracked.
+ """
+
+ quantity: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The number of items affected by the physical count as a decimal string.
+ The number can support up to 5 digits after the decimal point.
+ """
+
+ source: typing.Optional[SourceApplication] = pydantic.Field(default=None)
+ """
+ Information about the application with which the
+ physical count is submitted.
+ """
+
+ employee_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Employee](entity:Employee) responsible for the
+ physical count.
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
+ physical count.
+ """
+
+ occurred_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A client-generated RFC 3339-formatted timestamp that indicates when
+ the physical count was examined. For physical count updates, the `occurred_at`
+ timestamp cannot be older than 24 hours or in the future relative to the
+ time of the request.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An RFC 3339-formatted timestamp that indicates when the physical count is received.
+ """
+
+ adjustment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the InventoryAdjustment that was generated by this physical count in order to
+ adjust the current stock count to reflect the re-counted quantity.
+ This field may be empty if the merchant does not have an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_state.py b/src/square/types/inventory_state.py
new file mode 100644
index 00000000..8f03c5d2
--- /dev/null
+++ b/src/square/types/inventory_state.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InventoryState = typing.Union[
+ typing.Literal[
+ "CUSTOM",
+ "IN_STOCK",
+ "SOLD",
+ "RETURNED_BY_CUSTOMER",
+ "RESERVED_FOR_SALE",
+ "SOLD_ONLINE",
+ "ORDERED_FROM_VENDOR",
+ "RECEIVED_FROM_VENDOR",
+ "IN_TRANSIT_TO",
+ "NONE",
+ "WASTE",
+ "UNLINKED_RETURN",
+ "COMPOSED",
+ "DECOMPOSED",
+ "SUPPORTED_BY_NEWER_VERSION",
+ "IN_TRANSIT",
+ "UNTRACKED",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/invoice.py b/src/square/types/invoice.py
new file mode 100644
index 00000000..0d58ca08
--- /dev/null
+++ b/src/square/types/invoice.py
@@ -0,0 +1,226 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_accepted_payment_methods import InvoiceAcceptedPaymentMethods
+from .invoice_attachment import InvoiceAttachment
+from .invoice_custom_field import InvoiceCustomField
+from .invoice_delivery_method import InvoiceDeliveryMethod
+from .invoice_payment_request import InvoicePaymentRequest
+from .invoice_recipient import InvoiceRecipient
+from .invoice_status import InvoiceStatus
+from .money import Money
+
+
+class Invoice(UncheckedBaseModel):
+ """
+ Stores information about an invoice. You use the Invoices API to create and manage
+ invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the invoice.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The Square-assigned version number, which is incremented each time an update is committed to the invoice.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location that this invoice is associated with.
+
+ If specified in a `CreateInvoice` request, the value must match the `location_id` of the associated order.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [order](entity:Order) for which the invoice is created.
+ This field is required when creating an invoice, and the order must be in the `OPEN` state.
+
+ To view the line items and other information for the associated order, call the
+ [RetrieveOrder](api-endpoint:Orders-RetrieveOrder) endpoint using the order ID.
+ """
+
+ primary_recipient: typing.Optional[InvoiceRecipient] = pydantic.Field(default=None)
+ """
+ The customer who receives the invoice. This customer data is displayed on the invoice and used by Square to deliver the invoice.
+
+ This field is required to publish an invoice, and it must specify the `customer_id`.
+ """
+
+ payment_requests: typing.Optional[typing.List[InvoicePaymentRequest]] = pydantic.Field(default=None)
+ """
+ The payment schedule for the invoice, represented by one or more payment requests that
+ define payment settings, such as amount due and due date. An invoice supports the following payment request combinations:
+ - One balance
+ - One deposit with one balance
+ - 2–12 installments
+ - One deposit with 2–12 installments
+
+ This field is required when creating an invoice. It must contain at least one payment request.
+ All payment requests for the invoice must equal the total order amount. For more information, see
+ [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests).
+
+ Adding `INSTALLMENT` payment requests to an invoice requires an
+ [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
+ """
+
+ delivery_method: typing.Optional[InvoiceDeliveryMethod] = pydantic.Field(default=None)
+ """
+ The delivery method that Square uses to send the invoice, reminders, and receipts to
+ the customer. After the invoice is published, Square processes the invoice based on the delivery
+ method and payment request settings, either immediately or on the `scheduled_at` date, if specified.
+ For example, Square might send the invoice or receipt for an automatic payment. For invoices with
+ automatic payments, this field must be set to `EMAIL`.
+
+ One of the following is required when creating an invoice:
+ - (Recommended) This `delivery_method` field. To configure an automatic payment, the
+ `automatic_payment_source` field of the payment request is also required.
+ - The deprecated `request_method` field of the payment request. Note that `invoice`
+ objects returned in responses do not include `request_method`.
+ See [InvoiceDeliveryMethod](#type-invoicedeliverymethod) for possible values
+ """
+
+ invoice_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A user-friendly invoice number that is displayed on the invoice. The value is unique within a location.
+ If not provided when creating an invoice, Square assigns a value.
+ It increments from 1 and is padded with zeros making it 7 characters long
+ (for example, 0000001 and 0000002).
+ """
+
+ title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The title of the invoice, which is displayed on the invoice.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the invoice, which is displayed on the invoice.
+ """
+
+ scheduled_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the invoice is scheduled for processing, in RFC 3339 format.
+ After the invoice is published, Square processes the invoice on the specified date,
+ according to the delivery method and payment request settings.
+
+ If the field is not set, Square processes the invoice immediately after it is published.
+ """
+
+ public_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A temporary link to the Square-hosted payment page where the customer can pay the
+ invoice. If the link expires, customers can provide the email address or phone number
+ associated with the invoice and request a new link directly from the expired payment page.
+
+ This field is added after the invoice is published and reaches the scheduled date
+ (if one is defined).
+ """
+
+ next_payment_amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The current amount due for the invoice. In addition to the
+ amount due on the next payment request, this includes any overdue payment amounts.
+ """
+
+ status: typing.Optional[InvoiceStatus] = pydantic.Field(default=None)
+ """
+ The status of the invoice.
+ See [InvoiceStatus](#type-invoicestatus) for possible values
+ """
+
+ timezone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time zone used to interpret calendar dates on the invoice, such as `due_date`.
+ When an invoice is created, this field is set to the `timezone` specified for the seller
+ location. The value cannot be changed.
+
+ For example, a payment `due_date` of 2021-03-09 with a `timezone` of America/Los\\_Angeles
+ becomes overdue at midnight on March 9 in America/Los\\_Angeles (which equals a UTC timestamp
+ of 2021-03-10T08:00:00Z).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the invoice was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the invoice was last updated, in RFC 3339 format.
+ """
+
+ accepted_payment_methods: typing.Optional[InvoiceAcceptedPaymentMethods] = pydantic.Field(default=None)
+ """
+ The payment methods that customers can use to pay the invoice on the Square-hosted
+ invoice page. This setting is independent of any automatic payment requests for the invoice.
+
+ This field is required when creating an invoice and must set at least one payment method to `true`.
+ """
+
+ custom_fields: typing.Optional[typing.List[InvoiceCustomField]] = pydantic.Field(default=None)
+ """
+ Additional seller-defined fields that are displayed on the invoice. For more information, see
+ [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields).
+
+ Adding custom fields to an invoice requires an
+ [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
+
+ Max: 2 custom fields
+ """
+
+ subscription_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [subscription](entity:Subscription) associated with the invoice.
+ This field is present only on subscription billing invoices.
+ """
+
+ sale_or_service_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The date of the sale or the date that the service is rendered, in `YYYY-MM-DD` format.
+ This field can be used to specify a past or future date which is displayed on the invoice.
+ """
+
+ payment_conditions: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ **France only.** The payment terms and conditions that are displayed on the invoice. For more information,
+ see [Payment conditions](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions).
+
+ For countries other than France, Square returns an `INVALID_REQUEST_ERROR` with a `BAD_REQUEST` code and
+ "Payment conditions are not supported for this location's country" detail if this field is included in `CreateInvoice` or `UpdateInvoice` requests.
+ """
+
+ store_payment_method_enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a
+ bank account on file. If `true`, Square displays a __Save my card on file__ or __Save my bank on file__ checkbox on the
+ invoice payment page. Stored payment information can be used for future automatic payments. The default value is `false`.
+ """
+
+ attachments: typing.Optional[typing.List[InvoiceAttachment]] = pydantic.Field(default=None)
+ """
+ Metadata about the attachments on the invoice. Invoice attachments are managed using the
+ [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) and [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) endpoints.
+ """
+
+ creator_team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [team member](entity:TeamMember) who created the invoice.
+ This field is present only on invoices created in the Square Dashboard or Square Invoices app by a logged-in team member.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_accepted_payment_methods.py b/src/square/types/invoice_accepted_payment_methods.py
new file mode 100644
index 00000000..a4ffed06
--- /dev/null
+++ b/src/square/types/invoice_accepted_payment_methods.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class InvoiceAcceptedPaymentMethods(UncheckedBaseModel):
+ """
+ The payment methods that customers can use to pay an [invoice](entity:Invoice) on the Square-hosted invoice payment page.
+ """
+
+ card: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether credit card or debit card payments are accepted. The default value is `false`.
+ """
+
+ square_gift_card: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether Square gift card payments are accepted. The default value is `false`.
+ """
+
+ bank_account: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether ACH bank transfer payments are accepted. The default value is `false`.
+ """
+
+ buy_now_pay_later: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether Afterpay (also known as Clearpay) payments are accepted. The default value is `false`.
+
+ This option is allowed only for invoices that have a single payment request of the `BALANCE` type. This payment method is
+ supported if the seller account accepts Afterpay payments and the seller location is in a country where Afterpay
+ invoice payments are supported. As a best practice, consider enabling an additional payment method when allowing
+ `buy_now_pay_later` payments. For more information, including detailed requirements and processing limits, see
+ [Buy Now Pay Later payments with Afterpay](https://developer.squareup.com/docs/invoices-api/overview#buy-now-pay-later).
+ """
+
+ cash_app_pay: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether Cash App payments are accepted. The default value is `false`.
+
+ This payment method is supported only for seller [locations](entity:Location) in the United States.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_attachment.py b/src/square/types/invoice_attachment.py
new file mode 100644
index 00000000..5bb640ad
--- /dev/null
+++ b/src/square/types/invoice_attachment.py
@@ -0,0 +1,60 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class InvoiceAttachment(UncheckedBaseModel):
+ """
+ Represents a file attached to an [invoice](entity:Invoice).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the attachment.
+ """
+
+ filename: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The file name of the attachment, which is displayed on the invoice.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the attachment, which is displayed on the invoice.
+ This field maps to the seller-defined **Message** field.
+ """
+
+ filesize: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The file size of the attachment in bytes.
+ """
+
+ hash: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The MD5 hash that was generated from the file contents.
+ """
+
+ mime_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The mime type of the attachment.
+ The following mime types are supported:
+ image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf.
+ """
+
+ uploaded_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the attachment was uploaded, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_automatic_payment_source.py b/src/square/types/invoice_automatic_payment_source.py
new file mode 100644
index 00000000..6c09446a
--- /dev/null
+++ b/src/square/types/invoice_automatic_payment_source.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InvoiceAutomaticPaymentSource = typing.Union[typing.Literal["NONE", "CARD_ON_FILE", "BANK_ON_FILE"], typing.Any]
diff --git a/src/square/types/invoice_canceled_event.py b/src/square/types/invoice_canceled_event.py
new file mode 100644
index 00000000..2db2953f
--- /dev/null
+++ b/src/square/types/invoice_canceled_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_canceled_event_data import InvoiceCanceledEventData
+
+
+class InvoiceCanceledEvent(UncheckedBaseModel):
+ """
+ Published when an [Invoice](entity:Invoice) is canceled.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"invoice.canceled"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[InvoiceCanceledEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_canceled_event_data.py b/src/square/types/invoice_canceled_event_data.py
new file mode 100644
index 00000000..9eb1b406
--- /dev/null
+++ b/src/square/types/invoice_canceled_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_canceled_event_object import InvoiceCanceledEventObject
+
+
+class InvoiceCanceledEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing.Optional[InvoiceCanceledEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the canceled invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_canceled_event_object.py b/src/square/types/invoice_canceled_event_object.py
new file mode 100644
index 00000000..79a6bca3
--- /dev/null
+++ b/src/square/types/invoice_canceled_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice import Invoice
+
+
+class InvoiceCanceledEventObject(UncheckedBaseModel):
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The related invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_created_event.py b/src/square/types/invoice_created_event.py
new file mode 100644
index 00000000..172f9afa
--- /dev/null
+++ b/src/square/types/invoice_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_created_event_data import InvoiceCreatedEventData
+
+
+class InvoiceCreatedEvent(UncheckedBaseModel):
+ """
+ Published when an [Invoice](entity:Invoice) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"invoice.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[InvoiceCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_created_event_data.py b/src/square/types/invoice_created_event_data.py
new file mode 100644
index 00000000..e0dfdce8
--- /dev/null
+++ b/src/square/types/invoice_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_created_event_object import InvoiceCreatedEventObject
+
+
+class InvoiceCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing.Optional[InvoiceCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_created_event_object.py b/src/square/types/invoice_created_event_object.py
new file mode 100644
index 00000000..3de4a95c
--- /dev/null
+++ b/src/square/types/invoice_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice import Invoice
+
+
+class InvoiceCreatedEventObject(UncheckedBaseModel):
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The related invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_custom_field.py b/src/square/types/invoice_custom_field.py
new file mode 100644
index 00000000..32f89302
--- /dev/null
+++ b/src/square/types/invoice_custom_field.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_custom_field_placement import InvoiceCustomFieldPlacement
+
+
+class InvoiceCustomField(UncheckedBaseModel):
+ """
+ An additional seller-defined and customer-facing field to include on the invoice. For more information,
+ see [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields).
+
+ Adding custom fields to an invoice requires an
+ [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
+ """
+
+ label: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The label or title of the custom field. This field is required for a custom field.
+ """
+
+ value: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The text of the custom field. If omitted, only the label is rendered.
+ """
+
+ placement: typing.Optional[InvoiceCustomFieldPlacement] = pydantic.Field(default=None)
+ """
+ The location of the custom field on the invoice. This field is required for a custom field.
+ See [InvoiceCustomFieldPlacement](#type-invoicecustomfieldplacement) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_custom_field_placement.py b/src/square/types/invoice_custom_field_placement.py
new file mode 100644
index 00000000..d676f479
--- /dev/null
+++ b/src/square/types/invoice_custom_field_placement.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InvoiceCustomFieldPlacement = typing.Union[typing.Literal["ABOVE_LINE_ITEMS", "BELOW_LINE_ITEMS"], typing.Any]
diff --git a/src/square/types/invoice_deleted_event.py b/src/square/types/invoice_deleted_event.py
new file mode 100644
index 00000000..8339b17e
--- /dev/null
+++ b/src/square/types/invoice_deleted_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_deleted_event_data import InvoiceDeletedEventData
+
+
+class InvoiceDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a draft [Invoice](entity:Invoice) is deleted.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"invoice.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[InvoiceDeletedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_deleted_event_data.py b/src/square/types/invoice_deleted_event_data.py
new file mode 100644
index 00000000..12eaf07b
--- /dev/null
+++ b/src/square/types/invoice_deleted_event_data.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class InvoiceDeletedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected invoice.
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates that the invoice was deleted.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_delivery_method.py b/src/square/types/invoice_delivery_method.py
new file mode 100644
index 00000000..e47f6b6f
--- /dev/null
+++ b/src/square/types/invoice_delivery_method.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InvoiceDeliveryMethod = typing.Union[typing.Literal["EMAIL", "SHARE_MANUALLY", "SMS"], typing.Any]
diff --git a/src/square/types/invoice_filter.py b/src/square/types/invoice_filter.py
new file mode 100644
index 00000000..fdce9087
--- /dev/null
+++ b/src/square/types/invoice_filter.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class InvoiceFilter(UncheckedBaseModel):
+ """
+ Describes query filters to apply.
+ """
+
+ location_ids: typing.List[str] = pydantic.Field()
+ """
+ Limits the search to the specified locations. A location is required.
+ In the current implementation, only one location can be specified.
+ """
+
+ customer_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Limits the search to the specified customers, within the specified locations.
+ Specifying a customer is optional. In the current implementation,
+ a maximum of one customer can be specified.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_payment_made_event.py b/src/square/types/invoice_payment_made_event.py
new file mode 100644
index 00000000..bdadbc1b
--- /dev/null
+++ b/src/square/types/invoice_payment_made_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_payment_made_event_data import InvoicePaymentMadeEventData
+
+
+class InvoicePaymentMadeEvent(UncheckedBaseModel):
+ """
+ Published when a payment that is associated with an [invoice](entity:Invoice) is completed.
+ For more information about invoice payments, see [Pay an invoice](https://developer.squareup.com/docs/invoices-api/pay-refund-invoices#pay-invoice).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"invoice.payment_made"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[InvoicePaymentMadeEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_payment_made_event_data.py b/src/square/types/invoice_payment_made_event_data.py
new file mode 100644
index 00000000..ebe4737c
--- /dev/null
+++ b/src/square/types/invoice_payment_made_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_payment_made_event_object import InvoicePaymentMadeEventObject
+
+
+class InvoicePaymentMadeEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing.Optional[InvoicePaymentMadeEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the invoice that was paid.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_payment_made_event_object.py b/src/square/types/invoice_payment_made_event_object.py
new file mode 100644
index 00000000..a66c63c8
--- /dev/null
+++ b/src/square/types/invoice_payment_made_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice import Invoice
+
+
+class InvoicePaymentMadeEventObject(UncheckedBaseModel):
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The related invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_payment_reminder.py b/src/square/types/invoice_payment_reminder.py
new file mode 100644
index 00000000..94a7b4aa
--- /dev/null
+++ b/src/square/types/invoice_payment_reminder.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_payment_reminder_status import InvoicePaymentReminderStatus
+
+
+class InvoicePaymentReminder(UncheckedBaseModel):
+ """
+ Describes a payment request reminder (automatic notification) that Square sends
+ to the customer. You configure a reminder relative to the payment request
+ `due_date`.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A Square-assigned ID that uniquely identifies the reminder within the
+ `InvoicePaymentRequest`.
+ """
+
+ relative_scheduled_days: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of days before (a negative number) or after (a positive number)
+ the payment request `due_date` when the reminder is sent. For example, -3 indicates that
+ the reminder should be sent 3 days before the payment request `due_date`.
+ """
+
+ message: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The reminder message.
+ """
+
+ status: typing.Optional[InvoicePaymentReminderStatus] = pydantic.Field(default=None)
+ """
+ The status of the reminder.
+ See [InvoicePaymentReminderStatus](#type-invoicepaymentreminderstatus) for possible values
+ """
+
+ sent_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ If sent, the timestamp when the reminder was sent, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_payment_reminder_status.py b/src/square/types/invoice_payment_reminder_status.py
new file mode 100644
index 00000000..f6659b5b
--- /dev/null
+++ b/src/square/types/invoice_payment_reminder_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InvoicePaymentReminderStatus = typing.Union[typing.Literal["PENDING", "NOT_APPLICABLE", "SENT"], typing.Any]
diff --git a/src/square/types/invoice_payment_request.py b/src/square/types/invoice_payment_request.py
new file mode 100644
index 00000000..4008b50a
--- /dev/null
+++ b/src/square/types/invoice_payment_request.py
@@ -0,0 +1,138 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_automatic_payment_source import InvoiceAutomaticPaymentSource
+from .invoice_payment_reminder import InvoicePaymentReminder
+from .invoice_request_method import InvoiceRequestMethod
+from .invoice_request_type import InvoiceRequestType
+from .money import Money
+
+
+class InvoicePaymentRequest(UncheckedBaseModel):
+ """
+ Represents a payment request for an [invoice](entity:Invoice). Invoices can specify a maximum
+ of 13 payment requests, with up to 12 `INSTALLMENT` request types. For more information,
+ see [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests).
+
+ Adding `INSTALLMENT` payment requests to an invoice requires an
+ [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the payment request in an [invoice](entity:Invoice).
+ """
+
+ request_method: typing.Optional[InvoiceRequestMethod] = pydantic.Field(default=None)
+ """
+ Indicates how Square processes the payment request. DEPRECATED at version 2021-01-21. Replaced by the
+ `Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields.
+
+ One of the following is required when creating an invoice:
+ - (Recommended) The `delivery_method` field of the invoice. To configure an automatic payment, the
+ `automatic_payment_source` field of the payment request is also required.
+ - This `request_method` field. Note that `invoice` objects returned in responses do not include `request_method`.
+ See [InvoiceRequestMethod](#type-invoicerequestmethod) for possible values
+ """
+
+ request_type: typing.Optional[InvoiceRequestType] = pydantic.Field(default=None)
+ """
+ Identifies the payment request type. This type defines how the payment request amount is determined.
+ This field is required to create a payment request.
+ See [InvoiceRequestType](#type-invoicerequesttype) for possible values
+ """
+
+ due_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The due date (in the invoice's time zone) for the payment request, in `YYYY-MM-DD` format. This field
+ is required to create a payment request. If an `automatic_payment_source` is defined for the request, Square
+ charges the payment source on this date.
+
+ After this date, the invoice becomes overdue. For example, a payment `due_date` of 2021-03-09 with a `timezone`
+ of America/Los\\_Angeles becomes overdue at midnight on March 9 in America/Los\\_Angeles (which equals a UTC
+ timestamp of 2021-03-10T08:00:00Z).
+ """
+
+ fixed_amount_requested_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ If the payment request specifies `DEPOSIT` or `INSTALLMENT` as the `request_type`,
+ this indicates the request amount.
+ You cannot specify this when `request_type` is `BALANCE` or when the
+ payment request includes the `percentage_requested` field.
+ """
+
+ percentage_requested: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Specifies the amount for the payment request in percentage:
+
+ - When the payment `request_type` is `DEPOSIT`, it is the percentage of the order's total amount.
+ - When the payment `request_type` is `INSTALLMENT`, it is the percentage of the order's total less
+ the deposit, if requested. The sum of the `percentage_requested` in all installment
+ payment requests must be equal to 100.
+
+ You cannot specify this when the payment `request_type` is `BALANCE` or when the
+ payment request specifies the `fixed_amount_requested_money` field.
+ """
+
+ tipping_enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If set to true, the Square-hosted invoice page (the `public_url` field of the invoice)
+ provides a place for the customer to pay a tip.
+
+ This field is allowed only on the final payment request
+ and the payment `request_type` must be `BALANCE` or `INSTALLMENT`.
+ """
+
+ automatic_payment_source: typing.Optional[InvoiceAutomaticPaymentSource] = pydantic.Field(default=None)
+ """
+ The payment method for an automatic payment.
+
+ The default value is `NONE`.
+ See [InvoiceAutomaticPaymentSource](#type-invoiceautomaticpaymentsource) for possible values
+ """
+
+ card_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the credit or debit card on file to charge for the payment request. To get the cards on file for a customer,
+ call [ListCards](api-endpoint:Cards-ListCards) and include the `customer_id` of the invoice recipient.
+ """
+
+ reminders: typing.Optional[typing.List[InvoicePaymentReminder]] = pydantic.Field(default=None)
+ """
+ A list of one or more reminders to send for the payment request.
+ """
+
+ computed_amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of the payment request, computed using the order amount and information from the various payment
+ request fields (`request_type`, `fixed_amount_requested_money`, and `percentage_requested`).
+ """
+
+ total_completed_amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money already paid for the specific payment request.
+ This amount might include a rounding adjustment if the most recent invoice payment
+ was in cash in a currency that rounds cash payments (such as, `CAD` or `AUD`).
+ """
+
+ rounding_adjustment_included_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ If the most recent payment was a cash payment
+ in a currency that rounds cash payments (such as, `CAD` or `AUD`) and the payment
+ is rounded from `computed_amount_money` in the payment request, then this
+ field specifies the rounding adjustment applied. This amount
+ might be negative.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_published_event.py b/src/square/types/invoice_published_event.py
new file mode 100644
index 00000000..8b98d5b9
--- /dev/null
+++ b/src/square/types/invoice_published_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_published_event_data import InvoicePublishedEventData
+
+
+class InvoicePublishedEvent(UncheckedBaseModel):
+ """
+ Published when an [Invoice](entity:Invoice) transitions from a draft to a non-draft status.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"invoice.published"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[InvoicePublishedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_published_event_data.py b/src/square/types/invoice_published_event_data.py
new file mode 100644
index 00000000..63aa5d1d
--- /dev/null
+++ b/src/square/types/invoice_published_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_published_event_object import InvoicePublishedEventObject
+
+
+class InvoicePublishedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing.Optional[InvoicePublishedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the published invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_published_event_object.py b/src/square/types/invoice_published_event_object.py
new file mode 100644
index 00000000..bd45b970
--- /dev/null
+++ b/src/square/types/invoice_published_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice import Invoice
+
+
+class InvoicePublishedEventObject(UncheckedBaseModel):
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The related invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_query.py b/src/square/types/invoice_query.py
new file mode 100644
index 00000000..f155922d
--- /dev/null
+++ b/src/square/types/invoice_query.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_filter import InvoiceFilter
+from .invoice_sort import InvoiceSort
+
+
+class InvoiceQuery(UncheckedBaseModel):
+ """
+ Describes query criteria for searching invoices.
+ """
+
+ filter: InvoiceFilter = pydantic.Field()
+ """
+ Query filters to apply in searching invoices.
+ For more information, see [Search for invoices](https://developer.squareup.com/docs/invoices-api/retrieve-list-search-invoices#search-invoices).
+ """
+
+ sort: typing.Optional[InvoiceSort] = pydantic.Field(default=None)
+ """
+ Describes the sort order for the search result.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_recipient.py b/src/square/types/invoice_recipient.py
new file mode 100644
index 00000000..00c71f7d
--- /dev/null
+++ b/src/square/types/invoice_recipient.py
@@ -0,0 +1,71 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .invoice_recipient_tax_ids import InvoiceRecipientTaxIds
+
+
+class InvoiceRecipient(UncheckedBaseModel):
+ """
+ Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice
+ and that Square uses to deliver the invoice.
+
+ When you provide a customer ID for a draft invoice, Square retrieves the associated customer profile and populates
+ the remaining `InvoiceRecipient` fields. You cannot update these fields after the invoice is published.
+ Square updates the customer ID in response to a merge operation, but does not update other fields.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the customer. This is the customer profile ID that
+ you provide when creating a draft invoice.
+ """
+
+ given_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The recipient's given (that is, first) name.
+ """
+
+ family_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The recipient's family (that is, last) name.
+ """
+
+ email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The recipient's email address.
+ """
+
+ address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The recipient's physical address.
+ """
+
+ phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The recipient's phone number.
+ """
+
+ company_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the recipient's company.
+ """
+
+ tax_ids: typing.Optional[InvoiceRecipientTaxIds] = pydantic.Field(default=None)
+ """
+ The recipient's tax IDs. The country of the seller account determines whether this field
+ is available for the customer. For more information, see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_recipient_tax_ids.py b/src/square/types/invoice_recipient_tax_ids.py
new file mode 100644
index 00000000..1c9d5943
--- /dev/null
+++ b/src/square/types/invoice_recipient_tax_ids.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class InvoiceRecipientTaxIds(UncheckedBaseModel):
+ """
+ Represents the tax IDs for an invoice recipient. The country of the seller account determines
+ whether the corresponding `tax_ids` field is available for the customer. For more information,
+ see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids).
+ """
+
+ eu_vat: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The EU VAT identification number for the invoice recipient. For example, `IE3426675K`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_refunded_event.py b/src/square/types/invoice_refunded_event.py
new file mode 100644
index 00000000..71a415e6
--- /dev/null
+++ b/src/square/types/invoice_refunded_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_refunded_event_data import InvoiceRefundedEventData
+
+
+class InvoiceRefundedEvent(UncheckedBaseModel):
+ """
+ Published when a refund is applied toward a payment of an [invoice](entity:Invoice).
+ For more information about invoice refunds, see [Refund an invoice](https://developer.squareup.com/docs/invoices-api/pay-refund-invoices#refund-invoice).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"invoice.refunded"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[InvoiceRefundedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_refunded_event_data.py b/src/square/types/invoice_refunded_event_data.py
new file mode 100644
index 00000000..3d649954
--- /dev/null
+++ b/src/square/types/invoice_refunded_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_refunded_event_object import InvoiceRefundedEventObject
+
+
+class InvoiceRefundedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing.Optional[InvoiceRefundedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the refunded invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_refunded_event_object.py b/src/square/types/invoice_refunded_event_object.py
new file mode 100644
index 00000000..6070ba6a
--- /dev/null
+++ b/src/square/types/invoice_refunded_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice import Invoice
+
+
+class InvoiceRefundedEventObject(UncheckedBaseModel):
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The related invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_request_method.py b/src/square/types/invoice_request_method.py
new file mode 100644
index 00000000..7730dcc1
--- /dev/null
+++ b/src/square/types/invoice_request_method.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InvoiceRequestMethod = typing.Union[
+ typing.Literal[
+ "EMAIL",
+ "CHARGE_CARD_ON_FILE",
+ "SHARE_MANUALLY",
+ "CHARGE_BANK_ON_FILE",
+ "SMS",
+ "SMS_CHARGE_CARD_ON_FILE",
+ "SMS_CHARGE_BANK_ON_FILE",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/invoice_request_type.py b/src/square/types/invoice_request_type.py
new file mode 100644
index 00000000..a0ce192b
--- /dev/null
+++ b/src/square/types/invoice_request_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InvoiceRequestType = typing.Union[typing.Literal["BALANCE", "DEPOSIT", "INSTALLMENT"], typing.Any]
diff --git a/src/square/types/invoice_scheduled_charge_failed_event.py b/src/square/types/invoice_scheduled_charge_failed_event.py
new file mode 100644
index 00000000..47f6987e
--- /dev/null
+++ b/src/square/types/invoice_scheduled_charge_failed_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_scheduled_charge_failed_event_data import InvoiceScheduledChargeFailedEventData
+
+
+class InvoiceScheduledChargeFailedEvent(UncheckedBaseModel):
+ """
+ Published when an automatic scheduled payment for an [Invoice](entity:Invoice) has failed.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"invoice.scheduled_charge_failed"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[InvoiceScheduledChargeFailedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_scheduled_charge_failed_event_data.py b/src/square/types/invoice_scheduled_charge_failed_event_data.py
new file mode 100644
index 00000000..ff0132e0
--- /dev/null
+++ b/src/square/types/invoice_scheduled_charge_failed_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_scheduled_charge_failed_event_object import InvoiceScheduledChargeFailedEventObject
+
+
+class InvoiceScheduledChargeFailedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing.Optional[InvoiceScheduledChargeFailedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the invoice that experienced the failed scheduled charge.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_scheduled_charge_failed_event_object.py b/src/square/types/invoice_scheduled_charge_failed_event_object.py
new file mode 100644
index 00000000..75965e89
--- /dev/null
+++ b/src/square/types/invoice_scheduled_charge_failed_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice import Invoice
+
+
+class InvoiceScheduledChargeFailedEventObject(UncheckedBaseModel):
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The related invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_sort.py b/src/square/types/invoice_sort.py
new file mode 100644
index 00000000..34dcb583
--- /dev/null
+++ b/src/square/types/invoice_sort.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_sort_field import InvoiceSortField
+from .sort_order import SortOrder
+
+
+class InvoiceSort(UncheckedBaseModel):
+ """
+ Identifies the sort field and sort order.
+ """
+
+ field: InvoiceSortField = pydantic.Field(default="INVOICE_SORT_DATE")
+ """
+ The field to use for sorting.
+ See [InvoiceSortField](#type-invoicesortfield) for possible values
+ """
+
+ order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The order to use for sorting the results.
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_sort_field.py b/src/square/types/invoice_sort_field.py
new file mode 100644
index 00000000..165c1760
--- /dev/null
+++ b/src/square/types/invoice_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InvoiceSortField = typing.Literal["INVOICE_SORT_DATE"]
diff --git a/src/square/types/invoice_status.py b/src/square/types/invoice_status.py
new file mode 100644
index 00000000..bf7ae427
--- /dev/null
+++ b/src/square/types/invoice_status.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InvoiceStatus = typing.Union[
+ typing.Literal[
+ "DRAFT",
+ "UNPAID",
+ "SCHEDULED",
+ "PARTIALLY_PAID",
+ "PAID",
+ "PARTIALLY_REFUNDED",
+ "REFUNDED",
+ "CANCELED",
+ "FAILED",
+ "PAYMENT_PENDING",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/invoice_updated_event.py b/src/square/types/invoice_updated_event.py
new file mode 100644
index 00000000..1a8ec55a
--- /dev/null
+++ b/src/square/types/invoice_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_updated_event_data import InvoiceUpdatedEventData
+
+
+class InvoiceUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when an [Invoice](entity:Invoice) is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"invoice.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[InvoiceUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_updated_event_data.py b/src/square/types/invoice_updated_event_data.py
new file mode 100644
index 00000000..8e59a4a4
--- /dev/null
+++ b/src/square/types/invoice_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice_updated_event_object import InvoiceUpdatedEventObject
+
+
+class InvoiceUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"invoice"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected invoice.
+ """
+
+ object: typing.Optional[InvoiceUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/invoice_updated_event_object.py b/src/square/types/invoice_updated_event_object.py
new file mode 100644
index 00000000..a956adc3
--- /dev/null
+++ b/src/square/types/invoice_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .invoice import Invoice
+
+
+class InvoiceUpdatedEventObject(UncheckedBaseModel):
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The related invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/item_variation_location_overrides.py b/src/square/types/item_variation_location_overrides.py
new file mode 100644
index 00000000..a36f7cae
--- /dev/null
+++ b/src/square/types/item_variation_location_overrides.py
@@ -0,0 +1,81 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_pricing_type import CatalogPricingType
+from .inventory_alert_type import InventoryAlertType
+from .money import Money
+
+
+class ItemVariationLocationOverrides(UncheckedBaseModel):
+ """
+ Price and inventory alerting overrides for a `CatalogItemVariation` at a specific `Location`.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the `Location`. This can include locations that are deactivated.
+ """
+
+ price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The price of the `CatalogItemVariation` at the given `Location`, or blank for variable pricing.
+ """
+
+ pricing_type: typing.Optional[CatalogPricingType] = pydantic.Field(default=None)
+ """
+ The pricing type (fixed or variable) for the `CatalogItemVariation` at the given `Location`.
+ See [CatalogPricingType](#type-catalogpricingtype) for possible values
+ """
+
+ track_inventory: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether inventory tracking is active for the `CatalogItemVariation` at this `Location`.
+ When set, this value explicitly overrides the global `track_inventory` setting. When unset, the location
+ should use the global value. If both global and location-level values are unset, inventory tracking is disabled.
+ """
+
+ inventory_alert_type: typing.Optional[InventoryAlertType] = pydantic.Field(default=None)
+ """
+ Indicates whether the `CatalogItemVariation` displays an alert when its inventory
+ quantity is less than or equal to its `inventory_alert_threshold`.
+ See [InventoryAlertType](#type-inventoryalerttype) for possible values
+ """
+
+ inventory_alert_threshold: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type`
+ is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard.
+
+ This value is always an integer.
+ """
+
+ sold_out: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the overridden item variation is sold out at the specified location.
+
+ When inventory tracking is enabled on the item variation either globally or at the specified location,
+ the item variation is automatically marked as sold out when its inventory count reaches zero. The seller
+ can manually set the item variation as sold out even when the inventory count is greater than zero.
+ Attempts by an application to set this attribute are ignored. Regardless how the sold-out status is set,
+ applications should treat its inventory count as zero when this attribute value is `true`.
+ """
+
+ sold_out_valid_until: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The seller-assigned timestamp, of the RFC 3339 format, to indicate when this sold-out variation
+ becomes available again at the specified location. Attempts by an application to set this attribute are ignored.
+ When the current time is later than this attribute value, the affected item variation is no longer sold out.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/job.py b/src/square/types/job.py
new file mode 100644
index 00000000..c82bc4a7
--- /dev/null
+++ b/src/square/types/job.py
@@ -0,0 +1,59 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class Job(UncheckedBaseModel):
+ """
+ Represents a job that can be assigned to [team members](entity:TeamMember). This object defines the
+ job's title and tip eligibility. Compensation is defined in a [job assignment](entity:JobAssignment)
+ in a team member's wage setting.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ **Read only** The unique Square-assigned ID of the job. If you need a job ID for an API request,
+ call [ListJobs](api-endpoint:Team-ListJobs) or use the ID returned when you created the job.
+ You can also get job IDs from a team member's wage setting.
+ """
+
+ title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The title of the job.
+ """
+
+ is_tip_eligible: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether team members can earn tips for the job.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the job was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the job was last updated, in RFC 3339 format.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ **Read only** The current version of the job. Include this field in `UpdateJob` requests to enable
+ [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency)
+ control and avoid overwrites from concurrent requests. Requests fail if the provided version doesn't
+ match the server version at the time of the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/job_assignment.py b/src/square/types/job_assignment.py
new file mode 100644
index 00000000..c822c688
--- /dev/null
+++ b/src/square/types/job_assignment.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .job_assignment_pay_type import JobAssignmentPayType
+from .money import Money
+
+
+class JobAssignment(UncheckedBaseModel):
+ """
+ Represents a job assigned to a [team member](entity:TeamMember), including the compensation the team
+ member earns for the job. Job assignments are listed in the team member's [wage setting](entity:WageSetting).
+ """
+
+ job_title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The title of the job.
+ """
+
+ pay_type: JobAssignmentPayType = pydantic.Field()
+ """
+ The current pay type for the job assignment used to
+ calculate the pay amount in a pay period.
+ See [JobAssignmentPayType](#type-jobassignmentpaytype) for possible values
+ """
+
+ hourly_rate: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The hourly pay rate of the job. For `SALARY` pay types, Square calculates the hourly rate based on
+ `annual_rate` and `weekly_hours`.
+ """
+
+ annual_rate: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total pay amount for a 12-month period on the job. Set if the job `PayType` is `SALARY`.
+ """
+
+ weekly_hours: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The planned hours per week for the job. Set if the job `PayType` is `SALARY`.
+ """
+
+ job_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [job](entity:Job).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/job_assignment_pay_type.py b/src/square/types/job_assignment_pay_type.py
new file mode 100644
index 00000000..c4666e4b
--- /dev/null
+++ b/src/square/types/job_assignment_pay_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+JobAssignmentPayType = typing.Union[typing.Literal["NONE", "HOURLY", "SALARY"], typing.Any]
diff --git a/src/square/types/job_created_event.py b/src/square/types/job_created_event.py
new file mode 100644
index 00000000..c5274053
--- /dev/null
+++ b/src/square/types/job_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .job_created_event_data import JobCreatedEventData
+
+
+class JobCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a Job is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"job.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[JobCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/job_created_event_data.py b/src/square/types/job_created_event_data.py
new file mode 100644
index 00000000..b007b211
--- /dev/null
+++ b/src/square/types/job_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .job_created_event_object import JobCreatedEventObject
+
+
+class JobCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"job"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the created job.
+ """
+
+ object: typing.Optional[JobCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created job.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/job_created_event_object.py b/src/square/types/job_created_event_object.py
new file mode 100644
index 00000000..a735b4d9
--- /dev/null
+++ b/src/square/types/job_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .job import Job
+
+
+class JobCreatedEventObject(UncheckedBaseModel):
+ job: typing.Optional[Job] = pydantic.Field(default=None)
+ """
+ The created job.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/job_updated_event.py b/src/square/types/job_updated_event.py
new file mode 100644
index 00000000..f48c5763
--- /dev/null
+++ b/src/square/types/job_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .job_updated_event_data import JobUpdatedEventData
+
+
+class JobUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a Job is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"job.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[JobUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/job_updated_event_data.py b/src/square/types/job_updated_event_data.py
new file mode 100644
index 00000000..c6ae68c0
--- /dev/null
+++ b/src/square/types/job_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .job_updated_event_object import JobUpdatedEventObject
+
+
+class JobUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"job"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the updated job.
+ """
+
+ object: typing.Optional[JobUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated job.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/job_updated_event_object.py b/src/square/types/job_updated_event_object.py
new file mode 100644
index 00000000..d6f5725b
--- /dev/null
+++ b/src/square/types/job_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .job import Job
+
+
+class JobUpdatedEventObject(UncheckedBaseModel):
+ job: typing.Optional[Job] = pydantic.Field(default=None)
+ """
+ The updated job.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/join_hint.py b/src/square/types/join_hint.py
new file mode 100644
index 00000000..b9692d7d
--- /dev/null
+++ b/src/square/types/join_hint.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+JoinHint = typing.List[str]
diff --git a/src/square/types/join_subquery.py b/src/square/types/join_subquery.py
new file mode 100644
index 00000000..777cb11c
--- /dev/null
+++ b/src/square/types/join_subquery.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class JoinSubquery(UncheckedBaseModel):
+ sql: str
+ on: str
+ join_type: typing_extensions.Annotated[str, FieldMetadata(alias="joinType"), pydantic.Field(alias="joinType")]
+ alias: str
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_created_event.py b/src/square/types/labor_scheduled_shift_created_event.py
new file mode 100644
index 00000000..70cf8998
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_created_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_scheduled_shift_created_event_data import LaborScheduledShiftCreatedEventData
+
+
+class LaborScheduledShiftCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [ScheduledShift](entity:ScheduledShift) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `labor.scheduled_shift.created`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LaborScheduledShiftCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_created_event_data.py b/src/square/types/labor_scheduled_shift_created_event_data.py
new file mode 100644
index 00000000..8064b29c
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_scheduled_shift_created_event_object import LaborScheduledShiftCreatedEventObject
+
+
+class LaborScheduledShiftCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `scheduled_shift`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected `ScheduledShift`.
+ """
+
+ object: typing.Optional[LaborScheduledShiftCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the affected `ScheduledShift`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_created_event_object.py b/src/square/types/labor_scheduled_shift_created_event_object.py
new file mode 100644
index 00000000..74280d59
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_created_event_object.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .scheduled_shift import ScheduledShift
+
+
+class LaborScheduledShiftCreatedEventObject(UncheckedBaseModel):
+ scheduled_shift: typing_extensions.Annotated[
+ typing.Optional[ScheduledShift],
+ FieldMetadata(alias="ScheduledShift"),
+ pydantic.Field(alias="ScheduledShift", description="The new `ScheduledShift`."),
+ ] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_deleted_event.py b/src/square/types/labor_scheduled_shift_deleted_event.py
new file mode 100644
index 00000000..5d4a71a2
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_deleted_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_scheduled_shift_deleted_event_data import LaborScheduledShiftDeletedEventData
+
+
+class LaborScheduledShiftDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a [ScheduledShift](entity:ScheduledShift) is deleted.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `labor.scheduled_shift.deleted`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LaborScheduledShiftDeletedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_deleted_event_data.py b/src/square/types/labor_scheduled_shift_deleted_event_data.py
new file mode 100644
index 00000000..47b86951
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_deleted_event_data.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LaborScheduledShiftDeletedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `scheduled_shift`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected `ScheduledShift`.
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Is true if the affected object was deleted. Otherwise absent.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_published_event.py b/src/square/types/labor_scheduled_shift_published_event.py
new file mode 100644
index 00000000..d222966b
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_published_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_scheduled_shift_published_event_data import LaborScheduledShiftPublishedEventData
+
+
+class LaborScheduledShiftPublishedEvent(UncheckedBaseModel):
+ """
+ Published when a [ScheduledShift](entity:ScheduledShift) is published.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `labor.scheduled_shift.published`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LaborScheduledShiftPublishedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_published_event_data.py b/src/square/types/labor_scheduled_shift_published_event_data.py
new file mode 100644
index 00000000..f4e15fea
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_published_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_scheduled_shift_published_event_object import LaborScheduledShiftPublishedEventObject
+
+
+class LaborScheduledShiftPublishedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `scheduled_shift`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected `ScheduledShift`.
+ """
+
+ object: typing.Optional[LaborScheduledShiftPublishedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the affected `ScheduledShift`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_published_event_object.py b/src/square/types/labor_scheduled_shift_published_event_object.py
new file mode 100644
index 00000000..2e5eb564
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_published_event_object.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .scheduled_shift import ScheduledShift
+
+
+class LaborScheduledShiftPublishedEventObject(UncheckedBaseModel):
+ scheduled_shift: typing_extensions.Annotated[
+ typing.Optional[ScheduledShift],
+ FieldMetadata(alias="ScheduledShift"),
+ pydantic.Field(alias="ScheduledShift", description="The published `ScheduledShift`."),
+ ] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_updated_event.py b/src/square/types/labor_scheduled_shift_updated_event.py
new file mode 100644
index 00000000..1a67cdbb
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_updated_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_scheduled_shift_updated_event_data import LaborScheduledShiftUpdatedEventData
+
+
+class LaborScheduledShiftUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [ScheduledShift](entity:ScheduledShift) is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `labor.scheduled_shift.updated`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LaborScheduledShiftUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_updated_event_data.py b/src/square/types/labor_scheduled_shift_updated_event_data.py
new file mode 100644
index 00000000..330b3cc2
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_scheduled_shift_updated_event_object import LaborScheduledShiftUpdatedEventObject
+
+
+class LaborScheduledShiftUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `scheduled_shift`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected `ScheduledShift`.
+ """
+
+ object: typing.Optional[LaborScheduledShiftUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the affected `ScheduledShift`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_scheduled_shift_updated_event_object.py b/src/square/types/labor_scheduled_shift_updated_event_object.py
new file mode 100644
index 00000000..6d8268f8
--- /dev/null
+++ b/src/square/types/labor_scheduled_shift_updated_event_object.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .scheduled_shift import ScheduledShift
+
+
+class LaborScheduledShiftUpdatedEventObject(UncheckedBaseModel):
+ scheduled_shift: typing_extensions.Annotated[
+ typing.Optional[ScheduledShift],
+ FieldMetadata(alias="ScheduledShift"),
+ pydantic.Field(alias="ScheduledShift", description="The updated `ScheduledShift`."),
+ ] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_shift_created_event.py b/src/square/types/labor_shift_created_event.py
new file mode 100644
index 00000000..726af24d
--- /dev/null
+++ b/src/square/types/labor_shift_created_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_shift_created_event_data import LaborShiftCreatedEventData
+
+
+class LaborShiftCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a worker starts a [Shift](entity:Shift).
+
+ Deprecated at Square API version 2025-05-21. Replaced by `labor.timecard.created`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `labor.shift.created`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LaborShiftCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_shift_created_event_data.py b/src/square/types/labor_shift_created_event_data.py
new file mode 100644
index 00000000..8e8db533
--- /dev/null
+++ b/src/square/types/labor_shift_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_shift_created_event_object import LaborShiftCreatedEventObject
+
+
+class LaborShiftCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `shift`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected `Shift`.
+ """
+
+ object: typing.Optional[LaborShiftCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the affected `Shift`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_shift_created_event_object.py b/src/square/types/labor_shift_created_event_object.py
new file mode 100644
index 00000000..e3d5fc80
--- /dev/null
+++ b/src/square/types/labor_shift_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .shift import Shift
+
+
+class LaborShiftCreatedEventObject(UncheckedBaseModel):
+ shift: typing.Optional[Shift] = pydantic.Field(default=None)
+ """
+ The new `Shift`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_shift_deleted_event.py b/src/square/types/labor_shift_deleted_event.py
new file mode 100644
index 00000000..fa94d134
--- /dev/null
+++ b/src/square/types/labor_shift_deleted_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_shift_deleted_event_data import LaborShiftDeletedEventData
+
+
+class LaborShiftDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a [Shift](entity:Shift) is deleted.
+
+ Deprecated at Square API version 2025-05-21. Replaced by `labor.timecard.deleted`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `labor.shift.deleted`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LaborShiftDeletedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_shift_deleted_event_data.py b/src/square/types/labor_shift_deleted_event_data.py
new file mode 100644
index 00000000..fb5dfc8e
--- /dev/null
+++ b/src/square/types/labor_shift_deleted_event_data.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LaborShiftDeletedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `shift`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected `Shift`.
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Is true if the affected object was deleted. Otherwise absent.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_shift_updated_event.py b/src/square/types/labor_shift_updated_event.py
new file mode 100644
index 00000000..088cce6f
--- /dev/null
+++ b/src/square/types/labor_shift_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_shift_updated_event_data import LaborShiftUpdatedEventData
+
+
+class LaborShiftUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Shift](entity:Shift) is updated.
+
+ Deprecated at Square API version 2025-05-21. Replaced by `labor.timecard.updated`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `labor.shift.updated`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LaborShiftUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_shift_updated_event_data.py b/src/square/types/labor_shift_updated_event_data.py
new file mode 100644
index 00000000..7897aced
--- /dev/null
+++ b/src/square/types/labor_shift_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_shift_updated_event_object import LaborShiftUpdatedEventObject
+
+
+class LaborShiftUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `shift`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected `Shift`.
+ """
+
+ object: typing.Optional[LaborShiftUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the affected `Shift`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_shift_updated_event_object.py b/src/square/types/labor_shift_updated_event_object.py
new file mode 100644
index 00000000..9b0cbfb8
--- /dev/null
+++ b/src/square/types/labor_shift_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .shift import Shift
+
+
+class LaborShiftUpdatedEventObject(UncheckedBaseModel):
+ shift: typing.Optional[Shift] = pydantic.Field(default=None)
+ """
+ The updated `Shift`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_timecard_created_event.py b/src/square/types/labor_timecard_created_event.py
new file mode 100644
index 00000000..7676aa0e
--- /dev/null
+++ b/src/square/types/labor_timecard_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_timecard_created_event_data import LaborTimecardCreatedEventData
+
+
+class LaborTimecardCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a worker starts a [Timecard](entity:Timecard).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `labor.timecard.created`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LaborTimecardCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_timecard_created_event_data.py b/src/square/types/labor_timecard_created_event_data.py
new file mode 100644
index 00000000..29055d57
--- /dev/null
+++ b/src/square/types/labor_timecard_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_timecard_created_event_object import LaborTimecardCreatedEventObject
+
+
+class LaborTimecardCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `timecard`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected `Timecard`.
+ """
+
+ object: typing.Optional[LaborTimecardCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the affected `Timecard`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_timecard_created_event_object.py b/src/square/types/labor_timecard_created_event_object.py
new file mode 100644
index 00000000..262e0b92
--- /dev/null
+++ b/src/square/types/labor_timecard_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .timecard import Timecard
+
+
+class LaborTimecardCreatedEventObject(UncheckedBaseModel):
+ timecard: typing.Optional[Timecard] = pydantic.Field(default=None)
+ """
+ The new `Timecard`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_timecard_deleted_event.py b/src/square/types/labor_timecard_deleted_event.py
new file mode 100644
index 00000000..248417bd
--- /dev/null
+++ b/src/square/types/labor_timecard_deleted_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_timecard_deleted_event_data import LaborTimecardDeletedEventData
+
+
+class LaborTimecardDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a [Timecard](entity:Timecard) is deleted.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `labor.timecard.deleted`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LaborTimecardDeletedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_timecard_deleted_event_data.py b/src/square/types/labor_timecard_deleted_event_data.py
new file mode 100644
index 00000000..990c9718
--- /dev/null
+++ b/src/square/types/labor_timecard_deleted_event_data.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LaborTimecardDeletedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `timecard`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected `Timecard`.
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Is true if the affected object was deleted. Otherwise absent.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_timecard_updated_event.py b/src/square/types/labor_timecard_updated_event.py
new file mode 100644
index 00000000..5fb15041
--- /dev/null
+++ b/src/square/types/labor_timecard_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_timecard_updated_event_data import LaborTimecardUpdatedEventData
+
+
+class LaborTimecardUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Timecard](entity:Timecard) is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `labor.timecard.updated`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LaborTimecardUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_timecard_updated_event_data.py b/src/square/types/labor_timecard_updated_event_data.py
new file mode 100644
index 00000000..e9e1e48d
--- /dev/null
+++ b/src/square/types/labor_timecard_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .labor_timecard_updated_event_object import LaborTimecardUpdatedEventObject
+
+
+class LaborTimecardUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `timecard`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected `Timecard`.
+ """
+
+ object: typing.Optional[LaborTimecardUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the affected `Timecard`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/labor_timecard_updated_event_object.py b/src/square/types/labor_timecard_updated_event_object.py
new file mode 100644
index 00000000..f83ea634
--- /dev/null
+++ b/src/square/types/labor_timecard_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .timecard import Timecard
+
+
+class LaborTimecardUpdatedEventObject(UncheckedBaseModel):
+ timecard: typing.Optional[Timecard] = pydantic.Field(default=None)
+ """
+ The updated `Timecard`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/lightning_details.py b/src/square/types/lightning_details.py
new file mode 100644
index 00000000..9066ad19
--- /dev/null
+++ b/src/square/types/lightning_details.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LightningDetails(UncheckedBaseModel):
+ """
+ Additional details about `WALLET` type payments with the `brand` of `LIGHTNING`.
+ """
+
+ payment_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Payment URL for the lightning payment, a.k.a. the invoice.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/link_customer_to_gift_card_response.py b/src/square/types/link_customer_to_gift_card_response.py
new file mode 100644
index 00000000..5fa2dd67
--- /dev/null
+++ b/src/square/types/link_customer_to_gift_card_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .gift_card import GiftCard
+
+
+class LinkCustomerToGiftCardResponse(UncheckedBaseModel):
+ """
+ A response that contains the linked `GiftCard` object. If the request resulted in errors,
+ the response contains a set of `Error` objects.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing.Optional[GiftCard] = pydantic.Field(default=None)
+ """
+ The gift card with the ID of the linked customer listed in the `customer_ids` field.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/link_format.py b/src/square/types/link_format.py
new file mode 100644
index 00000000..423bc8a8
--- /dev/null
+++ b/src/square/types/link_format.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LinkFormat(UncheckedBaseModel):
+ """
+ Link format with label and type
+ """
+
+ label: str = pydantic.Field()
+ """
+ Label for the link
+ """
+
+ type: typing.Literal["link"] = pydantic.Field(default="link")
+ """
+ Type of the format (must be 'link')
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_bank_accounts_response.py b/src/square/types/list_bank_accounts_response.py
new file mode 100644
index 00000000..b853a5a1
--- /dev/null
+++ b/src/square/types/list_bank_accounts_response.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .bank_account import BankAccount
+from .error import Error
+
+
+class ListBankAccountsResponse(UncheckedBaseModel):
+ """
+ Response object returned by ListBankAccounts.
+ """
+
+ bank_accounts: typing.Optional[typing.List[BankAccount]] = pydantic.Field(default=None)
+ """
+ List of BankAccounts associated with this account.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When a response is truncated, it includes a cursor that you can
+ use in a subsequent request to fetch next set of bank accounts.
+ If empty, this is the final response.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_booking_custom_attribute_definitions_response.py b/src/square/types/list_booking_custom_attribute_definitions_response.py
new file mode 100644
index 00000000..66e594f0
--- /dev/null
+++ b/src/square/types/list_booking_custom_attribute_definitions_response.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class ListBookingCustomAttributeDefinitionsResponse(UncheckedBaseModel):
+ """
+ Represents a [ListBookingCustomAttributeDefinitions](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributeDefinitions) response.
+ Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response.
+ If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`.
+ """
+
+ custom_attribute_definitions: typing.Optional[typing.List[CustomAttributeDefinition]] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute definitions. If no custom attribute definitions are found,
+ Square returns an empty object (`{}`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of
+ results for your original request. This field is present only if the request succeeded and
+ additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_booking_custom_attributes_response.py b/src/square/types/list_booking_custom_attributes_response.py
new file mode 100644
index 00000000..0260598c
--- /dev/null
+++ b/src/square/types/list_booking_custom_attributes_response.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class ListBookingCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [ListBookingCustomAttributes](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributes) response.
+ Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional
+ results are available, the `cursor` field is also present along with `custom_attributes`.
+ """
+
+ custom_attributes: typing.Optional[typing.List[CustomAttribute]] = pydantic.Field(default=None)
+ """
+ The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field of each custom attribute.
+
+ If no custom attributes are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to use in your next call to this endpoint to retrieve the next page of results
+ for your original request. This field is present only if the request succeeded and additional
+ results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_bookings_response.py b/src/square/types/list_bookings_response.py
new file mode 100644
index 00000000..54d4e916
--- /dev/null
+++ b/src/square/types/list_bookings_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking import Booking
+from .error import Error
+
+
+class ListBookingsResponse(UncheckedBaseModel):
+ bookings: typing.Optional[typing.List[Booking]] = pydantic.Field(default=None)
+ """
+ The list of targeted bookings.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_break_types_response.py b/src/square/types/list_break_types_response.py
new file mode 100644
index 00000000..2758a748
--- /dev/null
+++ b/src/square/types/list_break_types_response.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .break_type import BreakType
+from .error import Error
+
+
+class ListBreakTypesResponse(UncheckedBaseModel):
+ """
+ The response to a request for a set of `BreakType` objects. The response contains
+ the requested `BreakType` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ break_types: typing.Optional[typing.List[BreakType]] = pydantic.Field(default=None)
+ """
+ A page of `BreakType` results.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The value supplied in the subsequent request to fetch the next page
+ of `BreakType` results.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_cards_response.py b/src/square/types/list_cards_response.py
new file mode 100644
index 00000000..7e397daa
--- /dev/null
+++ b/src/square/types/list_cards_response.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+from .error import Error
+
+
+class ListCardsResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListCards](api-endpoint:Cards-ListCards) endpoint.
+
+ Note: if there are errors processing the request, the card field will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ cards: typing.Optional[typing.List[Card]] = pydantic.Field(default=None)
+ """
+ The requested list of `Card`s.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_cash_drawer_shift_events_response.py b/src/square/types/list_cash_drawer_shift_events_response.py
new file mode 100644
index 00000000..8c262e52
--- /dev/null
+++ b/src/square/types/list_cash_drawer_shift_events_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .cash_drawer_shift_event import CashDrawerShiftEvent
+from .error import Error
+
+
+class ListCashDrawerShiftEventsResponse(UncheckedBaseModel):
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Opaque cursor for fetching the next page. Cursor is not present in
+ the last page of results.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ cash_drawer_shift_events: typing.Optional[typing.List[CashDrawerShiftEvent]] = pydantic.Field(default=None)
+ """
+ All of the events (payments, refunds, etc.) for a cash drawer during
+ the shift.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_cash_drawer_shifts_response.py b/src/square/types/list_cash_drawer_shifts_response.py
new file mode 100644
index 00000000..1eb4dac2
--- /dev/null
+++ b/src/square/types/list_cash_drawer_shifts_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .cash_drawer_shift_summary import CashDrawerShiftSummary
+from .error import Error
+
+
+class ListCashDrawerShiftsResponse(UncheckedBaseModel):
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Opaque cursor for fetching the next page of results. Cursor is not
+ present in the last page of results.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ cash_drawer_shifts: typing.Optional[typing.List[CashDrawerShiftSummary]] = pydantic.Field(default=None)
+ """
+ A collection of CashDrawerShiftSummary objects for shifts that match
+ the query.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_catalog_response.py b/src/square/types/list_catalog_response.py
new file mode 100644
index 00000000..8610b157
--- /dev/null
+++ b/src/square/types/list_catalog_response.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class ListCatalogResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If unset, this is the final response.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
+
+ objects: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ The CatalogObjects returned.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ ListCatalogResponse,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/list_channels_request_constants.py b/src/square/types/list_channels_request_constants.py
new file mode 100644
index 00000000..c63482b5
--- /dev/null
+++ b/src/square/types/list_channels_request_constants.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ListChannelsRequestConstants = typing.Literal["MAX_PAGE_SIZE"]
diff --git a/src/square/types/list_channels_response.py b/src/square/types/list_channels_response.py
new file mode 100644
index 00000000..939cd62e
--- /dev/null
+++ b/src/square/types/list_channels_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .channel import Channel
+from .error import Error
+
+
+class ListChannelsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ channels: typing.Optional[typing.List[Channel]] = pydantic.Field(default=None)
+ """
+ List of requested Channel.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The token required to retrieve the next page of results.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_customer_custom_attribute_definitions_response.py b/src/square/types/list_customer_custom_attribute_definitions_response.py
new file mode 100644
index 00000000..c7b0d478
--- /dev/null
+++ b/src/square/types/list_customer_custom_attribute_definitions_response.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class ListCustomerCustomAttributeDefinitionsResponse(UncheckedBaseModel):
+ """
+ Represents a [ListCustomerCustomAttributeDefinitions](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributeDefinitions) response.
+ Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response.
+ If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`.
+ """
+
+ custom_attribute_definitions: typing.Optional[typing.List[CustomAttributeDefinition]] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute definitions. If no custom attribute definitions are found,
+ Square returns an empty object (`{}`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of
+ results for your original request. This field is present only if the request succeeded and
+ additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_customer_custom_attributes_response.py b/src/square/types/list_customer_custom_attributes_response.py
new file mode 100644
index 00000000..51f6c5c8
--- /dev/null
+++ b/src/square/types/list_customer_custom_attributes_response.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class ListCustomerCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [ListCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributes) response.
+ Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional
+ results are available, the `cursor` field is also present along with `custom_attributes`.
+ """
+
+ custom_attributes: typing.Optional[typing.List[CustomAttribute]] = pydantic.Field(default=None)
+ """
+ The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field of each custom attribute.
+
+ If no custom attributes are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to use in your next call to this endpoint to retrieve the next page of results
+ for your original request. This field is present only if the request succeeded and additional
+ results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_customer_groups_response.py b/src/square/types/list_customer_groups_response.py
new file mode 100644
index 00000000..7bc5b0e4
--- /dev/null
+++ b/src/square/types/list_customer_groups_response.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_group import CustomerGroup
+from .error import Error
+
+
+class ListCustomerGroupsResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListCustomerGroups](api-endpoint:CustomerGroups-ListCustomerGroups) endpoint.
+
+ Either `errors` or `groups` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ groups: typing.Optional[typing.List[CustomerGroup]] = pydantic.Field(default=None)
+ """
+ A list of customer groups belonging to the current seller.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A pagination cursor to retrieve the next set of results for your
+ original query to the endpoint. This value is present only if the request
+ succeeded and additional results are available.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_customer_segments_response.py b/src/square/types/list_customer_segments_response.py
new file mode 100644
index 00000000..5cf2b649
--- /dev/null
+++ b/src/square/types/list_customer_segments_response.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_segment import CustomerSegment
+from .error import Error
+
+
+class ListCustomerSegmentsResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body for requests to the `ListCustomerSegments` endpoint.
+
+ Either `errors` or `segments` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ segments: typing.Optional[typing.List[CustomerSegment]] = pydantic.Field(default=None)
+ """
+ The list of customer segments belonging to the associated Square account.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A pagination cursor to be used in subsequent calls to `ListCustomerSegments`
+ to retrieve the next set of query results. The cursor is only present if the request succeeded and
+ additional results are available.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_customers_response.py b/src/square/types/list_customers_response.py
new file mode 100644
index 00000000..ff3a9569
--- /dev/null
+++ b/src/square/types/list_customers_response.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer import Customer
+from .error import Error
+
+
+class ListCustomersResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `ListCustomers` endpoint.
+
+ Either `errors` or `customers` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ customers: typing.Optional[typing.List[Customer]] = pydantic.Field(default=None)
+ """
+ The customer profiles associated with the Square account or an empty object (`{}`) if none are found.
+ Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or
+ `phone_number`) are included in the response.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A pagination cursor to retrieve the next set of results for the
+ original query. A cursor is only present if the request succeeded and additional results
+ are available.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The total count of customers associated with the Square account. Only customer profiles with public information
+ (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is present
+ only if `count` is set to `true` in the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_device_codes_response.py b/src/square/types/list_device_codes_response.py
new file mode 100644
index 00000000..44612897
--- /dev/null
+++ b/src/square/types/list_device_codes_response.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device_code import DeviceCode
+from .error import Error
+
+
+class ListDeviceCodesResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ device_codes: typing.Optional[typing.List[DeviceCode]] = pydantic.Field(default=None)
+ """
+ The queried DeviceCode.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A pagination cursor to retrieve the next set of results for your
+ original query to the endpoint. This value is present only if the request
+ succeeded and additional results are available.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_devices_response.py b/src/square/types/list_devices_response.py
new file mode 100644
index 00000000..f909335b
--- /dev/null
+++ b/src/square/types/list_devices_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .device import Device
+from .error import Error
+
+
+class ListDevicesResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors that occurred during the request.
+ """
+
+ devices: typing.Optional[typing.List[Device]] = pydantic.Field(default=None)
+ """
+ The requested list of `Device` objects.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_dispute_evidence_response.py b/src/square/types/list_dispute_evidence_response.py
new file mode 100644
index 00000000..96d3f49b
--- /dev/null
+++ b/src/square/types/list_dispute_evidence_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute_evidence import DisputeEvidence
+from .error import Error
+
+
+class ListDisputeEvidenceResponse(UncheckedBaseModel):
+ """
+ Defines the fields in a `ListDisputeEvidence` response.
+ """
+
+ evidence: typing.Optional[typing.List[DisputeEvidence]] = pydantic.Field(default=None)
+ """
+ The list of evidence previously uploaded to the specified dispute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request.
+ If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_disputes_response.py b/src/square/types/list_disputes_response.py
new file mode 100644
index 00000000..76dd4b97
--- /dev/null
+++ b/src/square/types/list_disputes_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+from .error import Error
+
+
+class ListDisputesResponse(UncheckedBaseModel):
+ """
+ Defines fields in a `ListDisputes` response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ disputes: typing.Optional[typing.List[Dispute]] = pydantic.Field(default=None)
+ """
+ The list of disputes.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request.
+ If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_employee_wages_response.py b/src/square/types/list_employee_wages_response.py
new file mode 100644
index 00000000..14398743
--- /dev/null
+++ b/src/square/types/list_employee_wages_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .employee_wage import EmployeeWage
+from .error import Error
+
+
+class ListEmployeeWagesResponse(UncheckedBaseModel):
+ """
+ The response to a request for a set of `EmployeeWage` objects. The response contains
+ a set of `EmployeeWage` objects.
+ """
+
+ employee_wages: typing.Optional[typing.List[EmployeeWage]] = pydantic.Field(default=None)
+ """
+ A page of `EmployeeWage` results.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The value supplied in the subsequent request to fetch the next page
+ of `EmployeeWage` results.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_employees_response.py b/src/square/types/list_employees_response.py
new file mode 100644
index 00000000..0449f868
--- /dev/null
+++ b/src/square/types/list_employees_response.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .employee import Employee
+from .error import Error
+
+
+class ListEmployeesResponse(UncheckedBaseModel):
+ employees: typing.Optional[typing.List[Employee]] = None
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The token to be used to retrieve the next page of results.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_event_types_response.py b/src/square/types/list_event_types_response.py
new file mode 100644
index 00000000..02feffeb
--- /dev/null
+++ b/src/square/types/list_event_types_response.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .event_type_metadata import EventTypeMetadata
+
+
+class ListEventTypesResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListEventTypes](api-endpoint:Events-ListEventTypes) endpoint.
+
+ Note: if there are errors processing the request, the event types field will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ event_types: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The list of event types.
+ """
+
+ metadata: typing.Optional[typing.List[EventTypeMetadata]] = pydantic.Field(default=None)
+ """
+ Contains the metadata of an event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_gift_card_activities_response.py b/src/square/types/list_gift_card_activities_response.py
new file mode 100644
index 00000000..7ec16d16
--- /dev/null
+++ b/src/square/types/list_gift_card_activities_response.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .gift_card_activity import GiftCardActivity
+
+
+class ListGiftCardActivitiesResponse(UncheckedBaseModel):
+ """
+ A response that contains a list of `GiftCardActivity` objects. If the request resulted in errors,
+ the response contains a set of `Error` objects.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card_activities: typing.Optional[typing.List[GiftCardActivity]] = pydantic.Field(default=None)
+ """
+ The requested gift card activities or an empty object if none are found.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When a response is truncated, it includes a cursor that you can use in a
+ subsequent request to retrieve the next set of activities. If a cursor is not present, this is
+ the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_gift_cards_response.py b/src/square/types/list_gift_cards_response.py
new file mode 100644
index 00000000..21f527ef
--- /dev/null
+++ b/src/square/types/list_gift_cards_response.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .gift_card import GiftCard
+
+
+class ListGiftCardsResponse(UncheckedBaseModel):
+ """
+ A response that contains a list of `GiftCard` objects. If the request resulted in errors,
+ the response contains a set of `Error` objects.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_cards: typing.Optional[typing.List[GiftCard]] = pydantic.Field(default=None)
+ """
+ The requested gift cards or an empty object if none are found.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When a response is truncated, it includes a cursor that you can use in a
+ subsequent request to retrieve the next set of gift cards. If a cursor is not present, this is
+ the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_inventory_adjustment_reasons_response.py b/src/square/types/list_inventory_adjustment_reasons_response.py
new file mode 100644
index 00000000..8ee2eaef
--- /dev/null
+++ b/src/square/types/list_inventory_adjustment_reasons_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class ListInventoryAdjustmentReasonsResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [ListInventoryAdjustmentReasons](api-endpoint:Inventory-ListInventoryAdjustmentReasons).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reasons: typing.Optional[typing.List[InventoryAdjustmentReason]] = pydantic.Field(default=None)
+ """
+ The standard, system-generated, and custom inventory adjustment
+ reasons available to the seller.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_invoices_response.py b/src/square/types/list_invoices_response.py
new file mode 100644
index 00000000..ebbc7eca
--- /dev/null
+++ b/src/square/types/list_invoices_response.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .invoice import Invoice
+
+
+class ListInvoicesResponse(UncheckedBaseModel):
+ """
+ Describes a `ListInvoice` response.
+ """
+
+ invoices: typing.Optional[typing.List[Invoice]] = pydantic.Field(default=None)
+ """
+ The invoices retrieved.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When a response is truncated, it includes a cursor that you can use in a
+ subsequent request to retrieve the next set of invoices. If empty, this is the final
+ response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_jobs_response.py b/src/square/types/list_jobs_response.py
new file mode 100644
index 00000000..0d8c0326
--- /dev/null
+++ b/src/square/types/list_jobs_response.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .job import Job
+
+
+class ListJobsResponse(UncheckedBaseModel):
+ """
+ Represents a [ListJobs](api-endpoint:Team-ListJobs) response. Either `jobs` or `errors`
+ is present in the response. If additional results are available, the `cursor` field is also present.
+ """
+
+ jobs: typing.Optional[typing.List[Job]] = pydantic.Field(default=None)
+ """
+ The retrieved jobs. A single paged response contains up to 100 jobs.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An opaque cursor used to retrieve the next page of results. This field is present only
+ if the request succeeded and additional results are available. For more information, see
+ [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_location_booking_profiles_response.py b/src/square/types/list_location_booking_profiles_response.py
new file mode 100644
index 00000000..e0376d9f
--- /dev/null
+++ b/src/square/types/list_location_booking_profiles_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .location_booking_profile import LocationBookingProfile
+
+
+class ListLocationBookingProfilesResponse(UncheckedBaseModel):
+ location_booking_profiles: typing.Optional[typing.List[LocationBookingProfile]] = pydantic.Field(default=None)
+ """
+ The list of a seller's location booking profiles.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_location_custom_attribute_definitions_response.py b/src/square/types/list_location_custom_attribute_definitions_response.py
new file mode 100644
index 00000000..a4689bf4
--- /dev/null
+++ b/src/square/types/list_location_custom_attribute_definitions_response.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class ListLocationCustomAttributeDefinitionsResponse(UncheckedBaseModel):
+ """
+ Represents a [ListLocationCustomAttributeDefinitions](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributeDefinitions) response.
+ Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response.
+ If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`.
+ """
+
+ custom_attribute_definitions: typing.Optional[typing.List[CustomAttributeDefinition]] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute definitions. If no custom attribute definitions are found,
+ Square returns an empty object (`{}`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of
+ results for your original request. This field is present only if the request succeeded and
+ additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_location_custom_attributes_response.py b/src/square/types/list_location_custom_attributes_response.py
new file mode 100644
index 00000000..9488e279
--- /dev/null
+++ b/src/square/types/list_location_custom_attributes_response.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class ListLocationCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [ListLocationCustomAttributes](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributes) response.
+ Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional
+ results are available, the `cursor` field is also present along with `custom_attributes`.
+ """
+
+ custom_attributes: typing.Optional[typing.List[CustomAttribute]] = pydantic.Field(default=None)
+ """
+ The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field of each custom attribute.
+ If no custom attributes are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to use in your next call to this endpoint to retrieve the next page of results
+ for your original request. This field is present only if the request succeeded and additional
+ results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_locations_response.py b/src/square/types/list_locations_response.py
new file mode 100644
index 00000000..29bae41a
--- /dev/null
+++ b/src/square/types/list_locations_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .location import Location
+
+
+class ListLocationsResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of a request
+ to the [ListLocations](api-endpoint:Locations-ListLocations) endpoint.
+
+ Either `errors` or `locations` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ locations: typing.Optional[typing.List[Location]] = pydantic.Field(default=None)
+ """
+ The business locations.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_loyalty_programs_response.py b/src/square/types/list_loyalty_programs_response.py
new file mode 100644
index 00000000..65c73d5d
--- /dev/null
+++ b/src/square/types/list_loyalty_programs_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_program import LoyaltyProgram
+
+
+class ListLoyaltyProgramsResponse(UncheckedBaseModel):
+ """
+ A response that contains all loyalty programs.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ programs: typing.Optional[typing.List[LoyaltyProgram]] = pydantic.Field(default=None)
+ """
+ A list of `LoyaltyProgram` for the merchant.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_loyalty_promotions_response.py b/src/square/types/list_loyalty_promotions_response.py
new file mode 100644
index 00000000..35b6d57f
--- /dev/null
+++ b/src/square/types/list_loyalty_promotions_response.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_promotion import LoyaltyPromotion
+
+
+class ListLoyaltyPromotionsResponse(UncheckedBaseModel):
+ """
+ Represents a [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) response.
+ One of `loyalty_promotions`, an empty object, or `errors` is present in the response.
+ If additional results are available, the `cursor` field is also present along with `loyalty_promotions`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_promotions: typing.Optional[typing.List[LoyaltyPromotion]] = pydantic.Field(default=None)
+ """
+ The retrieved loyalty promotions.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to use in your next call to this endpoint to retrieve the next page of results
+ for your original request. This field is present only if the request succeeded and additional
+ results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_merchant_custom_attribute_definitions_response.py b/src/square/types/list_merchant_custom_attribute_definitions_response.py
new file mode 100644
index 00000000..6092d89b
--- /dev/null
+++ b/src/square/types/list_merchant_custom_attribute_definitions_response.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class ListMerchantCustomAttributeDefinitionsResponse(UncheckedBaseModel):
+ """
+ Represents a [ListMerchantCustomAttributeDefinitions](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributeDefinitions) response.
+ Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response.
+ If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`.
+ """
+
+ custom_attribute_definitions: typing.Optional[typing.List[CustomAttributeDefinition]] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute definitions. If no custom attribute definitions are found,
+ Square returns an empty object (`{}`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of
+ results for your original request. This field is present only if the request succeeded and
+ additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_merchant_custom_attributes_response.py b/src/square/types/list_merchant_custom_attributes_response.py
new file mode 100644
index 00000000..79090adc
--- /dev/null
+++ b/src/square/types/list_merchant_custom_attributes_response.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class ListMerchantCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a [ListMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributes) response.
+ Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional
+ results are available, the `cursor` field is also present along with `custom_attributes`.
+ """
+
+ custom_attributes: typing.Optional[typing.List[CustomAttribute]] = pydantic.Field(default=None)
+ """
+ The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field of each custom attribute.
+ If no custom attributes are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to use in your next call to this endpoint to retrieve the next page of results
+ for your original request. This field is present only if the request succeeded and additional
+ results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_merchants_response.py b/src/square/types/list_merchants_response.py
new file mode 100644
index 00000000..cbcaa0de
--- /dev/null
+++ b/src/square/types/list_merchants_response.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .merchant import Merchant
+
+
+class ListMerchantsResponse(UncheckedBaseModel):
+ """
+ The response object returned by the [ListMerchant](api-endpoint:Merchants-ListMerchants) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ merchant: typing.Optional[typing.List[Merchant]] = pydantic.Field(default=None)
+ """
+ The requested `Merchant` entities.
+ """
+
+ cursor: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ If the response is truncated, the cursor to use in next request to fetch next set of objects.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_order_custom_attribute_definitions_response.py b/src/square/types/list_order_custom_attribute_definitions_response.py
new file mode 100644
index 00000000..f41608c1
--- /dev/null
+++ b/src/square/types/list_order_custom_attribute_definitions_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class ListOrderCustomAttributeDefinitionsResponse(UncheckedBaseModel):
+ """
+ Represents a response from listing order custom attribute definitions.
+ """
+
+ custom_attribute_definitions: typing.List[CustomAttributeDefinition] = pydantic.Field()
+ """
+ The retrieved custom attribute definitions. If no custom attribute definitions are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request.
+ This field is present only if the request succeeded and additional results are available.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_order_custom_attributes_response.py b/src/square/types/list_order_custom_attributes_response.py
new file mode 100644
index 00000000..0e8bc2c4
--- /dev/null
+++ b/src/square/types/list_order_custom_attributes_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class ListOrderCustomAttributesResponse(UncheckedBaseModel):
+ """
+ Represents a response from listing order custom attributes.
+ """
+
+ custom_attributes: typing.Optional[typing.List[CustomAttribute]] = pydantic.Field(default=None)
+ """
+ The retrieved custom attributes. If no custom attribute are found, Square returns an empty object (`{}`).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request.
+ This field is present only if the request succeeded and additional results are available.
+ For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_payment_links_response.py b/src/square/types/list_payment_links_response.py
new file mode 100644
index 00000000..1bd87723
--- /dev/null
+++ b/src/square/types/list_payment_links_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment_link import PaymentLink
+
+
+class ListPaymentLinksResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ payment_links: typing.Optional[typing.List[PaymentLink]] = pydantic.Field(default=None)
+ """
+ The list of payment links.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When a response is truncated, it includes a cursor that you can use in a subsequent request
+ to retrieve the next set of gift cards. If a cursor is not present, this is the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_payment_refunds_request_sort_field.py b/src/square/types/list_payment_refunds_request_sort_field.py
new file mode 100644
index 00000000..e113b1bb
--- /dev/null
+++ b/src/square/types/list_payment_refunds_request_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ListPaymentRefundsRequestSortField = typing.Union[typing.Literal["CREATED_AT", "UPDATED_AT"], typing.Any]
diff --git a/src/square/types/list_payment_refunds_response.py b/src/square/types/list_payment_refunds_response.py
new file mode 100644
index 00000000..149c463f
--- /dev/null
+++ b/src/square/types/list_payment_refunds_response.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment_refund import PaymentRefund
+
+
+class ListPaymentRefundsResponse(UncheckedBaseModel):
+ """
+ Defines the response returned by [ListPaymentRefunds](api-endpoint:Refunds-ListPaymentRefunds).
+
+ Either `errors` or `refunds` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ refunds: typing.Optional[typing.List[PaymentRefund]] = pydantic.Field(default=None)
+ """
+ The list of requested refunds.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_payments_request_sort_field.py b/src/square/types/list_payments_request_sort_field.py
new file mode 100644
index 00000000..fa46dac2
--- /dev/null
+++ b/src/square/types/list_payments_request_sort_field.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ListPaymentsRequestSortField = typing.Union[
+ typing.Literal["CREATED_AT", "OFFLINE_CREATED_AT", "UPDATED_AT"], typing.Any
+]
diff --git a/src/square/types/list_payments_response.py b/src/square/types/list_payments_response.py
new file mode 100644
index 00000000..207a7890
--- /dev/null
+++ b/src/square/types/list_payments_response.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment import Payment
+
+
+class ListPaymentsResponse(UncheckedBaseModel):
+ """
+ Defines the response returned by [ListPayments](api-endpoint:Payments-ListPayments).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ payments: typing.Optional[typing.List[Payment]] = pydantic.Field(default=None)
+ """
+ The requested list of payments.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_payout_entries_response.py b/src/square/types/list_payout_entries_response.py
new file mode 100644
index 00000000..f21917b4
--- /dev/null
+++ b/src/square/types/list_payout_entries_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payout_entry import PayoutEntry
+
+
+class ListPayoutEntriesResponse(UncheckedBaseModel):
+ """
+ The response to retrieve payout records entries.
+ """
+
+ payout_entries: typing.Optional[typing.List[PayoutEntry]] = pydantic.Field(default=None)
+ """
+ The requested list of payout entries, ordered with the given or default sort order.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If empty, this is the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_payouts_response.py b/src/square/types/list_payouts_response.py
new file mode 100644
index 00000000..1e17438b
--- /dev/null
+++ b/src/square/types/list_payouts_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payout import Payout
+
+
+class ListPayoutsResponse(UncheckedBaseModel):
+ """
+ The response to retrieve payout records entries.
+ """
+
+ payouts: typing.Optional[typing.List[Payout]] = pydantic.Field(default=None)
+ """
+ The requested list of payouts.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If empty, this is the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_sites_response.py b/src/square/types/list_sites_response.py
new file mode 100644
index 00000000..a650e812
--- /dev/null
+++ b/src/square/types/list_sites_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .site import Site
+
+
+class ListSitesResponse(UncheckedBaseModel):
+ """
+ Represents a `ListSites` response. The response can include either `sites` or `errors`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ sites: typing.Optional[typing.List[Site]] = pydantic.Field(default=None)
+ """
+ The sites that belong to the seller.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_subscription_events_response.py b/src/square/types/list_subscription_events_response.py
new file mode 100644
index 00000000..fafd022b
--- /dev/null
+++ b/src/square/types/list_subscription_events_response.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription_event import SubscriptionEvent
+
+
+class ListSubscriptionEventsResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response from the
+ [ListSubscriptionEvents](api-endpoint:Subscriptions-ListSubscriptionEvents).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscription_events: typing.Optional[typing.List[SubscriptionEvent]] = pydantic.Field(default=None)
+ """
+ The retrieved subscription events.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When the total number of resulting subscription events exceeds the limit of a paged response,
+ the response includes a cursor for you to use in a subsequent request to fetch the next set of events.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_team_member_booking_profiles_response.py b/src/square/types/list_team_member_booking_profiles_response.py
new file mode 100644
index 00000000..a17abce5
--- /dev/null
+++ b/src/square/types/list_team_member_booking_profiles_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .team_member_booking_profile import TeamMemberBookingProfile
+
+
+class ListTeamMemberBookingProfilesResponse(UncheckedBaseModel):
+ team_member_booking_profiles: typing.Optional[typing.List[TeamMemberBookingProfile]] = pydantic.Field(default=None)
+ """
+ The list of team member booking profiles. The results are returned in the ascending order of the time
+ when the team member booking profiles were last updated. Multiple booking profiles updated at the same time
+ are further sorted in the ascending order of their IDs.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_team_member_wages_response.py b/src/square/types/list_team_member_wages_response.py
new file mode 100644
index 00000000..bf9ffbef
--- /dev/null
+++ b/src/square/types/list_team_member_wages_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .team_member_wage import TeamMemberWage
+
+
+class ListTeamMemberWagesResponse(UncheckedBaseModel):
+ """
+ The response to a request for a set of `TeamMemberWage` objects. The response contains
+ a set of `TeamMemberWage` objects.
+ """
+
+ team_member_wages: typing.Optional[typing.List[TeamMemberWage]] = pydantic.Field(default=None)
+ """
+ A page of `TeamMemberWage` results.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The value supplied in the subsequent request to fetch the next page
+ of `TeamMemberWage` results.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_transactions_response.py b/src/square/types/list_transactions_response.py
new file mode 100644
index 00000000..3d28b6d4
--- /dev/null
+++ b/src/square/types/list_transactions_response.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .transaction import Transaction
+
+
+class ListTransactionsResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint.
+
+ One of `errors` or `transactions` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ transactions: typing.Optional[typing.List[Transaction]] = pydantic.Field(default=None)
+ """
+ An array of transactions that match your query.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A pagination cursor for retrieving the next set of results,
+ if any remain. Provide this value as the `cursor` parameter in a subsequent
+ request to this endpoint.
+
+ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_webhook_event_types_response.py b/src/square/types/list_webhook_event_types_response.py
new file mode 100644
index 00000000..65068085
--- /dev/null
+++ b/src/square/types/list_webhook_event_types_response.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .event_type_metadata import EventTypeMetadata
+
+
+class ListWebhookEventTypesResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListWebhookEventTypes](api-endpoint:WebhookSubscriptions-ListWebhookEventTypes) endpoint.
+
+ Note: if there are errors processing the request, the event types field will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ event_types: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The list of event types.
+ """
+
+ metadata: typing.Optional[typing.List[EventTypeMetadata]] = pydantic.Field(default=None)
+ """
+ Contains the metadata of a webhook event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_webhook_subscriptions_response.py b/src/square/types/list_webhook_subscriptions_response.py
new file mode 100644
index 00000000..61506afb
--- /dev/null
+++ b/src/square/types/list_webhook_subscriptions_response.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .webhook_subscription import WebhookSubscription
+
+
+class ListWebhookSubscriptionsResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [ListWebhookSubscriptions](api-endpoint:WebhookSubscriptions-ListWebhookSubscriptions) endpoint.
+
+ Note: if there are errors processing the request, the subscriptions field will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ subscriptions: typing.Optional[typing.List[WebhookSubscription]] = pydantic.Field(default=None)
+ """
+ The requested list of [Subscription](entity:WebhookSubscription)s.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/list_workweek_configs_response.py b/src/square/types/list_workweek_configs_response.py
new file mode 100644
index 00000000..ce4c2f96
--- /dev/null
+++ b/src/square/types/list_workweek_configs_response.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .workweek_config import WorkweekConfig
+
+
+class ListWorkweekConfigsResponse(UncheckedBaseModel):
+ """
+ The response to a request for a set of `WorkweekConfig` objects. The response contains
+ the requested `WorkweekConfig` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ workweek_configs: typing.Optional[typing.List[WorkweekConfig]] = pydantic.Field(default=None)
+ """
+ A page of `WorkweekConfig` results.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The value supplied in the subsequent request to fetch the next page of
+ `WorkweekConfig` results.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/load_response.py b/src/square/types/load_response.py
new file mode 100644
index 00000000..b1656073
--- /dev/null
+++ b/src/square/types/load_response.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .load_result_annotation import LoadResultAnnotation
+from .load_result_data import LoadResultData
+
+
+class LoadResponse(UncheckedBaseModel):
+ data_source: typing_extensions.Annotated[
+ typing.Optional[str], FieldMetadata(alias="dataSource"), pydantic.Field(alias="dataSource")
+ ] = None
+ annotation: typing.Optional[LoadResultAnnotation] = None
+ data: typing.Optional[LoadResultData] = None
+ last_refresh_time: typing_extensions.Annotated[
+ typing.Optional[str], FieldMetadata(alias="lastRefreshTime"), pydantic.Field(alias="lastRefreshTime")
+ ] = None
+ query: typing.Optional[typing.Dict[str, typing.Any]] = None
+ slow_query: typing_extensions.Annotated[
+ typing.Optional[bool], FieldMetadata(alias="slowQuery"), pydantic.Field(alias="slowQuery")
+ ] = None
+ external: typing.Optional[bool] = None
+ db_type: typing_extensions.Annotated[
+ typing.Optional[str], FieldMetadata(alias="dbType"), pydantic.Field(alias="dbType")
+ ] = None
+ refresh_key_values: typing_extensions.Annotated[
+ typing.Optional[typing.List[typing.Dict[str, typing.Any]]],
+ FieldMetadata(alias="refreshKeyValues"),
+ pydantic.Field(alias="refreshKeyValues"),
+ ] = None
+ pivot_query: typing_extensions.Annotated[
+ typing.Optional[typing.Dict[str, typing.Any]],
+ FieldMetadata(alias="pivotQuery"),
+ pydantic.Field(alias="pivotQuery"),
+ ] = None
+ query_type: typing_extensions.Annotated[
+ typing.Optional[str], FieldMetadata(alias="queryType"), pydantic.Field(alias="queryType")
+ ] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/load_result_annotation.py b/src/square/types/load_result_annotation.py
new file mode 100644
index 00000000..39acef8c
--- /dev/null
+++ b/src/square/types/load_result_annotation.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoadResultAnnotation(UncheckedBaseModel):
+ measures: typing.Dict[str, typing.Any]
+ dimensions: typing.Dict[str, typing.Any]
+ segments: typing.Dict[str, typing.Any]
+ time_dimensions: typing_extensions.Annotated[
+ typing.Dict[str, typing.Any], FieldMetadata(alias="timeDimensions"), pydantic.Field(alias="timeDimensions")
+ ]
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/load_result_data.py b/src/square/types/load_result_data.py
new file mode 100644
index 00000000..40079c37
--- /dev/null
+++ b/src/square/types/load_result_data.py
@@ -0,0 +1,9 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .load_result_data_columnar import LoadResultDataColumnar
+from .load_result_data_compact import LoadResultDataCompact
+from .load_result_data_row import LoadResultDataRow
+
+LoadResultData = typing.Union[LoadResultDataRow, LoadResultDataCompact, LoadResultDataColumnar]
diff --git a/src/square/types/load_result_data_columnar.py b/src/square/types/load_result_data_columnar.py
new file mode 100644
index 00000000..5ed5a343
--- /dev/null
+++ b/src/square/types/load_result_data_columnar.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoadResultDataColumnar(UncheckedBaseModel):
+ """
+ Columnar data format - members list paired with one primitive array per column. Returned when `responseFormat=columnar` is requested.
+ """
+
+ members: typing.List[str] = pydantic.Field()
+ """
+ Ordered list of member names. Element `i` of `columns` holds the values for `members[i]` across all rows.
+ """
+
+ columns: typing.List[typing.List[typing.Any]] = pydantic.Field()
+ """
+ One array per member, in the same order as `members`. Each inner array contains the primitive value of that member for every row (null, boolean, number, string).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/load_result_data_compact.py b/src/square/types/load_result_data_compact.py
new file mode 100644
index 00000000..734192af
--- /dev/null
+++ b/src/square/types/load_result_data_compact.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoadResultDataCompact(UncheckedBaseModel):
+ """
+ Compact data format - a single object with the members list and a dataset of primitive arrays. Returned when `responseFormat=compact` is requested.
+ """
+
+ members: typing.List[str] = pydantic.Field()
+ """
+ Ordered list of member names that correspond to each cell position in `dataset` rows.
+ """
+
+ dataset: typing.List[typing.List[typing.Any]] = pydantic.Field()
+ """
+ Array of rows, where each row is an array of primitive values (null, boolean, number, string) aligned with `members`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/load_result_data_row.py b/src/square/types/load_result_data_row.py
new file mode 100644
index 00000000..ac37bac6
--- /dev/null
+++ b/src/square/types/load_result_data_row.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoadResultDataRow = typing.List[typing.Dict[str, typing.Any]]
diff --git a/src/square/types/location.py b/src/square/types/location.py
new file mode 100644
index 00000000..798685f3
--- /dev/null
+++ b/src/square/types/location.py
@@ -0,0 +1,188 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .business_hours import BusinessHours
+from .coordinates import Coordinates
+from .country import Country
+from .currency import Currency
+from .location_capability import LocationCapability
+from .location_status import LocationStatus
+from .location_type import LocationType
+from .tax_ids import TaxIds
+
+
+class Location(UncheckedBaseModel):
+ """
+ Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A short generated string of letters and numbers that uniquely identifies this location instance.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the location.
+ This information appears in the Seller Dashboard as the nickname.
+ A location name must be unique within a seller account.
+ """
+
+ address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The physical address of the location.
+ """
+
+ timezone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [IANA time zone](https://www.iana.org/time-zones) identifier for
+ the time zone of the location. For example, `America/Los_Angeles`.
+ """
+
+ capabilities: typing.Optional[typing.List[LocationCapability]] = pydantic.Field(default=None)
+ """
+ The Square features that are enabled for the location.
+ See [LocationCapability](entity:LocationCapability) for possible values.
+ See [LocationCapability](#type-locationcapability) for possible values
+ """
+
+ status: typing.Optional[LocationStatus] = pydantic.Field(default=None)
+ """
+ The status of the location.
+ See [LocationStatus](#type-locationstatus) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the location was created, in RFC 3339 format.
+ For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the merchant that owns the location.
+ """
+
+ country: typing.Optional[Country] = pydantic.Field(default=None)
+ """
+ The country of the location, in the two-letter format of ISO 3166. For example, `US` or `JP`.
+
+ See [Country](entity:Country) for possible values.
+ See [Country](#type-country) for possible values
+ """
+
+ language_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The language associated with the location, in
+ [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A).
+ For more information, see [Language Preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences).
+ """
+
+ currency: typing.Optional[Currency] = pydantic.Field(default=None)
+ """
+ The currency used for all transactions at this location,
+ in ISO 4217 format. For example, the currency code for US dollars is `USD`.
+ See [Currency](entity:Currency) for possible values.
+ See [Currency](#type-currency) for possible values
+ """
+
+ phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The phone number of the location. For example, `+1 855-700-6000`.
+ """
+
+ business_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the location's overall business. This name is present on receipts and other customer-facing branding, and can be changed no more than three times in a twelve-month period.
+ """
+
+ type: typing.Optional[LocationType] = pydantic.Field(default=None)
+ """
+ The type of the location.
+ See [LocationType](#type-locationtype) for possible values
+ """
+
+ website_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The website URL of the location. For example, `https://squareup.com`.
+ """
+
+ business_hours: typing.Optional[BusinessHours] = pydantic.Field(default=None)
+ """
+ The hours of operation for the location.
+ """
+
+ business_email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address of the location. This can be unique to the location and is not always the email address for the business owner or administrator.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the location. For example, `Main Street location`.
+ """
+
+ twitter_username: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Twitter username of the location without the '@' symbol. For example, `Square`.
+ """
+
+ instagram_username: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Instagram username of the location without the '@' symbol. For example, `square`.
+ """
+
+ facebook_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`.
+ """
+
+ coordinates: typing.Optional[Coordinates] = pydantic.Field(default=None)
+ """
+ The physical coordinates (latitude and longitude) of the location.
+ """
+
+ logo_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL of the logo image for the location. When configured in the Seller
+ Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller.
+ This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels.
+ """
+
+ pos_background_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL of the Point of Sale background image for the location.
+ """
+
+ mcc: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A four-digit number that describes the kind of goods or services sold at the location.
+ The [merchant category code (MCC)](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) of the location as standardized by ISO 18245.
+ For example, `5045`, for a location that sells computer goods and software.
+ """
+
+ full_format_logo_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL of a full-format logo image for the location. When configured in the Seller
+ Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller.
+ This image can be wider than it is tall and should be at least 1280x648 pixels.
+ """
+
+ tax_ids: typing.Optional[TaxIds] = pydantic.Field(default=None)
+ """
+ The tax IDs for this location.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_booking_profile.py b/src/square/types/location_booking_profile.py
new file mode 100644
index 00000000..ffa6d681
--- /dev/null
+++ b/src/square/types/location_booking_profile.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LocationBookingProfile(UncheckedBaseModel):
+ """
+ The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [location](entity:Location).
+ """
+
+ booking_site_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Url for the online booking site for this location.
+ """
+
+ online_booking_enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the location is enabled for online booking.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_capability.py b/src/square/types/location_capability.py
new file mode 100644
index 00000000..7d886f99
--- /dev/null
+++ b/src/square/types/location_capability.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LocationCapability = typing.Union[
+ typing.Literal["CREDIT_CARD_PROCESSING", "AUTOMATIC_TRANSFERS", "UNLINKED_REFUNDS"], typing.Any
+]
diff --git a/src/square/types/location_created_event.py b/src/square/types/location_created_event.py
new file mode 100644
index 00000000..6f2c6126
--- /dev/null
+++ b/src/square/types/location_created_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .location_created_event_data import LocationCreatedEventData
+
+
+class LocationCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Location](entity:Location) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [Location](entity:Location) associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"location.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LocationCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_created_event_data.py b/src/square/types/location_created_event_data.py
new file mode 100644
index 00000000..a380c975
--- /dev/null
+++ b/src/square/types/location_created_event_data.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LocationCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"location"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the updated [Location](entity:Location).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_custom_attribute_definition_owned_created_event.py b/src/square/types/location_custom_attribute_definition_owned_created_event.py
new file mode 100644
index 00000000..4134b51b
--- /dev/null
+++ b/src/square/types/location_custom_attribute_definition_owned_created_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class LocationCustomAttributeDefinitionOwnedCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ is created by the subscribing application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.owned.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_custom_attribute_definition_owned_deleted_event.py b/src/square/types/location_custom_attribute_definition_owned_deleted_event.py
new file mode 100644
index 00000000..63b01705
--- /dev/null
+++ b/src/square/types/location_custom_attribute_definition_owned_deleted_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class LocationCustomAttributeDefinitionOwnedDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is deleted. A custom attribute definition can only be deleted by
+ the application that created it.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.owned.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_custom_attribute_definition_owned_updated_event.py b/src/square/types/location_custom_attribute_definition_owned_updated_event.py
new file mode 100644
index 00000000..d436e165
--- /dev/null
+++ b/src/square/types/location_custom_attribute_definition_owned_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class LocationCustomAttributeDefinitionOwnedUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ created by the subscribing application is updated. A custom attribute definition can only be updated
+ by the application that created it.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.owned.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_custom_attribute_definition_visible_created_event.py b/src/square/types/location_custom_attribute_definition_visible_created_event.py
new file mode 100644
index 00000000..4ccec0a7
--- /dev/null
+++ b/src/square/types/location_custom_attribute_definition_visible_created_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class LocationCustomAttributeDefinitionVisibleCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is created. A notification is sent when your application
+ creates a custom attribute definition or another application creates a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.visible.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_custom_attribute_definition_visible_deleted_event.py b/src/square/types/location_custom_attribute_definition_visible_deleted_event.py
new file mode 100644
index 00000000..26b9ac52
--- /dev/null
+++ b/src/square/types/location_custom_attribute_definition_visible_deleted_event.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class LocationCustomAttributeDefinitionVisibleDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is deleted. A custom attribute definition can only
+ be deleted by the application that created it. A notification is sent when your application deletes
+ a custom attribute definition or when another application deletes a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.visible.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_custom_attribute_definition_visible_updated_event.py b/src/square/types/location_custom_attribute_definition_visible_updated_event.py
new file mode 100644
index 00000000..e9602f17
--- /dev/null
+++ b/src/square/types/location_custom_attribute_definition_visible_updated_event.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class LocationCustomAttributeDefinitionVisibleUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a location [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is updated. A custom attribute definition can only be updated
+ by the application that created it. A notification is sent when your application updates a custom attribute
+ definition or when another application updates a custom attribute definition whose `visibility` is
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"location.custom_attribute_definition.visible.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_custom_attribute_owned_deleted_event.py b/src/square/types/location_custom_attribute_owned_deleted_event.py
new file mode 100644
index 00000000..5592d4d7
--- /dev/null
+++ b/src/square/types/location_custom_attribute_owned_deleted_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class LocationCustomAttributeOwnedDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a location [custom attribute](entity:CustomAttribute)
+ owned by the subscribing application is deleted. Custom attributes are owned by the
+ application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition).
+ Custom attributes whose `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"location.custom_attribute.owned.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_custom_attribute_owned_updated_event.py b/src/square/types/location_custom_attribute_owned_updated_event.py
new file mode 100644
index 00000000..955bd8d5
--- /dev/null
+++ b/src/square/types/location_custom_attribute_owned_updated_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class LocationCustomAttributeOwnedUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a location [custom attribute](entity:CustomAttribute) owned by the
+ subscribing application is created or updated. Custom attributes are owned by the application that created
+ the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose
+ `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"location.custom_attribute.owned.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_custom_attribute_visible_deleted_event.py b/src/square/types/location_custom_attribute_visible_deleted_event.py
new file mode 100644
index 00000000..b11f878e
--- /dev/null
+++ b/src/square/types/location_custom_attribute_visible_deleted_event.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class LocationCustomAttributeVisibleDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a location [custom attribute](entity:CustomAttribute) that is visible to the
+ subscribing application is deleted. A notification is sent when:
+ - Your application deletes a custom attribute owned by your application, regardless of the `visibility` setting.
+ - Any application deletes a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY`
+ or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application, but those set to
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be deleted by the owner. Custom attributes are owned
+ by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"location.custom_attribute.visible.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_custom_attribute_visible_updated_event.py b/src/square/types/location_custom_attribute_visible_updated_event.py
new file mode 100644
index 00000000..02935ecf
--- /dev/null
+++ b/src/square/types/location_custom_attribute_visible_updated_event.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class LocationCustomAttributeVisibleUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a location [custom attribute](entity:CustomAttribute) that is visible
+ to the subscribing application is created or updated. A notification is sent when:
+ - Your application creates or updates a custom attribute owned by your application, regardless of the `visibility` setting.
+ - Any application creates or updates a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY`
+ or `VISIBILITY_READ_WRITE_VALUES`.
+
+ Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application, but those set to
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be created or updated by the owner. Custom attributes are owned
+ by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition).
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"location.custom_attribute.visible.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_settings_updated_event.py b/src/square/types/location_settings_updated_event.py
new file mode 100644
index 00000000..2e1add06
--- /dev/null
+++ b/src/square/types/location_settings_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .location_settings_updated_event_data import LocationSettingsUpdatedEventData
+
+
+class LocationSettingsUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when online checkout location settings are updated
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"online_checkout.location_settings.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing.Optional[LocationSettingsUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_settings_updated_event_data.py b/src/square/types/location_settings_updated_event_data.py
new file mode 100644
index 00000000..1928a727
--- /dev/null
+++ b/src/square/types/location_settings_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .location_settings_updated_event_object import LocationSettingsUpdatedEventObject
+
+
+class LocationSettingsUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the updated object’s type, `"online_checkout.location_settings"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the updated location settings.
+ """
+
+ object: typing.Optional[LocationSettingsUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated location settings.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_settings_updated_event_object.py b/src/square/types/location_settings_updated_event_object.py
new file mode 100644
index 00000000..af761c07
--- /dev/null
+++ b/src/square/types/location_settings_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_location_settings import CheckoutLocationSettings
+
+
+class LocationSettingsUpdatedEventObject(UncheckedBaseModel):
+ location_settings: typing.Optional[CheckoutLocationSettings] = pydantic.Field(default=None)
+ """
+ The updated location settings.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_status.py b/src/square/types/location_status.py
new file mode 100644
index 00000000..117457e0
--- /dev/null
+++ b/src/square/types/location_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LocationStatus = typing.Union[typing.Literal["ACTIVE", "INACTIVE"], typing.Any]
diff --git a/src/square/types/location_type.py b/src/square/types/location_type.py
new file mode 100644
index 00000000..94a04f43
--- /dev/null
+++ b/src/square/types/location_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LocationType = typing.Union[typing.Literal["PHYSICAL", "MOBILE"], typing.Any]
diff --git a/src/square/types/location_updated_event.py b/src/square/types/location_updated_event.py
new file mode 100644
index 00000000..e83ec88b
--- /dev/null
+++ b/src/square/types/location_updated_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .location_updated_event_data import LocationUpdatedEventData
+
+
+class LocationUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Location](entity:Location) is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [Location](entity:Location) associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"location.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LocationUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/location_updated_event_data.py b/src/square/types/location_updated_event_data.py
new file mode 100644
index 00000000..3a40ad7e
--- /dev/null
+++ b/src/square/types/location_updated_event_data.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LocationUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"location"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the updated [Location](entity:Location).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account.py b/src/square/types/loyalty_account.py
new file mode 100644
index 00000000..90acfbd7
--- /dev/null
+++ b/src/square/types/loyalty_account.py
@@ -0,0 +1,92 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account_expiring_point_deadline import LoyaltyAccountExpiringPointDeadline
+from .loyalty_account_mapping import LoyaltyAccountMapping
+
+
+class LoyaltyAccount(UncheckedBaseModel):
+ """
+ Describes a loyalty account in a [loyalty program](entity:LoyaltyProgram). For more information, see
+ [Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the loyalty account.
+ """
+
+ program_id: str = pydantic.Field()
+ """
+ The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram) to which the account belongs.
+ """
+
+ balance: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the `expiring_point_deadlines` field.
+
+ Your application should be able to handle loyalty accounts that have a negative point balance (`balance` is less than 0). This might occur if a seller makes a manual adjustment or as a result of a refund or exchange.
+ """
+
+ lifetime_points: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The total points accrued during the lifetime of the account.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the [customer](entity:Customer) that is associated with the account.
+ """
+
+ enrolled_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the buyer joined the loyalty program, in RFC 3339 format. This field is used to display the **Enrolled On** or **Member Since** date in first-party Square products.
+
+ If this field is not set in a `CreateLoyaltyAccount` request, Square populates it after the buyer's first action on their account
+ (when `AccumulateLoyaltyPoints` or `CreateLoyaltyReward` is called). In first-party flows, Square populates the field when the buyer agrees to the terms of service on Square Point of Sale.
+
+ If this field is set in a `CreateLoyaltyAccount` request, it is meant to be used when there is a loyalty migration from another system and into Square.
+ In that case, the timestamp can reflect when the buyer originally enrolled in the previous system. It may represent a current or past date, but cannot be set in the future.
+ Note: Setting this field in this scenario does not, by itself, impact the first-party enrollment flow on Square Point of Sale.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the loyalty account was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the loyalty account was last updated, in RFC 3339 format.
+ """
+
+ mapping: typing.Optional[LoyaltyAccountMapping] = pydantic.Field(default=None)
+ """
+ The mapping that associates the loyalty account with a buyer. Currently,
+ a loyalty account can only be mapped to a buyer by phone number.
+
+ To create a loyalty account, you must specify the `mapping` field, with the buyer's phone number
+ in the `phone_number` field.
+ """
+
+ expiring_point_deadlines: typing.Optional[typing.List[LoyaltyAccountExpiringPointDeadline]] = pydantic.Field(
+ default=None
+ )
+ """
+ The schedule for when points expire in the loyalty account balance. This field is present only if the account has points that are scheduled to expire.
+
+ The total number of points in this field equals the number of points in the `balance` field.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_created_event.py b/src/square/types/loyalty_account_created_event.py
new file mode 100644
index 00000000..f68055a6
--- /dev/null
+++ b/src/square/types/loyalty_account_created_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account_created_event_data import LoyaltyAccountCreatedEventData
+
+
+class LoyaltyAccountCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [loyalty account](entity:LoyaltyAccount) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `loyalty.account.created`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LoyaltyAccountCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_created_event_data.py b/src/square/types/loyalty_account_created_event_data.py
new file mode 100644
index 00000000..58896dd1
--- /dev/null
+++ b/src/square/types/loyalty_account_created_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account_created_event_object import LoyaltyAccountCreatedEventObject
+
+
+class LoyaltyAccountCreatedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `loyalty.account.created` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_account`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected loyalty account.
+ """
+
+ object: typing.Optional[LoyaltyAccountCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the new loyalty account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_created_event_object.py b/src/square/types/loyalty_account_created_event_object.py
new file mode 100644
index 00000000..82722fe8
--- /dev/null
+++ b/src/square/types/loyalty_account_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account import LoyaltyAccount
+
+
+class LoyaltyAccountCreatedEventObject(UncheckedBaseModel):
+ loyalty_account: typing.Optional[LoyaltyAccount] = pydantic.Field(default=None)
+ """
+ The loyalty account that was created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_deleted_event.py b/src/square/types/loyalty_account_deleted_event.py
new file mode 100644
index 00000000..215a9c40
--- /dev/null
+++ b/src/square/types/loyalty_account_deleted_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account_deleted_event_data import LoyaltyAccountDeletedEventData
+
+
+class LoyaltyAccountDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a [loyalty account](entity:LoyaltyAccount) is deleted.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `loyalty.account.deleted`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LoyaltyAccountDeletedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_deleted_event_data.py b/src/square/types/loyalty_account_deleted_event_data.py
new file mode 100644
index 00000000..7a790709
--- /dev/null
+++ b/src/square/types/loyalty_account_deleted_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account_deleted_event_object import LoyaltyAccountDeletedEventObject
+
+
+class LoyaltyAccountDeletedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `loyalty.account.deleted` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_account`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected loyalty account.
+ """
+
+ object: typing.Optional[LoyaltyAccountDeletedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the loyalty account that was deleted.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_deleted_event_object.py b/src/square/types/loyalty_account_deleted_event_object.py
new file mode 100644
index 00000000..69bfc3e7
--- /dev/null
+++ b/src/square/types/loyalty_account_deleted_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account import LoyaltyAccount
+
+
+class LoyaltyAccountDeletedEventObject(UncheckedBaseModel):
+ loyalty_account: typing.Optional[LoyaltyAccount] = pydantic.Field(default=None)
+ """
+ The loyalty account that was deleted.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_expiring_point_deadline.py b/src/square/types/loyalty_account_expiring_point_deadline.py
new file mode 100644
index 00000000..7675d429
--- /dev/null
+++ b/src/square/types/loyalty_account_expiring_point_deadline.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyAccountExpiringPointDeadline(UncheckedBaseModel):
+ """
+ Represents a set of points for a loyalty account that are scheduled to expire on a specific date.
+ """
+
+ points: int = pydantic.Field()
+ """
+ The number of points scheduled to expire at the `expires_at` timestamp.
+ """
+
+ expires_at: str = pydantic.Field()
+ """
+ The timestamp of when the points are scheduled to expire, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_mapping.py b/src/square/types/loyalty_account_mapping.py
new file mode 100644
index 00000000..60bc057c
--- /dev/null
+++ b/src/square/types/loyalty_account_mapping.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyAccountMapping(UncheckedBaseModel):
+ """
+ Represents the mapping that associates a loyalty account with a buyer.
+
+ Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see
+ [Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the mapping.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the mapping was created, in RFC 3339 format.
+ """
+
+ phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The phone number of the buyer, in E.164 format. For example, "+14155551111".
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_mapping_type.py b/src/square/types/loyalty_account_mapping_type.py
new file mode 100644
index 00000000..f1e7e29f
--- /dev/null
+++ b/src/square/types/loyalty_account_mapping_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoyaltyAccountMappingType = typing.Literal["PHONE"]
diff --git a/src/square/types/loyalty_account_updated_event.py b/src/square/types/loyalty_account_updated_event.py
new file mode 100644
index 00000000..d260bddd
--- /dev/null
+++ b/src/square/types/loyalty_account_updated_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account_updated_event_data import LoyaltyAccountUpdatedEventData
+
+
+class LoyaltyAccountUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [loyalty account](entity:LoyaltyAccount) is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `loyalty.account.updated`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LoyaltyAccountUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_updated_event_data.py b/src/square/types/loyalty_account_updated_event_data.py
new file mode 100644
index 00000000..26984a37
--- /dev/null
+++ b/src/square/types/loyalty_account_updated_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account_updated_event_object import LoyaltyAccountUpdatedEventObject
+
+
+class LoyaltyAccountUpdatedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `loyalty.account.updated` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_account`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected loyalty account.
+ """
+
+ object: typing.Optional[LoyaltyAccountUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the loyalty account that was updated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_account_updated_event_object.py b/src/square/types/loyalty_account_updated_event_object.py
new file mode 100644
index 00000000..2c4960da
--- /dev/null
+++ b/src/square/types/loyalty_account_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account import LoyaltyAccount
+
+
+class LoyaltyAccountUpdatedEventObject(UncheckedBaseModel):
+ loyalty_account: typing.Optional[LoyaltyAccount] = pydantic.Field(default=None)
+ """
+ The loyalty account that was updated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event.py b/src/square/types/loyalty_event.py
new file mode 100644
index 00000000..b8264a43
--- /dev/null
+++ b/src/square/types/loyalty_event.py
@@ -0,0 +1,105 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_event_accumulate_points import LoyaltyEventAccumulatePoints
+from .loyalty_event_accumulate_promotion_points import LoyaltyEventAccumulatePromotionPoints
+from .loyalty_event_adjust_points import LoyaltyEventAdjustPoints
+from .loyalty_event_create_reward import LoyaltyEventCreateReward
+from .loyalty_event_delete_reward import LoyaltyEventDeleteReward
+from .loyalty_event_expire_points import LoyaltyEventExpirePoints
+from .loyalty_event_other import LoyaltyEventOther
+from .loyalty_event_redeem_reward import LoyaltyEventRedeemReward
+from .loyalty_event_source import LoyaltyEventSource
+from .loyalty_event_type import LoyaltyEventType
+
+
+class LoyaltyEvent(UncheckedBaseModel):
+ """
+ Provides information about a loyalty event.
+ For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the loyalty event.
+ """
+
+ type: typing.Optional[LoyaltyEventType] = pydantic.Field(default=None)
+ """
+ The type of the loyalty event.
+ See [LoyaltyEventType](#type-loyaltyeventtype) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the event was created, in RFC 3339 format.
+ """
+
+ accumulate_points: typing.Optional[LoyaltyEventAccumulatePoints] = pydantic.Field(default=None)
+ """
+ Provides metadata when the event `type` is `ACCUMULATE_POINTS`.
+ """
+
+ create_reward: typing.Optional[LoyaltyEventCreateReward] = pydantic.Field(default=None)
+ """
+ Provides metadata when the event `type` is `CREATE_REWARD`.
+ """
+
+ redeem_reward: typing.Optional[LoyaltyEventRedeemReward] = pydantic.Field(default=None)
+ """
+ Provides metadata when the event `type` is `REDEEM_REWARD`.
+ """
+
+ delete_reward: typing.Optional[LoyaltyEventDeleteReward] = pydantic.Field(default=None)
+ """
+ Provides metadata when the event `type` is `DELETE_REWARD`.
+ """
+
+ adjust_points: typing.Optional[LoyaltyEventAdjustPoints] = pydantic.Field(default=None)
+ """
+ Provides metadata when the event `type` is `ADJUST_POINTS`.
+ """
+
+ loyalty_account_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [loyalty account](entity:LoyaltyAccount) associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [location](entity:Location) where the event occurred.
+ """
+
+ source: typing.Optional[LoyaltyEventSource] = pydantic.Field(default=None)
+ """
+ Defines whether the event was generated by the Square Point of Sale.
+ See [LoyaltyEventSource](#type-loyaltyeventsource) for possible values
+ """
+
+ expire_points: typing.Optional[LoyaltyEventExpirePoints] = pydantic.Field(default=None)
+ """
+ Provides metadata when the event `type` is `EXPIRE_POINTS`.
+ """
+
+ other_event: typing.Optional[LoyaltyEventOther] = pydantic.Field(default=None)
+ """
+ Provides metadata when the event `type` is `OTHER`.
+ """
+
+ accumulate_promotion_points: typing.Optional[LoyaltyEventAccumulatePromotionPoints] = pydantic.Field(default=None)
+ """
+ Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_accumulate_points.py b/src/square/types/loyalty_event_accumulate_points.py
new file mode 100644
index 00000000..c6e9c1a3
--- /dev/null
+++ b/src/square/types/loyalty_event_accumulate_points.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventAccumulatePoints(UncheckedBaseModel):
+ """
+ Provides metadata when the event `type` is `ACCUMULATE_POINTS`.
+ """
+
+ loyalty_program_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ points: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of points accumulated by the event.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [order](entity:Order) for which the buyer accumulated the points.
+ This field is returned only if the Orders API is used to process orders.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_accumulate_promotion_points.py b/src/square/types/loyalty_event_accumulate_promotion_points.py
new file mode 100644
index 00000000..a6e9e84d
--- /dev/null
+++ b/src/square/types/loyalty_event_accumulate_promotion_points.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventAccumulatePromotionPoints(UncheckedBaseModel):
+ """
+ Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`.
+ """
+
+ loyalty_program_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ loyalty_promotion_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the [loyalty promotion](entity:LoyaltyPromotion).
+ """
+
+ points: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of points earned by the event.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [order](entity:Order) for which the buyer earned the promotion points.
+ Only applications that use the Orders API to process orders can trigger this event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_adjust_points.py b/src/square/types/loyalty_event_adjust_points.py
new file mode 100644
index 00000000..91da2947
--- /dev/null
+++ b/src/square/types/loyalty_event_adjust_points.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventAdjustPoints(UncheckedBaseModel):
+ """
+ Provides metadata when the event `type` is `ADJUST_POINTS`.
+ """
+
+ loyalty_program_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ points: int = pydantic.Field()
+ """
+ The number of points added or removed.
+ """
+
+ reason: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The reason for the adjustment of points.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_create_reward.py b/src/square/types/loyalty_event_create_reward.py
new file mode 100644
index 00000000..9c2bdfa7
--- /dev/null
+++ b/src/square/types/loyalty_event_create_reward.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventCreateReward(UncheckedBaseModel):
+ """
+ Provides metadata when the event `type` is `CREATE_REWARD`.
+ """
+
+ loyalty_program_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ reward_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the created [loyalty reward](entity:LoyaltyReward).
+ This field is returned only if the event source is `LOYALTY_API`.
+ """
+
+ points: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The loyalty points used to create the reward.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_created_event.py b/src/square/types/loyalty_event_created_event.py
new file mode 100644
index 00000000..2e98c2e5
--- /dev/null
+++ b/src/square/types/loyalty_event_created_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_event_created_event_data import LoyaltyEventCreatedEventData
+
+
+class LoyaltyEventCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [loyalty event](entity:LoyaltyEvent) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `loyalty.event.created`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LoyaltyEventCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_created_event_data.py b/src/square/types/loyalty_event_created_event_data.py
new file mode 100644
index 00000000..dd04fbdd
--- /dev/null
+++ b/src/square/types/loyalty_event_created_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_event_created_event_object import LoyaltyEventCreatedEventObject
+
+
+class LoyaltyEventCreatedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `loyalty.event.created` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_event`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected loyalty event.
+ """
+
+ object: typing.Optional[LoyaltyEventCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the new loyalty event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_created_event_object.py b/src/square/types/loyalty_event_created_event_object.py
new file mode 100644
index 00000000..12e8560b
--- /dev/null
+++ b/src/square/types/loyalty_event_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_event import LoyaltyEvent
+
+
+class LoyaltyEventCreatedEventObject(UncheckedBaseModel):
+ loyalty_event: typing.Optional[LoyaltyEvent] = pydantic.Field(default=None)
+ """
+ The loyalty event that was created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_date_time_filter.py b/src/square/types/loyalty_event_date_time_filter.py
new file mode 100644
index 00000000..45abf17b
--- /dev/null
+++ b/src/square/types/loyalty_event_date_time_filter.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .time_range import TimeRange
+
+
+class LoyaltyEventDateTimeFilter(UncheckedBaseModel):
+ """
+ Filter events by date time range.
+ """
+
+ created_at: TimeRange = pydantic.Field()
+ """
+ The `created_at` date time range used to filter the result.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_delete_reward.py b/src/square/types/loyalty_event_delete_reward.py
new file mode 100644
index 00000000..d7701988
--- /dev/null
+++ b/src/square/types/loyalty_event_delete_reward.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventDeleteReward(UncheckedBaseModel):
+ """
+ Provides metadata when the event `type` is `DELETE_REWARD`.
+ """
+
+ loyalty_program_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ reward_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the deleted [loyalty reward](entity:LoyaltyReward).
+ This field is returned only if the event source is `LOYALTY_API`.
+ """
+
+ points: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of points returned to the loyalty account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_expire_points.py b/src/square/types/loyalty_event_expire_points.py
new file mode 100644
index 00000000..53be60eb
--- /dev/null
+++ b/src/square/types/loyalty_event_expire_points.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventExpirePoints(UncheckedBaseModel):
+ """
+ Provides metadata when the event `type` is `EXPIRE_POINTS`.
+ """
+
+ loyalty_program_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ points: int = pydantic.Field()
+ """
+ The number of points expired.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_filter.py b/src/square/types/loyalty_event_filter.py
new file mode 100644
index 00000000..f668cbbd
--- /dev/null
+++ b/src/square/types/loyalty_event_filter.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_event_date_time_filter import LoyaltyEventDateTimeFilter
+from .loyalty_event_location_filter import LoyaltyEventLocationFilter
+from .loyalty_event_loyalty_account_filter import LoyaltyEventLoyaltyAccountFilter
+from .loyalty_event_order_filter import LoyaltyEventOrderFilter
+from .loyalty_event_type_filter import LoyaltyEventTypeFilter
+
+
+class LoyaltyEventFilter(UncheckedBaseModel):
+ """
+ The filtering criteria. If the request specifies multiple filters,
+ the endpoint uses a logical AND to evaluate them.
+ """
+
+ loyalty_account_filter: typing.Optional[LoyaltyEventLoyaltyAccountFilter] = pydantic.Field(default=None)
+ """
+ Filter events by loyalty account.
+ """
+
+ type_filter: typing.Optional[LoyaltyEventTypeFilter] = pydantic.Field(default=None)
+ """
+ Filter events by event type.
+ """
+
+ date_time_filter: typing.Optional[LoyaltyEventDateTimeFilter] = pydantic.Field(default=None)
+ """
+ Filter events by date time range.
+ For each range, the start time is inclusive and the end time
+ is exclusive.
+ """
+
+ location_filter: typing.Optional[LoyaltyEventLocationFilter] = pydantic.Field(default=None)
+ """
+ Filter events by location.
+ """
+
+ order_filter: typing.Optional[LoyaltyEventOrderFilter] = pydantic.Field(default=None)
+ """
+ Filter events by the order associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_location_filter.py b/src/square/types/loyalty_event_location_filter.py
new file mode 100644
index 00000000..5d6dc72c
--- /dev/null
+++ b/src/square/types/loyalty_event_location_filter.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventLocationFilter(UncheckedBaseModel):
+ """
+ Filter events by location.
+ """
+
+ location_ids: typing.List[str] = pydantic.Field()
+ """
+ The [location](entity:Location) IDs for loyalty events to query.
+ If multiple values are specified, the endpoint uses
+ a logical OR to combine them.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_loyalty_account_filter.py b/src/square/types/loyalty_event_loyalty_account_filter.py
new file mode 100644
index 00000000..3b189d8e
--- /dev/null
+++ b/src/square/types/loyalty_event_loyalty_account_filter.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventLoyaltyAccountFilter(UncheckedBaseModel):
+ """
+ Filter events by loyalty account.
+ """
+
+ loyalty_account_id: str = pydantic.Field()
+ """
+ The ID of the [loyalty account](entity:LoyaltyAccount) associated with loyalty events.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_order_filter.py b/src/square/types/loyalty_event_order_filter.py
new file mode 100644
index 00000000..09a6b2b5
--- /dev/null
+++ b/src/square/types/loyalty_event_order_filter.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventOrderFilter(UncheckedBaseModel):
+ """
+ Filter events by the order associated with the event.
+ """
+
+ order_id: str = pydantic.Field()
+ """
+ The ID of the [order](entity:Order) associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_other.py b/src/square/types/loyalty_event_other.py
new file mode 100644
index 00000000..fc6f113c
--- /dev/null
+++ b/src/square/types/loyalty_event_other.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventOther(UncheckedBaseModel):
+ """
+ Provides metadata when the event `type` is `OTHER`.
+ """
+
+ loyalty_program_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ points: int = pydantic.Field()
+ """
+ The number of points added or removed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_query.py b/src/square/types/loyalty_event_query.py
new file mode 100644
index 00000000..02dde1d5
--- /dev/null
+++ b/src/square/types/loyalty_event_query.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_event_filter import LoyaltyEventFilter
+
+
+class LoyaltyEventQuery(UncheckedBaseModel):
+ """
+ Represents a query used to search for loyalty events.
+ """
+
+ filter: typing.Optional[LoyaltyEventFilter] = pydantic.Field(default=None)
+ """
+ The query filter criteria.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_redeem_reward.py b/src/square/types/loyalty_event_redeem_reward.py
new file mode 100644
index 00000000..76f49f79
--- /dev/null
+++ b/src/square/types/loyalty_event_redeem_reward.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyEventRedeemReward(UncheckedBaseModel):
+ """
+ Provides metadata when the event `type` is `REDEEM_REWARD`.
+ """
+
+ loyalty_program_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [loyalty program](entity:LoyaltyProgram).
+ """
+
+ reward_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the redeemed [loyalty reward](entity:LoyaltyReward).
+ This field is returned only if the event source is `LOYALTY_API`.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [order](entity:Order) that redeemed the reward.
+ This field is returned only if the Orders API is used to process orders.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event_source.py b/src/square/types/loyalty_event_source.py
new file mode 100644
index 00000000..72393ede
--- /dev/null
+++ b/src/square/types/loyalty_event_source.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoyaltyEventSource = typing.Union[typing.Literal["SQUARE", "LOYALTY_API"], typing.Any]
diff --git a/src/square/types/loyalty_event_type.py b/src/square/types/loyalty_event_type.py
new file mode 100644
index 00000000..6844a18f
--- /dev/null
+++ b/src/square/types/loyalty_event_type.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoyaltyEventType = typing.Union[
+ typing.Literal[
+ "ACCUMULATE_POINTS",
+ "CREATE_REWARD",
+ "REDEEM_REWARD",
+ "DELETE_REWARD",
+ "ADJUST_POINTS",
+ "EXPIRE_POINTS",
+ "OTHER",
+ "ACCUMULATE_PROMOTION_POINTS",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/loyalty_event_type_filter.py b/src/square/types/loyalty_event_type_filter.py
new file mode 100644
index 00000000..7ae82722
--- /dev/null
+++ b/src/square/types/loyalty_event_type_filter.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_event_type import LoyaltyEventType
+
+
+class LoyaltyEventTypeFilter(UncheckedBaseModel):
+ """
+ Filter events by event type.
+ """
+
+ types: typing.List[LoyaltyEventType] = pydantic.Field()
+ """
+ The loyalty event types used to filter the result.
+ If multiple values are specified, the endpoint uses a
+ logical OR to combine them.
+ See [LoyaltyEventType](#type-loyaltyeventtype) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program.py b/src/square/types/loyalty_program.py
new file mode 100644
index 00000000..7326e2e9
--- /dev/null
+++ b/src/square/types/loyalty_program.py
@@ -0,0 +1,78 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_program_accrual_rule import LoyaltyProgramAccrualRule
+from .loyalty_program_expiration_policy import LoyaltyProgramExpirationPolicy
+from .loyalty_program_reward_tier import LoyaltyProgramRewardTier
+from .loyalty_program_status import LoyaltyProgramStatus
+from .loyalty_program_terminology import LoyaltyProgramTerminology
+
+
+class LoyaltyProgram(UncheckedBaseModel):
+ """
+ Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards.
+ Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard.
+ For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the loyalty program. Updates to
+ the loyalty program do not modify the identifier.
+ """
+
+ status: typing.Optional[LoyaltyProgramStatus] = pydantic.Field(default=None)
+ """
+ Whether the program is currently active.
+ See [LoyaltyProgramStatus](#type-loyaltyprogramstatus) for possible values
+ """
+
+ reward_tiers: typing.Optional[typing.List[LoyaltyProgramRewardTier]] = pydantic.Field(default=None)
+ """
+ The list of rewards for buyers, sorted by ascending points.
+ """
+
+ expiration_policy: typing.Optional[LoyaltyProgramExpirationPolicy] = pydantic.Field(default=None)
+ """
+ If present, details for how points expire.
+ """
+
+ terminology: typing.Optional[LoyaltyProgramTerminology] = pydantic.Field(default=None)
+ """
+ A cosmetic name for the “points” currency.
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The [locations](entity:Location) at which the program is active.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the program was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the reward was last updated, in RFC 3339 format.
+ """
+
+ accrual_rules: typing.Optional[typing.List[LoyaltyProgramAccrualRule]] = pydantic.Field(default=None)
+ """
+ Defines how buyers can earn loyalty points from the base loyalty program.
+ To check for associated [loyalty promotions](entity:LoyaltyPromotion) that enable
+ buyers to earn extra points, call [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_accrual_rule.py b/src/square/types/loyalty_program_accrual_rule.py
new file mode 100644
index 00000000..b22c0acc
--- /dev/null
+++ b/src/square/types/loyalty_program_accrual_rule.py
@@ -0,0 +1,59 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_program_accrual_rule_category_data import LoyaltyProgramAccrualRuleCategoryData
+from .loyalty_program_accrual_rule_item_variation_data import LoyaltyProgramAccrualRuleItemVariationData
+from .loyalty_program_accrual_rule_spend_data import LoyaltyProgramAccrualRuleSpendData
+from .loyalty_program_accrual_rule_type import LoyaltyProgramAccrualRuleType
+from .loyalty_program_accrual_rule_visit_data import LoyaltyProgramAccrualRuleVisitData
+
+
+class LoyaltyProgramAccrualRule(UncheckedBaseModel):
+ """
+ Represents an accrual rule, which defines how buyers can earn points from the base [loyalty program](entity:LoyaltyProgram).
+ """
+
+ accrual_type: LoyaltyProgramAccrualRuleType = pydantic.Field()
+ """
+ The type of the accrual rule that defines how buyers can earn points.
+ See [LoyaltyProgramAccrualRuleType](#type-loyaltyprogramaccrualruletype) for possible values
+ """
+
+ points: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of points that
+ buyers earn based on the `accrual_type`.
+ """
+
+ visit_data: typing.Optional[LoyaltyProgramAccrualRuleVisitData] = pydantic.Field(default=None)
+ """
+ Additional data for rules with the `VISIT` accrual type.
+ """
+
+ spend_data: typing.Optional[LoyaltyProgramAccrualRuleSpendData] = pydantic.Field(default=None)
+ """
+ Additional data for rules with the `SPEND` accrual type.
+ """
+
+ item_variation_data: typing.Optional[LoyaltyProgramAccrualRuleItemVariationData] = pydantic.Field(default=None)
+ """
+ Additional data for rules with the `ITEM_VARIATION` accrual type.
+ """
+
+ category_data: typing.Optional[LoyaltyProgramAccrualRuleCategoryData] = pydantic.Field(default=None)
+ """
+ Additional data for rules with the `CATEGORY` accrual type.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_accrual_rule_category_data.py b/src/square/types/loyalty_program_accrual_rule_category_data.py
new file mode 100644
index 00000000..c0d8ff5f
--- /dev/null
+++ b/src/square/types/loyalty_program_accrual_rule_category_data.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyProgramAccrualRuleCategoryData(UncheckedBaseModel):
+ """
+ Represents additional data for rules with the `CATEGORY` accrual type.
+ """
+
+ category_id: str = pydantic.Field()
+ """
+ The ID of the `CATEGORY` [catalog object](entity:CatalogObject) that buyers can purchase to earn
+ points.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_accrual_rule_item_variation_data.py b/src/square/types/loyalty_program_accrual_rule_item_variation_data.py
new file mode 100644
index 00000000..dd1a5d78
--- /dev/null
+++ b/src/square/types/loyalty_program_accrual_rule_item_variation_data.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyProgramAccrualRuleItemVariationData(UncheckedBaseModel):
+ """
+ Represents additional data for rules with the `ITEM_VARIATION` accrual type.
+ """
+
+ item_variation_id: str = pydantic.Field()
+ """
+ The ID of the `ITEM_VARIATION` [catalog object](entity:CatalogObject) that buyers can purchase to earn
+ points.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_accrual_rule_spend_data.py b/src/square/types/loyalty_program_accrual_rule_spend_data.py
new file mode 100644
index 00000000..1391307a
--- /dev/null
+++ b/src/square/types/loyalty_program_accrual_rule_spend_data.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_program_accrual_rule_tax_mode import LoyaltyProgramAccrualRuleTaxMode
+from .money import Money
+
+
+class LoyaltyProgramAccrualRuleSpendData(UncheckedBaseModel):
+ """
+ Represents additional data for rules with the `SPEND` accrual type.
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount that buyers must spend to earn points.
+ For example, given an "Earn 1 point for every $10 spent" accrual rule, a buyer who spends $105 earns 10 points.
+ """
+
+ excluded_category_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of any `CATEGORY` catalog objects that are excluded from points accrual.
+
+ You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects)
+ endpoint to retrieve information about the excluded categories.
+ """
+
+ excluded_item_variation_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of any `ITEM_VARIATION` catalog objects that are excluded from points accrual.
+
+ You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects)
+ endpoint to retrieve information about the excluded item variations.
+ """
+
+ tax_mode: LoyaltyProgramAccrualRuleTaxMode = pydantic.Field()
+ """
+ Indicates how taxes should be treated when calculating the purchase amount used for points accrual.
+ See [LoyaltyProgramAccrualRuleTaxMode](#type-loyaltyprogramaccrualruletaxmode) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_accrual_rule_tax_mode.py b/src/square/types/loyalty_program_accrual_rule_tax_mode.py
new file mode 100644
index 00000000..eaf8d4b2
--- /dev/null
+++ b/src/square/types/loyalty_program_accrual_rule_tax_mode.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoyaltyProgramAccrualRuleTaxMode = typing.Union[typing.Literal["BEFORE_TAX", "AFTER_TAX"], typing.Any]
diff --git a/src/square/types/loyalty_program_accrual_rule_type.py b/src/square/types/loyalty_program_accrual_rule_type.py
new file mode 100644
index 00000000..07a54d98
--- /dev/null
+++ b/src/square/types/loyalty_program_accrual_rule_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoyaltyProgramAccrualRuleType = typing.Union[typing.Literal["VISIT", "SPEND", "ITEM_VARIATION", "CATEGORY"], typing.Any]
diff --git a/src/square/types/loyalty_program_accrual_rule_visit_data.py b/src/square/types/loyalty_program_accrual_rule_visit_data.py
new file mode 100644
index 00000000..e0de3753
--- /dev/null
+++ b/src/square/types/loyalty_program_accrual_rule_visit_data.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_program_accrual_rule_tax_mode import LoyaltyProgramAccrualRuleTaxMode
+from .money import Money
+
+
+class LoyaltyProgramAccrualRuleVisitData(UncheckedBaseModel):
+ """
+ Represents additional data for rules with the `VISIT` accrual type.
+ """
+
+ minimum_amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The minimum purchase required during the visit to quality for points.
+ """
+
+ tax_mode: LoyaltyProgramAccrualRuleTaxMode = pydantic.Field()
+ """
+ Indicates how taxes should be treated when calculating the purchase amount to determine whether the visit qualifies for points.
+ This setting applies only if `minimum_amount_money` is specified.
+ See [LoyaltyProgramAccrualRuleTaxMode](#type-loyaltyprogramaccrualruletaxmode) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_created_event.py b/src/square/types/loyalty_program_created_event.py
new file mode 100644
index 00000000..9d87a26d
--- /dev/null
+++ b/src/square/types/loyalty_program_created_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_program_created_event_data import LoyaltyProgramCreatedEventData
+
+
+class LoyaltyProgramCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [loyalty program](entity:LoyaltyProgram) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `loyalty.program.created`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LoyaltyProgramCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_created_event_data.py b/src/square/types/loyalty_program_created_event_data.py
new file mode 100644
index 00000000..38b70b56
--- /dev/null
+++ b/src/square/types/loyalty_program_created_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_program_created_event_object import LoyaltyProgramCreatedEventObject
+
+
+class LoyaltyProgramCreatedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `loyalty.program.created` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_program`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the created loyalty program.
+ """
+
+ object: typing.Optional[LoyaltyProgramCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the loyalty program that was created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_created_event_object.py b/src/square/types/loyalty_program_created_event_object.py
new file mode 100644
index 00000000..c6b80a05
--- /dev/null
+++ b/src/square/types/loyalty_program_created_event_object.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_program import LoyaltyProgram
+
+
+class LoyaltyProgramCreatedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the loyalty program associated with a `loyalty.program.created` event.
+ """
+
+ loyalty_program: typing.Optional[LoyaltyProgram] = pydantic.Field(default=None)
+ """
+ The loyalty program that was created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_expiration_policy.py b/src/square/types/loyalty_program_expiration_policy.py
new file mode 100644
index 00000000..77cd976a
--- /dev/null
+++ b/src/square/types/loyalty_program_expiration_policy.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyProgramExpirationPolicy(UncheckedBaseModel):
+ """
+ Describes when the loyalty program expires.
+ """
+
+ expiration_duration: str = pydantic.Field()
+ """
+ The number of months before points expire, in `P[n]M` RFC 3339 duration format. For example, a value of `P12M` represents a duration of 12 months.
+ Points are valid through the last day of the month in which they are scheduled to expire. For example, with a `P12M` duration, points earned on July 6, 2020 expire on August 1, 2021.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_reward_tier.py b/src/square/types/loyalty_program_reward_tier.py
new file mode 100644
index 00000000..fd999fb1
--- /dev/null
+++ b/src/square/types/loyalty_program_reward_tier.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_object_reference import CatalogObjectReference
+
+
+class LoyaltyProgramRewardTier(UncheckedBaseModel):
+ """
+ Represents a reward tier in a loyalty program. A reward tier defines how buyers can redeem points for a reward, such as the number of points required and the value and scope of the discount. A loyalty program can offer multiple reward tiers.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the reward tier.
+ """
+
+ points: int = pydantic.Field()
+ """
+ The points exchanged for the reward tier.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the reward tier.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the reward tier was created, in RFC 3339 format.
+ """
+
+ pricing_rule_reference: CatalogObjectReference = pydantic.Field()
+ """
+ A reference to the specific version of a `PRICING_RULE` catalog object that contains information about the reward tier discount.
+
+ Use `object_id` and `catalog_version` with the [RetrieveCatalogObject](api-endpoint:Catalog-RetrieveCatalogObject) endpoint
+ to get discount details. Make sure to set `include_related_objects` to true in the request to retrieve all catalog objects
+ that define the discount. For more information, see [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_status.py b/src/square/types/loyalty_program_status.py
new file mode 100644
index 00000000..e2a7fb37
--- /dev/null
+++ b/src/square/types/loyalty_program_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoyaltyProgramStatus = typing.Union[typing.Literal["INACTIVE", "ACTIVE"], typing.Any]
diff --git a/src/square/types/loyalty_program_terminology.py b/src/square/types/loyalty_program_terminology.py
new file mode 100644
index 00000000..39d9a2f7
--- /dev/null
+++ b/src/square/types/loyalty_program_terminology.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyProgramTerminology(UncheckedBaseModel):
+ """
+ Represents the naming used for loyalty points.
+ """
+
+ one: str = pydantic.Field()
+ """
+ A singular unit for a point (for example, 1 point is called 1 star).
+ """
+
+ other: str = pydantic.Field()
+ """
+ A plural unit for point (for example, 10 points is called 10 stars).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_updated_event.py b/src/square/types/loyalty_program_updated_event.py
new file mode 100644
index 00000000..0923aca8
--- /dev/null
+++ b/src/square/types/loyalty_program_updated_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_program_updated_event_data import LoyaltyProgramUpdatedEventData
+
+
+class LoyaltyProgramUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [loyalty program](entity:LoyaltyProgram) is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `loyalty.program.updated`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LoyaltyProgramUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_updated_event_data.py b/src/square/types/loyalty_program_updated_event_data.py
new file mode 100644
index 00000000..4f502605
--- /dev/null
+++ b/src/square/types/loyalty_program_updated_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_program_updated_event_object import LoyaltyProgramUpdatedEventObject
+
+
+class LoyaltyProgramUpdatedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `loyalty.program.updated` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_program`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected loyalty program.
+ """
+
+ object: typing.Optional[LoyaltyProgramUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the loyalty program that was updated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_program_updated_event_object.py b/src/square/types/loyalty_program_updated_event_object.py
new file mode 100644
index 00000000..7193887d
--- /dev/null
+++ b/src/square/types/loyalty_program_updated_event_object.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_program import LoyaltyProgram
+
+
+class LoyaltyProgramUpdatedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the loyalty program associated with a `loyalty.program.updated` event.
+ """
+
+ loyalty_program: typing.Optional[LoyaltyProgram] = pydantic.Field(default=None)
+ """
+ The loyalty program that was updated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion.py b/src/square/types/loyalty_promotion.py
new file mode 100644
index 00000000..9bf1b319
--- /dev/null
+++ b/src/square/types/loyalty_promotion.py
@@ -0,0 +1,110 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_promotion_available_time_data import LoyaltyPromotionAvailableTimeData
+from .loyalty_promotion_incentive import LoyaltyPromotionIncentive
+from .loyalty_promotion_status import LoyaltyPromotionStatus
+from .loyalty_promotion_trigger_limit import LoyaltyPromotionTriggerLimit
+from .money import Money
+
+
+class LoyaltyPromotion(UncheckedBaseModel):
+ """
+ Represents a promotion for a [loyalty program](entity:LoyaltyProgram). Loyalty promotions enable buyers
+ to earn extra points on top of those earned from the base program.
+
+ A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the promotion.
+ """
+
+ name: str = pydantic.Field()
+ """
+ The name of the promotion.
+ """
+
+ incentive: LoyaltyPromotionIncentive = pydantic.Field()
+ """
+ The points incentive for the promotion. This field defines whether promotion points
+ are earned by multiplying base program points or by adding a specified number of points.
+ """
+
+ available_time: LoyaltyPromotionAvailableTimeData = pydantic.Field()
+ """
+ The scheduling information that defines when purchases can qualify to earn points from an `ACTIVE` promotion.
+ """
+
+ trigger_limit: typing.Optional[LoyaltyPromotionTriggerLimit] = pydantic.Field(default=None)
+ """
+ The number of times a buyer can earn promotion points during a specified interval.
+ If not specified, buyers can trigger the promotion an unlimited number of times.
+ """
+
+ status: typing.Optional[LoyaltyPromotionStatus] = pydantic.Field(default=None)
+ """
+ The current status of the promotion.
+ See [LoyaltyPromotionStatus](#type-loyaltypromotionstatus) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the promotion was created, in RFC 3339 format.
+ """
+
+ canceled_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the promotion was canceled, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the promotion was last updated, in RFC 3339 format.
+ """
+
+ loyalty_program_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [loyalty program](entity:LoyaltyProgram) associated with the promotion.
+ """
+
+ minimum_spend_amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The minimum purchase amount required to earn promotion points. If specified, this amount is positive.
+ """
+
+ qualifying_item_variation_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of any qualifying `ITEM_VARIATION` [catalog objects](entity:CatalogObject). If specified,
+ the purchase must include at least one of these items to qualify for the promotion.
+
+ This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule.
+ With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded.
+
+ You can specify `qualifying_item_variation_ids` or `qualifying_category_ids` for a given promotion, but not both.
+ """
+
+ qualifying_category_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of any qualifying `CATEGORY` [catalog objects](entity:CatalogObject). If specified,
+ the purchase must include at least one item from one of these categories to qualify for the promotion.
+
+ This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule.
+ With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded.
+
+ You can specify `qualifying_category_ids` or `qualifying_item_variation_ids` for a promotion, but not both.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_available_time_data.py b/src/square/types/loyalty_promotion_available_time_data.py
new file mode 100644
index 00000000..2b859ab7
--- /dev/null
+++ b/src/square/types/loyalty_promotion_available_time_data.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyPromotionAvailableTimeData(UncheckedBaseModel):
+ """
+ Represents scheduling information that determines when purchases can qualify to earn points
+ from a [loyalty promotion](entity:LoyaltyPromotion).
+ """
+
+ start_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The date that the promotion starts, in `YYYY-MM-DD` format. Square populates this field
+ based on the provided `time_periods`.
+ """
+
+ end_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The date that the promotion ends, in `YYYY-MM-DD` format. Square populates this field
+ based on the provided `time_periods`. If an end date is not specified, an `ACTIVE` promotion
+ remains available until it is canceled.
+ """
+
+ time_periods: typing.List[str] = pydantic.Field()
+ """
+ A list of [iCalendar (RFC 5545) events](https://tools.ietf.org/html/rfc5545#section-3.6.1)
+ (`VEVENT`). Each event represents an available time period per day or days of the week.
+ A day can have a maximum of one available time period.
+
+ Only `DTSTART`, `DURATION`, and `RRULE` are supported. `DTSTART` and `DURATION` are required and
+ timestamps must be in local (unzoned) time format. Include `RRULE` to specify recurring promotions,
+ an end date (using the `UNTIL` keyword), or both. For more information, see
+ [Available time](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#available-time).
+
+ Note that `BEGIN:VEVENT` and `END:VEVENT` are optional in a `CreateLoyaltyPromotion` request
+ but are always included in the response.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_created_event.py b/src/square/types/loyalty_promotion_created_event.py
new file mode 100644
index 00000000..76eb923f
--- /dev/null
+++ b/src/square/types/loyalty_promotion_created_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_promotion_created_event_data import LoyaltyPromotionCreatedEventData
+
+
+class LoyaltyPromotionCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [loyalty promotion](entity:LoyaltyPromotion) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `loyalty.promotion.created`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LoyaltyPromotionCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_created_event_data.py b/src/square/types/loyalty_promotion_created_event_data.py
new file mode 100644
index 00000000..5c73e5d3
--- /dev/null
+++ b/src/square/types/loyalty_promotion_created_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_promotion_created_event_object import LoyaltyPromotionCreatedEventObject
+
+
+class LoyaltyPromotionCreatedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `loyalty.promotion.created` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_promotion`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected loyalty promotion.
+ """
+
+ object: typing.Optional[LoyaltyPromotionCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the loyalty promotion that was created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_created_event_object.py b/src/square/types/loyalty_promotion_created_event_object.py
new file mode 100644
index 00000000..209c014f
--- /dev/null
+++ b/src/square/types/loyalty_promotion_created_event_object.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_promotion import LoyaltyPromotion
+
+
+class LoyaltyPromotionCreatedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the loyalty promotion associated with a `loyalty.promotion.created` event.
+ """
+
+ loyalty_promotion: typing.Optional[LoyaltyPromotion] = pydantic.Field(default=None)
+ """
+ The loyalty promotion that was created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_incentive.py b/src/square/types/loyalty_promotion_incentive.py
new file mode 100644
index 00000000..c286c978
--- /dev/null
+++ b/src/square/types/loyalty_promotion_incentive.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_promotion_incentive_points_addition_data import LoyaltyPromotionIncentivePointsAdditionData
+from .loyalty_promotion_incentive_points_multiplier_data import LoyaltyPromotionIncentivePointsMultiplierData
+from .loyalty_promotion_incentive_type import LoyaltyPromotionIncentiveType
+
+
+class LoyaltyPromotionIncentive(UncheckedBaseModel):
+ """
+ Represents how points for a [loyalty promotion](entity:LoyaltyPromotion) are calculated,
+ either by multiplying the points earned from the base program or by adding a specified number
+ of points to the points earned from the base program.
+ """
+
+ type: LoyaltyPromotionIncentiveType = pydantic.Field()
+ """
+ The type of points incentive.
+ See [LoyaltyPromotionIncentiveType](#type-loyaltypromotionincentivetype) for possible values
+ """
+
+ points_multiplier_data: typing.Optional[LoyaltyPromotionIncentivePointsMultiplierData] = pydantic.Field(
+ default=None
+ )
+ """
+ Additional data for a `POINTS_MULTIPLIER` incentive type.
+ """
+
+ points_addition_data: typing.Optional[LoyaltyPromotionIncentivePointsAdditionData] = pydantic.Field(default=None)
+ """
+ Additional data for a `POINTS_ADDITION` incentive type.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_incentive_points_addition_data.py b/src/square/types/loyalty_promotion_incentive_points_addition_data.py
new file mode 100644
index 00000000..6a2ba3bc
--- /dev/null
+++ b/src/square/types/loyalty_promotion_incentive_points_addition_data.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyPromotionIncentivePointsAdditionData(UncheckedBaseModel):
+ """
+ Represents the metadata for a `POINTS_ADDITION` type of [loyalty promotion incentive](entity:LoyaltyPromotionIncentive).
+ """
+
+ points_addition: int = pydantic.Field()
+ """
+ The number of additional points to earn each time the promotion is triggered. For example,
+ suppose a purchase qualifies for 5 points from the base loyalty program. If the purchase also
+ qualifies for a `POINTS_ADDITION` promotion incentive with a `points_addition` of 3, the buyer
+ earns a total of 8 points (5 program points + 3 promotion points = 8 points).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_incentive_points_multiplier_data.py b/src/square/types/loyalty_promotion_incentive_points_multiplier_data.py
new file mode 100644
index 00000000..a589600d
--- /dev/null
+++ b/src/square/types/loyalty_promotion_incentive_points_multiplier_data.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class LoyaltyPromotionIncentivePointsMultiplierData(UncheckedBaseModel):
+ """
+ Represents the metadata for a `POINTS_MULTIPLIER` type of [loyalty promotion incentive](entity:LoyaltyPromotionIncentive).
+ """
+
+ points_multiplier: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The multiplier used to calculate the number of points earned each time the promotion
+ is triggered. For example, suppose a purchase qualifies for 5 points from the base loyalty program.
+ If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a `points_multiplier`
+ of 3, the buyer earns a total of 15 points (5 program points x 3 promotion multiplier = 15 points).
+
+ DEPRECATED at version 2023-08-16. Replaced by the `multiplier` field.
+
+ One of the following is required when specifying a points multiplier:
+ - (Recommended) The `multiplier` field.
+ - This deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier`
+ with the equivalent value.
+ """
+
+ multiplier: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The multiplier used to calculate the number of points earned each time the promotion is triggered,
+ specified as a string representation of a decimal. Square supports multipliers up to 10x, with three
+ point precision for decimal multipliers. For example, suppose a purchase qualifies for 4 points from the
+ base loyalty program. If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a
+ `multiplier` of "1.5", the buyer earns a total of 6 points (4 program points x 1.5 promotion multiplier = 6 points).
+ Fractional points are dropped.
+
+ One of the following is required when specifying a points multiplier:
+ - (Recommended) This `multiplier` field.
+ - The deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier`
+ with the equivalent value.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_incentive_type.py b/src/square/types/loyalty_promotion_incentive_type.py
new file mode 100644
index 00000000..bdffea2b
--- /dev/null
+++ b/src/square/types/loyalty_promotion_incentive_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoyaltyPromotionIncentiveType = typing.Union[typing.Literal["POINTS_MULTIPLIER", "POINTS_ADDITION"], typing.Any]
diff --git a/src/square/types/loyalty_promotion_status.py b/src/square/types/loyalty_promotion_status.py
new file mode 100644
index 00000000..3693c233
--- /dev/null
+++ b/src/square/types/loyalty_promotion_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoyaltyPromotionStatus = typing.Union[typing.Literal["ACTIVE", "ENDED", "CANCELED", "SCHEDULED"], typing.Any]
diff --git a/src/square/types/loyalty_promotion_trigger_limit.py b/src/square/types/loyalty_promotion_trigger_limit.py
new file mode 100644
index 00000000..13735b18
--- /dev/null
+++ b/src/square/types/loyalty_promotion_trigger_limit.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_promotion_trigger_limit_interval import LoyaltyPromotionTriggerLimitInterval
+
+
+class LoyaltyPromotionTriggerLimit(UncheckedBaseModel):
+ """
+ Represents the number of times a buyer can earn points during a [loyalty promotion](entity:LoyaltyPromotion).
+ If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during
+ the time that the promotion is available.
+
+ A purchase that is disqualified from earning points because of this limit might qualify for another active promotion.
+ """
+
+ times: int = pydantic.Field()
+ """
+ The maximum number of times a buyer can trigger the promotion during the specified `interval`.
+ """
+
+ interval: typing.Optional[LoyaltyPromotionTriggerLimitInterval] = pydantic.Field(default=None)
+ """
+ The time period the limit applies to.
+ See [LoyaltyPromotionTriggerLimitInterval](#type-loyaltypromotiontriggerlimitinterval) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_trigger_limit_interval.py b/src/square/types/loyalty_promotion_trigger_limit_interval.py
new file mode 100644
index 00000000..a47a3fde
--- /dev/null
+++ b/src/square/types/loyalty_promotion_trigger_limit_interval.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoyaltyPromotionTriggerLimitInterval = typing.Union[typing.Literal["ALL_TIME", "DAY"], typing.Any]
diff --git a/src/square/types/loyalty_promotion_updated_event.py b/src/square/types/loyalty_promotion_updated_event.py
new file mode 100644
index 00000000..68ec4fbe
--- /dev/null
+++ b/src/square/types/loyalty_promotion_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_promotion_updated_event_data import LoyaltyPromotionUpdatedEventData
+
+
+class LoyaltyPromotionUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [loyalty promotion](entity:LoyaltyPromotion) is updated. This event is
+ invoked only when a loyalty promotion is canceled.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the Square seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event. For this event, the value is `loyalty.promotion.updated`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the event, which is used for
+ [idempotency support](https://developer.squareup.com/docs/webhooks/step4manage#webhooks-best-practices).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[LoyaltyPromotionUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_updated_event_data.py b/src/square/types/loyalty_promotion_updated_event_data.py
new file mode 100644
index 00000000..f973d703
--- /dev/null
+++ b/src/square/types/loyalty_promotion_updated_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_promotion_updated_event_object import LoyaltyPromotionUpdatedEventObject
+
+
+class LoyaltyPromotionUpdatedEventData(UncheckedBaseModel):
+ """
+ The data associated with a `loyalty.promotion.updated` event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object affected by the event. For this event, the value is `loyalty_promotion`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the affected loyalty promotion.
+ """
+
+ object: typing.Optional[LoyaltyPromotionUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object that contains the loyalty promotion that was updated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_promotion_updated_event_object.py b/src/square/types/loyalty_promotion_updated_event_object.py
new file mode 100644
index 00000000..aea1755d
--- /dev/null
+++ b/src/square/types/loyalty_promotion_updated_event_object.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_promotion import LoyaltyPromotion
+
+
+class LoyaltyPromotionUpdatedEventObject(UncheckedBaseModel):
+ """
+ An object that contains the loyalty promotion associated with a `loyalty.promotion.updated` event.
+ """
+
+ loyalty_promotion: typing.Optional[LoyaltyPromotion] = pydantic.Field(default=None)
+ """
+ The loyalty promotion that was updated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_reward.py b/src/square/types/loyalty_reward.py
new file mode 100644
index 00000000..326e6f88
--- /dev/null
+++ b/src/square/types/loyalty_reward.py
@@ -0,0 +1,70 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_reward_status import LoyaltyRewardStatus
+
+
+class LoyaltyReward(UncheckedBaseModel):
+ """
+ Represents a contract to redeem loyalty points for a [reward tier](entity:LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state.
+ For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the loyalty reward.
+ """
+
+ status: typing.Optional[LoyaltyRewardStatus] = pydantic.Field(default=None)
+ """
+ The status of a loyalty reward.
+ See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values
+ """
+
+ loyalty_account_id: str = pydantic.Field()
+ """
+ The Square-assigned ID of the [loyalty account](entity:LoyaltyAccount) to which the reward belongs.
+ """
+
+ reward_tier_id: str = pydantic.Field()
+ """
+ The Square-assigned ID of the [reward tier](entity:LoyaltyProgramRewardTier) used to create the reward.
+ """
+
+ points: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of loyalty points used for the reward.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the [order](entity:Order) to which the reward is attached.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the reward was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the reward was last updated, in RFC 3339 format.
+ """
+
+ redeemed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the reward was redeemed, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_reward_status.py b/src/square/types/loyalty_reward_status.py
new file mode 100644
index 00000000..026cc7ee
--- /dev/null
+++ b/src/square/types/loyalty_reward_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LoyaltyRewardStatus = typing.Union[typing.Literal["ISSUED", "REDEEMED", "DELETED"], typing.Any]
diff --git a/src/square/types/measure.py b/src/square/types/measure.py
new file mode 100644
index 00000000..c65a1bf1
--- /dev/null
+++ b/src/square/types/measure.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .format import Format
+from .format_description import FormatDescription
+
+
+class Measure(UncheckedBaseModel):
+ name: str
+ title: typing.Optional[str] = None
+ short_title: typing_extensions.Annotated[
+ typing.Optional[str], FieldMetadata(alias="shortTitle"), pydantic.Field(alias="shortTitle")
+ ] = None
+ description: typing.Optional[str] = None
+ type: str
+ agg_type: typing_extensions.Annotated[
+ typing.Optional[str], FieldMetadata(alias="aggType"), pydantic.Field(alias="aggType")
+ ] = None
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = None
+ format: typing.Optional[Format] = None
+ format_description: typing_extensions.Annotated[
+ typing.Optional[FormatDescription],
+ FieldMetadata(alias="formatDescription"),
+ pydantic.Field(alias="formatDescription"),
+ ] = None
+ currency: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ISO 4217 currency code in uppercase (3 characters, e.g. USD, EUR)
+ """
+
+ alias_member: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="aliasMember"),
+ pydantic.Field(
+ alias="aliasMember", description="When measure is defined in View, it keeps the original path: Cube.measure"
+ ),
+ ] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/measurement_unit.py b/src/square/types/measurement_unit.py
new file mode 100644
index 00000000..839d9016
--- /dev/null
+++ b/src/square/types/measurement_unit.py
@@ -0,0 +1,80 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .measurement_unit_area import MeasurementUnitArea
+from .measurement_unit_custom import MeasurementUnitCustom
+from .measurement_unit_generic import MeasurementUnitGeneric
+from .measurement_unit_length import MeasurementUnitLength
+from .measurement_unit_time import MeasurementUnitTime
+from .measurement_unit_unit_type import MeasurementUnitUnitType
+from .measurement_unit_volume import MeasurementUnitVolume
+from .measurement_unit_weight import MeasurementUnitWeight
+
+
+class MeasurementUnit(UncheckedBaseModel):
+ """
+ Represents a unit of measurement to use with a quantity, such as ounces
+ or inches. Exactly one of the following fields are required: `custom_unit`,
+ `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`.
+ """
+
+ custom_unit: typing.Optional[MeasurementUnitCustom] = pydantic.Field(default=None)
+ """
+ A custom unit of measurement defined by the seller using the Point of Sale
+ app or ad-hoc as an order line item.
+ """
+
+ area_unit: typing.Optional[MeasurementUnitArea] = pydantic.Field(default=None)
+ """
+ Represents a standard area unit.
+ See [MeasurementUnitArea](#type-measurementunitarea) for possible values
+ """
+
+ length_unit: typing.Optional[MeasurementUnitLength] = pydantic.Field(default=None)
+ """
+ Represents a standard length unit.
+ See [MeasurementUnitLength](#type-measurementunitlength) for possible values
+ """
+
+ volume_unit: typing.Optional[MeasurementUnitVolume] = pydantic.Field(default=None)
+ """
+ Represents a standard volume unit.
+ See [MeasurementUnitVolume](#type-measurementunitvolume) for possible values
+ """
+
+ weight_unit: typing.Optional[MeasurementUnitWeight] = pydantic.Field(default=None)
+ """
+ Represents a standard unit of weight or mass.
+ See [MeasurementUnitWeight](#type-measurementunitweight) for possible values
+ """
+
+ generic_unit: typing.Optional[MeasurementUnitGeneric] = pydantic.Field(default=None)
+ """
+ Reserved for API integrations that lack the ability to specify a real measurement unit
+ See [MeasurementUnitGeneric](#type-measurementunitgeneric) for possible values
+ """
+
+ time_unit: typing.Optional[MeasurementUnitTime] = pydantic.Field(default=None)
+ """
+ Represents a standard unit of time.
+ See [MeasurementUnitTime](#type-measurementunittime) for possible values
+ """
+
+ type: typing.Optional[MeasurementUnitUnitType] = pydantic.Field(default=None)
+ """
+ Represents the type of the measurement unit.
+ See [MeasurementUnitUnitType](#type-measurementunitunittype) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/measurement_unit_area.py b/src/square/types/measurement_unit_area.py
new file mode 100644
index 00000000..b12068c6
--- /dev/null
+++ b/src/square/types/measurement_unit_area.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+MeasurementUnitArea = typing.Union[
+ typing.Literal[
+ "IMPERIAL_ACRE",
+ "IMPERIAL_SQUARE_INCH",
+ "IMPERIAL_SQUARE_FOOT",
+ "IMPERIAL_SQUARE_YARD",
+ "IMPERIAL_SQUARE_MILE",
+ "METRIC_SQUARE_CENTIMETER",
+ "METRIC_SQUARE_METER",
+ "METRIC_SQUARE_KILOMETER",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/measurement_unit_custom.py b/src/square/types/measurement_unit_custom.py
new file mode 100644
index 00000000..6892943a
--- /dev/null
+++ b/src/square/types/measurement_unit_custom.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class MeasurementUnitCustom(UncheckedBaseModel):
+ """
+ The information needed to define a custom unit, provided by the seller.
+ """
+
+ name: str = pydantic.Field()
+ """
+ The name of the custom unit, for example "bushel".
+ """
+
+ abbreviation: str = pydantic.Field()
+ """
+ The abbreviation of the custom unit, such as "bsh" (bushel). This appears
+ in the cart for the Point of Sale app, and in reports.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/measurement_unit_generic.py b/src/square/types/measurement_unit_generic.py
new file mode 100644
index 00000000..9fb8f09a
--- /dev/null
+++ b/src/square/types/measurement_unit_generic.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+MeasurementUnitGeneric = typing.Literal["UNIT"]
diff --git a/src/square/types/measurement_unit_length.py b/src/square/types/measurement_unit_length.py
new file mode 100644
index 00000000..8c3c23be
--- /dev/null
+++ b/src/square/types/measurement_unit_length.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+MeasurementUnitLength = typing.Union[
+ typing.Literal[
+ "IMPERIAL_INCH",
+ "IMPERIAL_FOOT",
+ "IMPERIAL_YARD",
+ "IMPERIAL_MILE",
+ "METRIC_MILLIMETER",
+ "METRIC_CENTIMETER",
+ "METRIC_METER",
+ "METRIC_KILOMETER",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/measurement_unit_time.py b/src/square/types/measurement_unit_time.py
new file mode 100644
index 00000000..7d1e5e8c
--- /dev/null
+++ b/src/square/types/measurement_unit_time.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+MeasurementUnitTime = typing.Union[
+ typing.Literal["GENERIC_MILLISECOND", "GENERIC_SECOND", "GENERIC_MINUTE", "GENERIC_HOUR", "GENERIC_DAY"], typing.Any
+]
diff --git a/src/square/types/measurement_unit_unit_type.py b/src/square/types/measurement_unit_unit_type.py
new file mode 100644
index 00000000..4c34d80e
--- /dev/null
+++ b/src/square/types/measurement_unit_unit_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+MeasurementUnitUnitType = typing.Union[
+ typing.Literal["TYPE_CUSTOM", "TYPE_AREA", "TYPE_LENGTH", "TYPE_VOLUME", "TYPE_WEIGHT", "TYPE_GENERIC"], typing.Any
+]
diff --git a/src/square/types/measurement_unit_volume.py b/src/square/types/measurement_unit_volume.py
new file mode 100644
index 00000000..15a93c9d
--- /dev/null
+++ b/src/square/types/measurement_unit_volume.py
@@ -0,0 +1,20 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+MeasurementUnitVolume = typing.Union[
+ typing.Literal[
+ "GENERIC_FLUID_OUNCE",
+ "GENERIC_SHOT",
+ "GENERIC_CUP",
+ "GENERIC_PINT",
+ "GENERIC_QUART",
+ "GENERIC_GALLON",
+ "IMPERIAL_CUBIC_INCH",
+ "IMPERIAL_CUBIC_FOOT",
+ "IMPERIAL_CUBIC_YARD",
+ "METRIC_MILLILITER",
+ "METRIC_LITER",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/measurement_unit_weight.py b/src/square/types/measurement_unit_weight.py
new file mode 100644
index 00000000..0a2e649f
--- /dev/null
+++ b/src/square/types/measurement_unit_weight.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+MeasurementUnitWeight = typing.Union[
+ typing.Literal[
+ "IMPERIAL_WEIGHT_OUNCE",
+ "IMPERIAL_POUND",
+ "IMPERIAL_STONE",
+ "METRIC_MILLIGRAM",
+ "METRIC_GRAM",
+ "METRIC_KILOGRAM",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/merchant.py b/src/square/types/merchant.py
new file mode 100644
index 00000000..4f85dec0
--- /dev/null
+++ b/src/square/types/merchant.py
@@ -0,0 +1,69 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .country import Country
+from .currency import Currency
+from .merchant_status import MerchantStatus
+
+
+class Merchant(UncheckedBaseModel):
+ """
+ Represents a business that sells with Square.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-issued ID of the merchant.
+ """
+
+ business_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the merchant's overall business.
+ """
+
+ country: Country = pydantic.Field()
+ """
+ The country code associated with the merchant, in the two-letter format of ISO 3166. For example, `US` or `JP`.
+ See [Country](#type-country) for possible values
+ """
+
+ language_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The code indicating the [language preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences) of the merchant, in [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). For example, `en-US` or `fr-CA`.
+ """
+
+ currency: typing.Optional[Currency] = pydantic.Field(default=None)
+ """
+ The currency associated with the merchant, in ISO 4217 format. For example, the currency code for US dollars is `USD`.
+ See [Currency](#type-currency) for possible values
+ """
+
+ status: typing.Optional[MerchantStatus] = pydantic.Field(default=None)
+ """
+ The merchant's status.
+ See [MerchantStatus](#type-merchantstatus) for possible values
+ """
+
+ main_location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [main `Location`](https://developer.squareup.com/docs/locations-api#about-the-main-location) for this merchant.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the merchant was created, in RFC 3339 format.
+ For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_custom_attribute_definition_owned_created_event.py b/src/square/types/merchant_custom_attribute_definition_owned_created_event.py
new file mode 100644
index 00000000..3436e9bf
--- /dev/null
+++ b/src/square/types/merchant_custom_attribute_definition_owned_created_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class MerchantCustomAttributeDefinitionOwnedCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ is created by the subscribing application. Subscribe to this event to be notified
+ when your application creates a merchant custom attribute definition.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.owned.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_custom_attribute_definition_owned_deleted_event.py b/src/square/types/merchant_custom_attribute_definition_owned_deleted_event.py
new file mode 100644
index 00000000..2007d716
--- /dev/null
+++ b/src/square/types/merchant_custom_attribute_definition_owned_deleted_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class MerchantCustomAttributeDefinitionOwnedDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ is deleted by the subscribing application. Subscribe to this event to be notified
+ when your application deletes a merchant custom attribute definition.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.owned.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_custom_attribute_definition_owned_updated_event.py b/src/square/types/merchant_custom_attribute_definition_owned_updated_event.py
new file mode 100644
index 00000000..cb50de16
--- /dev/null
+++ b/src/square/types/merchant_custom_attribute_definition_owned_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class MerchantCustomAttributeDefinitionOwnedUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ is updated by the subscribing application. Subscribe to this event to be notified
+ when your application updates a merchant custom attribute definition.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.owned.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_custom_attribute_definition_visible_created_event.py b/src/square/types/merchant_custom_attribute_definition_visible_created_event.py
new file mode 100644
index 00000000..67a36675
--- /dev/null
+++ b/src/square/types/merchant_custom_attribute_definition_visible_created_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class MerchantCustomAttributeDefinitionVisibleCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is created. A notification is sent when your application
+ creates a custom attribute definition or another application creates a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.visible.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_custom_attribute_definition_visible_deleted_event.py b/src/square/types/merchant_custom_attribute_definition_visible_deleted_event.py
new file mode 100644
index 00000000..1cc0e4e3
--- /dev/null
+++ b/src/square/types/merchant_custom_attribute_definition_visible_deleted_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class MerchantCustomAttributeDefinitionVisibleDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is deleted. A notification is sent when your application
+ deletes a custom attribute definition or another application deletes a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.visible.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_custom_attribute_definition_visible_updated_event.py b/src/square/types/merchant_custom_attribute_definition_visible_updated_event.py
new file mode 100644
index 00000000..7e893a40
--- /dev/null
+++ b/src/square/types/merchant_custom_attribute_definition_visible_updated_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class MerchantCustomAttributeDefinitionVisibleUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition)
+ that is visible to the subscribing application is updated. A notification is sent when your application
+ updates a custom attribute definition or another application updates a custom attribute definition whose
+ `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"merchant.custom_attribute_definition.visible.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_custom_attribute_owned_deleted_event.py b/src/square/types/merchant_custom_attribute_owned_deleted_event.py
new file mode 100644
index 00000000..0c1f6720
--- /dev/null
+++ b/src/square/types/merchant_custom_attribute_owned_deleted_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class MerchantCustomAttributeOwnedDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant [custom attribute](entity:CustomAttribute)
+ associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is
+ owned by the subscribing application is deleted. Subscribe to this event to be notified
+ when your application deletes a merchant custom attribute.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"merchant.custom_attribute.owned.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_custom_attribute_owned_updated_event.py b/src/square/types/merchant_custom_attribute_owned_updated_event.py
new file mode 100644
index 00000000..b0e319bb
--- /dev/null
+++ b/src/square/types/merchant_custom_attribute_owned_updated_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class MerchantCustomAttributeOwnedUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant [custom attribute](entity:CustomAttribute)
+ associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is
+ owned by the subscribing application is updated. Subscribe to this event to be notified
+ when your application updates a merchant custom attribute.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"merchant.custom_attribute.owned.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_custom_attribute_visible_deleted_event.py b/src/square/types/merchant_custom_attribute_visible_deleted_event.py
new file mode 100644
index 00000000..2b6870b7
--- /dev/null
+++ b/src/square/types/merchant_custom_attribute_visible_deleted_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class MerchantCustomAttributeVisibleDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant [custom attribute](entity:CustomAttribute) with
+ the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted.
+ An application that subscribes to this event is notified when a merchant custom attribute is deleted
+ by any application for which the subscribing application has read access to the merchant custom attribute.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"merchant.custom_attribute.visible.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_custom_attribute_visible_updated_event.py b/src/square/types/merchant_custom_attribute_visible_updated_event.py
new file mode 100644
index 00000000..9b96b0e4
--- /dev/null
+++ b/src/square/types/merchant_custom_attribute_visible_updated_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class MerchantCustomAttributeVisibleUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant [custom attribute](entity:CustomAttribute) with
+ the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated.
+ An application that subscribes to this event is notified when a merchant custom attribute is updated
+ by any application for which the subscribing application has read access to the merchant custom attribute.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller associated with the event that triggered the event notification.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"merchant.custom_attribute.visible.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp that indicates when the event notification was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event that triggered the event notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_settings_updated_event.py b/src/square/types/merchant_settings_updated_event.py
new file mode 100644
index 00000000..deee1351
--- /dev/null
+++ b/src/square/types/merchant_settings_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .merchant_settings_updated_event_data import MerchantSettingsUpdatedEventData
+
+
+class MerchantSettingsUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when online checkout merchant settings are updated
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"online_checkout.merchant_settings.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing.Optional[MerchantSettingsUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_settings_updated_event_data.py b/src/square/types/merchant_settings_updated_event_data.py
new file mode 100644
index 00000000..7df67e63
--- /dev/null
+++ b/src/square/types/merchant_settings_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .merchant_settings_updated_event_object import MerchantSettingsUpdatedEventObject
+
+
+class MerchantSettingsUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the updated object’s type, `"online_checkout.merchant_settings"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the updated merchant settings.
+ """
+
+ object: typing.Optional[MerchantSettingsUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated merchant settings.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_settings_updated_event_object.py b/src/square/types/merchant_settings_updated_event_object.py
new file mode 100644
index 00000000..52c00f7b
--- /dev/null
+++ b/src/square/types/merchant_settings_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_merchant_settings import CheckoutMerchantSettings
+
+
+class MerchantSettingsUpdatedEventObject(UncheckedBaseModel):
+ merchant_settings: typing.Optional[CheckoutMerchantSettings] = pydantic.Field(default=None)
+ """
+ The updated merchant settings.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/merchant_status.py b/src/square/types/merchant_status.py
new file mode 100644
index 00000000..7b593d57
--- /dev/null
+++ b/src/square/types/merchant_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+MerchantStatus = typing.Union[typing.Literal["ACTIVE", "INACTIVE"], typing.Any]
diff --git a/src/square/types/metadata_response.py b/src/square/types/metadata_response.py
new file mode 100644
index 00000000..fe106b94
--- /dev/null
+++ b/src/square/types/metadata_response.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .cube import Cube
+
+
+class MetadataResponse(UncheckedBaseModel):
+ cubes: typing.Optional[typing.List[Cube]] = None
+ compiler_id: typing_extensions.Annotated[
+ typing.Optional[str], FieldMetadata(alias="compilerId"), pydantic.Field(alias="compilerId")
+ ] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/modifier_location_overrides.py b/src/square/types/modifier_location_overrides.py
new file mode 100644
index 00000000..113f32a3
--- /dev/null
+++ b/src/square/types/modifier_location_overrides.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class ModifierLocationOverrides(UncheckedBaseModel):
+ """
+ Location-specific overrides for specified properties of a `CatalogModifier` object.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the `Location` object representing the location. This can include a deactivated location.
+ """
+
+ price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The overridden price at the specified location. If this is unspecified, the modifier price is not overridden.
+ The modifier becomes free of charge at the specified location, when this `price_money` field is set to 0.
+ """
+
+ sold_out: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the modifier is sold out at the specified location or not. As an example, for cheese (modifier) burger (item), when the modifier is sold out, it is the cheese, but not the burger, that is sold out.
+ The seller can manually set this sold out status. Attempts by an application to set this attribute are ignored.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/money.py b/src/square/types/money.py
new file mode 100644
index 00000000..b26b593b
--- /dev/null
+++ b/src/square/types/money.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .currency import Currency
+
+
+class Money(UncheckedBaseModel):
+ """
+ Represents an amount of money. `Money` fields can be signed or unsigned.
+ Fields that do not explicitly define whether they are signed or unsigned are
+ considered unsigned and can only hold positive amounts. For signed fields, the
+ sign of the value indicates the purpose of the money transfer. See
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
+ for more information.
+ """
+
+ amount: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The amount of money, in the smallest denomination of the currency
+ indicated by `currency`. For example, when `currency` is `USD`, `amount` is
+ in cents. Monetary amounts can be positive or negative. See the specific
+ field description to determine the meaning of the sign in a particular case.
+ """
+
+ currency: typing.Optional[Currency] = pydantic.Field(default=None)
+ """
+ The type of currency, in __ISO 4217 format__. For example, the currency
+ code for US dollars is `USD`.
+
+ See [Currency](entity:Currency) for possible values.
+ See [Currency](#type-currency) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/nested_folder.py b/src/square/types/nested_folder.py
new file mode 100644
index 00000000..f7bd8775
--- /dev/null
+++ b/src/square/types/nested_folder.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class NestedFolder(UncheckedBaseModel):
+ name: str
+ members: typing.List[str]
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/oauth_authorization_revoked_event.py b/src/square/types/oauth_authorization_revoked_event.py
new file mode 100644
index 00000000..b4ee7d83
--- /dev/null
+++ b/src/square/types/oauth_authorization_revoked_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .oauth_authorization_revoked_event_data import OauthAuthorizationRevokedEventData
+
+
+class OauthAuthorizationRevokedEvent(UncheckedBaseModel):
+ """
+ Published when a merchant/application revokes all access tokens and refresh tokens granted to an application.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"oauth.authorization.revoked"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[OauthAuthorizationRevokedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/oauth_authorization_revoked_event_data.py b/src/square/types/oauth_authorization_revoked_event_data.py
new file mode 100644
index 00000000..2bbb1f19
--- /dev/null
+++ b/src/square/types/oauth_authorization_revoked_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .oauth_authorization_revoked_event_object import OauthAuthorizationRevokedEventObject
+
+
+class OauthAuthorizationRevokedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"revocation"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Not applicable, revocation is not an object
+ """
+
+ object: typing.Optional[OauthAuthorizationRevokedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing information about revocation event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/oauth_authorization_revoked_event_object.py b/src/square/types/oauth_authorization_revoked_event_object.py
new file mode 100644
index 00000000..887453f9
--- /dev/null
+++ b/src/square/types/oauth_authorization_revoked_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .oauth_authorization_revoked_event_revocation_object import OauthAuthorizationRevokedEventRevocationObject
+
+
+class OauthAuthorizationRevokedEventObject(UncheckedBaseModel):
+ revocation: typing.Optional[OauthAuthorizationRevokedEventRevocationObject] = pydantic.Field(default=None)
+ """
+ The revocation event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/oauth_authorization_revoked_event_revocation_object.py b/src/square/types/oauth_authorization_revoked_event_revocation_object.py
new file mode 100644
index 00000000..708ebeab
--- /dev/null
+++ b/src/square/types/oauth_authorization_revoked_event_revocation_object.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .oauth_authorization_revoked_event_revoker_type import OauthAuthorizationRevokedEventRevokerType
+
+
+class OauthAuthorizationRevokedEventRevocationObject(UncheckedBaseModel):
+ revoked_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the revocation event occurred, in RFC 3339 format.
+ """
+
+ revoker_type: typing.Optional[OauthAuthorizationRevokedEventRevokerType] = pydantic.Field(default=None)
+ """
+ Type of client that performed the revocation, either APPLICATION, MERCHANT, or SQUARE.
+ See [OauthAuthorizationRevokedEventRevokerType](#type-oauthauthorizationrevokedeventrevokertype) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/oauth_authorization_revoked_event_revoker_type.py b/src/square/types/oauth_authorization_revoked_event_revoker_type.py
new file mode 100644
index 00000000..006da788
--- /dev/null
+++ b/src/square/types/oauth_authorization_revoked_event_revoker_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OauthAuthorizationRevokedEventRevokerType = typing.Union[
+ typing.Literal["APPLICATION", "MERCHANT", "SQUARE"], typing.Any
+]
diff --git a/src/square/types/obtain_token_response.py b/src/square/types/obtain_token_response.py
new file mode 100644
index 00000000..0e40ba2f
--- /dev/null
+++ b/src/square/types/obtain_token_response.py
@@ -0,0 +1,104 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class ObtainTokenResponse(UncheckedBaseModel):
+ """
+ Represents an [ObtainToken](api-endpoint:OAuth-ObtainToken) response.
+ """
+
+ access_token: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An OAuth access token used to authorize Square API requests on behalf of the seller.
+ Include this token as a bearer token in the `Authorization` header of your API requests.
+
+ OAuth access tokens expire in 30 days (except `short_lived` access tokens). You should call
+ `ObtainToken` and provide the returned `refresh_token` to get a new access token well before
+ the current one expires. For more information, see [OAuth API: Walkthrough](https://developer.squareup.com/docs/oauth-api/walkthrough).
+ """
+
+ token_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of access token. This value is always `bearer`.
+ """
+
+ expires_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the authorizing [merchant](entity:Merchant) (seller), which represents a business.
+ """
+
+ subscription_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ __LEGACY__ The ID of merchant's subscription.
+ The ID is only present if the merchant signed up for a subscription plan during authorization.
+ """
+
+ plan_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ __LEGACY__ The ID of the subscription plan the merchant signed
+ up for. The ID is only present if the merchant signed up for a subscription plan during
+ authorization.
+ """
+
+ id_token: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The OpenID token that belongs to this person. This token is only present if the
+ `OPENID` scope is included in the authorization request.
+
+ Deprecated at version 2021-09-15. Square doesn't support OpenID or other single sign-on (SSO)
+ protocols on top of OAuth.
+ """
+
+ refresh_token: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A refresh token that can be used in an `ObtainToken` request to generate a new access token.
+
+ With the code flow:
+ - For the `authorization_code` grant type, the refresh token is multi-use and never expires.
+ - For the `refresh_token` grant type, the response returns the same refresh token.
+
+ With the PKCE flow:
+ - For the `authorization_code` grant type, the refresh token is single-use and expires in 90 days.
+ - For the `refresh_token` grant type, the refresh token is a new single-use refresh token that expires in 90 days.
+
+ For more information, see [Refresh, Revoke, and Limit the Scope of OAuth Tokens](https://developer.squareup.com/docs/oauth-api/refresh-revoke-limit-scope).
+ """
+
+ short_lived: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the access_token is short lived. If `true`, the access token expires
+ in 24 hours. If `false`, the access token expires in 30 days.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ refresh_token_expires_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the `refresh_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm)
+ format.
+
+ This field is only returned for the PKCE flow.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/offline_payment_details.py b/src/square/types/offline_payment_details.py
new file mode 100644
index 00000000..d540efc2
--- /dev/null
+++ b/src/square/types/offline_payment_details.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class OfflinePaymentDetails(UncheckedBaseModel):
+ """
+ Details specific to offline payments.
+ """
+
+ client_created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The client-side timestamp of when the offline payment was created, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order.py b/src/square/types/order.py
new file mode 100644
index 00000000..9f7e1902
--- /dev/null
+++ b/src/square/types/order.py
@@ -0,0 +1,267 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .fulfillment import Fulfillment
+from .money import Money
+from .order_line_item import OrderLineItem
+from .order_line_item_discount import OrderLineItemDiscount
+from .order_line_item_tax import OrderLineItemTax
+from .order_money_amounts import OrderMoneyAmounts
+from .order_pricing_options import OrderPricingOptions
+from .order_return import OrderReturn
+from .order_reward import OrderReward
+from .order_rounding_adjustment import OrderRoundingAdjustment
+from .order_service_charge import OrderServiceCharge
+from .order_source import OrderSource
+from .order_state import OrderState
+from .refund import Refund
+from .tender import Tender
+
+
+class Order(UncheckedBaseModel):
+ """
+ Contains all information related to a single order to process with Square,
+ including line items that specify the products to purchase. `Order` objects also
+ include information about any associated tenders, refunds, and returns.
+
+ All Connect V2 Transactions have all been converted to Orders including all associated
+ itemization data.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The order's unique ID.
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The ID of the seller location that this order is associated with.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A client-specified ID to associate an entity in another system
+ with this order.
+ """
+
+ source: typing.Optional[OrderSource] = pydantic.Field(default=None)
+ """
+ The latest source details of the order.
+
+ This field reflects the most recent source that interacted with or modified the order,
+ and may change during the order lifecycle. For example:
+ - An order created via API (source.name = "MyPOS") paid with Square Terminal may have
+ source updated to reflect the Terminal application (which uses REGISTER, like POS)
+ - An order updated or completed by a different application may have source updated
+ to reflect that application.
+
+ To preserve the original source from order creation regardless of subsequent updates,
+ use the `creation_source` field instead.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [customer](entity:Customer) associated with the order.
+
+ You should specify a `customer_id` on the order (or the payment) to ensure that transactions
+ are reliably linked to customers. Omitting this field might result in the creation of new
+ [instant profiles](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles).
+ """
+
+ line_items: typing.Optional[typing.List[OrderLineItem]] = pydantic.Field(default=None)
+ """
+ The line items included in the order.
+ """
+
+ taxes: typing.Optional[typing.List[OrderLineItemTax]] = pydantic.Field(default=None)
+ """
+ The list of all taxes associated with the order.
+
+ Taxes can be scoped to either `ORDER` or `LINE_ITEM`. For taxes with `LINE_ITEM` scope, an
+ `OrderLineItemAppliedTax` must be added to each line item that the tax applies to. For taxes
+ with `ORDER` scope, the server generates an `OrderLineItemAppliedTax` for every line item.
+
+ On reads, each tax in the list includes the total amount of that tax applied to the order.
+
+ __IMPORTANT__: If `LINE_ITEM` scope is set on any taxes in this field, using the deprecated
+ `line_items.taxes` field results in an error. Use `line_items.applied_taxes`
+ instead.
+ """
+
+ discounts: typing.Optional[typing.List[OrderLineItemDiscount]] = pydantic.Field(default=None)
+ """
+ The list of all discounts associated with the order.
+
+ Discounts can be scoped to either `ORDER` or `LINE_ITEM`. For discounts scoped to `LINE_ITEM`,
+ an `OrderLineItemAppliedDiscount` must be added to each line item that the discount applies to.
+ For discounts with `ORDER` scope, the server generates an `OrderLineItemAppliedDiscount`
+ for every line item.
+
+ __IMPORTANT__: If `LINE_ITEM` scope is set on any discounts in this field, using the deprecated
+ `line_items.discounts` field results in an error. Use `line_items.applied_discounts`
+ instead.
+ """
+
+ service_charges: typing.Optional[typing.List[OrderServiceCharge]] = pydantic.Field(default=None)
+ """
+ A list of service charges applied to the order.
+ """
+
+ fulfillments: typing.Optional[typing.List[Fulfillment]] = pydantic.Field(default=None)
+ """
+ Details about order fulfillment.
+
+ Orders can only be created with at most one fulfillment. However, orders returned
+ by the API might contain multiple fulfillments.
+ """
+
+ returns: typing.Optional[typing.List[OrderReturn]] = pydantic.Field(default=None)
+ """
+ A collection of items from sale orders being returned in this one. Normally part of an
+ itemized return or exchange. There is exactly one `Return` object per sale `Order` being
+ referenced.
+ """
+
+ return_amounts: typing.Optional[OrderMoneyAmounts] = pydantic.Field(default=None)
+ """
+ The rollup of the returned money amounts.
+ """
+
+ net_amounts: typing.Optional[OrderMoneyAmounts] = pydantic.Field(default=None)
+ """
+ The net money amounts (sale money - return money).
+ """
+
+ rounding_adjustment: typing.Optional[OrderRoundingAdjustment] = pydantic.Field(default=None)
+ """
+ A positive rounding adjustment to the total of the order. This adjustment is commonly
+ used to apply cash rounding when the minimum unit of account is smaller than the lowest physical
+ denomination of the currency.
+ """
+
+ tenders: typing.Optional[typing.List[Tender]] = pydantic.Field(default=None)
+ """
+ The tenders that were used to pay for the order.
+ """
+
+ refunds: typing.Optional[typing.List[Refund]] = pydantic.Field(default=None)
+ """
+ The refunds that are part of this order.
+ """
+
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
+ """
+ Application-defined data attached to this order. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ closed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the order reached a terminal [state](entity:OrderState), in RFC 3339 format (for example "2016-09-04T23:59:33.123Z").
+ """
+
+ state: typing.Optional[OrderState] = pydantic.Field(default=None)
+ """
+ The current state of the order.
+ See [OrderState](#type-orderstate) for possible values
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version number, which is incremented each time an update is committed to the order.
+ Orders not created through the API do not include a version number and
+ therefore cannot be updated.
+
+ [Read more about working with versions](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders).
+ """
+
+ total_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of money to collect for the order.
+ """
+
+ total_tax_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of tax money to collect for the order.
+ """
+
+ total_discount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of discount money to collect for the order.
+ """
+
+ total_tip_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of tip money to collect for the order.
+ """
+
+ total_service_charge_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of money collected in service charges for the order.
+
+ Note: `total_service_charge_money` is the sum of `applied_money` fields for each individual
+ service charge. Therefore, `total_service_charge_money` only includes inclusive tax amounts,
+ not additive tax amounts.
+ """
+
+ ticket_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A short-term identifier for the order (such as a customer first name,
+ table number, or auto-generated order number that resets daily).
+ """
+
+ pricing_options: typing.Optional[OrderPricingOptions] = pydantic.Field(default=None)
+ """
+ Pricing options for an order. The options affect how the order's price is calculated.
+ They can be used, for example, to apply automatic price adjustments that are based on
+ preconfigured [pricing rules](entity:CatalogPricingRule).
+ """
+
+ rewards: typing.Optional[typing.List[OrderReward]] = pydantic.Field(default=None)
+ """
+ A set-like list of Rewards that have been added to the Order.
+ """
+
+ net_amount_due_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The net amount of money due on the order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_card_surcharge_treatment_type.py b/src/square/types/order_card_surcharge_treatment_type.py
new file mode 100644
index 00000000..2fdc7367
--- /dev/null
+++ b/src/square/types/order_card_surcharge_treatment_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderCardSurchargeTreatmentType = typing.Union[
+ typing.Literal["LINE_ITEM_TREATMENT", "APPORTIONED_TREATMENT"], typing.Any
+]
diff --git a/src/square/types/order_created.py b/src/square/types/order_created.py
new file mode 100644
index 00000000..b2f150da
--- /dev/null
+++ b/src/square/types/order_created.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_state import OrderState
+
+
+class OrderCreated(UncheckedBaseModel):
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The order's unique ID.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version number, which is incremented each time an update is committed to the order.
+ Orders that were not created through the API do not include a version number and
+ therefore cannot be updated.
+
+ [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders)
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller location that this order is associated with.
+ """
+
+ state: typing.Optional[OrderState] = pydantic.Field(default=None)
+ """
+ The state of the order.
+ See [OrderState](#type-orderstate) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the order was created, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_created_event.py b/src/square/types/order_created_event.py
new file mode 100644
index 00000000..91f90902
--- /dev/null
+++ b/src/square/types/order_created_event.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_created_event_data import OrderCreatedEventData
+
+
+class OrderCreatedEvent(UncheckedBaseModel):
+ """
+ Published when an [Order](entity:Order) is created. This event is
+ triggered only by the [CreateOrder](api-endpoint:Orders-CreateOrder) endpoint call.
+
+ Creating an order in the Point of Sale app will **not** publish this event.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"order.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[OrderCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_created_event_data.py b/src/square/types/order_created_event_data.py
new file mode 100644
index 00000000..8cb8f95d
--- /dev/null
+++ b/src/square/types/order_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_created_object import OrderCreatedObject
+
+
+class OrderCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"order_created"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected order.
+ """
+
+ object: typing.Optional[OrderCreatedObject] = pydantic.Field(default=None)
+ """
+ An object containing information about the created Order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_created_object.py b/src/square/types/order_created_object.py
new file mode 100644
index 00000000..9000d583
--- /dev/null
+++ b/src/square/types/order_created_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_created import OrderCreated
+
+
+class OrderCreatedObject(UncheckedBaseModel):
+ order_created: typing.Optional[OrderCreated] = pydantic.Field(default=None)
+ """
+ Information about the created order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_custom_attribute_definition_owned_created_event.py b/src/square/types/order_custom_attribute_definition_owned_created_event.py
new file mode 100644
index 00000000..70629c40
--- /dev/null
+++ b/src/square/types/order_custom_attribute_definition_owned_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class OrderCustomAttributeDefinitionOwnedCreatedEvent(UncheckedBaseModel):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.owned.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_custom_attribute_definition_owned_deleted_event.py b/src/square/types/order_custom_attribute_definition_owned_deleted_event.py
new file mode 100644
index 00000000..4a74d2bf
--- /dev/null
+++ b/src/square/types/order_custom_attribute_definition_owned_deleted_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class OrderCustomAttributeDefinitionOwnedDeletedEvent(UncheckedBaseModel):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is deleted.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.owned.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_custom_attribute_definition_owned_updated_event.py b/src/square/types/order_custom_attribute_definition_owned_updated_event.py
new file mode 100644
index 00000000..b7fd94a8
--- /dev/null
+++ b/src/square/types/order_custom_attribute_definition_owned_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class OrderCustomAttributeDefinitionOwnedUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.owned.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_custom_attribute_definition_visible_created_event.py b/src/square/types/order_custom_attribute_definition_visible_created_event.py
new file mode 100644
index 00000000..9b04e378
--- /dev/null
+++ b/src/square/types/order_custom_attribute_definition_visible_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class OrderCustomAttributeDefinitionVisibleCreatedEvent(UncheckedBaseModel):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.visible.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_custom_attribute_definition_visible_deleted_event.py b/src/square/types/order_custom_attribute_definition_visible_deleted_event.py
new file mode 100644
index 00000000..36802ea7
--- /dev/null
+++ b/src/square/types/order_custom_attribute_definition_visible_deleted_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class OrderCustomAttributeDefinitionVisibleDeletedEvent(UncheckedBaseModel):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is deleted.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.visible.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_custom_attribute_definition_visible_updated_event.py b/src/square/types/order_custom_attribute_definition_visible_updated_event.py
new file mode 100644
index 00000000..d0a80f0c
--- /dev/null
+++ b/src/square/types/order_custom_attribute_definition_visible_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition_event_data import CustomAttributeDefinitionEventData
+
+
+class OrderCustomAttributeDefinitionVisibleUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"order.custom_attribute_definition.visible.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeDefinitionEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_custom_attribute_owned_deleted_event.py b/src/square/types/order_custom_attribute_owned_deleted_event.py
new file mode 100644
index 00000000..f6e9dcb4
--- /dev/null
+++ b/src/square/types/order_custom_attribute_owned_deleted_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class OrderCustomAttributeOwnedDeletedEvent(UncheckedBaseModel):
+ """
+ Published when an order [custom attribute](entity:CustomAttribute) associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is deleted.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"order.custom_attribute.owned.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_custom_attribute_owned_updated_event.py b/src/square/types/order_custom_attribute_owned_updated_event.py
new file mode 100644
index 00000000..395947fe
--- /dev/null
+++ b/src/square/types/order_custom_attribute_owned_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class OrderCustomAttributeOwnedUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when an order [custom attribute](entity:CustomAttribute) associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"order.custom_attribute.owned.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_custom_attribute_visible_deleted_event.py b/src/square/types/order_custom_attribute_visible_deleted_event.py
new file mode 100644
index 00000000..a2b550d7
--- /dev/null
+++ b/src/square/types/order_custom_attribute_visible_deleted_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class OrderCustomAttributeVisibleDeletedEvent(UncheckedBaseModel):
+ """
+ Published when an order [custom attribute](entity:CustomAttribute) that is visible to the subscribing app is deleted.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"order.custom_attribute.visible.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_custom_attribute_visible_updated_event.py b/src/square/types/order_custom_attribute_visible_updated_event.py
new file mode 100644
index 00000000..2156d81f
--- /dev/null
+++ b/src/square/types/order_custom_attribute_visible_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_event_data import CustomAttributeEventData
+
+
+class OrderCustomAttributeVisibleUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when an order [custom attribute](entity:CustomAttribute) that is visible to the subscribing app is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target seller associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"order.custom_attribute.visible.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[CustomAttributeEventData] = pydantic.Field(default=None)
+ """
+ The data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_entry.py b/src/square/types/order_entry.py
new file mode 100644
index 00000000..019e3fbf
--- /dev/null
+++ b/src/square/types/order_entry.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class OrderEntry(UncheckedBaseModel):
+ """
+ A lightweight description of an [order](entity:Order) that is returned when
+ `returned_entries` is `true` on a [SearchOrdersRequest](api-endpoint:Orders-SearchOrders).
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the order.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version number, which is incremented each time an update is committed to the order.
+ Orders that were not created through the API do not include a version number and
+ therefore cannot be updated.
+
+ [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders)
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The location ID the order belongs to.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_fulfillment_delivery_details_schedule_type.py b/src/square/types/order_fulfillment_delivery_details_schedule_type.py
new file mode 100644
index 00000000..b20abec7
--- /dev/null
+++ b/src/square/types/order_fulfillment_delivery_details_schedule_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderFulfillmentDeliveryDetailsScheduleType = typing.Union[typing.Literal["SCHEDULED", "ASAP"], typing.Any]
diff --git a/src/square/types/order_fulfillment_fulfillment_line_item_application.py b/src/square/types/order_fulfillment_fulfillment_line_item_application.py
new file mode 100644
index 00000000..67079457
--- /dev/null
+++ b/src/square/types/order_fulfillment_fulfillment_line_item_application.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderFulfillmentFulfillmentLineItemApplication = typing.Union[typing.Literal["ALL", "ENTRY_LIST"], typing.Any]
diff --git a/src/square/types/order_fulfillment_pickup_details_schedule_type.py b/src/square/types/order_fulfillment_pickup_details_schedule_type.py
new file mode 100644
index 00000000..e59cd4f1
--- /dev/null
+++ b/src/square/types/order_fulfillment_pickup_details_schedule_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderFulfillmentPickupDetailsScheduleType = typing.Union[typing.Literal["SCHEDULED", "ASAP"], typing.Any]
diff --git a/src/square/types/order_fulfillment_state.py b/src/square/types/order_fulfillment_state.py
new file mode 100644
index 00000000..6bc27bb1
--- /dev/null
+++ b/src/square/types/order_fulfillment_state.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderFulfillmentState = typing.Union[
+ typing.Literal["PROPOSED", "RESERVED", "PREPARED", "COMPLETED", "CANCELED", "FAILED"], typing.Any
+]
diff --git a/src/square/types/order_fulfillment_type.py b/src/square/types/order_fulfillment_type.py
new file mode 100644
index 00000000..dec7d729
--- /dev/null
+++ b/src/square/types/order_fulfillment_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderFulfillmentType = typing.Union[typing.Literal["PICKUP", "SHIPMENT", "DELIVERY"], typing.Any]
diff --git a/src/square/types/order_fulfillment_updated.py b/src/square/types/order_fulfillment_updated.py
new file mode 100644
index 00000000..3b5baa71
--- /dev/null
+++ b/src/square/types/order_fulfillment_updated.py
@@ -0,0 +1,60 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_fulfillment_updated_update import OrderFulfillmentUpdatedUpdate
+from .order_state import OrderState
+
+
+class OrderFulfillmentUpdated(UncheckedBaseModel):
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The order's unique ID.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version number, which is incremented each time an update is committed to the order.
+ Orders that were not created through the API do not include a version number and
+ therefore cannot be updated.
+
+ [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders)
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller location that this order is associated with.
+ """
+
+ state: typing.Optional[OrderState] = pydantic.Field(default=None)
+ """
+ The state of the order.
+ See [OrderState](#type-orderstate) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the order was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the order was last updated, in RFC 3339 format.
+ """
+
+ fulfillment_update: typing.Optional[typing.List[OrderFulfillmentUpdatedUpdate]] = pydantic.Field(default=None)
+ """
+ The fulfillments that were updated with this version change.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_fulfillment_updated_event.py b/src/square/types/order_fulfillment_updated_event.py
new file mode 100644
index 00000000..91f06f17
--- /dev/null
+++ b/src/square/types/order_fulfillment_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_fulfillment_updated_event_data import OrderFulfillmentUpdatedEventData
+
+
+class OrderFulfillmentUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when an [OrderFulfillment](entity:OrderFulfillment)
+ is created or updated. This event is triggered only by the
+ [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint call.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"order.fulfillment.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[OrderFulfillmentUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_fulfillment_updated_event_data.py b/src/square/types/order_fulfillment_updated_event_data.py
new file mode 100644
index 00000000..74c41418
--- /dev/null
+++ b/src/square/types/order_fulfillment_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_fulfillment_updated_object import OrderFulfillmentUpdatedObject
+
+
+class OrderFulfillmentUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"order_fulfillment_updated"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected order.
+ """
+
+ object: typing.Optional[OrderFulfillmentUpdatedObject] = pydantic.Field(default=None)
+ """
+ An object containing information about the updated Order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_fulfillment_updated_object.py b/src/square/types/order_fulfillment_updated_object.py
new file mode 100644
index 00000000..741b9060
--- /dev/null
+++ b/src/square/types/order_fulfillment_updated_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_fulfillment_updated import OrderFulfillmentUpdated
+
+
+class OrderFulfillmentUpdatedObject(UncheckedBaseModel):
+ order_fulfillment_updated: typing.Optional[OrderFulfillmentUpdated] = pydantic.Field(default=None)
+ """
+ Information about the updated order fulfillment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_fulfillment_updated_update.py b/src/square/types/order_fulfillment_updated_update.py
new file mode 100644
index 00000000..275b0642
--- /dev/null
+++ b/src/square/types/order_fulfillment_updated_update.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .fulfillment_state import FulfillmentState
+
+
+class OrderFulfillmentUpdatedUpdate(UncheckedBaseModel):
+ """
+ Information about fulfillment updates.
+ """
+
+ fulfillment_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the fulfillment only within this order.
+ """
+
+ old_state: typing.Optional[FulfillmentState] = pydantic.Field(default=None)
+ """
+ The state of the fulfillment before the change.
+ The state is not populated if the fulfillment is created with this new `Order` version.
+ """
+
+ new_state: typing.Optional[FulfillmentState] = pydantic.Field(default=None)
+ """
+ The state of the fulfillment after the change. The state might be equal to `old_state` if a non-state
+ field was changed on the fulfillment (such as the tracking number).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item.py b/src/square/types/order_line_item.py
new file mode 100644
index 00000000..9a13671b
--- /dev/null
+++ b/src/square/types/order_line_item.py
@@ -0,0 +1,205 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .order_line_item_applied_discount import OrderLineItemAppliedDiscount
+from .order_line_item_applied_service_charge import OrderLineItemAppliedServiceCharge
+from .order_line_item_applied_tax import OrderLineItemAppliedTax
+from .order_line_item_item_type import OrderLineItemItemType
+from .order_line_item_modifier import OrderLineItemModifier
+from .order_line_item_pricing_blocklists import OrderLineItemPricingBlocklists
+from .order_quantity_unit import OrderQuantityUnit
+
+
+class OrderLineItem(UncheckedBaseModel):
+ """
+ Represents a line item in an order. Each line item describes a different
+ product to purchase, with its own quantity and price details.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the line item only within this order.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the line item.
+ """
+
+ quantity: str = pydantic.Field()
+ """
+ The count, or measurement, of a line item being purchased:
+
+ If `quantity` is a whole number, and `quantity_unit` is not specified, then `quantity` denotes an item count. For example: `3` apples.
+
+ If `quantity` is a whole or decimal number, and `quantity_unit` is also specified, then `quantity` denotes a measurement. For example: `2.25` pounds of broccoli.
+
+ For more information, see [Specify item quantity and measurement unit](https://developer.squareup.com/docs/orders-api/create-orders#specify-item-quantity-and-measurement-unit).
+
+ Line items with a quantity of `0` are automatically removed
+ when paying for or otherwise completing the order.
+ """
+
+ quantity_unit: typing.Optional[OrderQuantityUnit] = pydantic.Field(default=None)
+ """
+ The measurement unit and decimal precision that this line item's quantity is measured in.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional note associated with the line item.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this line item.
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this line item references.
+ """
+
+ variation_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the variation applied to this line item.
+ """
+
+ item_type: typing.Optional[OrderLineItemItemType] = pydantic.Field(default=None)
+ """
+ The type of line item: an itemized sale, a non-itemized sale (custom amount), or the
+ activation or reloading of a gift card.
+ See [OrderLineItemItemType](#type-orderlineitemitemtype) for possible values
+ """
+
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
+ """
+ Application-defined data attached to this line item. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ modifiers: typing.Optional[typing.List[OrderLineItemModifier]] = pydantic.Field(default=None)
+ """
+ The [CatalogModifier](entity:CatalogModifier)s applied to this line item.
+ """
+
+ applied_taxes: typing.Optional[typing.List[OrderLineItemAppliedTax]] = pydantic.Field(default=None)
+ """
+ The list of references to taxes applied to this line item. Each
+ `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a
+ top-level `OrderLineItemTax` applied to the line item. On reads, the
+ amount applied is populated.
+
+ An `OrderLineItemAppliedTax` is automatically created on every line
+ item for all `ORDER` scoped taxes added to the order. `OrderLineItemAppliedTax`
+ records for `LINE_ITEM` scoped taxes must be added in requests for the tax
+ to apply to any line items.
+
+ To change the amount of a tax, modify the referenced top-level tax.
+ """
+
+ applied_discounts: typing.Optional[typing.List[OrderLineItemAppliedDiscount]] = pydantic.Field(default=None)
+ """
+ The list of references to discounts applied to this line item. Each
+ `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level
+ `OrderLineItemDiscounts` applied to the line item. On reads, the amount
+ applied is populated.
+
+ An `OrderLineItemAppliedDiscount` is automatically created on every line item for all
+ `ORDER` scoped discounts that are added to the order. `OrderLineItemAppliedDiscount` records
+ for `LINE_ITEM` scoped discounts must be added in requests for the discount to apply to any
+ line items.
+
+ To change the amount of a discount, modify the referenced top-level discount.
+ """
+
+ applied_service_charges: typing.Optional[typing.List[OrderLineItemAppliedServiceCharge]] = pydantic.Field(
+ default=None
+ )
+ """
+ The list of references to service charges applied to this line item. Each
+ `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a
+ top-level `OrderServiceCharge` applied to the line item. On reads, the amount applied is
+ populated.
+
+ To change the amount of a service charge, modify the referenced top-level service charge.
+ """
+
+ base_price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The base price for a single unit of the line item. Note - If inclusive tax is set on
+ this item it will be included in this value.
+ """
+
+ variation_total_price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total price of all item variations sold in this line item.
+ The price is calculated as `base_price_money` multiplied by `quantity`.
+ It does not include modifiers. Note - If inclusive tax is set on
+ this item it will be included in this value.
+ """
+
+ gross_sales_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money made in gross sales for this line item.
+ The amount is calculated as the sum of the variation's total price and each modifier's total price.
+ For inclusive tax items in the US, Canada, and Japan, tax is deducted from `gross_sales_money`. For Europe and
+ Australia, inclusive tax remains as part of the gross sale calculation.
+ """
+
+ total_tax_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of tax money to collect for the line item.
+ """
+
+ total_discount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of discount money to collect for the line item.
+ """
+
+ total_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of money to collect for this line item.
+ """
+
+ pricing_blocklists: typing.Optional[OrderLineItemPricingBlocklists] = pydantic.Field(default=None)
+ """
+ Describes pricing adjustments that are blocked from automatic
+ application to a line item. For more information, see
+ [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts).
+ """
+
+ total_service_charge_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of apportioned service charge money to collect for the line item.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_applied_discount.py b/src/square/types/order_line_item_applied_discount.py
new file mode 100644
index 00000000..62e88bfa
--- /dev/null
+++ b/src/square/types/order_line_item_applied_discount.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class OrderLineItemAppliedDiscount(UncheckedBaseModel):
+ """
+ Represents an applied portion of a discount to a line item in an order.
+
+ Order scoped discounts have automatically applied discounts present for each line item.
+ Line-item scoped discounts must have applied discounts added manually for any applicable line
+ items. The corresponding applied money is automatically computed based on participating
+ line items.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the applied discount only within this order.
+ """
+
+ discount_uid: str = pydantic.Field()
+ """
+ The `uid` of the discount that the applied discount represents. It must
+ reference a discount present in the `order.discounts` field.
+
+ This field is immutable. To change which discounts apply to a line item,
+ you must delete the discount and re-add it as a new `OrderLineItemAppliedDiscount`.
+ """
+
+ applied_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money applied by the discount to the line item.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_applied_service_charge.py b/src/square/types/order_line_item_applied_service_charge.py
new file mode 100644
index 00000000..bd263b31
--- /dev/null
+++ b/src/square/types/order_line_item_applied_service_charge.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class OrderLineItemAppliedServiceCharge(UncheckedBaseModel):
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the applied service charge only within this order.
+ """
+
+ service_charge_uid: str = pydantic.Field()
+ """
+ The `uid` of the service charge that the applied service charge represents. It must
+ reference a service charge present in the `order.service_charges` field.
+
+ This field is immutable. To change which service charges apply to a line item,
+ delete and add a new `OrderLineItemAppliedServiceCharge`.
+ """
+
+ applied_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money applied by the service charge to the line item.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_applied_tax.py b/src/square/types/order_line_item_applied_tax.py
new file mode 100644
index 00000000..bc6e10f7
--- /dev/null
+++ b/src/square/types/order_line_item_applied_tax.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class OrderLineItemAppliedTax(UncheckedBaseModel):
+ """
+ Represents an applied portion of a tax to a line item in an order.
+
+ Order-scoped taxes automatically include the applied taxes in each line item.
+ Line item taxes must be referenced from any applicable line items.
+ The corresponding applied money is automatically computed, based on the
+ set of participating line items.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the applied tax only within this order.
+ """
+
+ tax_uid: str = pydantic.Field()
+ """
+ The `uid` of the tax for which this applied tax represents. It must reference
+ a tax present in the `order.taxes` field.
+
+ This field is immutable. To change which taxes apply to a line item, delete and add a new
+ `OrderLineItemAppliedTax`.
+ """
+
+ applied_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money applied by the tax to the line item.
+ """
+
+ auto_applied: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the tax was automatically applied to the order based on
+ the catalog configuration. For an example, see
+ [Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_discount.py b/src/square/types/order_line_item_discount.py
new file mode 100644
index 00000000..44379f12
--- /dev/null
+++ b/src/square/types/order_line_item_discount.py
@@ -0,0 +1,135 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .order_line_item_discount_scope import OrderLineItemDiscountScope
+from .order_line_item_discount_type import OrderLineItemDiscountType
+
+
+class OrderLineItemDiscount(UncheckedBaseModel):
+ """
+ Represents a discount that applies to one or more line items in an
+ order.
+
+ Fixed-amount, order-scoped discounts are distributed across all non-zero line item totals.
+ The amount distributed to each line item is relative to the
+ amount contributed by the item to the order subtotal.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the discount only within this order.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount).
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this discount references.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The discount's name.
+ """
+
+ type: typing.Optional[OrderLineItemDiscountType] = pydantic.Field(default=None)
+ """
+ The type of the discount.
+
+ Discounts that do not reference a catalog object ID must have a type of
+ `FIXED_PERCENTAGE` or `FIXED_AMOUNT`.
+ See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values
+ """
+
+ percentage: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The percentage of the discount, as a string representation of a decimal number.
+ A value of `7.25` corresponds to a percentage of 7.25%.
+
+ `percentage` is not set for amount-based discounts.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total declared monetary amount of the discount.
+
+ `amount_money` is not set for percentage-based discounts.
+ """
+
+ applied_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of discount actually applied to the line item.
+
+ The amount represents the amount of money applied as a line-item scoped discount.
+ When an amount-based discount is scoped to the entire order, the value
+ of `applied_money` is different than `amount_money` because the total
+ amount of the discount is distributed across all line items.
+ """
+
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
+ """
+ Application-defined data attached to this discount. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ scope: typing.Optional[OrderLineItemDiscountScope] = pydantic.Field(default=None)
+ """
+ Indicates the level at which the discount applies. For `ORDER` scoped discounts,
+ Square generates references in `applied_discounts` on all order line items that do
+ not have them. For `LINE_ITEM` scoped discounts, the discount only applies to line items
+ with a discount reference in their `applied_discounts` field.
+
+ This field is immutable. To change the scope of a discount, you must delete
+ the discount and re-add it as a new discount.
+ See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values
+ """
+
+ reward_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The reward IDs corresponding to this discount. The application and
+ specification of discounts that have `reward_ids` are completely controlled by the backing
+ criteria corresponding to the reward tiers of the rewards that are added to the order
+ through the Loyalty API. To manually unapply discounts that are the result of added rewards,
+ the rewards must be removed from the order through the Loyalty API.
+ """
+
+ pricing_rule_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The object ID of a [pricing rule](entity:CatalogPricingRule) to be applied
+ automatically to this discount. The specification and application of the discounts, to
+ which a `pricing_rule_id` is assigned, are completely controlled by the corresponding
+ pricing rule.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_discount_scope.py b/src/square/types/order_line_item_discount_scope.py
new file mode 100644
index 00000000..35b65fd4
--- /dev/null
+++ b/src/square/types/order_line_item_discount_scope.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderLineItemDiscountScope = typing.Union[typing.Literal["OTHER_DISCOUNT_SCOPE", "LINE_ITEM", "ORDER"], typing.Any]
diff --git a/src/square/types/order_line_item_discount_type.py b/src/square/types/order_line_item_discount_type.py
new file mode 100644
index 00000000..ffb01f58
--- /dev/null
+++ b/src/square/types/order_line_item_discount_type.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderLineItemDiscountType = typing.Union[
+ typing.Literal["UNKNOWN_DISCOUNT", "FIXED_PERCENTAGE", "FIXED_AMOUNT", "VARIABLE_PERCENTAGE", "VARIABLE_AMOUNT"],
+ typing.Any,
+]
diff --git a/src/square/types/order_line_item_item_type.py b/src/square/types/order_line_item_item_type.py
new file mode 100644
index 00000000..9d5f019f
--- /dev/null
+++ b/src/square/types/order_line_item_item_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderLineItemItemType = typing.Union[typing.Literal["ITEM", "CUSTOM_AMOUNT", "GIFT_CARD"], typing.Any]
diff --git a/src/square/types/order_line_item_modifier.py b/src/square/types/order_line_item_modifier.py
new file mode 100644
index 00000000..04e72429
--- /dev/null
+++ b/src/square/types/order_line_item_modifier.py
@@ -0,0 +1,96 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class OrderLineItemModifier(UncheckedBaseModel):
+ """
+ A [CatalogModifier](entity:CatalogModifier).
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the modifier only within this order.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The catalog object ID referencing [CatalogModifier](entity:CatalogModifier).
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this modifier references.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the item modifier.
+ """
+
+ quantity: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The quantity of the line item modifier. The modifier quantity can be 0 or more.
+ For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders
+ this item, the restaurant records the purchase by creating an `Order` object with a line item
+ for a burger. The line item includes a line item modifier: the name is cheese and the quantity
+ is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses
+ the extra cheese option, the modifier quantity increases to 2. If the buyer does not want
+ any cheese, the modifier quantity is set to 0.
+ """
+
+ base_price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The base price for the modifier.
+
+ `base_price_money` is required for ad hoc modifiers.
+ If both `catalog_object_id` and `base_price_money` are set, `base_price_money` will
+ override the predefined [CatalogModifier](entity:CatalogModifier) price.
+ """
+
+ total_price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total price of the item modifier for its line item.
+ This is the modifier's `base_price_money` multiplied by the line item's quantity.
+ """
+
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
+ """
+ Application-defined data attached to this order. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ parent_modifier_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `uid` of the parent modifier, if this modifier is nested under another modifier.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_pricing_blocklists.py b/src/square/types/order_line_item_pricing_blocklists.py
new file mode 100644
index 00000000..29ce8dad
--- /dev/null
+++ b/src/square/types/order_line_item_pricing_blocklists.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_line_item_pricing_blocklists_blocked_discount import OrderLineItemPricingBlocklistsBlockedDiscount
+from .order_line_item_pricing_blocklists_blocked_service_charge import (
+ OrderLineItemPricingBlocklistsBlockedServiceCharge,
+)
+from .order_line_item_pricing_blocklists_blocked_tax import OrderLineItemPricingBlocklistsBlockedTax
+
+
+class OrderLineItemPricingBlocklists(UncheckedBaseModel):
+ """
+ Describes pricing adjustments that are blocked from automatic
+ application to a line item. For more information, see
+ [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts).
+ """
+
+ blocked_discounts: typing.Optional[typing.List[OrderLineItemPricingBlocklistsBlockedDiscount]] = pydantic.Field(
+ default=None
+ )
+ """
+ A list of discounts blocked from applying to the line item.
+ Discounts can be blocked by the `discount_uid` (for ad hoc discounts) or
+ the `discount_catalog_object_id` (for catalog discounts).
+ """
+
+ blocked_taxes: typing.Optional[typing.List[OrderLineItemPricingBlocklistsBlockedTax]] = pydantic.Field(default=None)
+ """
+ A list of taxes blocked from applying to the line item.
+ Taxes can be blocked by the `tax_uid` (for ad hoc taxes) or
+ the `tax_catalog_object_id` (for catalog taxes).
+ """
+
+ blocked_service_charges: typing.Optional[typing.List[OrderLineItemPricingBlocklistsBlockedServiceCharge]] = (
+ pydantic.Field(default=None)
+ )
+ """
+ A list of service charges blocked from applying to the line item.
+ Service charges can be blocked by the `service_charge_uid` (for ad hoc
+ service charges) or the `service_charge_catalog_object_id` (for catalog
+ service charges).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_pricing_blocklists_blocked_discount.py b/src/square/types/order_line_item_pricing_blocklists_blocked_discount.py
new file mode 100644
index 00000000..7bb099e7
--- /dev/null
+++ b/src/square/types/order_line_item_pricing_blocklists_blocked_discount.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class OrderLineItemPricingBlocklistsBlockedDiscount(UncheckedBaseModel):
+ """
+ A discount to block from applying to a line item. The discount must be
+ identified by either `discount_uid` or `discount_catalog_object_id`, but not both.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID of the `BlockedDiscount` within the order.
+ """
+
+ discount_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `uid` of the discount that should be blocked. Use this field to block
+ ad hoc discounts. For catalog discounts, use the `discount_catalog_object_id` field.
+ """
+
+ discount_catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `catalog_object_id` of the discount that should be blocked.
+ Use this field to block catalog discounts. For ad hoc discounts, use the
+ `discount_uid` field.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_pricing_blocklists_blocked_service_charge.py b/src/square/types/order_line_item_pricing_blocklists_blocked_service_charge.py
new file mode 100644
index 00000000..9d89a4ca
--- /dev/null
+++ b/src/square/types/order_line_item_pricing_blocklists_blocked_service_charge.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class OrderLineItemPricingBlocklistsBlockedServiceCharge(UncheckedBaseModel):
+ """
+ A service charge to block from applying to a line item. The service charge
+ must be identified by either `service_charge_uid` or
+ `service_charge_catalog_object_id`, but not both.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID of the `BlockedServiceCharge` within the order.
+ """
+
+ service_charge_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `uid` of the service charge that should be blocked. Use this field to
+ block ad hoc service charges. For catalog service charges, use the
+ `service_charge_catalog_object_id` field.
+ """
+
+ service_charge_catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `catalog_object_id` of the service charge that should be blocked.
+ Use this field to block catalog service charges. For ad hoc service charges,
+ use the `service_charge_uid` field.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_pricing_blocklists_blocked_tax.py b/src/square/types/order_line_item_pricing_blocklists_blocked_tax.py
new file mode 100644
index 00000000..8426582d
--- /dev/null
+++ b/src/square/types/order_line_item_pricing_blocklists_blocked_tax.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class OrderLineItemPricingBlocklistsBlockedTax(UncheckedBaseModel):
+ """
+ A tax to block from applying to a line item. The tax must be
+ identified by either `tax_uid` or `tax_catalog_object_id`, but not both.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID of the `BlockedTax` within the order.
+ """
+
+ tax_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `uid` of the tax that should be blocked. Use this field to block
+ ad hoc taxes. For catalog, taxes use the `tax_catalog_object_id` field.
+ """
+
+ tax_catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `catalog_object_id` of the tax that should be blocked.
+ Use this field to block catalog taxes. For ad hoc taxes, use the
+ `tax_uid` field.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_tax.py b/src/square/types/order_line_item_tax.py
new file mode 100644
index 00000000..3ded4046
--- /dev/null
+++ b/src/square/types/order_line_item_tax.py
@@ -0,0 +1,111 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .order_line_item_tax_scope import OrderLineItemTaxScope
+from .order_line_item_tax_type import OrderLineItemTaxType
+
+
+class OrderLineItemTax(UncheckedBaseModel):
+ """
+ Represents a tax that applies to one or more line item in the order.
+
+ Fixed-amount, order-scoped taxes are distributed across all non-zero line item totals.
+ The amount distributed to each line item is relative to the amount the item
+ contributes to the order subtotal.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the tax only within this order.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The catalog object ID referencing [CatalogTax](entity:CatalogTax).
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this tax references.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The tax's name.
+ """
+
+ type: typing.Optional[OrderLineItemTaxType] = pydantic.Field(default=None)
+ """
+ Indicates the calculation method used to apply the tax.
+ See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values
+ """
+
+ percentage: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The percentage of the tax, as a string representation of a decimal
+ number. For example, a value of `"7.25"` corresponds to a percentage of
+ 7.25%.
+ """
+
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
+ """
+ Application-defined data attached to this tax. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ applied_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money applied to the order by the tax.
+
+ - For percentage-based taxes, `applied_money` is the money
+ calculated using the percentage.
+ """
+
+ scope: typing.Optional[OrderLineItemTaxScope] = pydantic.Field(default=None)
+ """
+ Indicates the level at which the tax applies. For `ORDER` scoped taxes,
+ Square generates references in `applied_taxes` on all order line items that do
+ not have them. For `LINE_ITEM` scoped taxes, the tax only applies to line items
+ with references in their `applied_taxes` field.
+
+ This field is immutable. To change the scope, you must delete the tax and
+ re-add it as a new tax.
+ See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values
+ """
+
+ auto_applied: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Determines whether the tax was automatically applied to the order based on
+ the catalog configuration. For an example, see
+ [Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_line_item_tax_scope.py b/src/square/types/order_line_item_tax_scope.py
new file mode 100644
index 00000000..f3a94f31
--- /dev/null
+++ b/src/square/types/order_line_item_tax_scope.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderLineItemTaxScope = typing.Union[typing.Literal["OTHER_TAX_SCOPE", "LINE_ITEM", "ORDER"], typing.Any]
diff --git a/src/square/types/order_line_item_tax_type.py b/src/square/types/order_line_item_tax_type.py
new file mode 100644
index 00000000..e8bc46c7
--- /dev/null
+++ b/src/square/types/order_line_item_tax_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderLineItemTaxType = typing.Union[typing.Literal["UNKNOWN_TAX", "ADDITIVE", "INCLUSIVE"], typing.Any]
diff --git a/src/square/types/order_money_amounts.py b/src/square/types/order_money_amounts.py
new file mode 100644
index 00000000..dfc6ef72
--- /dev/null
+++ b/src/square/types/order_money_amounts.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class OrderMoneyAmounts(UncheckedBaseModel):
+ """
+ A collection of various money amounts.
+ """
+
+ total_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total money.
+ """
+
+ tax_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The money associated with taxes.
+ """
+
+ discount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The money associated with discounts.
+ """
+
+ tip_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The money associated with tips.
+ """
+
+ service_charge_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The money associated with service charges.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_pricing_options.py b/src/square/types/order_pricing_options.py
new file mode 100644
index 00000000..358a8acb
--- /dev/null
+++ b/src/square/types/order_pricing_options.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class OrderPricingOptions(UncheckedBaseModel):
+ """
+ Pricing options for an order. The options affect how the order's price is calculated.
+ They can be used, for example, to apply automatic price adjustments that are based on preconfigured
+ [pricing rules](entity:CatalogPricingRule).
+ """
+
+ auto_apply_discounts: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ The option to determine whether pricing rule-based
+ discounts are automatically applied to an order.
+ """
+
+ auto_apply_taxes: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ The option to determine whether rule-based taxes are automatically
+ applied to an order when the criteria of the corresponding rules are met.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_quantity_unit.py b/src/square/types/order_quantity_unit.py
new file mode 100644
index 00000000..55918d8b
--- /dev/null
+++ b/src/square/types/order_quantity_unit.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .measurement_unit import MeasurementUnit
+
+
+class OrderQuantityUnit(UncheckedBaseModel):
+ """
+ Contains the measurement unit for a quantity and a precision that
+ specifies the number of digits after the decimal point for decimal quantities.
+ """
+
+ measurement_unit: typing.Optional[MeasurementUnit] = pydantic.Field(default=None)
+ """
+ A [MeasurementUnit](entity:MeasurementUnit) that represents the
+ unit of measure for the quantity.
+ """
+
+ precision: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ For non-integer quantities, represents the number of digits after the decimal point that are
+ recorded for this quantity.
+
+ For example, a precision of 1 allows quantities such as `"1.0"` and `"1.1"`, but not `"1.01"`.
+
+ Min: 0. Max: 5.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The catalog object ID referencing the
+ [CatalogMeasurementUnit](entity:CatalogMeasurementUnit).
+
+ This field is set when this is a catalog-backed measurement unit.
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this measurement unit references.
+
+ This field is set when this is a catalog-backed measurement unit.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_return.py b/src/square/types/order_return.py
new file mode 100644
index 00000000..2a62a7d1
--- /dev/null
+++ b/src/square/types/order_return.py
@@ -0,0 +1,81 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_money_amounts import OrderMoneyAmounts
+from .order_return_discount import OrderReturnDiscount
+from .order_return_line_item import OrderReturnLineItem
+from .order_return_service_charge import OrderReturnServiceCharge
+from .order_return_tax import OrderReturnTax
+from .order_return_tip import OrderReturnTip
+from .order_rounding_adjustment import OrderRoundingAdjustment
+
+
+class OrderReturn(UncheckedBaseModel):
+ """
+ The set of line items, service charges, taxes, discounts, tips, and other items being returned in an order.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the return only within this order.
+ """
+
+ source_order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An order that contains the original sale of these return line items. This is unset
+ for unlinked returns.
+ """
+
+ return_line_items: typing.Optional[typing.List[OrderReturnLineItem]] = pydantic.Field(default=None)
+ """
+ A collection of line items that are being returned.
+ """
+
+ return_service_charges: typing.Optional[typing.List[OrderReturnServiceCharge]] = pydantic.Field(default=None)
+ """
+ A collection of service charges that are being returned.
+ """
+
+ return_taxes: typing.Optional[typing.List[OrderReturnTax]] = pydantic.Field(default=None)
+ """
+ A collection of references to taxes being returned for an order, including the total
+ applied tax amount to be returned. The taxes must reference a top-level tax ID from the source
+ order.
+ """
+
+ return_discounts: typing.Optional[typing.List[OrderReturnDiscount]] = pydantic.Field(default=None)
+ """
+ A collection of references to discounts being returned for an order, including the total
+ applied discount amount to be returned. The discounts must reference a top-level discount ID
+ from the source order.
+ """
+
+ return_tips: typing.Optional[typing.List[OrderReturnTip]] = pydantic.Field(default=None)
+ """
+ A collection of references to tips being returned for an order.
+ """
+
+ rounding_adjustment: typing.Optional[OrderRoundingAdjustment] = pydantic.Field(default=None)
+ """
+ A positive or negative rounding adjustment to the total value being returned. Adjustments are commonly
+ used to apply cash rounding when the minimum unit of the account is smaller than the lowest
+ physical denomination of the currency.
+ """
+
+ return_amounts: typing.Optional[OrderMoneyAmounts] = pydantic.Field(default=None)
+ """
+ An aggregate monetary value being returned by this return entry.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_return_discount.py b/src/square/types/order_return_discount.py
new file mode 100644
index 00000000..f2d1f703
--- /dev/null
+++ b/src/square/types/order_return_discount.py
@@ -0,0 +1,95 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .order_line_item_discount_scope import OrderLineItemDiscountScope
+from .order_line_item_discount_type import OrderLineItemDiscountType
+
+
+class OrderReturnDiscount(UncheckedBaseModel):
+ """
+ Represents a discount being returned that applies to one or more return line items in an
+ order.
+
+ Fixed-amount, order-scoped discounts are distributed across all non-zero return line item totals.
+ The amount distributed to each return line item is relative to that item’s contribution to the
+ order subtotal.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the returned discount only within this order.
+ """
+
+ source_discount_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The discount `uid` from the order that contains the original application of this discount.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount).
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this discount references.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The discount's name.
+ """
+
+ type: typing.Optional[OrderLineItemDiscountType] = pydantic.Field(default=None)
+ """
+ The type of the discount. If it is created by the API, it is `FIXED_PERCENTAGE` or `FIXED_AMOUNT`.
+
+ Discounts that do not reference a catalog object ID must have a type of
+ `FIXED_PERCENTAGE` or `FIXED_AMOUNT`.
+ See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values
+ """
+
+ percentage: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The percentage of the tax, as a string representation of a decimal number.
+ A value of `"7.25"` corresponds to a percentage of 7.25%.
+
+ `percentage` is not set for amount-based discounts.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total declared monetary amount of the discount.
+
+ `amount_money` is not set for percentage-based discounts.
+ """
+
+ applied_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of discount actually applied to this line item. When an amount-based
+ discount is at the order level, this value is different from `amount_money` because the discount
+ is distributed across the line items.
+ """
+
+ scope: typing.Optional[OrderLineItemDiscountScope] = pydantic.Field(default=None)
+ """
+ Indicates the level at which the `OrderReturnDiscount` applies. For `ORDER` scoped
+ discounts, the server generates references in `applied_discounts` on all
+ `OrderReturnLineItem`s. For `LINE_ITEM` scoped discounts, the discount is only applied to
+ `OrderReturnLineItem`s with references in their `applied_discounts` field.
+ See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_return_line_item.py b/src/square/types/order_return_line_item.py
new file mode 100644
index 00000000..d29033ba
--- /dev/null
+++ b/src/square/types/order_return_line_item.py
@@ -0,0 +1,153 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .order_line_item_applied_discount import OrderLineItemAppliedDiscount
+from .order_line_item_applied_service_charge import OrderLineItemAppliedServiceCharge
+from .order_line_item_applied_tax import OrderLineItemAppliedTax
+from .order_line_item_item_type import OrderLineItemItemType
+from .order_quantity_unit import OrderQuantityUnit
+from .order_return_line_item_modifier import OrderReturnLineItemModifier
+
+
+class OrderReturnLineItem(UncheckedBaseModel):
+ """
+ The line item being returned in an order.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for this return line-item entry.
+ """
+
+ source_line_item_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `uid` of the line item in the original sale order.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the line item.
+ """
+
+ quantity: str = pydantic.Field()
+ """
+ The quantity returned, formatted as a decimal number.
+ For example, `"3"`.
+
+ Line items with a `quantity_unit` can have non-integer quantities.
+ For example, `"1.70000"`.
+ """
+
+ quantity_unit: typing.Optional[OrderQuantityUnit] = pydantic.Field(default=None)
+ """
+ The unit and precision that this return line item's quantity is measured in.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The note of the return line item.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this return line item.
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this line item references.
+ """
+
+ variation_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the variation applied to this return line item.
+ """
+
+ item_type: typing.Optional[OrderLineItemItemType] = pydantic.Field(default=None)
+ """
+ The type of line item: an itemized return, a non-itemized return (custom amount),
+ or the return of an unactivated gift card sale.
+ See [OrderLineItemItemType](#type-orderlineitemitemtype) for possible values
+ """
+
+ return_modifiers: typing.Optional[typing.List[OrderReturnLineItemModifier]] = pydantic.Field(default=None)
+ """
+ The [CatalogModifier](entity:CatalogModifier)s applied to this line item.
+ """
+
+ applied_taxes: typing.Optional[typing.List[OrderLineItemAppliedTax]] = pydantic.Field(default=None)
+ """
+ The list of references to `OrderReturnTax` entities applied to the return line item. Each
+ `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level
+ `OrderReturnTax` applied to the return line item. On reads, the applied amount
+ is populated.
+ """
+
+ applied_discounts: typing.Optional[typing.List[OrderLineItemAppliedDiscount]] = pydantic.Field(default=None)
+ """
+ The list of references to `OrderReturnDiscount` entities applied to the return line item. Each
+ `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level
+ `OrderReturnDiscount` applied to the return line item. On reads, the applied amount
+ is populated.
+ """
+
+ base_price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The base price for a single unit of the line item.
+ """
+
+ variation_total_price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total price of all item variations returned in this line item.
+ The price is calculated as `base_price_money` multiplied by `quantity` and
+ does not include modifiers.
+ """
+
+ gross_return_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The gross return amount of money calculated as (item base price + modifiers price) * quantity.
+ """
+
+ total_tax_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of tax money to return for the line item.
+ """
+
+ total_discount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of discount money to return for the line item.
+ """
+
+ total_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of money to return for this line item.
+ """
+
+ applied_service_charges: typing.Optional[typing.List[OrderLineItemAppliedServiceCharge]] = pydantic.Field(
+ default=None
+ )
+ """
+ The list of references to `OrderReturnServiceCharge` entities applied to the return
+ line item. Each `OrderLineItemAppliedServiceCharge` has a `service_charge_uid` that
+ references the `uid` of a top-level `OrderReturnServiceCharge` applied to the return line
+ item. On reads, the applied amount is populated.
+ """
+
+ total_service_charge_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of apportioned service charge money to return for the line item.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_return_line_item_modifier.py b/src/square/types/order_return_line_item_modifier.py
new file mode 100644
index 00000000..e2c8d1ae
--- /dev/null
+++ b/src/square/types/order_return_line_item_modifier.py
@@ -0,0 +1,74 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class OrderReturnLineItemModifier(UncheckedBaseModel):
+ """
+ A line item modifier being returned.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the return modifier only within this order.
+ """
+
+ source_modifier_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The modifier `uid` from the order's line item that contains the
+ original sale of this line item modifier.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The catalog object ID referencing [CatalogModifier](entity:CatalogModifier).
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this line item modifier references.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the item modifier.
+ """
+
+ base_price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The base price for the modifier.
+
+ `base_price_money` is required for ad hoc modifiers.
+ If both `catalog_object_id` and `base_price_money` are set, `base_price_money` overrides the predefined [CatalogModifier](entity:CatalogModifier) price.
+ """
+
+ total_price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total price of the item modifier for its line item.
+ This is the modifier's `base_price_money` multiplied by the line item's quantity.
+ """
+
+ quantity: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The quantity of the line item modifier. The modifier quantity can be 0 or more.
+ For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders
+ this item, the restaurant records the purchase by creating an `Order` object with a line item
+ for a burger. The line item includes a line item modifier: the name is cheese and the quantity
+ is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses
+ the extra cheese option, the modifier quantity increases to 2. If the buyer does not want
+ any cheese, the modifier quantity is set to 0.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_return_service_charge.py b/src/square/types/order_return_service_charge.py
new file mode 100644
index 00000000..dccc6eaf
--- /dev/null
+++ b/src/square/types/order_return_service_charge.py
@@ -0,0 +1,140 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .order_line_item_applied_tax import OrderLineItemAppliedTax
+from .order_service_charge_calculation_phase import OrderServiceChargeCalculationPhase
+from .order_service_charge_scope import OrderServiceChargeScope
+from .order_service_charge_treatment_type import OrderServiceChargeTreatmentType
+from .order_service_charge_type import OrderServiceChargeType
+
+
+class OrderReturnServiceCharge(UncheckedBaseModel):
+ """
+ Represents the service charge applied to the original order.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the return service charge only within this order.
+ """
+
+ source_service_charge_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The service charge `uid` from the order containing the original
+ service charge. `source_service_charge_uid` is `null` for
+ unlinked returns.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the service charge.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The catalog object ID of the associated [OrderServiceCharge](entity:OrderServiceCharge).
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this service charge references.
+ """
+
+ percentage: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The percentage of the service charge, as a string representation of
+ a decimal number. For example, a value of `"7.25"` corresponds to a
+ percentage of 7.25%.
+
+ Either `percentage` or `amount_money` should be set, but not both.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of a non-percentage-based service charge.
+
+ Either `percentage` or `amount_money` should be set, but not both.
+ """
+
+ applied_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money applied to the order by the service charge, including
+ any inclusive tax amounts, as calculated by Square.
+
+ - For fixed-amount service charges, `applied_money` is equal to `amount_money`.
+ - For percentage-based service charges, `applied_money` is the money calculated using the percentage.
+ """
+
+ total_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of money to collect for the service charge.
+
+ __NOTE__: If an inclusive tax is applied to the service charge, `total_money`
+ does not equal `applied_money` plus `total_tax_money` because the inclusive
+ tax amount is already included in both `applied_money` and `total_tax_money`.
+ """
+
+ total_tax_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of tax money to collect for the service charge.
+ """
+
+ calculation_phase: typing.Optional[OrderServiceChargeCalculationPhase] = pydantic.Field(default=None)
+ """
+ The calculation phase after which to apply the service charge.
+ See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values
+ """
+
+ taxable: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the surcharge can be taxed. Service charges
+ calculated in the `TOTAL_PHASE` cannot be marked as taxable.
+ """
+
+ applied_taxes: typing.Optional[typing.List[OrderLineItemAppliedTax]] = pydantic.Field(default=None)
+ """
+ The list of references to `OrderReturnTax` entities applied to the
+ `OrderReturnServiceCharge`. Each `OrderLineItemAppliedTax` has a `tax_uid`
+ that references the `uid` of a top-level `OrderReturnTax` that is being
+ applied to the `OrderReturnServiceCharge`. On reads, the applied amount is
+ populated.
+ """
+
+ treatment_type: typing.Optional[OrderServiceChargeTreatmentType] = pydantic.Field(default=None)
+ """
+ Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item.
+ See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values
+ """
+
+ scope: typing.Optional[OrderServiceChargeScope] = pydantic.Field(default=None)
+ """
+ Indicates the level at which the apportioned service charge applies. For `ORDER`
+ scoped service charges, Square generates references in `applied_service_charges` on
+ all order line items that do not have them. For `LINE_ITEM` scoped service charges,
+ the service charge only applies to line items with a service charge reference in their
+ `applied_service_charges` field.
+
+ This field is immutable. To change the scope of an apportioned service charge, you must delete
+ the apportioned service charge and re-add it as a new apportioned service charge.
+ See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values
+ """
+
+ type: typing.Optional[OrderServiceChargeType] = pydantic.Field(default=None)
+ """
+ The type of the service charge.
+ See [OrderServiceChargeType](#type-orderservicechargetype) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_return_tax.py b/src/square/types/order_return_tax.py
new file mode 100644
index 00000000..e7643418
--- /dev/null
+++ b/src/square/types/order_return_tax.py
@@ -0,0 +1,80 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .order_line_item_tax_scope import OrderLineItemTaxScope
+from .order_line_item_tax_type import OrderLineItemTaxType
+
+
+class OrderReturnTax(UncheckedBaseModel):
+ """
+ Represents a tax being returned that applies to one or more return line items in an order.
+
+ Fixed-amount, order-scoped taxes are distributed across all non-zero return line item totals.
+ The amount distributed to each return line item is relative to that item’s contribution to the
+ order subtotal.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the returned tax only within this order.
+ """
+
+ source_tax_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The tax `uid` from the order that contains the original tax charge.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The catalog object ID referencing [CatalogTax](entity:CatalogTax).
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this tax references.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The tax's name.
+ """
+
+ type: typing.Optional[OrderLineItemTaxType] = pydantic.Field(default=None)
+ """
+ Indicates the calculation method used to apply the tax.
+ See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values
+ """
+
+ percentage: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The percentage of the tax, as a string representation of a decimal number.
+ For example, a value of `"7.25"` corresponds to a percentage of 7.25%.
+ """
+
+ applied_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money applied by the tax in an order.
+ """
+
+ scope: typing.Optional[OrderLineItemTaxScope] = pydantic.Field(default=None)
+ """
+ Indicates the level at which the `OrderReturnTax` applies. For `ORDER` scoped
+ taxes, Square generates references in `applied_taxes` on all
+ `OrderReturnLineItem`s. For `LINE_ITEM` scoped taxes, the tax is only applied to
+ `OrderReturnLineItem`s with references in their `applied_discounts` field.
+ See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_return_tip.py b/src/square/types/order_return_tip.py
new file mode 100644
index 00000000..6d053012
--- /dev/null
+++ b/src/square/types/order_return_tip.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class OrderReturnTip(UncheckedBaseModel):
+ """
+ A tip being returned.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the tip only within this order.
+ """
+
+ applied_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of tip being returned
+ --
+ """
+
+ source_tender_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The tender `uid` from the order that contains the original application of this tip.
+ """
+
+ source_tender_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The tender `id` from the order that contains the original application of this tip.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_reward.py b/src/square/types/order_reward.py
new file mode 100644
index 00000000..7647b317
--- /dev/null
+++ b/src/square/types/order_reward.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class OrderReward(UncheckedBaseModel):
+ """
+ Represents a reward that can be applied to an order if the necessary
+ reward tier criteria are met. Rewards are created through the Loyalty API.
+ """
+
+ id: str = pydantic.Field()
+ """
+ The identifier of the reward.
+ """
+
+ reward_tier_id: str = pydantic.Field()
+ """
+ The identifier of the reward tier corresponding to this reward.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_rounding_adjustment.py b/src/square/types/order_rounding_adjustment.py
new file mode 100644
index 00000000..7a06e979
--- /dev/null
+++ b/src/square/types/order_rounding_adjustment.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class OrderRoundingAdjustment(UncheckedBaseModel):
+ """
+ A rounding adjustment of the money being returned. Commonly used to apply cash rounding
+ when the minimum unit of the account is smaller than the lowest physical denomination of the currency.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the rounding adjustment only within this order.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the rounding adjustment from the original sale order.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The actual rounding adjustment amount.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_service_charge.py b/src/square/types/order_service_charge.py
new file mode 100644
index 00000000..fa5c5a58
--- /dev/null
+++ b/src/square/types/order_service_charge.py
@@ -0,0 +1,164 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .order_line_item_applied_tax import OrderLineItemAppliedTax
+from .order_service_charge_calculation_phase import OrderServiceChargeCalculationPhase
+from .order_service_charge_scope import OrderServiceChargeScope
+from .order_service_charge_treatment_type import OrderServiceChargeTreatmentType
+from .order_service_charge_type import OrderServiceChargeType
+
+
+class OrderServiceCharge(UncheckedBaseModel):
+ """
+ Represents a service charge applied to an order.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID that identifies the service charge only within this order.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the service charge. This is unused and null for AUTO_GRATUITY to match the behavior on Bills.
+ """
+
+ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The catalog object ID referencing the service charge [CatalogObject](entity:CatalogObject).
+ """
+
+ catalog_version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the catalog object that this service charge references.
+ """
+
+ percentage: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The service charge percentage as a string representation of a
+ decimal number. For example, `"7.25"` indicates a service charge of 7.25%.
+
+ Exactly 1 of `percentage` or `amount_money` should be set.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of a non-percentage-based service charge.
+
+ Exactly one of `percentage` or `amount_money` should be set.
+ """
+
+ applied_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money applied to the order by the service charge,
+ including any inclusive tax amounts, as calculated by Square.
+
+ - For fixed-amount service charges, `applied_money` is equal to `amount_money`.
+ - For percentage-based service charges, `applied_money` is the money
+ calculated using the percentage.
+ """
+
+ total_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of money to collect for the service charge.
+
+ __Note__: If an inclusive tax is applied to the service charge,
+ `total_money` does not equal `applied_money` plus `total_tax_money`
+ because the inclusive tax amount is already included in both
+ `applied_money` and `total_tax_money`.
+ """
+
+ total_tax_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of tax money to collect for the service charge.
+ """
+
+ calculation_phase: typing.Optional[OrderServiceChargeCalculationPhase] = pydantic.Field(default=None)
+ """
+ The calculation phase at which to apply the service charge.
+ See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values
+ """
+
+ taxable: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the service charge can be taxed. If set to `true`,
+ order-level taxes automatically apply to the service charge. Note that
+ service charges calculated in the `TOTAL_PHASE` cannot be marked as taxable.
+ """
+
+ applied_taxes: typing.Optional[typing.List[OrderLineItemAppliedTax]] = pydantic.Field(default=None)
+ """
+ The list of references to the taxes applied to this service charge. Each
+ `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level
+ `OrderLineItemTax` that is being applied to this service charge. On reads, the amount applied
+ is populated.
+
+ An `OrderLineItemAppliedTax` is automatically created on every taxable service charge
+ for all `ORDER` scoped taxes that are added to the order. `OrderLineItemAppliedTax` records
+ for `LINE_ITEM` scoped taxes must be added in requests for the tax to apply to any taxable
+ service charge. Taxable service charges have the `taxable` field set to `true` and calculated
+ in the `SUBTOTAL_PHASE`.
+
+ To change the amount of a tax, modify the referenced top-level tax.
+ """
+
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
+ """
+ Application-defined data attached to this service charge. Metadata fields are intended
+ to store descriptive references or associations with an entity in another system or store brief
+ information about the object. Square does not process this field; it only stores and returns it
+ in relevant API calls. Do not use metadata to store any sensitive information (such as personally
+ identifiable information or card details).
+
+ Keys written by applications must be 60 characters or less and must be in the character set
+ `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
+ with a namespace, separated from the key with a ':' character.
+
+ Values have a maximum length of 255 characters.
+
+ An application can have up to 10 entries per metadata field.
+
+ Entries written by applications are private and can only be read or modified by the same
+ application.
+
+ For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
+ """
+
+ type: typing.Optional[OrderServiceChargeType] = pydantic.Field(default=None)
+ """
+ The type of the service charge.
+ See [OrderServiceChargeType](#type-orderservicechargetype) for possible values
+ """
+
+ treatment_type: typing.Optional[OrderServiceChargeTreatmentType] = pydantic.Field(default=None)
+ """
+ Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item.
+ See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values
+ """
+
+ scope: typing.Optional[OrderServiceChargeScope] = pydantic.Field(default=None)
+ """
+ Indicates the level at which the apportioned service charge applies. For `ORDER`
+ scoped service charges, Square generates references in `applied_service_charges` on
+ all order line items that do not have them. For `LINE_ITEM` scoped service charges,
+ the service charge only applies to line items with a service charge reference in their
+ `applied_service_charges` field.
+
+ This field is immutable. To change the scope of an apportioned service charge, you must delete
+ the apportioned service charge and re-add it as a new apportioned service charge.
+ See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_service_charge_calculation_phase.py b/src/square/types/order_service_charge_calculation_phase.py
new file mode 100644
index 00000000..b5a1f2f4
--- /dev/null
+++ b/src/square/types/order_service_charge_calculation_phase.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderServiceChargeCalculationPhase = typing.Union[
+ typing.Literal["SUBTOTAL_PHASE", "TOTAL_PHASE", "APPORTIONED_PERCENTAGE_PHASE", "APPORTIONED_AMOUNT_PHASE"],
+ typing.Any,
+]
diff --git a/src/square/types/order_service_charge_scope.py b/src/square/types/order_service_charge_scope.py
new file mode 100644
index 00000000..4911786e
--- /dev/null
+++ b/src/square/types/order_service_charge_scope.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderServiceChargeScope = typing.Union[typing.Literal["OTHER_SERVICE_CHARGE_SCOPE", "LINE_ITEM", "ORDER"], typing.Any]
diff --git a/src/square/types/order_service_charge_treatment_type.py b/src/square/types/order_service_charge_treatment_type.py
new file mode 100644
index 00000000..e23dcff8
--- /dev/null
+++ b/src/square/types/order_service_charge_treatment_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderServiceChargeTreatmentType = typing.Union[
+ typing.Literal["LINE_ITEM_TREATMENT", "APPORTIONED_TREATMENT"], typing.Any
+]
diff --git a/src/square/types/order_service_charge_type.py b/src/square/types/order_service_charge_type.py
new file mode 100644
index 00000000..ef0f612b
--- /dev/null
+++ b/src/square/types/order_service_charge_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderServiceChargeType = typing.Union[typing.Literal["AUTO_GRATUITY", "CUSTOM"], typing.Any]
diff --git a/src/square/types/order_source.py b/src/square/types/order_source.py
new file mode 100644
index 00000000..10ff98a1
--- /dev/null
+++ b/src/square/types/order_source.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class OrderSource(UncheckedBaseModel):
+ """
+ Represents the origination details of an order.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name used to identify the place (physical or digital) that an order originates.
+ If unset, the name defaults to the name of the application that created the order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_state.py b/src/square/types/order_state.py
new file mode 100644
index 00000000..075eab08
--- /dev/null
+++ b/src/square/types/order_state.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+OrderState = typing.Union[typing.Literal["OPEN", "COMPLETED", "CANCELED", "DRAFT"], typing.Any]
diff --git a/src/square/types/order_updated.py b/src/square/types/order_updated.py
new file mode 100644
index 00000000..23b8870c
--- /dev/null
+++ b/src/square/types/order_updated.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_state import OrderState
+
+
+class OrderUpdated(UncheckedBaseModel):
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The order's unique ID.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version number, which is incremented each time an update is committed to the order.
+ Orders that were not created through the API do not include a version number and
+ therefore cannot be updated.
+
+ [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders)
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the seller location that this order is associated with.
+ """
+
+ state: typing.Optional[OrderState] = pydantic.Field(default=None)
+ """
+ The state of the order.
+ See [OrderState](#type-orderstate) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the order was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the order was last updated, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_updated_event.py b/src/square/types/order_updated_event.py
new file mode 100644
index 00000000..9747299c
--- /dev/null
+++ b/src/square/types/order_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_updated_event_data import OrderUpdatedEventData
+
+
+class OrderUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when an [Order](entity:Order) is updated. This
+ event is triggered by the [UpdateOrder](api-endpoint:Orders-UpdateOrder)
+ endpoint call, Order Manager, or the Square Dashboard.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"order.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[OrderUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_updated_event_data.py b/src/square/types/order_updated_event_data.py
new file mode 100644
index 00000000..eff47378
--- /dev/null
+++ b/src/square/types/order_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_updated_object import OrderUpdatedObject
+
+
+class OrderUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"order_updated"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected order.
+ """
+
+ object: typing.Optional[OrderUpdatedObject] = pydantic.Field(default=None)
+ """
+ An object containing information about the updated Order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/order_updated_object.py b/src/square/types/order_updated_object.py
new file mode 100644
index 00000000..f828b8ea
--- /dev/null
+++ b/src/square/types/order_updated_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_updated import OrderUpdated
+
+
+class OrderUpdatedObject(UncheckedBaseModel):
+ order_updated: typing.Optional[OrderUpdated] = pydantic.Field(default=None)
+ """
+ Information about the updated order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/pause_subscription_response.py b/src/square/types/pause_subscription_response.py
new file mode 100644
index 00000000..629dd902
--- /dev/null
+++ b/src/square/types/pause_subscription_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription import Subscription
+from .subscription_action import SubscriptionAction
+
+
+class PauseSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response from the
+ [PauseSubscription](api-endpoint:Subscriptions-PauseSubscription) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The subscription to be paused by the scheduled `PAUSE` action.
+ """
+
+ actions: typing.Optional[typing.List[SubscriptionAction]] = pydantic.Field(default=None)
+ """
+ The list of a `PAUSE` action and a possible `RESUME` action created by the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/pay_order_response.py b/src/square/types/pay_order_response.py
new file mode 100644
index 00000000..a843bf2f
--- /dev/null
+++ b/src/square/types/pay_order_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .order import Order
+
+
+class PayOrderResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of a request to the
+ [PayOrder](api-endpoint:Orders-PayOrder) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ order: typing.Optional[Order] = pydantic.Field(default=None)
+ """
+ The paid, updated [order](entity:Order).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment.py b/src/square/types/payment.py
new file mode 100644
index 00000000..a24ca34f
--- /dev/null
+++ b/src/square/types/payment.py
@@ -0,0 +1,352 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .application_details import ApplicationDetails
+from .bank_account_payment_details import BankAccountPaymentDetails
+from .buy_now_pay_later_details import BuyNowPayLaterDetails
+from .card_payment_details import CardPaymentDetails
+from .cash_payment_details import CashPaymentDetails
+from .device_details import DeviceDetails
+from .digital_wallet_details import DigitalWalletDetails
+from .electronic_money_details import ElectronicMoneyDetails
+from .external_payment_details import ExternalPaymentDetails
+from .money import Money
+from .offline_payment_details import OfflinePaymentDetails
+from .processing_fee import ProcessingFee
+from .risk_evaluation import RiskEvaluation
+from .square_account_details import SquareAccountDetails
+
+
+class Payment(UncheckedBaseModel):
+ """
+ Represents a payment processed by the Square API.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the payment.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the payment was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the payment was last updated, in RFC 3339 format.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount processed for this payment, not including `tip_money`.
+
+ The amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+ """
+
+ tip_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount designated as a tip for the seller's staff.
+
+ Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.
+
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+ """
+
+ total_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount for the payment, including `amount_money` and `tip_money`.
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+ """
+
+ app_fee_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount the developer is taking as a fee for facilitating the payment on behalf
+ of the seller. This amount is specified in the smallest denomination of the applicable currency
+ (for example, US dollar amounts are specified in cents). For more information,
+ see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ The amount cannot be more than 90% of the `total_money` value.
+
+ To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
+ For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+ """
+
+ app_fee_allocations: typing.Optional[typing.List[typing.Any]] = pydantic.Field(default=None)
+ """
+ Details pertaining to recipients of the application fee.
+ """
+
+ approved_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money approved for this payment. This value may change if Square chooses to
+ obtain reauthorization as part of a call to [UpdatePayment](api-endpoint:Payments-UpdatePayment).
+ """
+
+ processing_fee: typing.Optional[typing.List[ProcessingFee]] = pydantic.Field(default=None)
+ """
+ The processing fees and fee adjustments assessed by Square for this payment.
+ """
+
+ refunded_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of the payment refunded to date.
+
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents).
+ """
+
+ status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Indicates whether the payment is APPROVED, PENDING, COMPLETED, CANCELED, or FAILED.
+ """
+
+ delay_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The duration of time after the payment's creation when Square automatically applies the
+ `delay_action` to the payment. This automatic `delay_action` applies only to payments that
+ do not reach a terminal state (COMPLETED, CANCELED, or FAILED) before the `delay_duration`
+ time period.
+
+ This field is specified as a time duration, in RFC 3339 format.
+
+ Notes:
+ This feature is only supported for card payments.
+
+ Default:
+
+ - Card-present payments: "PT36H" (36 hours) from the creation time.
+ - Card-not-present payments: "P7D" (7 days) from the creation time.
+ """
+
+ delay_action: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The action to be applied to the payment when the `delay_duration` has elapsed.
+
+ Current values include `CANCEL` and `COMPLETE`.
+ """
+
+ delayed_until: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The read-only timestamp of when the `delay_action` is automatically applied,
+ in RFC 3339 format.
+
+ Note that this field is calculated by summing the payment's `delay_duration` and `created_at`
+ fields. The `created_at` field is generated by Square and might not exactly match the
+ time on your local machine.
+ """
+
+ source_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The source type for this payment.
+
+ Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `SQUARE_ACCOUNT`,
+ `CASH` and `EXTERNAL`. For information about these payment source types,
+ see [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
+ """
+
+ card_details: typing.Optional[CardPaymentDetails] = pydantic.Field(default=None)
+ """
+ Details about a card payment. These details are only populated if the source_type is `CARD`.
+ """
+
+ cash_details: typing.Optional[CashPaymentDetails] = pydantic.Field(default=None)
+ """
+ Details about a cash payment. These details are only populated if the source_type is `CASH`.
+ """
+
+ bank_account_details: typing.Optional[BankAccountPaymentDetails] = pydantic.Field(default=None)
+ """
+ Details about a bank account payment. These details are only populated if the source_type is `BANK_ACCOUNT`.
+ """
+
+ electronic_money_details: typing.Optional[ElectronicMoneyDetails] = pydantic.Field(default=None)
+ """
+ Details specific to electronic money payments.
+ """
+
+ external_details: typing.Optional[ExternalPaymentDetails] = pydantic.Field(default=None)
+ """
+ Details about an external payment. The details are only populated
+ if the `source_type` is `EXTERNAL`.
+ """
+
+ wallet_details: typing.Optional[DigitalWalletDetails] = pydantic.Field(default=None)
+ """
+ Details about an wallet payment. The details are only populated
+ if the `source_type` is `WALLET`.
+ """
+
+ buy_now_pay_later_details: typing.Optional[BuyNowPayLaterDetails] = pydantic.Field(default=None)
+ """
+ Details about a Buy Now Pay Later payment. The details are only populated
+ if the `source_type` is `BUY_NOW_PAY_LATER`. For more information, see
+ [Afterpay Payments](https://developer.squareup.com/docs/payments-api/take-payments/afterpay-payments).
+ """
+
+ square_account_details: typing.Optional[SquareAccountDetails] = pydantic.Field(default=None)
+ """
+ Details about a Square Account payment. The details are only populated
+ if the `source_type` is `SQUARE_ACCOUNT`.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location associated with the payment.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the order associated with the payment.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional ID that associates the payment with an entity in
+ another system.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the customer associated with the payment. If the ID is
+ not provided in the `CreatePayment` request that was used to create the `Payment`,
+ Square may use information in the request
+ (such as the billing and shipping address, email address, and payment source)
+ to identify a matching customer profile in the Customer Directory.
+ If found, the profile ID is used. If a profile is not found, the
+ API attempts to create an
+ [instant profile](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles).
+ If the API cannot create an
+ instant profile (either because the seller has disabled it or the
+ seller's region prevents creating it), this field remains unset. Note that
+ this process is asynchronous and it may take some time before a
+ customer ID is added to the payment.
+ """
+
+ employee_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ __Deprecated__: Use `Payment.team_member_id` instead.
+
+ An optional ID of the employee associated with taking the payment.
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional ID of the [TeamMember](entity:TeamMember) associated with taking the payment.
+ """
+
+ refund_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of `refund_id`s identifying refunds for the payment.
+ """
+
+ risk_evaluation: typing.Optional[RiskEvaluation] = pydantic.Field(default=None)
+ """
+ Provides information about the risk associated with the payment, as determined by Square.
+ This field is present for payments to sellers that have opted in to receive risk
+ evaluations.
+ """
+
+ terminal_checkout_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional ID for a Terminal checkout that is associated with the payment.
+ """
+
+ buyer_email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The buyer's email address.
+ """
+
+ billing_address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The buyer's billing address.
+ """
+
+ shipping_address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The buyer's shipping address.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional note to include when creating a payment.
+ """
+
+ statement_description_identifier: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Additional payment information that gets added to the customer's card statement
+ as part of the statement description.
+
+ Note that the `statement_description_identifier` might get truncated on the statement description
+ to fit the required information including the Square identifier (SQ *) and the name of the
+ seller taking the payment.
+ """
+
+ capabilities: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Actions that can be performed on this payment:
+ - `EDIT_AMOUNT_UP` - The payment amount can be edited up.
+ - `EDIT_AMOUNT_DOWN` - The payment amount can be edited down.
+ - `EDIT_TIP_AMOUNT_UP` - The tip amount can be edited up.
+ - `EDIT_TIP_AMOUNT_DOWN` - The tip amount can be edited down.
+ - `EDIT_DELAY_ACTION` - The delay_action can be edited.
+ """
+
+ receipt_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The payment's receipt number.
+ The field is missing if a payment is canceled.
+ """
+
+ receipt_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL for the payment's receipt.
+ The field is only populated for COMPLETED payments.
+ """
+
+ device_details: typing.Optional[DeviceDetails] = pydantic.Field(default=None)
+ """
+ Details about the device that took the payment.
+ """
+
+ application_details: typing.Optional[ApplicationDetails] = pydantic.Field(default=None)
+ """
+ Details about the application that took the payment.
+ """
+
+ buyer_currency_exchange: typing.Optional[typing.Any] = None
+ is_offline_payment: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether or not this payment was taken offline.
+ """
+
+ offline_payment_details: typing.Optional[OfflinePaymentDetails] = pydantic.Field(default=None)
+ """
+ Additional information about the payment if it was taken offline.
+ """
+
+ version_token: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Used for optimistic concurrency. This opaque token identifies a specific version of the
+ `Payment` object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_app_fee_refund_detail.py b/src/square/types/payment_balance_activity_app_fee_refund_detail.py
new file mode 100644
index 00000000..5c3d7263
--- /dev/null
+++ b/src/square/types/payment_balance_activity_app_fee_refund_detail.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityAppFeeRefundDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ refund_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the refund associated with this activity.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location of the merchant associated with the payment refund activity
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_app_fee_revenue_detail.py b/src/square/types/payment_balance_activity_app_fee_revenue_detail.py
new file mode 100644
index 00000000..a9837c88
--- /dev/null
+++ b/src/square/types/payment_balance_activity_app_fee_revenue_detail.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityAppFeeRevenueDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location of the merchant associated with the payment activity
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_automatic_savings_detail.py b/src/square/types/payment_balance_activity_automatic_savings_detail.py
new file mode 100644
index 00000000..194e28a5
--- /dev/null
+++ b/src/square/types/payment_balance_activity_automatic_savings_detail.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityAutomaticSavingsDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ payout_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payout associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_automatic_savings_reversed_detail.py b/src/square/types/payment_balance_activity_automatic_savings_reversed_detail.py
new file mode 100644
index 00000000..7dd72efb
--- /dev/null
+++ b/src/square/types/payment_balance_activity_automatic_savings_reversed_detail.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityAutomaticSavingsReversedDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ payout_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payout associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_charge_detail.py b/src/square/types/payment_balance_activity_charge_detail.py
new file mode 100644
index 00000000..68f4eb03
--- /dev/null
+++ b/src/square/types/payment_balance_activity_charge_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityChargeDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_deposit_fee_detail.py b/src/square/types/payment_balance_activity_deposit_fee_detail.py
new file mode 100644
index 00000000..e5512efd
--- /dev/null
+++ b/src/square/types/payment_balance_activity_deposit_fee_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityDepositFeeDetail(UncheckedBaseModel):
+ payout_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payout that triggered this deposit fee activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_deposit_fee_reversed_detail.py b/src/square/types/payment_balance_activity_deposit_fee_reversed_detail.py
new file mode 100644
index 00000000..fe0862be
--- /dev/null
+++ b/src/square/types/payment_balance_activity_deposit_fee_reversed_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityDepositFeeReversedDetail(UncheckedBaseModel):
+ payout_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payout that triggered this deposit fee activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_dispute_detail.py b/src/square/types/payment_balance_activity_dispute_detail.py
new file mode 100644
index 00000000..76d9d5cd
--- /dev/null
+++ b/src/square/types/payment_balance_activity_dispute_detail.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityDisputeDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ dispute_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the dispute associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_fee_detail.py b/src/square/types/payment_balance_activity_fee_detail.py
new file mode 100644
index 00000000..021ce622
--- /dev/null
+++ b/src/square/types/payment_balance_activity_fee_detail.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityFeeDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity
+ This will only be populated when a principal LedgerEntryToken is also populated.
+ If the fee is independent (there is no principal LedgerEntryToken) then this will likely not
+ be populated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_free_processing_detail.py b/src/square/types/payment_balance_activity_free_processing_detail.py
new file mode 100644
index 00000000..ae7bf838
--- /dev/null
+++ b/src/square/types/payment_balance_activity_free_processing_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityFreeProcessingDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_hold_adjustment_detail.py b/src/square/types/payment_balance_activity_hold_adjustment_detail.py
new file mode 100644
index 00000000..d338e95b
--- /dev/null
+++ b/src/square/types/payment_balance_activity_hold_adjustment_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityHoldAdjustmentDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_open_dispute_detail.py b/src/square/types/payment_balance_activity_open_dispute_detail.py
new file mode 100644
index 00000000..7ebc669c
--- /dev/null
+++ b/src/square/types/payment_balance_activity_open_dispute_detail.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityOpenDisputeDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ dispute_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the dispute associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_other_adjustment_detail.py b/src/square/types/payment_balance_activity_other_adjustment_detail.py
new file mode 100644
index 00000000..c7467d04
--- /dev/null
+++ b/src/square/types/payment_balance_activity_other_adjustment_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityOtherAdjustmentDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_other_detail.py b/src/square/types/payment_balance_activity_other_detail.py
new file mode 100644
index 00000000..f10f0494
--- /dev/null
+++ b/src/square/types/payment_balance_activity_other_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityOtherDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_refund_detail.py b/src/square/types/payment_balance_activity_refund_detail.py
new file mode 100644
index 00000000..808111c8
--- /dev/null
+++ b/src/square/types/payment_balance_activity_refund_detail.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityRefundDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ refund_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the refund associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_release_adjustment_detail.py b/src/square/types/payment_balance_activity_release_adjustment_detail.py
new file mode 100644
index 00000000..0b9b61a2
--- /dev/null
+++ b/src/square/types/payment_balance_activity_release_adjustment_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityReleaseAdjustmentDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_reserve_hold_detail.py b/src/square/types/payment_balance_activity_reserve_hold_detail.py
new file mode 100644
index 00000000..12be4de0
--- /dev/null
+++ b/src/square/types/payment_balance_activity_reserve_hold_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityReserveHoldDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_reserve_release_detail.py b/src/square/types/payment_balance_activity_reserve_release_detail.py
new file mode 100644
index 00000000..bfe662e5
--- /dev/null
+++ b/src/square/types/payment_balance_activity_reserve_release_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityReserveReleaseDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_square_capital_payment_detail.py b/src/square/types/payment_balance_activity_square_capital_payment_detail.py
new file mode 100644
index 00000000..670d0735
--- /dev/null
+++ b/src/square/types/payment_balance_activity_square_capital_payment_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivitySquareCapitalPaymentDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_square_capital_reversed_payment_detail.py b/src/square/types/payment_balance_activity_square_capital_reversed_payment_detail.py
new file mode 100644
index 00000000..e09b3e2b
--- /dev/null
+++ b/src/square/types/payment_balance_activity_square_capital_reversed_payment_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivitySquareCapitalReversedPaymentDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_square_payroll_transfer_detail.py b/src/square/types/payment_balance_activity_square_payroll_transfer_detail.py
new file mode 100644
index 00000000..2e72a3fc
--- /dev/null
+++ b/src/square/types/payment_balance_activity_square_payroll_transfer_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivitySquarePayrollTransferDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_square_payroll_transfer_reversed_detail.py b/src/square/types/payment_balance_activity_square_payroll_transfer_reversed_detail.py
new file mode 100644
index 00000000..ccd86445
--- /dev/null
+++ b/src/square/types/payment_balance_activity_square_payroll_transfer_reversed_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivitySquarePayrollTransferReversedDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_tax_on_fee_detail.py b/src/square/types/payment_balance_activity_tax_on_fee_detail.py
new file mode 100644
index 00000000..f979d002
--- /dev/null
+++ b/src/square/types/payment_balance_activity_tax_on_fee_detail.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityTaxOnFeeDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ tax_rate_description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the tax rate being applied. For example: "GST", "HST".
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_third_party_fee_detail.py b/src/square/types/payment_balance_activity_third_party_fee_detail.py
new file mode 100644
index 00000000..156925fb
--- /dev/null
+++ b/src/square/types/payment_balance_activity_third_party_fee_detail.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityThirdPartyFeeDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_balance_activity_third_party_fee_refund_detail.py b/src/square/types/payment_balance_activity_third_party_fee_refund_detail.py
new file mode 100644
index 00000000..2242799f
--- /dev/null
+++ b/src/square/types/payment_balance_activity_third_party_fee_refund_detail.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PaymentBalanceActivityThirdPartyFeeRefundDetail(UncheckedBaseModel):
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this activity.
+ """
+
+ refund_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The public refund id associated with this activity.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_created_event.py b/src/square/types/payment_created_event.py
new file mode 100644
index 00000000..4c648880
--- /dev/null
+++ b/src/square/types/payment_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payment_created_event_data import PaymentCreatedEventData
+
+
+class PaymentCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Payment](entity:Payment) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"payment.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[PaymentCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_created_event_data.py b/src/square/types/payment_created_event_data.py
new file mode 100644
index 00000000..44f4d192
--- /dev/null
+++ b/src/square/types/payment_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payment_created_event_object import PaymentCreatedEventObject
+
+
+class PaymentCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"payment"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected payment.
+ """
+
+ object: typing.Optional[PaymentCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created payment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_created_event_object.py b/src/square/types/payment_created_event_object.py
new file mode 100644
index 00000000..acd369e6
--- /dev/null
+++ b/src/square/types/payment_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payment import Payment
+
+
+class PaymentCreatedEventObject(UncheckedBaseModel):
+ payment: typing.Optional[Payment] = pydantic.Field(default=None)
+ """
+ The created payment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_link.py b/src/square/types/payment_link.py
new file mode 100644
index 00000000..69fb541e
--- /dev/null
+++ b/src/square/types/payment_link.py
@@ -0,0 +1,79 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_options import CheckoutOptions
+from .pre_populated_data import PrePopulatedData
+
+
+class PaymentLink(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the payment link.
+ """
+
+ version: int = pydantic.Field()
+ """
+ The Square-assigned version number, which is incremented each time an update is committed to the payment link.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The optional description of the `payment_link` object.
+ It is primarily for use by your application and is not used anywhere.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the order associated with the payment link.
+ """
+
+ checkout_options: typing.Optional[CheckoutOptions] = pydantic.Field(default=None)
+ """
+ The checkout options configured for the payment link.
+ For more information, see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations).
+ """
+
+ pre_populated_data: typing.Optional[PrePopulatedData] = pydantic.Field(default=None)
+ """
+ Describes buyer data to prepopulate
+ on the checkout page.
+ """
+
+ url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The shortened URL of the payment link.
+ """
+
+ long_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The long URL of the payment link.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the payment link was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the payment link was last updated, in RFC 3339 format.
+ """
+
+ payment_note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional note. After Square processes the payment, this note is added to the
+ resulting `Payment`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_link_related_resources.py b/src/square/types/payment_link_related_resources.py
new file mode 100644
index 00000000..159d741c
--- /dev/null
+++ b/src/square/types/payment_link_related_resources.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order import Order
+
+
+class PaymentLinkRelatedResources(UncheckedBaseModel):
+ orders: typing.Optional[typing.List[Order]] = pydantic.Field(default=None)
+ """
+ The order associated with the payment link.
+ """
+
+ subscription_plans: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ The subscription plan associated with the payment link.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ PaymentLinkRelatedResources,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/payment_options.py b/src/square/types/payment_options.py
new file mode 100644
index 00000000..f08ebf6e
--- /dev/null
+++ b/src/square/types/payment_options.py
@@ -0,0 +1,72 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payment_options_delay_action import PaymentOptionsDelayAction
+
+
+class PaymentOptions(UncheckedBaseModel):
+ autocomplete: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the `Payment` objects created from this `TerminalCheckout` are
+ automatically `COMPLETED` or left in an `APPROVED` state for later modification.
+
+ Default: true
+ """
+
+ delay_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The duration of time after the payment's creation when Square automatically resolves the
+ payment. This automatic resolution applies only to payments that do not reach a terminal state
+ (`COMPLETED` or `CANCELED`) before the `delay_duration` time period.
+
+ This parameter should be specified as a time duration, in RFC 3339 format, with a minimum value
+ of 1 minute and a maximum value of 36 hours. This feature is only supported for card payments,
+ and all payments will be considered card-present.
+
+ This parameter can only be set for a delayed capture payment (`autocomplete=false`). For more
+ information, see [Delayed Capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ Default: "PT36H" (36 hours) from the creation time
+ """
+
+ accept_partial_authorization: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If set to `true` and charging a Square Gift Card, a payment might be returned with
+ `amount_money` equal to less than what was requested. For example, a request for $20 when charging
+ a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose
+ to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card
+ payment.
+
+ This parameter can only be set for a delayed capture payment (`autocomplete=false`).
+
+ For more information, see [Take Partial Payments](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/partial-payments-with-gift-cards).
+
+ Default: false
+ """
+
+ delay_action: typing.Optional[PaymentOptionsDelayAction] = pydantic.Field(default=None)
+ """
+ The action to be applied to the `Payment` when the delay_duration has elapsed.
+ The action must be CANCEL or COMPLETE.
+
+ The action cannot be set to COMPLETE if an `order_id` is present on the TerminalCheckout.
+
+ This parameter can only be set for a delayed capture payment (`autocomplete=false`). For more
+ information, see [Delayed Capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+
+ Default: CANCEL
+ See [DelayAction](#type-delayaction) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_options_delay_action.py b/src/square/types/payment_options_delay_action.py
new file mode 100644
index 00000000..55756c20
--- /dev/null
+++ b/src/square/types/payment_options_delay_action.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+PaymentOptionsDelayAction = typing.Union[typing.Literal["CANCEL", "COMPLETE"], typing.Any]
diff --git a/src/square/types/payment_refund.py b/src/square/types/payment_refund.py
new file mode 100644
index 00000000..f1a2ffcf
--- /dev/null
+++ b/src/square/types/payment_refund.py
@@ -0,0 +1,123 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .destination_details import DestinationDetails
+from .money import Money
+from .processing_fee import ProcessingFee
+
+
+class PaymentRefund(UncheckedBaseModel):
+ """
+ Represents a refund of a payment made using Square. Contains information about
+ the original payment and the amount of money refunded.
+ """
+
+ id: str = pydantic.Field()
+ """
+ The unique ID for this refund, generated by Square.
+ """
+
+ status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The refund's status:
+ - `PENDING` - Awaiting approval.
+ - `COMPLETED` - Successfully completed.
+ - `REJECTED` - The refund was rejected.
+ - `FAILED` - An error occurred.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The location ID associated with the payment this refund is attached to.
+ """
+
+ unlinked: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Flag indicating whether or not the refund is linked to an existing payment in Square.
+ """
+
+ destination_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The destination type for this refund.
+
+ Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`,
+ `EXTERNAL`, and `SQUARE_ACCOUNT`.
+ """
+
+ destination_details: typing.Optional[DestinationDetails] = pydantic.Field(default=None)
+ """
+ Contains information about the refund destination. This field is populated only if
+ `destination_id` is defined in the `RefundPayment` request.
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount of money refunded. This amount is specified in the smallest denomination
+ of the applicable currency (for example, US dollar amounts are specified in cents).
+ """
+
+ app_fee_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money the application developer contributed to help cover the refunded amount.
+ This amount is specified in the smallest denomination of the applicable currency (for example,
+ US dollar amounts are specified in cents). For more information, see
+ [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+ """
+
+ app_fee_allocations: typing.Optional[typing.List[typing.Any]] = pydantic.Field(default=None)
+ """
+ Details pertaining to contributors to the refund of the application fee.
+ """
+
+ processing_fee: typing.Optional[typing.List[ProcessingFee]] = pydantic.Field(default=None)
+ """
+ Processing fees and fee adjustments assessed by Square for this refund.
+ """
+
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the payment associated with this refund.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the order associated with the refund.
+ """
+
+ reason: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The reason for the refund.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the refund was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the refund was last updated, in RFC 3339 format.
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional ID of the team member associated with taking the payment.
+ """
+
+ terminal_refund_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional ID for a Terminal refund.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_updated_event.py b/src/square/types/payment_updated_event.py
new file mode 100644
index 00000000..7d2a7bd1
--- /dev/null
+++ b/src/square/types/payment_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payment_updated_event_data import PaymentUpdatedEventData
+
+
+class PaymentUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Payment](entity:Payment) is updated.
+ Typically the `payment.status`, or `card_details.status` fields are updated
+ as a payment is canceled, authorized, or completed.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"payment.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[PaymentUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_updated_event_data.py b/src/square/types/payment_updated_event_data.py
new file mode 100644
index 00000000..0b03f8e2
--- /dev/null
+++ b/src/square/types/payment_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payment_updated_event_object import PaymentUpdatedEventObject
+
+
+class PaymentUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"payment"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected payment.
+ """
+
+ object: typing.Optional[PaymentUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated payment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payment_updated_event_object.py b/src/square/types/payment_updated_event_object.py
new file mode 100644
index 00000000..678e0714
--- /dev/null
+++ b/src/square/types/payment_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payment import Payment
+
+
+class PaymentUpdatedEventObject(UncheckedBaseModel):
+ payment: typing.Optional[Payment] = pydantic.Field(default=None)
+ """
+ The updated payment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout.py b/src/square/types/payout.py
new file mode 100644
index 00000000..558e8b94
--- /dev/null
+++ b/src/square/types/payout.py
@@ -0,0 +1,92 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .destination import Destination
+from .money import Money
+from .payout_fee import PayoutFee
+from .payout_status import PayoutStatus
+from .payout_type import PayoutType
+
+
+class Payout(UncheckedBaseModel):
+ """
+ An accounting of the amount owed the seller and record of the actual transfer to their
+ external bank account or to the Square balance.
+ """
+
+ id: str = pydantic.Field()
+ """
+ A unique ID for the payout.
+ """
+
+ status: typing.Optional[PayoutStatus] = pydantic.Field(default=None)
+ """
+ Indicates the payout status.
+ See [PayoutStatus](#type-payoutstatus) for possible values
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The ID of the location associated with the payout.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the payout was created and submitted for deposit to the seller's banking destination, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the payout was last updated, in RFC 3339 format.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money involved in the payout. A positive amount indicates a deposit, and a negative amount indicates a withdrawal. This amount is never zero.
+ """
+
+ destination: typing.Optional[Destination] = pydantic.Field(default=None)
+ """
+ Information about the banking destination (such as a bank account, Square checking account, or debit card)
+ against which the payout was made.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version number, which is incremented each time an update is made to this payout record.
+ The version number helps developers receive event notifications or feeds out of order.
+ """
+
+ type: typing.Optional[PayoutType] = pydantic.Field(default=None)
+ """
+ Indicates the payout type.
+ See [PayoutType](#type-payouttype) for possible values
+ """
+
+ payout_fee: typing.Optional[typing.List[PayoutFee]] = pydantic.Field(default=None)
+ """
+ A list of transfer fees and any taxes on the fees assessed by Square for this payout.
+ """
+
+ arrival_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s banking destination.
+ """
+
+ end_to_end_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for each `Payout` object that might also appear on the seller’s bank statement. You can use this ID to automate the process of reconciling each payout with the corresponding line item on the bank statement.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_entry.py b/src/square/types/payout_entry.py
new file mode 100644
index 00000000..e2e402bf
--- /dev/null
+++ b/src/square/types/payout_entry.py
@@ -0,0 +1,249 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .activity_type import ActivityType
+from .money import Money
+from .payment_balance_activity_app_fee_refund_detail import PaymentBalanceActivityAppFeeRefundDetail
+from .payment_balance_activity_app_fee_revenue_detail import PaymentBalanceActivityAppFeeRevenueDetail
+from .payment_balance_activity_automatic_savings_detail import PaymentBalanceActivityAutomaticSavingsDetail
+from .payment_balance_activity_automatic_savings_reversed_detail import (
+ PaymentBalanceActivityAutomaticSavingsReversedDetail,
+)
+from .payment_balance_activity_charge_detail import PaymentBalanceActivityChargeDetail
+from .payment_balance_activity_deposit_fee_detail import PaymentBalanceActivityDepositFeeDetail
+from .payment_balance_activity_deposit_fee_reversed_detail import PaymentBalanceActivityDepositFeeReversedDetail
+from .payment_balance_activity_dispute_detail import PaymentBalanceActivityDisputeDetail
+from .payment_balance_activity_fee_detail import PaymentBalanceActivityFeeDetail
+from .payment_balance_activity_free_processing_detail import PaymentBalanceActivityFreeProcessingDetail
+from .payment_balance_activity_hold_adjustment_detail import PaymentBalanceActivityHoldAdjustmentDetail
+from .payment_balance_activity_open_dispute_detail import PaymentBalanceActivityOpenDisputeDetail
+from .payment_balance_activity_other_adjustment_detail import PaymentBalanceActivityOtherAdjustmentDetail
+from .payment_balance_activity_other_detail import PaymentBalanceActivityOtherDetail
+from .payment_balance_activity_refund_detail import PaymentBalanceActivityRefundDetail
+from .payment_balance_activity_release_adjustment_detail import PaymentBalanceActivityReleaseAdjustmentDetail
+from .payment_balance_activity_reserve_hold_detail import PaymentBalanceActivityReserveHoldDetail
+from .payment_balance_activity_reserve_release_detail import PaymentBalanceActivityReserveReleaseDetail
+from .payment_balance_activity_square_capital_payment_detail import PaymentBalanceActivitySquareCapitalPaymentDetail
+from .payment_balance_activity_square_capital_reversed_payment_detail import (
+ PaymentBalanceActivitySquareCapitalReversedPaymentDetail,
+)
+from .payment_balance_activity_square_payroll_transfer_detail import PaymentBalanceActivitySquarePayrollTransferDetail
+from .payment_balance_activity_square_payroll_transfer_reversed_detail import (
+ PaymentBalanceActivitySquarePayrollTransferReversedDetail,
+)
+from .payment_balance_activity_tax_on_fee_detail import PaymentBalanceActivityTaxOnFeeDetail
+from .payment_balance_activity_third_party_fee_detail import PaymentBalanceActivityThirdPartyFeeDetail
+from .payment_balance_activity_third_party_fee_refund_detail import PaymentBalanceActivityThirdPartyFeeRefundDetail
+
+
+class PayoutEntry(UncheckedBaseModel):
+ """
+ One or more PayoutEntries that make up a Payout. Each one has a date, amount, and type of activity.
+ The total amount of the payout will equal the sum of the payout entries for a batch payout
+ """
+
+ id: str = pydantic.Field()
+ """
+ A unique ID for the payout entry.
+ """
+
+ payout_id: str = pydantic.Field()
+ """
+ The ID of the payout entries’ associated payout.
+ """
+
+ effective_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the payout entry affected the balance, in RFC 3339 format.
+ """
+
+ type: typing.Optional[ActivityType] = pydantic.Field(default=None)
+ """
+ The type of activity associated with this payout entry.
+ See [ActivityType](#type-activitytype) for possible values
+ """
+
+ gross_amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of money involved in this payout entry.
+ """
+
+ fee_amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of Square fees associated with this payout entry.
+ """
+
+ net_amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The net proceeds from this transaction after any fees.
+ """
+
+ type_app_fee_revenue_details: typing.Optional[PaymentBalanceActivityAppFeeRevenueDetail] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of any developer app fee revenue generated on a payment.
+ """
+
+ type_app_fee_refund_details: typing.Optional[PaymentBalanceActivityAppFeeRefundDetail] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of a refund for an app fee on a payment.
+ """
+
+ type_automatic_savings_details: typing.Optional[PaymentBalanceActivityAutomaticSavingsDetail] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of any automatic transfer from the payment processing balance to the Square Savings account. These are, generally, proportional to the merchant's sales.
+ """
+
+ type_automatic_savings_reversed_details: typing.Optional[PaymentBalanceActivityAutomaticSavingsReversedDetail] = (
+ pydantic.Field(default=None)
+ )
+ """
+ Details of any automatic transfer from the Square Savings account back to the processing balance. These are, generally, proportional to the merchant's refunds.
+ """
+
+ type_charge_details: typing.Optional[PaymentBalanceActivityChargeDetail] = pydantic.Field(default=None)
+ """
+ Details of credit card payment captures.
+ """
+
+ type_deposit_fee_details: typing.Optional[PaymentBalanceActivityDepositFeeDetail] = pydantic.Field(default=None)
+ """
+ Details of any fees involved with deposits such as for instant deposits.
+ """
+
+ type_deposit_fee_reversed_details: typing.Optional[PaymentBalanceActivityDepositFeeReversedDetail] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of any reversal or refund of fees involved with deposits such as for instant deposits.
+ """
+
+ type_dispute_details: typing.Optional[PaymentBalanceActivityDisputeDetail] = pydantic.Field(default=None)
+ """
+ Details of any balance change due to a dispute event.
+ """
+
+ type_fee_details: typing.Optional[PaymentBalanceActivityFeeDetail] = pydantic.Field(default=None)
+ """
+ Details of adjustments due to the Square processing fee.
+ """
+
+ type_free_processing_details: typing.Optional[PaymentBalanceActivityFreeProcessingDetail] = pydantic.Field(
+ default=None
+ )
+ """
+ Square offers Free Payments Processing for a variety of business scenarios including seller referral or when Square wants to apologize for a bug, customer service, repricing complication, and so on. This entry represents details of any credit to the merchant for the purposes of Free Processing.
+ """
+
+ type_hold_adjustment_details: typing.Optional[PaymentBalanceActivityHoldAdjustmentDetail] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of any adjustment made by Square related to the holding or releasing of a payment.
+ """
+
+ type_open_dispute_details: typing.Optional[PaymentBalanceActivityOpenDisputeDetail] = pydantic.Field(default=None)
+ """
+ Details of any open disputes.
+ """
+
+ type_other_details: typing.Optional[PaymentBalanceActivityOtherDetail] = pydantic.Field(default=None)
+ """
+ Details of any other type that does not belong in the rest of the types.
+ """
+
+ type_other_adjustment_details: typing.Optional[PaymentBalanceActivityOtherAdjustmentDetail] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of any other type of adjustments that don't fall under existing types.
+ """
+
+ type_refund_details: typing.Optional[PaymentBalanceActivityRefundDetail] = pydantic.Field(default=None)
+ """
+ Details of a refund for an existing card payment.
+ """
+
+ type_release_adjustment_details: typing.Optional[PaymentBalanceActivityReleaseAdjustmentDetail] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of fees released for adjustments.
+ """
+
+ type_reserve_hold_details: typing.Optional[PaymentBalanceActivityReserveHoldDetail] = pydantic.Field(default=None)
+ """
+ Details of fees paid for funding risk reserve.
+ """
+
+ type_reserve_release_details: typing.Optional[PaymentBalanceActivityReserveReleaseDetail] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of fees released from risk reserve.
+ """
+
+ type_square_capital_payment_details: typing.Optional[PaymentBalanceActivitySquareCapitalPaymentDetail] = (
+ pydantic.Field(default=None)
+ )
+ """
+ Details of capital merchant cash advance (MCA) assessments. These are, generally, proportional to the merchant's sales but may be issued for other reasons related to the MCA.
+ """
+
+ type_square_capital_reversed_payment_details: typing.Optional[
+ PaymentBalanceActivitySquareCapitalReversedPaymentDetail
+ ] = pydantic.Field(default=None)
+ """
+ Details of capital merchant cash advance (MCA) assessment refunds. These are, generally, proportional to the merchant's refunds but may be issued for other reasons related to the MCA.
+ """
+
+ type_tax_on_fee_details: typing.Optional[PaymentBalanceActivityTaxOnFeeDetail] = pydantic.Field(default=None)
+ """
+ Details of tax paid on fee amounts.
+ """
+
+ type_third_party_fee_details: typing.Optional[PaymentBalanceActivityThirdPartyFeeDetail] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of fees collected by a 3rd party platform.
+ """
+
+ type_third_party_fee_refund_details: typing.Optional[PaymentBalanceActivityThirdPartyFeeRefundDetail] = (
+ pydantic.Field(default=None)
+ )
+ """
+ Details of refunded fees from a 3rd party platform.
+ """
+
+ type_square_payroll_transfer_details: typing.Optional[PaymentBalanceActivitySquarePayrollTransferDetail] = (
+ pydantic.Field(default=None)
+ )
+ """
+ Details of a payroll payment that was transferred to a team member’s bank account.
+ """
+
+ type_square_payroll_transfer_reversed_details: typing.Optional[
+ PaymentBalanceActivitySquarePayrollTransferReversedDetail
+ ] = pydantic.Field(default=None)
+ """
+ Details of a payroll payment to a team member’s bank account that was deposited back to the seller’s account by Square.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_failed_event.py b/src/square/types/payout_failed_event.py
new file mode 100644
index 00000000..44ca89f1
--- /dev/null
+++ b/src/square/types/payout_failed_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payout_failed_event_data import PayoutFailedEventData
+
+
+class PayoutFailedEvent(UncheckedBaseModel):
+ """
+ Published when a [Payout](entity:Payout) has failed.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event that this represents, `payout.failed`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the event was verified, in RFC 3339 format.
+ """
+
+ data: typing.Optional[PayoutFailedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_failed_event_data.py b/src/square/types/payout_failed_event_data.py
new file mode 100644
index 00000000..bd105d40
--- /dev/null
+++ b/src/square/types/payout_failed_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payout_failed_event_object import PayoutFailedEventObject
+
+
+class PayoutFailedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the affected object's type, `payout`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the failed payout.
+ """
+
+ object: typing.Optional[PayoutFailedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the failed payout.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_failed_event_object.py b/src/square/types/payout_failed_event_object.py
new file mode 100644
index 00000000..1ad87b7e
--- /dev/null
+++ b/src/square/types/payout_failed_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payout import Payout
+
+
+class PayoutFailedEventObject(UncheckedBaseModel):
+ payout: typing.Optional[Payout] = pydantic.Field(default=None)
+ """
+ The payout that failed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_fee.py b/src/square/types/payout_fee.py
new file mode 100644
index 00000000..a7405bdf
--- /dev/null
+++ b/src/square/types/payout_fee.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .payout_fee_type import PayoutFeeType
+
+
+class PayoutFee(UncheckedBaseModel):
+ """
+ Represents a payout fee that can incur as part of a payout.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The money amount of the payout fee.
+ """
+
+ effective_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the fee takes effect, in RFC 3339 format.
+ """
+
+ type: typing.Optional[PayoutFeeType] = pydantic.Field(default=None)
+ """
+ The type of fee assessed as part of the payout.
+ See [PayoutFeeType](#type-payoutfeetype) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_fee_type.py b/src/square/types/payout_fee_type.py
new file mode 100644
index 00000000..d51e857c
--- /dev/null
+++ b/src/square/types/payout_fee_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+PayoutFeeType = typing.Union[typing.Literal["TRANSFER_FEE", "TAX_ON_TRANSFER_FEE"], typing.Any]
diff --git a/src/square/types/payout_paid_event.py b/src/square/types/payout_paid_event.py
new file mode 100644
index 00000000..bcfed920
--- /dev/null
+++ b/src/square/types/payout_paid_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payout_paid_event_data import PayoutPaidEventData
+
+
+class PayoutPaidEvent(UncheckedBaseModel):
+ """
+ Published when a [Payout](entity:Payout) is complete.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"payout.paid"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was verified, in RFC 3339 format.
+ """
+
+ data: typing.Optional[PayoutPaidEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_paid_event_data.py b/src/square/types/payout_paid_event_data.py
new file mode 100644
index 00000000..93c770e5
--- /dev/null
+++ b/src/square/types/payout_paid_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payout_paid_event_object import PayoutPaidEventObject
+
+
+class PayoutPaidEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"payout"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the completed payout.
+ """
+
+ object: typing.Optional[PayoutPaidEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the completed payout.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_paid_event_object.py b/src/square/types/payout_paid_event_object.py
new file mode 100644
index 00000000..cb61272f
--- /dev/null
+++ b/src/square/types/payout_paid_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payout import Payout
+
+
+class PayoutPaidEventObject(UncheckedBaseModel):
+ payout: typing.Optional[Payout] = pydantic.Field(default=None)
+ """
+ The payout that has completed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_sent_event.py b/src/square/types/payout_sent_event.py
new file mode 100644
index 00000000..28a70d55
--- /dev/null
+++ b/src/square/types/payout_sent_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payout_sent_event_data import PayoutSentEventData
+
+
+class PayoutSentEvent(UncheckedBaseModel):
+ """
+ Published when a [Payout](entity:Payout) is sent.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target location associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"payout.sent"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was verified, in RFC 3339 format.
+ """
+
+ data: typing.Optional[PayoutSentEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_sent_event_data.py b/src/square/types/payout_sent_event_data.py
new file mode 100644
index 00000000..6fbceed3
--- /dev/null
+++ b/src/square/types/payout_sent_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payout_sent_event_object import PayoutSentEventObject
+
+
+class PayoutSentEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"payout"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the sent payout.
+ """
+
+ object: typing.Optional[PayoutSentEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the sent payout.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_sent_event_object.py b/src/square/types/payout_sent_event_object.py
new file mode 100644
index 00000000..9260f305
--- /dev/null
+++ b/src/square/types/payout_sent_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payout import Payout
+
+
+class PayoutSentEventObject(UncheckedBaseModel):
+ payout: typing.Optional[Payout] = pydantic.Field(default=None)
+ """
+ The payout that was sent.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/payout_status.py b/src/square/types/payout_status.py
new file mode 100644
index 00000000..86fe22a6
--- /dev/null
+++ b/src/square/types/payout_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+PayoutStatus = typing.Union[typing.Literal["SENT", "FAILED", "PAID"], typing.Any]
diff --git a/src/square/types/payout_type.py b/src/square/types/payout_type.py
new file mode 100644
index 00000000..ac074aa7
--- /dev/null
+++ b/src/square/types/payout_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+PayoutType = typing.Union[typing.Literal["BATCH", "SIMPLE"], typing.Any]
diff --git a/src/square/types/phase.py b/src/square/types/phase.py
new file mode 100644
index 00000000..8c14da28
--- /dev/null
+++ b/src/square/types/phase.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class Phase(UncheckedBaseModel):
+ """
+ Represents a phase, which can override subscription phases as defined by plan_id
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ id of subscription phase
+ """
+
+ ordinal: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ index of phase in total subscription plan
+ """
+
+ order_template_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ id of order to be used in billing
+ """
+
+ plan_phase_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ the uid from the plan's phase in catalog
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/phase_input.py b/src/square/types/phase_input.py
new file mode 100644
index 00000000..e7700065
--- /dev/null
+++ b/src/square/types/phase_input.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class PhaseInput(UncheckedBaseModel):
+ """
+ Represents the arguments used to construct a new phase.
+ """
+
+ ordinal: int = pydantic.Field()
+ """
+ index of phase in total subscription plan
+ """
+
+ order_template_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ id of order to be used in billing
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/pre_populated_data.py b/src/square/types/pre_populated_data.py
new file mode 100644
index 00000000..e5b5142d
--- /dev/null
+++ b/src/square/types/pre_populated_data.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+
+
+class PrePopulatedData(UncheckedBaseModel):
+ """
+ Describes buyer data to prepopulate in the payment form.
+ For more information,
+ see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations).
+ """
+
+ buyer_email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The buyer email to prepopulate in the payment form.
+ """
+
+ buyer_phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The buyer phone number to prepopulate in the payment form.
+ """
+
+ buyer_address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The buyer address to prepopulate in the payment form.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/processing_fee.py b/src/square/types/processing_fee.py
new file mode 100644
index 00000000..611c13a3
--- /dev/null
+++ b/src/square/types/processing_fee.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class ProcessingFee(UncheckedBaseModel):
+ """
+ Represents the Square processing fee.
+ """
+
+ effective_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the fee takes effect, in RFC 3339 format.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of fee assessed or adjusted. The fee type can be `INITIAL` or `ADJUSTMENT`.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The fee amount, which might be negative, that is assessed or adjusted by Square.
+
+ Positive values represent funds being assessed, while negative values represent
+ funds being returned.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/product.py b/src/square/types/product.py
new file mode 100644
index 00000000..04a37897
--- /dev/null
+++ b/src/square/types/product.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+Product = typing.Union[
+ typing.Literal[
+ "SQUARE_POS",
+ "EXTERNAL_API",
+ "BILLING",
+ "APPOINTMENTS",
+ "INVOICES",
+ "ONLINE_STORE",
+ "PAYROLL",
+ "DASHBOARD",
+ "ITEM_LIBRARY_IMPORT",
+ "OTHER",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/product_type.py b/src/square/types/product_type.py
new file mode 100644
index 00000000..94753505
--- /dev/null
+++ b/src/square/types/product_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ProductType = typing.Literal["TERMINAL_API"]
diff --git a/src/square/types/publish_invoice_response.py b/src/square/types/publish_invoice_response.py
new file mode 100644
index 00000000..655e9336
--- /dev/null
+++ b/src/square/types/publish_invoice_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .invoice import Invoice
+
+
+class PublishInvoiceResponse(UncheckedBaseModel):
+ """
+ Describes a `PublishInvoice` response.
+ """
+
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The published invoice.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/publish_scheduled_shift_response.py b/src/square/types/publish_scheduled_shift_response.py
new file mode 100644
index 00000000..8ef96d33
--- /dev/null
+++ b/src/square/types/publish_scheduled_shift_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .scheduled_shift import ScheduledShift
+
+
+class PublishScheduledShiftResponse(UncheckedBaseModel):
+ """
+ Represents a [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) response.
+ Either `scheduled_shift` or `errors` is present in the response.
+ """
+
+ scheduled_shift: typing.Optional[ScheduledShift] = pydantic.Field(default=None)
+ """
+ The published scheduled shift.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/qr_code_options.py b/src/square/types/qr_code_options.py
new file mode 100644
index 00000000..563871cc
--- /dev/null
+++ b/src/square/types/qr_code_options.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class QrCodeOptions(UncheckedBaseModel):
+ """
+ Fields to describe the action that displays QR-Codes.
+ """
+
+ title: str = pydantic.Field()
+ """
+ The title text to display in the QR code flow on the Terminal.
+ """
+
+ body: str = pydantic.Field()
+ """
+ The body text to display in the QR code flow on the Terminal.
+ """
+
+ barcode_contents: str = pydantic.Field()
+ """
+ The text representation of the data to show in the QR code
+ as UTF8-encoded data.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/query.py b/src/square/types/query.py
new file mode 100644
index 00000000..f8d77c4d
--- /dev/null
+++ b/src/square/types/query.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .join_hint import JoinHint
+from .join_subquery import JoinSubquery
+from .query_filter import QueryFilter
+from .time_dimension import TimeDimension
+
+
+class Query(UncheckedBaseModel):
+ measures: typing.Optional[typing.List[str]] = None
+ dimensions: typing.Optional[typing.List[str]] = None
+ segments: typing.Optional[typing.List[str]] = None
+ time_dimensions: typing_extensions.Annotated[
+ typing.Optional[typing.List[TimeDimension]],
+ FieldMetadata(alias="timeDimensions"),
+ pydantic.Field(alias="timeDimensions"),
+ ] = None
+ order: typing.Optional[typing.List[typing.List[str]]] = None
+ limit: typing.Optional[int] = None
+ offset: typing.Optional[int] = None
+ filters: typing.Optional[typing.List[QueryFilter]] = None
+ ungrouped: typing.Optional[bool] = None
+ subquery_joins: typing_extensions.Annotated[
+ typing.Optional[typing.List[JoinSubquery]],
+ FieldMetadata(alias="subqueryJoins"),
+ pydantic.Field(alias="subqueryJoins"),
+ ] = None
+ join_hints: typing_extensions.Annotated[
+ typing.Optional[typing.List[JoinHint]], FieldMetadata(alias="joinHints"), pydantic.Field(alias="joinHints")
+ ] = None
+ timezone: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/query_filter.py b/src/square/types/query_filter.py
new file mode 100644
index 00000000..9e37bf92
--- /dev/null
+++ b/src/square/types/query_filter.py
@@ -0,0 +1,9 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .query_filter_and import QueryFilterAnd
+from .query_filter_condition import QueryFilterCondition
+from .query_filter_or import QueryFilterOr
+
+QueryFilter = typing.Union[QueryFilterCondition, QueryFilterOr, QueryFilterAnd]
diff --git a/src/square/types/query_filter_and.py b/src/square/types/query_filter_and.py
new file mode 100644
index 00000000..20303bd5
--- /dev/null
+++ b/src/square/types/query_filter_and.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class QueryFilterAnd(UncheckedBaseModel):
+ and_: typing_extensions.Annotated[
+ typing.List[typing.Dict[str, typing.Any]], FieldMetadata(alias="and"), pydantic.Field(alias="and")
+ ]
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/query_filter_condition.py b/src/square/types/query_filter_condition.py
new file mode 100644
index 00000000..d2a29a2d
--- /dev/null
+++ b/src/square/types/query_filter_condition.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class QueryFilterCondition(UncheckedBaseModel):
+ member: str
+ operator: str
+ values: typing.Optional[typing.List[str]] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/query_filter_or.py b/src/square/types/query_filter_or.py
new file mode 100644
index 00000000..161083e5
--- /dev/null
+++ b/src/square/types/query_filter_or.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class QueryFilterOr(UncheckedBaseModel):
+ or_: typing_extensions.Annotated[
+ typing.List[typing.Dict[str, typing.Any]], FieldMetadata(alias="or"), pydantic.Field(alias="or")
+ ]
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/quick_pay.py b/src/square/types/quick_pay.py
new file mode 100644
index 00000000..5fd63b19
--- /dev/null
+++ b/src/square/types/quick_pay.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class QuickPay(UncheckedBaseModel):
+ """
+ Describes an ad hoc item and price to generate a quick pay checkout link.
+ For more information,
+ see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout).
+ """
+
+ name: str = pydantic.Field()
+ """
+ The ad hoc item name. In the resulting `Order`, this name appears as the line item name.
+ """
+
+ price_money: Money = pydantic.Field()
+ """
+ The price of the item.
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The ID of the business location the checkout is associated with.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/range.py b/src/square/types/range.py
new file mode 100644
index 00000000..255ce500
--- /dev/null
+++ b/src/square/types/range.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class Range(UncheckedBaseModel):
+ """
+ The range of a number value between the specified lower and upper bounds.
+ """
+
+ min: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The lower bound of the number range. At least one of `min` or `max` must be specified.
+ If unspecified, the results will have no minimum value.
+ """
+
+ max: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The upper bound of the number range. At least one of `min` or `max` must be specified.
+ If unspecified, the results will have no maximum value.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/receipt_options.py b/src/square/types/receipt_options.py
new file mode 100644
index 00000000..9d2297a7
--- /dev/null
+++ b/src/square/types/receipt_options.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class ReceiptOptions(UncheckedBaseModel):
+ """
+ Describes receipt action fields.
+ """
+
+ payment_id: str = pydantic.Field()
+ """
+ The reference to the Square payment ID for the receipt.
+ """
+
+ print_only: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Instructs the device to print the receipt without displaying the receipt selection screen.
+ Requires `printer_enabled` set to true.
+ Defaults to false.
+ """
+
+ is_duplicate: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Identify the receipt as a reprint rather than an original receipt.
+ Defaults to false.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/receive_transfer_order_response.py b/src/square/types/receive_transfer_order_response.py
new file mode 100644
index 00000000..635ffde3
--- /dev/null
+++ b/src/square/types/receive_transfer_order_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .transfer_order import TransferOrder
+
+
+class ReceiveTransferOrderResponse(UncheckedBaseModel):
+ """
+ Response for receiving items for a transfer order
+ """
+
+ transfer_order: typing.Optional[TransferOrder] = pydantic.Field(default=None)
+ """
+ The updated transfer order
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/redeem_loyalty_reward_response.py b/src/square/types/redeem_loyalty_reward_response.py
new file mode 100644
index 00000000..1a14280c
--- /dev/null
+++ b/src/square/types/redeem_loyalty_reward_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_event import LoyaltyEvent
+
+
+class RedeemLoyaltyRewardResponse(UncheckedBaseModel):
+ """
+ A response that includes the `LoyaltyEvent` published for redeeming the reward.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ event: typing.Optional[LoyaltyEvent] = pydantic.Field(default=None)
+ """
+ The `LoyaltyEvent` for redeeming the reward.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/reference.py b/src/square/types/reference.py
new file mode 100644
index 00000000..b07a6e88
--- /dev/null
+++ b/src/square/types/reference.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .reference_type import ReferenceType
+
+
+class Reference(UncheckedBaseModel):
+ type: typing.Optional[ReferenceType] = pydantic.Field(default=None)
+ """
+ The type of entity a channel is associated with.
+ See [Type](#type-type) for possible values
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the entity a channel is associated with.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/reference_type.py b/src/square/types/reference_type.py
new file mode 100644
index 00000000..6b8b82ec
--- /dev/null
+++ b/src/square/types/reference_type.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ReferenceType = typing.Union[
+ typing.Literal[
+ "UNKNOWN_TYPE",
+ "LOCATION",
+ "FIRST_PARTY_INTEGRATION",
+ "OAUTH_APPLICATION",
+ "ONLINE_SITE",
+ "ONLINE_CHECKOUT",
+ "INVOICE",
+ "GIFT_CARD",
+ "GIFT_CARD_MARKETPLACE",
+ "RECURRING_SUBSCRIPTION",
+ "ONLINE_BOOKING_FLOW",
+ "SQUARE_ASSISTANT",
+ "CASH_LOCAL",
+ "POINT_OF_SALE",
+ "KIOSK",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/refund.py b/src/square/types/refund.py
new file mode 100644
index 00000000..b1c67432
--- /dev/null
+++ b/src/square/types/refund.py
@@ -0,0 +1,78 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .additional_recipient import AdditionalRecipient
+from .money import Money
+from .refund_status import RefundStatus
+
+
+class Refund(UncheckedBaseModel):
+ """
+ Represents a refund processed for a Square transaction.
+ """
+
+ id: str = pydantic.Field()
+ """
+ The refund's unique ID.
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The ID of the refund's associated location.
+ """
+
+ transaction_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the transaction that the refunded tender is part of.
+ """
+
+ tender_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the refunded tender.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the refund was created, in RFC 3339 format.
+ """
+
+ reason: str = pydantic.Field()
+ """
+ The reason for the refund being issued.
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount of money refunded to the buyer.
+ """
+
+ status: RefundStatus = pydantic.Field()
+ """
+ The current status of the refund (`PENDING`, `APPROVED`, `REJECTED`,
+ or `FAILED`).
+ See [RefundStatus](#type-refundstatus) for possible values
+ """
+
+ processing_fee_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of Square processing fee money refunded to the *merchant*.
+ """
+
+ additional_recipients: typing.Optional[typing.List[AdditionalRecipient]] = pydantic.Field(default=None)
+ """
+ Additional recipients (other than the merchant) receiving a portion of this refund.
+ For example, fees assessed on a refund of a purchase by a third party integration.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/refund_created_event.py b/src/square/types/refund_created_event.py
new file mode 100644
index 00000000..f491d1ee
--- /dev/null
+++ b/src/square/types/refund_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .refund_created_event_data import RefundCreatedEventData
+
+
+class RefundCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Refund](entity:PaymentRefund) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"refund.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[RefundCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/refund_created_event_data.py b/src/square/types/refund_created_event_data.py
new file mode 100644
index 00000000..0f0bdbcf
--- /dev/null
+++ b/src/square/types/refund_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .refund_created_event_object import RefundCreatedEventObject
+
+
+class RefundCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"refund"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected refund.
+ """
+
+ object: typing.Optional[RefundCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created refund.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/refund_created_event_object.py b/src/square/types/refund_created_event_object.py
new file mode 100644
index 00000000..ed80cb70
--- /dev/null
+++ b/src/square/types/refund_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payment_refund import PaymentRefund
+
+
+class RefundCreatedEventObject(UncheckedBaseModel):
+ refund: typing.Optional[PaymentRefund] = pydantic.Field(default=None)
+ """
+ The created refund.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/refund_payment_response.py b/src/square/types/refund_payment_response.py
new file mode 100644
index 00000000..491b3518
--- /dev/null
+++ b/src/square/types/refund_payment_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment_refund import PaymentRefund
+
+
+class RefundPaymentResponse(UncheckedBaseModel):
+ """
+ Defines the response returned by
+ [RefundPayment](api-endpoint:Refunds-RefundPayment).
+
+ If there are errors processing the request, the `refund` field might not be
+ present, or it might be present with a status of `FAILED`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ refund: typing.Optional[PaymentRefund] = pydantic.Field(default=None)
+ """
+ The successfully created `PaymentRefund`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/refund_status.py b/src/square/types/refund_status.py
new file mode 100644
index 00000000..c9e6f158
--- /dev/null
+++ b/src/square/types/refund_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+RefundStatus = typing.Union[typing.Literal["PENDING", "APPROVED", "REJECTED", "FAILED"], typing.Any]
diff --git a/src/square/types/refund_updated_event.py b/src/square/types/refund_updated_event.py
new file mode 100644
index 00000000..c2f377a9
--- /dev/null
+++ b/src/square/types/refund_updated_event.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .refund_updated_event_data import RefundUpdatedEventData
+
+
+class RefundUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Refund](entity:PaymentRefund) is updated.
+ Typically the `refund.status` changes when a refund is completed.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"refund.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[RefundUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/refund_updated_event_data.py b/src/square/types/refund_updated_event_data.py
new file mode 100644
index 00000000..d6e1962e
--- /dev/null
+++ b/src/square/types/refund_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .refund_updated_event_object import RefundUpdatedEventObject
+
+
+class RefundUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"refund"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected refund.
+ """
+
+ object: typing.Optional[RefundUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated refund.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/refund_updated_event_object.py b/src/square/types/refund_updated_event_object.py
new file mode 100644
index 00000000..2b3499b5
--- /dev/null
+++ b/src/square/types/refund_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .payment_refund import PaymentRefund
+
+
+class RefundUpdatedEventObject(UncheckedBaseModel):
+ refund: typing.Optional[PaymentRefund] = pydantic.Field(default=None)
+ """
+ The updated refund.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/register_domain_response.py b/src/square/types/register_domain_response.py
new file mode 100644
index 00000000..2ed831f4
--- /dev/null
+++ b/src/square/types/register_domain_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .register_domain_response_status import RegisterDomainResponseStatus
+
+
+class RegisterDomainResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RegisterDomain](api-endpoint:ApplePay-RegisterDomain) endpoint.
+
+ Either `errors` or `status` are present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ status: typing.Optional[RegisterDomainResponseStatus] = pydantic.Field(default=None)
+ """
+ The status of the domain registration.
+
+ See [RegisterDomainResponseStatus](entity:RegisterDomainResponseStatus) for possible values.
+ See [RegisterDomainResponseStatus](#type-registerdomainresponsestatus) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/register_domain_response_status.py b/src/square/types/register_domain_response_status.py
new file mode 100644
index 00000000..d154ab93
--- /dev/null
+++ b/src/square/types/register_domain_response_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+RegisterDomainResponseStatus = typing.Union[typing.Literal["PENDING", "VERIFIED"], typing.Any]
diff --git a/src/square/types/remove_group_from_customer_response.py b/src/square/types/remove_group_from_customer_response.py
new file mode 100644
index 00000000..fbaf140e
--- /dev/null
+++ b/src/square/types/remove_group_from_customer_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class RemoveGroupFromCustomerResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [RemoveGroupFromCustomer](api-endpoint:Customers-RemoveGroupFromCustomer)
+ endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/reporting_error.py b/src/square/types/reporting_error.py
new file mode 100644
index 00000000..e2165989
--- /dev/null
+++ b/src/square/types/reporting_error.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class ReportingError(UncheckedBaseModel):
+ """
+ Error envelope returned by the Reporting API. Note: a 200 response whose body is `{ "error": "Continue wait" }` is not a failure — it signals that a long-running query is still processing and the request should be retried.
+ """
+
+ error: str
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/restore_inventory_adjustment_reason_response.py b/src/square/types/restore_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..0b0a3f2a
--- /dev/null
+++ b/src/square/types/restore_inventory_adjustment_reason_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class RestoreInventoryAdjustmentReasonResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing.Optional[InventoryAdjustmentReason] = pydantic.Field(default=None)
+ """
+ The successfully restored inventory adjustment reason.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/resume_subscription_response.py b/src/square/types/resume_subscription_response.py
new file mode 100644
index 00000000..e9f65e94
--- /dev/null
+++ b/src/square/types/resume_subscription_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription import Subscription
+from .subscription_action import SubscriptionAction
+
+
+class ResumeSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response from the
+ [ResumeSubscription](api-endpoint:Subscriptions-ResumeSubscription) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The resumed subscription.
+ """
+
+ actions: typing.Optional[typing.List[SubscriptionAction]] = pydantic.Field(default=None)
+ """
+ A list of `RESUME` actions created by the request and scheduled for the subscription.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_booking_custom_attribute_definition_response.py b/src/square/types/retrieve_booking_custom_attribute_definition_response.py
new file mode 100644
index 00000000..33b225ed
--- /dev/null
+++ b/src/square/types/retrieve_booking_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class RetrieveBookingCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_booking_custom_attribute_response.py b/src/square/types/retrieve_booking_custom_attribute_response.py
new file mode 100644
index 00000000..f22deff5
--- /dev/null
+++ b/src/square/types/retrieve_booking_custom_attribute_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class RetrieveBookingCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveBookingCustomAttribute](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute. If `with_definition` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_channel_response.py b/src/square/types/retrieve_channel_response.py
new file mode 100644
index 00000000..c8c9d8e3
--- /dev/null
+++ b/src/square/types/retrieve_channel_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .channel import Channel
+from .error import Error
+
+
+class RetrieveChannelResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ channel: typing.Optional[Channel] = pydantic.Field(default=None)
+ """
+ The requested Channel.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_inventory_adjustment_reason_response.py b/src/square/types/retrieve_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..d9f1f589
--- /dev/null
+++ b/src/square/types/retrieve_inventory_adjustment_reason_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class RetrieveInventoryAdjustmentReasonResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [RetrieveInventoryAdjustmentReason](api-endpoint:Inventory-RetrieveInventoryAdjustmentReason).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing.Optional[InventoryAdjustmentReason] = pydantic.Field(default=None)
+ """
+ The successfully retrieved inventory adjustment reason. Deleted custom
+ reasons can be retrieved by ID and have `is_deleted` set to `true`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_job_response.py b/src/square/types/retrieve_job_response.py
new file mode 100644
index 00000000..62ce4252
--- /dev/null
+++ b/src/square/types/retrieve_job_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .job import Job
+
+
+class RetrieveJobResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveJob](api-endpoint:Team-RetrieveJob) response. Either `job` or `errors`
+ is present in the response.
+ """
+
+ job: typing.Optional[Job] = pydantic.Field(default=None)
+ """
+ The retrieved job.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_location_booking_profile_response.py b/src/square/types/retrieve_location_booking_profile_response.py
new file mode 100644
index 00000000..5d100846
--- /dev/null
+++ b/src/square/types/retrieve_location_booking_profile_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .location_booking_profile import LocationBookingProfile
+
+
+class RetrieveLocationBookingProfileResponse(UncheckedBaseModel):
+ location_booking_profile: typing.Optional[LocationBookingProfile] = pydantic.Field(default=None)
+ """
+ The requested location booking profile.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_location_custom_attribute_definition_response.py b/src/square/types/retrieve_location_custom_attribute_definition_response.py
new file mode 100644
index 00000000..73bc8bcf
--- /dev/null
+++ b/src/square/types/retrieve_location_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class RetrieveLocationCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_location_custom_attribute_response.py b/src/square/types/retrieve_location_custom_attribute_response.py
new file mode 100644
index 00000000..0bc149d2
--- /dev/null
+++ b/src/square/types/retrieve_location_custom_attribute_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class RetrieveLocationCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveLocationCustomAttribute](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute. If `with_definition` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_location_settings_response.py b/src/square/types/retrieve_location_settings_response.py
new file mode 100644
index 00000000..ee467a57
--- /dev/null
+++ b/src/square/types/retrieve_location_settings_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_location_settings import CheckoutLocationSettings
+from .error import Error
+
+
+class RetrieveLocationSettingsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ location_settings: typing.Optional[CheckoutLocationSettings] = pydantic.Field(default=None)
+ """
+ The location settings.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_merchant_custom_attribute_definition_response.py b/src/square/types/retrieve_merchant_custom_attribute_definition_response.py
new file mode 100644
index 00000000..12cc6468
--- /dev/null
+++ b/src/square/types/retrieve_merchant_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class RetrieveMerchantCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_merchant_custom_attribute_response.py b/src/square/types/retrieve_merchant_custom_attribute_response.py
new file mode 100644
index 00000000..92bf2585
--- /dev/null
+++ b/src/square/types/retrieve_merchant_custom_attribute_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class RetrieveMerchantCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute. If `with_definition` was set to `true` in the request,
+ the custom attribute definition is returned in the `definition` field.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_merchant_settings_response.py b/src/square/types/retrieve_merchant_settings_response.py
new file mode 100644
index 00000000..d651c1a0
--- /dev/null
+++ b/src/square/types/retrieve_merchant_settings_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_merchant_settings import CheckoutMerchantSettings
+from .error import Error
+
+
+class RetrieveMerchantSettingsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ merchant_settings: typing.Optional[CheckoutMerchantSettings] = pydantic.Field(default=None)
+ """
+ The merchant settings.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_order_custom_attribute_definition_response.py b/src/square/types/retrieve_order_custom_attribute_definition_response.py
new file mode 100644
index 00000000..8690e34b
--- /dev/null
+++ b/src/square/types/retrieve_order_custom_attribute_definition_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class RetrieveOrderCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a response from getting an order custom attribute definition.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_order_custom_attribute_response.py b/src/square/types/retrieve_order_custom_attribute_response.py
new file mode 100644
index 00000000..482c2fbb
--- /dev/null
+++ b/src/square/types/retrieve_order_custom_attribute_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class RetrieveOrderCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a response from getting an order custom attribute.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The retrieved custom attribute. If `with_definition` was set to `true` in the request, the custom attribute definition is returned in the `definition field.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_scheduled_shift_response.py b/src/square/types/retrieve_scheduled_shift_response.py
new file mode 100644
index 00000000..46b49a28
--- /dev/null
+++ b/src/square/types/retrieve_scheduled_shift_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .scheduled_shift import ScheduledShift
+
+
+class RetrieveScheduledShiftResponse(UncheckedBaseModel):
+ """
+ Represents a [RetrieveScheduledShift](api-endpoint:Labor-RetrieveScheduledShift) response.
+ Either `scheduled_shift` or `errors` is present in the response.
+ """
+
+ scheduled_shift: typing.Optional[ScheduledShift] = pydantic.Field(default=None)
+ """
+ The requested scheduled shift.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_timecard_response.py b/src/square/types/retrieve_timecard_response.py
new file mode 100644
index 00000000..7acfa5fd
--- /dev/null
+++ b/src/square/types/retrieve_timecard_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .timecard import Timecard
+
+
+class RetrieveTimecardResponse(UncheckedBaseModel):
+ """
+ A response to a request to get a `Timecard`. The response contains
+ the requested `Timecard` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ timecard: typing.Optional[Timecard] = pydantic.Field(default=None)
+ """
+ The requested `Timecard`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_token_status_response.py b/src/square/types/retrieve_token_status_response.py
new file mode 100644
index 00000000..1bdc92b4
--- /dev/null
+++ b/src/square/types/retrieve_token_status_response.py
@@ -0,0 +1,49 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class RetrieveTokenStatusResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `RetrieveTokenStatus` endpoint.
+ """
+
+ scopes: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The list of scopes associated with an access token.
+ """
+
+ expires_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The date and time when the `access_token` expires, in RFC 3339 format. Empty if the token never expires.
+ """
+
+ client_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-issued application ID associated with the access token. This is the same application ID used to obtain the token.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the authorizing merchant's business.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_transfer_order_response.py b/src/square/types/retrieve_transfer_order_response.py
new file mode 100644
index 00000000..df629ead
--- /dev/null
+++ b/src/square/types/retrieve_transfer_order_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .transfer_order import TransferOrder
+
+
+class RetrieveTransferOrderResponse(UncheckedBaseModel):
+ """
+ Response containing the requested transfer order
+ """
+
+ transfer_order: typing.Optional[TransferOrder] = pydantic.Field(default=None)
+ """
+ The requested transfer order
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/revoke_token_response.py b/src/square/types/revoke_token_response.py
new file mode 100644
index 00000000..84b07a15
--- /dev/null
+++ b/src/square/types/revoke_token_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class RevokeTokenResponse(UncheckedBaseModel):
+ success: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If the request is successful, this is `true`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/risk_evaluation.py b/src/square/types/risk_evaluation.py
new file mode 100644
index 00000000..0aae9651
--- /dev/null
+++ b/src/square/types/risk_evaluation.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .risk_evaluation_risk_level import RiskEvaluationRiskLevel
+
+
+class RiskEvaluation(UncheckedBaseModel):
+ """
+ Represents fraud risk information for the associated payment.
+
+ When you take a payment through Square's Payments API (using the `CreatePayment`
+ endpoint), Square evaluates it and assigns a risk level to the payment. Sellers
+ can use this information to determine the course of action (for example,
+ provide the goods/services or refund the payment).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when payment risk was evaluated, in RFC 3339 format.
+ """
+
+ risk_level: typing.Optional[RiskEvaluationRiskLevel] = pydantic.Field(default=None)
+ """
+ The risk level associated with the payment
+ See [RiskEvaluationRiskLevel](#type-riskevaluationrisklevel) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/risk_evaluation_risk_level.py b/src/square/types/risk_evaluation_risk_level.py
new file mode 100644
index 00000000..8802c596
--- /dev/null
+++ b/src/square/types/risk_evaluation_risk_level.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+RiskEvaluationRiskLevel = typing.Union[typing.Literal["PENDING", "NORMAL", "MODERATE", "HIGH"], typing.Any]
diff --git a/src/square/types/save_card_options.py b/src/square/types/save_card_options.py
new file mode 100644
index 00000000..e4c0e5c7
--- /dev/null
+++ b/src/square/types/save_card_options.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class SaveCardOptions(UncheckedBaseModel):
+ """
+ Describes save-card action fields.
+ """
+
+ customer_id: str = pydantic.Field()
+ """
+ The square-assigned ID of the customer linked to the saved card.
+ """
+
+ card_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the created card-on-file.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional user-defined reference ID that can be used to associate
+ this `Card` to another entity in an external system. For example, a customer
+ ID generated by a third-party system.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/scheduled_shift.py b/src/square/types/scheduled_shift.py
new file mode 100644
index 00000000..b7a53661
--- /dev/null
+++ b/src/square/types/scheduled_shift.py
@@ -0,0 +1,59 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .scheduled_shift_details import ScheduledShiftDetails
+
+
+class ScheduledShift(UncheckedBaseModel):
+ """
+ Represents a specific time slot in a work schedule. This object is used to manage the
+ lifecycle of a scheduled shift from the draft to published state. A scheduled shift contains
+ the latest draft shift details and current published shift details.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ **Read only** The Square-issued ID of the scheduled shift.
+ """
+
+ draft_shift_details: typing.Optional[ScheduledShiftDetails] = pydantic.Field(default=None)
+ """
+ The latest draft shift details for the scheduled shift. Draft shift details are used to
+ stage and manage shifts before publishing. This field is always present.
+ """
+
+ published_shift_details: typing.Optional[ScheduledShiftDetails] = pydantic.Field(default=None)
+ """
+ The current published (public) shift details for the scheduled shift. This field is
+ present only if the shift was published.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ **Read only** The current version of the scheduled shift, which is incremented with each update.
+ This field is used for [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control to ensure that requests don't overwrite data from another request.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the scheduled shift was created, in RFC 3339 format presented as UTC.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the scheduled shift was last updated, in RFC 3339 format presented as UTC.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/scheduled_shift_details.py b/src/square/types/scheduled_shift_details.py
new file mode 100644
index 00000000..a7983f98
--- /dev/null
+++ b/src/square/types/scheduled_shift_details.py
@@ -0,0 +1,70 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class ScheduledShiftDetails(UncheckedBaseModel):
+ """
+ Represents shift details for draft and published versions of a [scheduled shift](entity:ScheduledShift),
+ such as job ID, team member assignment, and start and end times.
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [team member](entity:TeamMember) scheduled for the shift.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [location](entity:Location) the shift is scheduled for.
+ """
+
+ job_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [job](entity:Job) the shift is scheduled for.
+ """
+
+ start_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The start time of the shift, in RFC 3339 format in the time zone +
+ offset of the shift location specified in `location_id`. Precision up to the minute
+ is respected; seconds are truncated.
+ """
+
+ end_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The end time for the shift, in RFC 3339 format in the time zone +
+ offset of the shift location specified in `location_id`. Precision up to the minute
+ is respected; seconds are truncated.
+ """
+
+ notes: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional notes for the shift.
+ """
+
+ is_deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the draft shift version is deleted. If set to `true` when the shift
+ is published, the entire scheduled shift (including the published shift) is deleted and
+ cannot be accessed using any endpoint.
+ """
+
+ timezone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time zone of the shift location, calculated based on the `location_id`. This field
+ is provided for convenience.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/scheduled_shift_filter.py b/src/square/types/scheduled_shift_filter.py
new file mode 100644
index 00000000..964db084
--- /dev/null
+++ b/src/square/types/scheduled_shift_filter.py
@@ -0,0 +1,84 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .scheduled_shift_filter_assignment_status import ScheduledShiftFilterAssignmentStatus
+from .scheduled_shift_filter_scheduled_shift_status import ScheduledShiftFilterScheduledShiftStatus
+from .scheduled_shift_workday import ScheduledShiftWorkday
+from .time_range import TimeRange
+
+
+class ScheduledShiftFilter(UncheckedBaseModel):
+ """
+ Defines filter criteria for a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts)
+ request. Multiple filters in a query are combined as an `AND` operation.
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Return shifts for the specified locations. When omitted, shifts for all
+ locations are returned. If needed, call [ListLocations](api-endpoint:Locations-ListLocations)
+ to get location IDs.
+ """
+
+ start: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ Return shifts whose `start_at` time is within the specified
+ time range (inclusive).
+ """
+
+ end: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ Return shifts whose `end_at` time is within the specified
+ time range (inclusive).
+ """
+
+ workday: typing.Optional[ScheduledShiftWorkday] = pydantic.Field(default=None)
+ """
+ Return shifts based on a workday date range.
+ """
+
+ team_member_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Return shifts assigned to specified team members. If needed, call
+ [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) to get team member IDs.
+
+ To return only the shifts assigned to the specified team members, include the
+ `assignment_status` filter in the query. Otherwise, all unassigned shifts are
+ returned along with shifts assigned to the specified team members.
+ """
+
+ assignment_status: typing.Optional[ScheduledShiftFilterAssignmentStatus] = pydantic.Field(default=None)
+ """
+ Return shifts based on whether a team member is assigned. A shift is
+ assigned if the `team_member_id` field is populated in the `draft_shift_details`
+ or `published_shift details` field of the shift.
+
+ To return only draft or published shifts, include the `scheduled_shift_statuses`
+ filter in the query.
+ See [ScheduledShiftFilterAssignmentStatus](#type-scheduledshiftfilterassignmentstatus) for possible values
+ """
+
+ scheduled_shift_statuses: typing.Optional[typing.List[ScheduledShiftFilterScheduledShiftStatus]] = pydantic.Field(
+ default=None
+ )
+ """
+ Return shifts based on the draft or published status of the shift.
+ A shift is published if the `published_shift_details` field is present.
+
+ Note that shifts with `draft_shift_details.is_deleted` set to `true` are ignored
+ with the `DRAFT` filter.
+ See [ScheduledShiftFilterScheduledShiftStatus](#type-scheduledshiftfilterscheduledshiftstatus) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/scheduled_shift_filter_assignment_status.py b/src/square/types/scheduled_shift_filter_assignment_status.py
new file mode 100644
index 00000000..975795e2
--- /dev/null
+++ b/src/square/types/scheduled_shift_filter_assignment_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ScheduledShiftFilterAssignmentStatus = typing.Union[typing.Literal["ASSIGNED", "UNASSIGNED"], typing.Any]
diff --git a/src/square/types/scheduled_shift_filter_scheduled_shift_status.py b/src/square/types/scheduled_shift_filter_scheduled_shift_status.py
new file mode 100644
index 00000000..ee721b58
--- /dev/null
+++ b/src/square/types/scheduled_shift_filter_scheduled_shift_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ScheduledShiftFilterScheduledShiftStatus = typing.Union[typing.Literal["DRAFT", "PUBLISHED"], typing.Any]
diff --git a/src/square/types/scheduled_shift_notification_audience.py b/src/square/types/scheduled_shift_notification_audience.py
new file mode 100644
index 00000000..9ee4eaa3
--- /dev/null
+++ b/src/square/types/scheduled_shift_notification_audience.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ScheduledShiftNotificationAudience = typing.Union[typing.Literal["ALL", "AFFECTED", "NONE"], typing.Any]
diff --git a/src/square/types/scheduled_shift_query.py b/src/square/types/scheduled_shift_query.py
new file mode 100644
index 00000000..ebf8ede1
--- /dev/null
+++ b/src/square/types/scheduled_shift_query.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .scheduled_shift_filter import ScheduledShiftFilter
+from .scheduled_shift_sort import ScheduledShiftSort
+
+
+class ScheduledShiftQuery(UncheckedBaseModel):
+ """
+ Represents filter and sort criteria for the `query` field in a
+ [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request.
+ """
+
+ filter: typing.Optional[ScheduledShiftFilter] = pydantic.Field(default=None)
+ """
+ Filtering options for the query.
+ """
+
+ sort: typing.Optional[ScheduledShiftSort] = pydantic.Field(default=None)
+ """
+ Sorting options for the query.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/scheduled_shift_sort.py b/src/square/types/scheduled_shift_sort.py
new file mode 100644
index 00000000..0fce7b00
--- /dev/null
+++ b/src/square/types/scheduled_shift_sort.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .scheduled_shift_sort_field import ScheduledShiftSortField
+from .sort_order import SortOrder
+
+
+class ScheduledShiftSort(UncheckedBaseModel):
+ """
+ Defines sort criteria for a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts)
+ request.
+ """
+
+ field: typing.Optional[ScheduledShiftSortField] = pydantic.Field(default=None)
+ """
+ The field to sort on. The default value is `START_AT`.
+ See [ScheduledShiftSortField](#type-scheduledshiftsortfield) for possible values
+ """
+
+ order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The order in which results are returned. The default value is `ASC`.
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/scheduled_shift_sort_field.py b/src/square/types/scheduled_shift_sort_field.py
new file mode 100644
index 00000000..2abcf87a
--- /dev/null
+++ b/src/square/types/scheduled_shift_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ScheduledShiftSortField = typing.Union[typing.Literal["START_AT", "END_AT", "CREATED_AT", "UPDATED_AT"], typing.Any]
diff --git a/src/square/types/scheduled_shift_workday.py b/src/square/types/scheduled_shift_workday.py
new file mode 100644
index 00000000..cb6c67df
--- /dev/null
+++ b/src/square/types/scheduled_shift_workday.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .date_range import DateRange
+from .scheduled_shift_workday_matcher import ScheduledShiftWorkdayMatcher
+
+
+class ScheduledShiftWorkday(UncheckedBaseModel):
+ """
+ A `ScheduledShift` search query filter parameter that sets a range of days that
+ a `Shift` must start or end in before passing the filter condition.
+ """
+
+ date_range: typing.Optional[DateRange] = pydantic.Field(default=None)
+ """
+ Dates for fetching the scheduled shifts.
+ """
+
+ match_scheduled_shifts_by: typing.Optional[ScheduledShiftWorkdayMatcher] = pydantic.Field(default=None)
+ """
+ The strategy on which the dates are applied.
+ See [ScheduledShiftWorkdayMatcher](#type-scheduledshiftworkdaymatcher) for possible values
+ """
+
+ default_timezone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Location-specific timezones convert workdays to datetime filters.
+ Every location included in the query must have a timezone or this field
+ must be provided as a fallback. Format: the IANA timezone database
+ identifier for the relevant timezone.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/scheduled_shift_workday_matcher.py b/src/square/types/scheduled_shift_workday_matcher.py
new file mode 100644
index 00000000..2f541c7f
--- /dev/null
+++ b/src/square/types/scheduled_shift_workday_matcher.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ScheduledShiftWorkdayMatcher = typing.Union[typing.Literal["START_AT", "END_AT", "INTERSECTION"], typing.Any]
diff --git a/src/square/types/search_availability_filter.py b/src/square/types/search_availability_filter.py
new file mode 100644
index 00000000..a5199b03
--- /dev/null
+++ b/src/square/types/search_availability_filter.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .segment_filter import SegmentFilter
+from .time_range import TimeRange
+
+
+class SearchAvailabilityFilter(UncheckedBaseModel):
+ """
+ A query filter to search for buyer-accessible availabilities by.
+ """
+
+ start_at_range: TimeRange = pydantic.Field()
+ """
+ The query expression to search for buy-accessible availabilities with their starting times falling within the specified time range.
+ The time range must be at least 24 hours and at most 32 days long.
+ For waitlist availabilities, the time range can be 0 or more up to 367 days long.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The query expression to search for buyer-accessible availabilities with their location IDs matching the specified location ID.
+ This query expression cannot be set if `booking_id` is set.
+ """
+
+ segment_filters: typing.Optional[typing.List[SegmentFilter]] = pydantic.Field(default=None)
+ """
+ The query expression to search for buyer-accessible availabilities matching the specified list of segment filters.
+ If the size of the `segment_filters` list is `n`, the search returns availabilities with `n` segments per availability.
+
+ This query expression cannot be set if `booking_id` is set.
+ """
+
+ booking_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The query expression to search for buyer-accessible availabilities for an existing booking by matching the specified `booking_id` value.
+ This is commonly used to reschedule an appointment.
+ If this expression is set, the `location_id` and `segment_filters` expressions cannot be set.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_availability_query.py b/src/square/types/search_availability_query.py
new file mode 100644
index 00000000..687927ff
--- /dev/null
+++ b/src/square/types/search_availability_query.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .search_availability_filter import SearchAvailabilityFilter
+
+
+class SearchAvailabilityQuery(UncheckedBaseModel):
+ """
+ The query used to search for buyer-accessible availabilities of bookings.
+ """
+
+ filter: SearchAvailabilityFilter = pydantic.Field()
+ """
+ The query filter to search for buyer-accessible availabilities of existing bookings.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_availability_response.py b/src/square/types/search_availability_response.py
new file mode 100644
index 00000000..1caf0388
--- /dev/null
+++ b/src/square/types/search_availability_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .availability import Availability
+from .error import Error
+
+
+class SearchAvailabilityResponse(UncheckedBaseModel):
+ availabilities: typing.Optional[typing.List[Availability]] = pydantic.Field(default=None)
+ """
+ List of appointment slots available for booking.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_catalog_items_request_stock_level.py b/src/square/types/search_catalog_items_request_stock_level.py
new file mode 100644
index 00000000..ead5bc6a
--- /dev/null
+++ b/src/square/types/search_catalog_items_request_stock_level.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SearchCatalogItemsRequestStockLevel = typing.Union[typing.Literal["OUT", "LOW"], typing.Any]
diff --git a/src/square/types/search_catalog_items_response.py b/src/square/types/search_catalog_items_response.py
new file mode 100644
index 00000000..5abb5514
--- /dev/null
+++ b/src/square/types/search_catalog_items_response.py
@@ -0,0 +1,69 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class SearchCatalogItemsResponse(UncheckedBaseModel):
+ """
+ Defines the response body returned from the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ items: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ Returned items matching the specified query expressions.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Pagination token used in the next request to return more of the search result.
+ """
+
+ matched_variation_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Ids of returned item variations matching the specified query expression.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ SearchCatalogItemsResponse,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/search_catalog_objects_response.py b/src/square/types/search_catalog_objects_response.py
new file mode 100644
index 00000000..6f5bebc6
--- /dev/null
+++ b/src/square/types/search_catalog_objects_response.py
@@ -0,0 +1,72 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class SearchCatalogObjectsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If unset, this is the final response.
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
+
+ objects: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ The CatalogObjects returned.
+ """
+
+ related_objects: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
+ """
+ A list of CatalogObjects referenced by the objects in the `objects` field.
+ """
+
+ latest_time: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When the associated product catalog was last updated. Will
+ match the value for `end_time` or `cursor` if either field is included in the `SearchCatalog` request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ SearchCatalogObjectsResponse,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/search_customers_response.py b/src/square/types/search_customers_response.py
new file mode 100644
index 00000000..62cb756a
--- /dev/null
+++ b/src/square/types/search_customers_response.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer import Customer
+from .error import Error
+
+
+class SearchCustomersResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the `SearchCustomers` endpoint.
+
+ Either `errors` or `customers` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ customers: typing.Optional[typing.List[Customer]] = pydantic.Field(default=None)
+ """
+ The customer profiles that match the search query. If any search condition is not met, the result is an empty object (`{}`).
+ Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`)
+ are included in the response.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A pagination cursor that can be used during subsequent calls
+ to `SearchCustomers` to retrieve the next set of results associated
+ with the original query. Pagination cursors are only present when
+ a request succeeds and additional results are available.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The total count of customers associated with the Square account that match the search query. Only customer profiles with
+ public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is
+ present only if `count` is set to `true` in the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_events_filter.py b/src/square/types/search_events_filter.py
new file mode 100644
index 00000000..df8abc0a
--- /dev/null
+++ b/src/square/types/search_events_filter.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .time_range import TimeRange
+
+
+class SearchEventsFilter(UncheckedBaseModel):
+ """
+ Criteria to filter events by.
+ """
+
+ event_types: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Filter events by event types.
+ """
+
+ merchant_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Filter events by merchant.
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Filter events by location.
+ """
+
+ created_at: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ Filter events by when they were created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_events_query.py b/src/square/types/search_events_query.py
new file mode 100644
index 00000000..e5d2714a
--- /dev/null
+++ b/src/square/types/search_events_query.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .search_events_filter import SearchEventsFilter
+from .search_events_sort import SearchEventsSort
+
+
+class SearchEventsQuery(UncheckedBaseModel):
+ """
+ Contains query criteria for the search.
+ """
+
+ filter: typing.Optional[SearchEventsFilter] = pydantic.Field(default=None)
+ """
+ Criteria to filter events by.
+ """
+
+ sort: typing.Optional[SearchEventsSort] = pydantic.Field(default=None)
+ """
+ Criteria to sort events by.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_events_response.py b/src/square/types/search_events_response.py
new file mode 100644
index 00000000..60de5720
--- /dev/null
+++ b/src/square/types/search_events_response.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .event import Event
+from .event_metadata import EventMetadata
+
+
+class SearchEventsResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [SearchEvents](api-endpoint:Events-SearchEvents) endpoint.
+
+ Note: if there are errors processing the request, the events field will not be
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ events: typing.Optional[typing.List[Event]] = pydantic.Field(default=None)
+ """
+ The list of [Event](entity:Event)s returned by the search.
+ """
+
+ metadata: typing.Optional[typing.List[EventMetadata]] = pydantic.Field(default=None)
+ """
+ Contains the metadata of an event. For more information, see [Event](entity:Event).
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When a response is truncated, it includes a cursor that you can use in a subsequent request to fetch the next set of events. If empty, this is the final response.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_events_sort.py b/src/square/types/search_events_sort.py
new file mode 100644
index 00000000..c19d2a6f
--- /dev/null
+++ b/src/square/types/search_events_sort.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .search_events_sort_field import SearchEventsSortField
+from .sort_order import SortOrder
+
+
+class SearchEventsSort(UncheckedBaseModel):
+ """
+ Criteria to sort events by.
+ """
+
+ field: typing.Optional[SearchEventsSortField] = pydantic.Field(default=None)
+ """
+ Sort events by event types.
+ See [SearchEventsSortField](#type-searcheventssortfield) for possible values
+ """
+
+ order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The order to use for sorting the events.
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_events_sort_field.py b/src/square/types/search_events_sort_field.py
new file mode 100644
index 00000000..3d052fc7
--- /dev/null
+++ b/src/square/types/search_events_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SearchEventsSortField = typing.Literal["DEFAULT"]
diff --git a/src/square/types/search_invoices_response.py b/src/square/types/search_invoices_response.py
new file mode 100644
index 00000000..f1667c80
--- /dev/null
+++ b/src/square/types/search_invoices_response.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .invoice import Invoice
+
+
+class SearchInvoicesResponse(UncheckedBaseModel):
+ """
+ Describes a `SearchInvoices` response.
+ """
+
+ invoices: typing.Optional[typing.List[Invoice]] = pydantic.Field(default=None)
+ """
+ The list of invoices returned by the search.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When a response is truncated, it includes a cursor that you can use in a
+ subsequent request to fetch the next set of invoices. If empty, this is the final
+ response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_loyalty_accounts_request_loyalty_account_query.py b/src/square/types/search_loyalty_accounts_request_loyalty_account_query.py
new file mode 100644
index 00000000..8569862e
--- /dev/null
+++ b/src/square/types/search_loyalty_accounts_request_loyalty_account_query.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_account_mapping import LoyaltyAccountMapping
+
+
+class SearchLoyaltyAccountsRequestLoyaltyAccountQuery(UncheckedBaseModel):
+ """
+ The search criteria for the loyalty accounts.
+ """
+
+ mappings: typing.Optional[typing.List[LoyaltyAccountMapping]] = pydantic.Field(default=None)
+ """
+ The set of mappings to use in the loyalty account search.
+
+ This cannot be combined with `customer_ids`.
+
+ Max: 30 mappings
+ """
+
+ customer_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The set of customer IDs to use in the loyalty account search.
+
+ This cannot be combined with `mappings`.
+
+ Max: 30 customer IDs
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_loyalty_accounts_response.py b/src/square/types/search_loyalty_accounts_response.py
new file mode 100644
index 00000000..ec5c12b8
--- /dev/null
+++ b/src/square/types/search_loyalty_accounts_response.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_account import LoyaltyAccount
+
+
+class SearchLoyaltyAccountsResponse(UncheckedBaseModel):
+ """
+ A response that includes loyalty accounts that satisfy the search criteria.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ loyalty_accounts: typing.Optional[typing.List[LoyaltyAccount]] = pydantic.Field(default=None)
+ """
+ The loyalty accounts that met the search criteria,
+ in order of creation date.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to use in a subsequent
+ request. If empty, this is the final response.
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_loyalty_events_response.py b/src/square/types/search_loyalty_events_response.py
new file mode 100644
index 00000000..8d829383
--- /dev/null
+++ b/src/square/types/search_loyalty_events_response.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_event import LoyaltyEvent
+
+
+class SearchLoyaltyEventsResponse(UncheckedBaseModel):
+ """
+ A response that contains loyalty events that satisfy the search
+ criteria, in order by the `created_at` date.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ events: typing.Optional[typing.List[LoyaltyEvent]] = pydantic.Field(default=None)
+ """
+ The loyalty events that satisfy the search criteria.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent
+ request. If empty, this is the final response.
+ For more information,
+ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_loyalty_rewards_request_loyalty_reward_query.py b/src/square/types/search_loyalty_rewards_request_loyalty_reward_query.py
new file mode 100644
index 00000000..9511036d
--- /dev/null
+++ b/src/square/types/search_loyalty_rewards_request_loyalty_reward_query.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .loyalty_reward_status import LoyaltyRewardStatus
+
+
+class SearchLoyaltyRewardsRequestLoyaltyRewardQuery(UncheckedBaseModel):
+ """
+ The set of search requirements.
+ """
+
+ loyalty_account_id: str = pydantic.Field()
+ """
+ The ID of the [loyalty account](entity:LoyaltyAccount) to which the loyalty reward belongs.
+ """
+
+ status: typing.Optional[LoyaltyRewardStatus] = pydantic.Field(default=None)
+ """
+ The status of the loyalty reward.
+ See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_loyalty_rewards_response.py b/src/square/types/search_loyalty_rewards_response.py
new file mode 100644
index 00000000..4b99eb31
--- /dev/null
+++ b/src/square/types/search_loyalty_rewards_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .loyalty_reward import LoyaltyReward
+
+
+class SearchLoyaltyRewardsResponse(UncheckedBaseModel):
+ """
+ A response that includes the loyalty rewards satisfying the search criteria.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ rewards: typing.Optional[typing.List[LoyaltyReward]] = pydantic.Field(default=None)
+ """
+ The loyalty rewards that satisfy the search criteria.
+ These are returned in descending order by `updated_at`.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent
+ request. If empty, this is the final response.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_orders_customer_filter.py b/src/square/types/search_orders_customer_filter.py
new file mode 100644
index 00000000..5517c7ae
--- /dev/null
+++ b/src/square/types/search_orders_customer_filter.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class SearchOrdersCustomerFilter(UncheckedBaseModel):
+ """
+ A filter based on the order `customer_id` and any tender `customer_id`
+ associated with the order. It does not filter based on the
+ [FulfillmentRecipient](entity:FulfillmentRecipient) `customer_id`.
+ """
+
+ customer_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of customer IDs to filter by.
+
+ Max: 10 customer ids.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_orders_date_time_filter.py b/src/square/types/search_orders_date_time_filter.py
new file mode 100644
index 00000000..69006eb1
--- /dev/null
+++ b/src/square/types/search_orders_date_time_filter.py
@@ -0,0 +1,57 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .time_range import TimeRange
+
+
+class SearchOrdersDateTimeFilter(UncheckedBaseModel):
+ """
+ Filter for `Order` objects based on whether their `CREATED_AT`,
+ `CLOSED_AT`, or `UPDATED_AT` timestamps fall within a specified time range.
+ You can specify the time range and which timestamp to filter for. You can filter
+ for only one time range at a time.
+
+ For each time range, the start time and end time are inclusive. If the end time
+ is absent, it defaults to the time of the first request for the cursor.
+
+ __Important:__ If you use the `DateTimeFilter` in a `SearchOrders` query,
+ you must set the `sort_field` in [OrdersSort](entity:SearchOrdersSort)
+ to the same field you filter for. For example, if you set the `CLOSED_AT` field
+ in `DateTimeFilter`, you must set the `sort_field` in `SearchOrdersSort` to
+ `CLOSED_AT`. Otherwise, `SearchOrders` throws an error.
+ [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range)
+ """
+
+ created_at: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ The time range for filtering on the `created_at` timestamp. If you use this
+ value, you must set the `sort_field` in the `OrdersSearchSort` object to
+ `CREATED_AT`.
+ """
+
+ updated_at: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ The time range for filtering on the `updated_at` timestamp. If you use this
+ value, you must set the `sort_field` in the `OrdersSearchSort` object to
+ `UPDATED_AT`.
+ """
+
+ closed_at: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ The time range for filtering on the `closed_at` timestamp. If you use this
+ value, you must set the `sort_field` in the `OrdersSearchSort` object to
+ `CLOSED_AT`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_orders_filter.py b/src/square/types/search_orders_filter.py
new file mode 100644
index 00000000..d7a50ab7
--- /dev/null
+++ b/src/square/types/search_orders_filter.py
@@ -0,0 +1,57 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .search_orders_customer_filter import SearchOrdersCustomerFilter
+from .search_orders_date_time_filter import SearchOrdersDateTimeFilter
+from .search_orders_fulfillment_filter import SearchOrdersFulfillmentFilter
+from .search_orders_source_filter import SearchOrdersSourceFilter
+from .search_orders_state_filter import SearchOrdersStateFilter
+
+
+class SearchOrdersFilter(UncheckedBaseModel):
+ """
+ Filtering criteria to use for a `SearchOrders` request. Multiple filters
+ are ANDed together.
+ """
+
+ state_filter: typing.Optional[SearchOrdersStateFilter] = pydantic.Field(default=None)
+ """
+ Filter by [OrderState](entity:OrderState).
+ """
+
+ date_time_filter: typing.Optional[SearchOrdersDateTimeFilter] = pydantic.Field(default=None)
+ """
+ Filter for results within a time range.
+
+ __Important:__ If you filter for orders by time range, you must set `SearchOrdersSort`
+ to sort by the same field.
+ [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range)
+ """
+
+ fulfillment_filter: typing.Optional[SearchOrdersFulfillmentFilter] = pydantic.Field(default=None)
+ """
+ Filter by the fulfillment type or state.
+ """
+
+ source_filter: typing.Optional[SearchOrdersSourceFilter] = pydantic.Field(default=None)
+ """
+ Filter by the source of the order.
+ """
+
+ customer_filter: typing.Optional[SearchOrdersCustomerFilter] = pydantic.Field(default=None)
+ """
+ Filter by customers associated with the order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_orders_fulfillment_filter.py b/src/square/types/search_orders_fulfillment_filter.py
new file mode 100644
index 00000000..c0bff795
--- /dev/null
+++ b/src/square/types/search_orders_fulfillment_filter.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .fulfillment_state import FulfillmentState
+from .fulfillment_type import FulfillmentType
+
+
+class SearchOrdersFulfillmentFilter(UncheckedBaseModel):
+ """
+ Filter based on [order fulfillment](entity:Fulfillment) information.
+ """
+
+ fulfillment_types: typing.Optional[typing.List[FulfillmentType]] = pydantic.Field(default=None)
+ """
+ A list of [fulfillment types](entity:FulfillmentType) to filter
+ for. The list returns orders if any of its fulfillments match any of the fulfillment types
+ listed in this field.
+ See [FulfillmentType](#type-fulfillmenttype) for possible values
+ """
+
+ fulfillment_states: typing.Optional[typing.List[FulfillmentState]] = pydantic.Field(default=None)
+ """
+ A list of [fulfillment states](entity:FulfillmentState) to filter
+ for. The list returns orders if any of its fulfillments match any of the
+ fulfillment states listed in this field.
+ See [FulfillmentState](#type-fulfillmentstate) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_orders_query.py b/src/square/types/search_orders_query.py
new file mode 100644
index 00000000..d1c46564
--- /dev/null
+++ b/src/square/types/search_orders_query.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .search_orders_filter import SearchOrdersFilter
+from .search_orders_sort import SearchOrdersSort
+
+
+class SearchOrdersQuery(UncheckedBaseModel):
+ """
+ Contains query criteria for the search.
+ """
+
+ filter: typing.Optional[SearchOrdersFilter] = pydantic.Field(default=None)
+ """
+ Criteria to filter results by.
+ """
+
+ sort: typing.Optional[SearchOrdersSort] = pydantic.Field(default=None)
+ """
+ Criteria to sort results by.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_orders_response.py b/src/square/types/search_orders_response.py
new file mode 100644
index 00000000..6ed1bed1
--- /dev/null
+++ b/src/square/types/search_orders_response.py
@@ -0,0 +1,51 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .order import Order
+from .order_entry import OrderEntry
+
+
+class SearchOrdersResponse(UncheckedBaseModel):
+ """
+ Either the `order_entries` or `orders` field is set, depending on whether
+ `return_entries` is set on the [SearchOrdersRequest](api-endpoint:Orders-SearchOrders).
+ """
+
+ order_entries: typing.Optional[typing.List[OrderEntry]] = pydantic.Field(default=None)
+ """
+ A list of [OrderEntries](entity:OrderEntry) that fit the query
+ conditions. The list is populated only if `return_entries` is set to `true` in the request.
+ """
+
+ orders: typing.Optional[typing.List[Order]] = pydantic.Field(default=None)
+ """
+ A list of
+ [Order](entity:Order) objects that match the query conditions. The list is populated only if
+ `return_entries` is set to `false` in the request.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ [Errors](entity:Error) encountered during the search.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_orders_sort.py b/src/square/types/search_orders_sort.py
new file mode 100644
index 00000000..7aeef304
--- /dev/null
+++ b/src/square/types/search_orders_sort.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .search_orders_sort_field import SearchOrdersSortField
+from .sort_order import SortOrder
+
+
+class SearchOrdersSort(UncheckedBaseModel):
+ """
+ Sorting criteria for a `SearchOrders` request. Results can only be sorted
+ by a timestamp field.
+ """
+
+ sort_field: SearchOrdersSortField = pydantic.Field()
+ """
+ The field to sort by.
+
+ __Important:__ When using a [DateTimeFilter](entity:SearchOrdersFilter),
+ `sort_field` must match the timestamp field that the `DateTimeFilter` uses to
+ filter. For example, if you set your `sort_field` to `CLOSED_AT` and you use a
+ `DateTimeFilter`, your `DateTimeFilter` must filter for orders by their `CLOSED_AT` date.
+ If this field does not match the timestamp field in `DateTimeFilter`,
+ `SearchOrders` returns an error.
+
+ Default: `CREATED_AT`.
+ See [SearchOrdersSortField](#type-searchorderssortfield) for possible values
+ """
+
+ sort_order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The chronological order in which results are returned. Defaults to `DESC`.
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_orders_sort_field.py b/src/square/types/search_orders_sort_field.py
new file mode 100644
index 00000000..1e912601
--- /dev/null
+++ b/src/square/types/search_orders_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SearchOrdersSortField = typing.Union[typing.Literal["CREATED_AT", "UPDATED_AT", "CLOSED_AT"], typing.Any]
diff --git a/src/square/types/search_orders_source_filter.py b/src/square/types/search_orders_source_filter.py
new file mode 100644
index 00000000..4dd471bf
--- /dev/null
+++ b/src/square/types/search_orders_source_filter.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class SearchOrdersSourceFilter(UncheckedBaseModel):
+ """
+ A filter based on order `source` information.
+ """
+
+ source_names: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Filters by the [Source](entity:OrderSource) `name`. The filter returns any orders
+ with a `source.name` that matches any of the listed source names.
+
+ Max: 10 source names.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_orders_state_filter.py b/src/square/types/search_orders_state_filter.py
new file mode 100644
index 00000000..ed764aa5
--- /dev/null
+++ b/src/square/types/search_orders_state_filter.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .order_state import OrderState
+
+
+class SearchOrdersStateFilter(UncheckedBaseModel):
+ """
+ Filter by the current order `state`.
+ """
+
+ states: typing.List[OrderState] = pydantic.Field()
+ """
+ States to filter for.
+ See [OrderState](#type-orderstate) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_scheduled_shifts_response.py b/src/square/types/search_scheduled_shifts_response.py
new file mode 100644
index 00000000..ae173696
--- /dev/null
+++ b/src/square/types/search_scheduled_shifts_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .scheduled_shift import ScheduledShift
+
+
+class SearchScheduledShiftsResponse(UncheckedBaseModel):
+ """
+ Represents a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) response.
+ Either `scheduled_shifts` or `errors` is present in the response.
+ """
+
+ scheduled_shifts: typing.Optional[typing.List[ScheduledShift]] = pydantic.Field(default=None)
+ """
+ A paginated list of scheduled shifts that match the query conditions.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor used to retrieve the next page of results. This field is present
+ only if additional results are available.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_shifts_response.py b/src/square/types/search_shifts_response.py
new file mode 100644
index 00000000..5ad9c840
--- /dev/null
+++ b/src/square/types/search_shifts_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .shift import Shift
+
+
+class SearchShiftsResponse(UncheckedBaseModel):
+ """
+ The response to a request for `Shift` objects. The response contains
+ the requested `Shift` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ shifts: typing.Optional[typing.List[Shift]] = pydantic.Field(default=None)
+ """
+ Shifts.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An opaque cursor for fetching the next page.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_subscriptions_filter.py b/src/square/types/search_subscriptions_filter.py
new file mode 100644
index 00000000..e166c156
--- /dev/null
+++ b/src/square/types/search_subscriptions_filter.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class SearchSubscriptionsFilter(UncheckedBaseModel):
+ """
+ Represents a set of query expressions (filters) to narrow the scope of targeted subscriptions returned by
+ the [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) endpoint.
+ """
+
+ customer_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A filter to select subscriptions based on the subscribing customer IDs.
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A filter to select subscriptions based on the location.
+ """
+
+ source_names: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A filter to select subscriptions based on the source application.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_subscriptions_query.py b/src/square/types/search_subscriptions_query.py
new file mode 100644
index 00000000..7cabaa68
--- /dev/null
+++ b/src/square/types/search_subscriptions_query.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .search_subscriptions_filter import SearchSubscriptionsFilter
+
+
+class SearchSubscriptionsQuery(UncheckedBaseModel):
+ """
+ Represents a query, consisting of specified query expressions, used to search for subscriptions.
+ """
+
+ filter: typing.Optional[SearchSubscriptionsFilter] = pydantic.Field(default=None)
+ """
+ A list of query expressions.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_subscriptions_response.py b/src/square/types/search_subscriptions_response.py
new file mode 100644
index 00000000..725134ff
--- /dev/null
+++ b/src/square/types/search_subscriptions_response.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription import Subscription
+
+
+class SearchSubscriptionsResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response from the
+ [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscriptions: typing.Optional[typing.List[Subscription]] = pydantic.Field(default=None)
+ """
+ The subscriptions matching the specified query expressions.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ When the total number of resulting subscription exceeds the limit of a paged response,
+ the response includes a cursor for you to use in a subsequent request to fetch the next set of results.
+ If the cursor is unset, the response contains the last page of the results.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_team_members_filter.py b/src/square/types/search_team_members_filter.py
new file mode 100644
index 00000000..be85906a
--- /dev/null
+++ b/src/square/types/search_team_members_filter.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member_status import TeamMemberStatus
+
+
+class SearchTeamMembersFilter(UncheckedBaseModel):
+ """
+ Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied
+ between the individual fields, and `OR` logic is applied within list-based fields.
+ For example, setting this filter value:
+ ```
+ filter = (locations_ids = ["A", "B"], status = ACTIVE)
+ ```
+ returns only active team members assigned to either location "A" or "B".
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ When present, filters by team members assigned to the specified locations.
+ When empty, includes team members assigned to any location.
+ """
+
+ status: typing.Optional[TeamMemberStatus] = pydantic.Field(default=None)
+ """
+ When present, filters by team members who match the given status.
+ When empty, includes team members of all statuses.
+ See [TeamMemberStatus](#type-teammemberstatus) for possible values
+ """
+
+ is_owner: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ When present and set to true, returns the team member who is the owner of the Square account.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_team_members_query.py b/src/square/types/search_team_members_query.py
new file mode 100644
index 00000000..f74d92bf
--- /dev/null
+++ b/src/square/types/search_team_members_query.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .search_team_members_filter import SearchTeamMembersFilter
+
+
+class SearchTeamMembersQuery(UncheckedBaseModel):
+ """
+ Represents the parameters in a search for `TeamMember` objects.
+ """
+
+ filter: typing.Optional[SearchTeamMembersFilter] = pydantic.Field(default=None)
+ """
+ The options to filter by.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_team_members_response.py b/src/square/types/search_team_members_response.py
new file mode 100644
index 00000000..c59d62ee
--- /dev/null
+++ b/src/square/types/search_team_members_response.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .team_member import TeamMember
+
+
+class SearchTeamMembersResponse(UncheckedBaseModel):
+ """
+ Represents a response from a search request containing a filtered list of `TeamMember` objects.
+ """
+
+ team_members: typing.Optional[typing.List[TeamMember]] = pydantic.Field(default=None)
+ """
+ The filtered list of `TeamMember` objects.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The opaque cursor for fetching the next page. For more information, see
+ [pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_terminal_actions_response.py b/src/square/types/search_terminal_actions_response.py
new file mode 100644
index 00000000..97efa277
--- /dev/null
+++ b/src/square/types/search_terminal_actions_response.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_action import TerminalAction
+
+
+class SearchTerminalActionsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ action: typing.Optional[typing.List[TerminalAction]] = pydantic.Field(default=None)
+ """
+ The requested search result of `TerminalAction`s.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more
+ information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_terminal_checkouts_response.py b/src/square/types/search_terminal_checkouts_response.py
new file mode 100644
index 00000000..19077baa
--- /dev/null
+++ b/src/square/types/search_terminal_checkouts_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_checkout import TerminalCheckout
+
+
+class SearchTerminalCheckoutsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ checkouts: typing.Optional[typing.List[TerminalCheckout]] = pydantic.Field(default=None)
+ """
+ The requested search result of `TerminalCheckout` objects.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_terminal_refunds_response.py b/src/square/types/search_terminal_refunds_response.py
new file mode 100644
index 00000000..7d3d6d21
--- /dev/null
+++ b/src/square/types/search_terminal_refunds_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .terminal_refund import TerminalRefund
+
+
+class SearchTerminalRefundsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ refunds: typing.Optional[typing.List[TerminalRefund]] = pydantic.Field(default=None)
+ """
+ The requested search result of `TerminalRefund` objects.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If empty,
+ this is the final response.
+
+ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_timecards_response.py b/src/square/types/search_timecards_response.py
new file mode 100644
index 00000000..3f34141c
--- /dev/null
+++ b/src/square/types/search_timecards_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .timecard import Timecard
+
+
+class SearchTimecardsResponse(UncheckedBaseModel):
+ """
+ The response to a request for `Timecard` objects. The response contains
+ the requested `Timecard` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ timecards: typing.Optional[typing.List[Timecard]] = pydantic.Field(default=None)
+ """
+ Timecards.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An opaque cursor for fetching the next page.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_transfer_orders_response.py b/src/square/types/search_transfer_orders_response.py
new file mode 100644
index 00000000..33bbda2a
--- /dev/null
+++ b/src/square/types/search_transfer_orders_response.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .transfer_order import TransferOrder
+
+
+class SearchTransferOrdersResponse(UncheckedBaseModel):
+ """
+ Response for searching transfer orders
+ """
+
+ transfer_orders: typing.Optional[typing.List[TransferOrder]] = pydantic.Field(default=None)
+ """
+ List of transfer orders matching the search criteria
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Pagination cursor for fetching the next page of results
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_vendors_request_filter.py b/src/square/types/search_vendors_request_filter.py
new file mode 100644
index 00000000..99752ffc
--- /dev/null
+++ b/src/square/types/search_vendors_request_filter.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .vendor_status import VendorStatus
+
+
+class SearchVendorsRequestFilter(UncheckedBaseModel):
+ """
+ Defines supported query expressions to search for vendors by.
+ """
+
+ name: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The names of the [Vendor](entity:Vendor) objects to retrieve.
+ """
+
+ status: typing.Optional[typing.List[VendorStatus]] = pydantic.Field(default=None)
+ """
+ The statuses of the [Vendor](entity:Vendor) objects to retrieve.
+ See [VendorStatus](#type-vendorstatus) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_vendors_request_sort.py b/src/square/types/search_vendors_request_sort.py
new file mode 100644
index 00000000..e272eb50
--- /dev/null
+++ b/src/square/types/search_vendors_request_sort.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .search_vendors_request_sort_field import SearchVendorsRequestSortField
+from .sort_order import SortOrder
+
+
+class SearchVendorsRequestSort(UncheckedBaseModel):
+ """
+ Defines a sorter used to sort results from [SearchVendors](api-endpoint:Vendors-SearchVendors).
+ """
+
+ field: typing.Optional[SearchVendorsRequestSortField] = pydantic.Field(default=None)
+ """
+ Specifies the sort key to sort the returned vendors.
+ See [Field](#type-field) for possible values
+ """
+
+ order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ Specifies the sort order for the returned vendors.
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/search_vendors_request_sort_field.py b/src/square/types/search_vendors_request_sort_field.py
new file mode 100644
index 00000000..626d5cd3
--- /dev/null
+++ b/src/square/types/search_vendors_request_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SearchVendorsRequestSortField = typing.Union[typing.Literal["NAME", "CREATED_AT"], typing.Any]
diff --git a/src/square/types/search_vendors_response.py b/src/square/types/search_vendors_response.py
new file mode 100644
index 00000000..af0d5c83
--- /dev/null
+++ b/src/square/types/search_vendors_response.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .vendor import Vendor
+
+
+class SearchVendorsResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [SearchVendors](api-endpoint:Vendors-SearchVendors).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ vendors: typing.Optional[typing.List[Vendor]] = pydantic.Field(default=None)
+ """
+ The [Vendor](entity:Vendor) objects matching the specified search filter.
+ """
+
+ cursor: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pagination cursor to be used in a subsequent request. If unset,
+ this is the final response.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/segment.py b/src/square/types/segment.py
new file mode 100644
index 00000000..05342ee2
--- /dev/null
+++ b/src/square/types/segment.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class Segment(UncheckedBaseModel):
+ name: str
+ title: str
+ description: typing.Optional[str] = None
+ short_title: typing_extensions.Annotated[str, FieldMetadata(alias="shortTitle"), pydantic.Field(alias="shortTitle")]
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/segment_filter.py b/src/square/types/segment_filter.py
new file mode 100644
index 00000000..f4de1af3
--- /dev/null
+++ b/src/square/types/segment_filter.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .filter_value import FilterValue
+
+
+class SegmentFilter(UncheckedBaseModel):
+ """
+ A query filter to search for buyer-accessible appointment segments by.
+ """
+
+ service_variation_id: str = pydantic.Field()
+ """
+ The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment.
+ """
+
+ team_member_id_filter: typing.Optional[FilterValue] = pydantic.Field(default=None)
+ """
+ A query filter to search for buyer-accessible appointment segments with service-providing team members matching the specified list of team member IDs. Supported query expressions are
+ - `ANY`: return the appointment segments with team members whose IDs match any member in this list.
+ - `NONE`: return the appointment segments with team members whose IDs are not in this list.
+ - `ALL`: not supported.
+
+ When no expression is specified, any service-providing team member is eligible to fulfill the Booking.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/select_option.py b/src/square/types/select_option.py
new file mode 100644
index 00000000..a4a8bad3
--- /dev/null
+++ b/src/square/types/select_option.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class SelectOption(UncheckedBaseModel):
+ reference_id: str = pydantic.Field()
+ """
+ The reference id for the option.
+ """
+
+ title: str = pydantic.Field()
+ """
+ The title text that displays in the select option button.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/select_options.py b/src/square/types/select_options.py
new file mode 100644
index 00000000..2ab14535
--- /dev/null
+++ b/src/square/types/select_options.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .select_option import SelectOption
+
+
+class SelectOptions(UncheckedBaseModel):
+ title: str = pydantic.Field()
+ """
+ The title text to display in the select flow on the Terminal.
+ """
+
+ body: str = pydantic.Field()
+ """
+ The body text to display in the select flow on the Terminal.
+ """
+
+ options: typing.List[SelectOption] = pydantic.Field()
+ """
+ Represents the buttons/options that should be displayed in the select flow on the Terminal.
+ """
+
+ selected_option: typing.Optional[SelectOption] = pydantic.Field(default=None)
+ """
+ The buyer’s selected option.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/shift.py b/src/square/types/shift.py
new file mode 100644
index 00000000..c510d03e
--- /dev/null
+++ b/src/square/types/shift.py
@@ -0,0 +1,112 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .break_ import Break
+from .money import Money
+from .shift_status import ShiftStatus
+from .shift_wage import ShiftWage
+
+
+class Shift(UncheckedBaseModel):
+ """
+ A record of the hourly rate, start, and end times for a single work shift
+ for an employee. This might include a record of the start and end times for breaks
+ taken during the shift.
+
+ Deprecated at Square API version 2025-05-21. Replaced by [Timecard](entity:Timecard).
+ See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The UUID for this object.
+ """
+
+ employee_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id` instead.
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The ID of the location this shift occurred at. The location should be based on
+ where the employee clocked in.
+ """
+
+ timezone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The read-only convenience value that is calculated from the location based
+ on the `location_id`. Format: the IANA timezone database identifier for the
+ location timezone.
+ """
+
+ start_at: str = pydantic.Field()
+ """
+ RFC 3339; shifted to the location timezone + offset. Precision up to the
+ minute is respected; seconds are truncated.
+ """
+
+ end_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339; shifted to the timezone + offset. Precision up to the minute is
+ respected; seconds are truncated.
+ """
+
+ wage: typing.Optional[ShiftWage] = pydantic.Field(default=None)
+ """
+ Job and pay related information. If the wage is not set on create, it defaults to a wage
+ of zero. If the title is not set on create, it defaults to the name of the role the employee
+ is assigned to, if any.
+ """
+
+ breaks: typing.Optional[typing.List[Break]] = pydantic.Field(default=None)
+ """
+ A list of all the paid or unpaid breaks that were taken during this shift.
+ """
+
+ status: typing.Optional[ShiftStatus] = pydantic.Field(default=None)
+ """
+ Describes the working state of the current `Shift`.
+ See [ShiftStatus](#type-shiftstatus) for possible values
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Used for resolving concurrency issues. The request fails if the version
+ provided does not match the server version at the time of the request. If not provided,
+ Square executes a blind write; potentially overwriting data from another
+ write.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A read-only timestamp in RFC 3339 format; presented in UTC.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A read-only timestamp in RFC 3339 format; presented in UTC.
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26".
+ """
+
+ declared_cash_tip_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The tips declared by the team member for the shift.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/shift_filter.py b/src/square/types/shift_filter.py
new file mode 100644
index 00000000..1126f97a
--- /dev/null
+++ b/src/square/types/shift_filter.py
@@ -0,0 +1,64 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .shift_filter_status import ShiftFilterStatus
+from .shift_workday import ShiftWorkday
+from .time_range import TimeRange
+
+
+class ShiftFilter(UncheckedBaseModel):
+ """
+ Defines a filter used in a search for `Shift` records. `AND` logic is
+ used by Square's servers to apply each filter property specified.
+
+ Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Fetch shifts for the specified location.
+ """
+
+ employee_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Fetch shifts for the specified employees. DEPRECATED at version 2020-08-26. Use `team_member_ids` instead.
+ """
+
+ status: typing.Optional[ShiftFilterStatus] = pydantic.Field(default=None)
+ """
+ Fetch a `Shift` instance by `Shift.status`.
+ See [ShiftFilterStatus](#type-shiftfilterstatus) for possible values
+ """
+
+ start: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ Fetch `Shift` instances that start in the time range - Inclusive.
+ """
+
+ end: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ Fetch the `Shift` instances that end in the time range - Inclusive.
+ """
+
+ workday: typing.Optional[ShiftWorkday] = pydantic.Field(default=None)
+ """
+ Fetch the `Shift` instances based on the workday date range.
+ """
+
+ team_member_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Fetch shifts for the specified team members. Replaced `employee_ids` at version "2020-08-26".
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/shift_filter_status.py b/src/square/types/shift_filter_status.py
new file mode 100644
index 00000000..2544d817
--- /dev/null
+++ b/src/square/types/shift_filter_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ShiftFilterStatus = typing.Union[typing.Literal["OPEN", "CLOSED"], typing.Any]
diff --git a/src/square/types/shift_query.py b/src/square/types/shift_query.py
new file mode 100644
index 00000000..de2c7730
--- /dev/null
+++ b/src/square/types/shift_query.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .shift_filter import ShiftFilter
+from .shift_sort import ShiftSort
+
+
+class ShiftQuery(UncheckedBaseModel):
+ """
+ The parameters of a `Shift` search query, which includes filter and sort options.
+
+ Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ filter: typing.Optional[ShiftFilter] = pydantic.Field(default=None)
+ """
+ Query filter options.
+ """
+
+ sort: typing.Optional[ShiftSort] = pydantic.Field(default=None)
+ """
+ Sort order details.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/shift_sort.py b/src/square/types/shift_sort.py
new file mode 100644
index 00000000..39c5eadc
--- /dev/null
+++ b/src/square/types/shift_sort.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .shift_sort_field import ShiftSortField
+from .sort_order import SortOrder
+
+
+class ShiftSort(UncheckedBaseModel):
+ """
+ Sets the sort order of search results.
+
+ Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ field: typing.Optional[ShiftSortField] = pydantic.Field(default=None)
+ """
+ The field to sort on.
+ See [ShiftSortField](#type-shiftsortfield) for possible values
+ """
+
+ order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The order in which results are returned. Defaults to DESC.
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/shift_sort_field.py b/src/square/types/shift_sort_field.py
new file mode 100644
index 00000000..2826bc80
--- /dev/null
+++ b/src/square/types/shift_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ShiftSortField = typing.Union[typing.Literal["START_AT", "END_AT", "CREATED_AT", "UPDATED_AT"], typing.Any]
diff --git a/src/square/types/shift_status.py b/src/square/types/shift_status.py
new file mode 100644
index 00000000..96b5fb96
--- /dev/null
+++ b/src/square/types/shift_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ShiftStatus = typing.Union[typing.Literal["OPEN", "CLOSED"], typing.Any]
diff --git a/src/square/types/shift_wage.py b/src/square/types/shift_wage.py
new file mode 100644
index 00000000..bda2d11d
--- /dev/null
+++ b/src/square/types/shift_wage.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class ShiftWage(UncheckedBaseModel):
+ """
+ The hourly wage rate used to compensate an employee for this shift.
+
+ Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the job performed during this shift.
+ """
+
+ hourly_rate: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ Can be a custom-set hourly wage or the calculated effective hourly
+ wage based on the annual wage and hours worked per week.
+ """
+
+ job_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the job performed during this shift. Square
+ labor-reporting UIs might group shifts together by id.
+ """
+
+ tip_eligible: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether team members are eligible for tips when working this job.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/shift_workday.py b/src/square/types/shift_workday.py
new file mode 100644
index 00000000..ddc1944d
--- /dev/null
+++ b/src/square/types/shift_workday.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .date_range import DateRange
+from .shift_workday_matcher import ShiftWorkdayMatcher
+
+
+class ShiftWorkday(UncheckedBaseModel):
+ """
+ A `Shift` search query filter parameter that sets a range of days that
+ a `Shift` must start or end in before passing the filter condition.
+
+ Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).
+ """
+
+ date_range: typing.Optional[DateRange] = pydantic.Field(default=None)
+ """
+ Dates for fetching the shifts.
+ """
+
+ match_shifts_by: typing.Optional[ShiftWorkdayMatcher] = pydantic.Field(default=None)
+ """
+ The strategy on which the dates are applied.
+ See [ShiftWorkdayMatcher](#type-shiftworkdaymatcher) for possible values
+ """
+
+ default_timezone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Location-specific timezones convert workdays to datetime filters.
+ Every location included in the query must have a timezone or this field
+ must be provided as a fallback. Format: the IANA timezone database
+ identifier for the relevant timezone.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/shift_workday_matcher.py b/src/square/types/shift_workday_matcher.py
new file mode 100644
index 00000000..b1266430
--- /dev/null
+++ b/src/square/types/shift_workday_matcher.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ShiftWorkdayMatcher = typing.Union[typing.Literal["START_AT", "END_AT", "INTERSECTION"], typing.Any]
diff --git a/src/square/types/shipping_fee.py b/src/square/types/shipping_fee.py
new file mode 100644
index 00000000..b5ef4d4c
--- /dev/null
+++ b/src/square/types/shipping_fee.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class ShippingFee(UncheckedBaseModel):
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name for the shipping fee.
+ """
+
+ charge: Money = pydantic.Field()
+ """
+ The amount and currency for the shipping fee.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/signature_image.py b/src/square/types/signature_image.py
new file mode 100644
index 00000000..6d3afcec
--- /dev/null
+++ b/src/square/types/signature_image.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class SignatureImage(UncheckedBaseModel):
+ image_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The mime/type of the image data.
+ Use `image/png;base64` for png.
+ """
+
+ data: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The base64 representation of the image.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/signature_options.py b/src/square/types/signature_options.py
new file mode 100644
index 00000000..9428f479
--- /dev/null
+++ b/src/square/types/signature_options.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .signature_image import SignatureImage
+
+
+class SignatureOptions(UncheckedBaseModel):
+ title: str = pydantic.Field()
+ """
+ The title text to display in the signature capture flow on the Terminal.
+ """
+
+ body: str = pydantic.Field()
+ """
+ The body text to display in the signature capture flow on the Terminal.
+ """
+
+ signature: typing.Optional[typing.List[SignatureImage]] = pydantic.Field(default=None)
+ """
+ An image representation of the collected signature.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/simple_format.py b/src/square/types/simple_format.py
new file mode 100644
index 00000000..7d2f83b6
--- /dev/null
+++ b/src/square/types/simple_format.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SimpleFormat = typing.Union[typing.Literal["percent", "currency", "number", "imageUrl", "id", "link"], typing.Any]
diff --git a/src/square/types/site.py b/src/square/types/site.py
new file mode 100644
index 00000000..d846ac34
--- /dev/null
+++ b/src/square/types/site.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class Site(UncheckedBaseModel):
+ """
+ Represents a Square Online site, which is an online store for a Square seller.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the site.
+ """
+
+ site_title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The title of the site.
+ """
+
+ domain: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The domain of the site (without the protocol). For example, `mysite1.square.site`.
+ """
+
+ is_published: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the site is published.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the site was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the site was last updated, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/snippet.py b/src/square/types/snippet.py
new file mode 100644
index 00000000..c6531f94
--- /dev/null
+++ b/src/square/types/snippet.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class Snippet(UncheckedBaseModel):
+ """
+ Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID for the snippet.
+ """
+
+ site_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the site that contains the snippet.
+ """
+
+ content: str = pydantic.Field()
+ """
+ The snippet code, which can contain valid HTML, JavaScript, or both.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the snippet was initially added to the site, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the snippet was last updated on the site, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/sort_order.py b/src/square/types/sort_order.py
new file mode 100644
index 00000000..223ea604
--- /dev/null
+++ b/src/square/types/sort_order.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SortOrder = typing.Union[typing.Literal["DESC", "ASC"], typing.Any]
diff --git a/src/square/types/source_application.py b/src/square/types/source_application.py
new file mode 100644
index 00000000..43d6322b
--- /dev/null
+++ b/src/square/types/source_application.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .product import Product
+
+
+class SourceApplication(UncheckedBaseModel):
+ """
+ Represents information about the application used to generate a change.
+ """
+
+ product: typing.Optional[Product] = pydantic.Field(default=None)
+ """
+ __Read only__ The [product](entity:Product) type of the application.
+ See [Product](#type-product) for possible values
+ """
+
+ application_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ __Read only__ The Square-assigned ID of the application. This field is used only if the
+ [product](entity:Product) type is `EXTERNAL_API`.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ __Read only__ The display name of the application
+ (for example, `"Custom Application"` or `"Square POS 4.74 for Android"`).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/square_account_details.py b/src/square/types/square_account_details.py
new file mode 100644
index 00000000..6df86514
--- /dev/null
+++ b/src/square/types/square_account_details.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class SquareAccountDetails(UncheckedBaseModel):
+ """
+ Additional details about Square Account payments.
+ """
+
+ payment_source_token: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique identifier for the payment source used for this payment.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/standard_unit_description.py b/src/square/types/standard_unit_description.py
new file mode 100644
index 00000000..2fec3e0c
--- /dev/null
+++ b/src/square/types/standard_unit_description.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .measurement_unit import MeasurementUnit
+
+
+class StandardUnitDescription(UncheckedBaseModel):
+ """
+ Contains the name and abbreviation for standard measurement unit.
+ """
+
+ unit: typing.Optional[MeasurementUnit] = pydantic.Field(default=None)
+ """
+ Identifies the measurement unit being described.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ UI display name of the measurement unit. For example, 'Pound'.
+ """
+
+ abbreviation: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ UI display abbreviation for the measurement unit. For example, 'lb'.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/standard_unit_description_group.py b/src/square/types/standard_unit_description_group.py
new file mode 100644
index 00000000..40753dd4
--- /dev/null
+++ b/src/square/types/standard_unit_description_group.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .standard_unit_description import StandardUnitDescription
+
+
+class StandardUnitDescriptionGroup(UncheckedBaseModel):
+ """
+ Group of standard measurement units.
+ """
+
+ standard_unit_descriptions: typing.Optional[typing.List[StandardUnitDescription]] = pydantic.Field(default=None)
+ """
+ List of standard (non-custom) measurement units in this description group.
+ """
+
+ language_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ IETF language tag.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/start_transfer_order_response.py b/src/square/types/start_transfer_order_response.py
new file mode 100644
index 00000000..ee077dab
--- /dev/null
+++ b/src/square/types/start_transfer_order_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .transfer_order import TransferOrder
+
+
+class StartTransferOrderResponse(UncheckedBaseModel):
+ """
+ Response for starting a transfer order.
+ """
+
+ transfer_order: typing.Optional[TransferOrder] = pydantic.Field(default=None)
+ """
+ The updated transfer order with status changed to STARTED
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/submit_evidence_response.py b/src/square/types/submit_evidence_response.py
new file mode 100644
index 00000000..ff8b906d
--- /dev/null
+++ b/src/square/types/submit_evidence_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .dispute import Dispute
+from .error import Error
+
+
+class SubmitEvidenceResponse(UncheckedBaseModel):
+ """
+ Defines the fields in a `SubmitEvidence` response.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ dispute: typing.Optional[Dispute] = pydantic.Field(default=None)
+ """
+ The `Dispute` for which evidence was submitted.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription.py b/src/square/types/subscription.py
new file mode 100644
index 00000000..605bbf30
--- /dev/null
+++ b/src/square/types/subscription.py
@@ -0,0 +1,160 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .phase import Phase
+from .subscription_action import SubscriptionAction
+from .subscription_source import SubscriptionSource
+from .subscription_status import SubscriptionStatus
+
+
+class Subscription(UncheckedBaseModel):
+ """
+ Represents a subscription purchased by a customer.
+
+ For more information, see
+ [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the subscription.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the location associated with the subscription.
+ """
+
+ plan_variation_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the subscribed-to [subscription plan variation](entity:CatalogSubscriptionPlanVariation).
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the subscribing [customer](entity:Customer) profile.
+ """
+
+ start_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to start the subscription.
+ """
+
+ canceled_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to cancel the subscription,
+ when the subscription status changes to `CANCELED` and the subscription billing stops.
+
+ If this field is not set, the subscription ends according its subscription plan.
+
+ This field cannot be updated, other than being cleared.
+ """
+
+ charged_through_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `YYYY-MM-DD`-formatted date up to when the subscriber is invoiced for the
+ subscription.
+
+ After the invoice is sent for a given billing period,
+ this date will be the last day of the billing period.
+ For example,
+ suppose for the month of May a subscriber gets an invoice
+ (or charged the card) on May 1. For the monthly billing scenario,
+ this date is then set to May 31.
+ """
+
+ status: typing.Optional[SubscriptionStatus] = pydantic.Field(default=None)
+ """
+ The current status of the subscription.
+ See [SubscriptionStatus](#type-subscriptionstatus) for possible values
+ """
+
+ tax_percentage: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The tax amount applied when billing the subscription. The
+ percentage is expressed in decimal form, using a `'.'` as the decimal
+ separator and without a `'%'` sign. For example, a value of `7.5`
+ corresponds to 7.5%.
+ """
+
+ invoice_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The IDs of the [invoices](entity:Invoice) created for the
+ subscription, listed in order when the invoices were created
+ (newest invoices appear first).
+ """
+
+ price_override_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing.
+ This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead,
+ you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates).
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the object. When updating an object, the version
+ supplied must match the version in the database, otherwise the write will
+ be rejected as conflicting.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the subscription was created, in RFC 3339 format.
+ """
+
+ card_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [subscriber's](entity:Customer) [card](entity:Card)
+ used to charge for the subscription.
+ """
+
+ timezone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timezone that will be used in date calculations for the subscription.
+ Defaults to the timezone of the location based on `location_id`.
+ Format: the IANA Timezone Database identifier for the location timezone (for example, `America/Los_Angeles`).
+ """
+
+ source: typing.Optional[SubscriptionSource] = pydantic.Field(default=None)
+ """
+ The origination details of the subscription.
+ """
+
+ actions: typing.Optional[typing.List[SubscriptionAction]] = pydantic.Field(default=None)
+ """
+ The list of scheduled actions on this subscription. It is set only in the response from
+ [RetrieveSubscription](api-endpoint:Subscriptions-RetrieveSubscription) with the query parameter
+ of `include=actions` or from
+ [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) with the input parameter
+ of `include:["actions"]`.
+ """
+
+ monthly_billing_anchor_date: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The day of the month on which the subscription will issue invoices and publish orders.
+ """
+
+ phases: typing.Optional[typing.List[Phase]] = pydantic.Field(default=None)
+ """
+ array of phases for this subscription
+ """
+
+ completed_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `YYYY-MM-DD`-formatted date when the subscription enters a terminal state.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_action.py b/src/square/types/subscription_action.py
new file mode 100644
index 00000000..67fe750b
--- /dev/null
+++ b/src/square/types/subscription_action.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .phase import Phase
+from .subscription_action_type import SubscriptionActionType
+
+
+class SubscriptionAction(UncheckedBaseModel):
+ """
+ Represents an action as a pending change to a subscription.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of an action scoped to a subscription.
+ """
+
+ type: typing.Optional[SubscriptionActionType] = pydantic.Field(default=None)
+ """
+ The type of the action.
+ See [SubscriptionActionType](#type-subscriptionactiontype) for possible values
+ """
+
+ effective_date: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `YYYY-MM-DD`-formatted date when the action occurs on the subscription.
+ """
+
+ monthly_billing_anchor_date: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action.
+ """
+
+ phases: typing.Optional[typing.List[Phase]] = pydantic.Field(default=None)
+ """
+ A list of Phases, to pass phase-specific information used in the swap.
+ """
+
+ new_plan_variation_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The target subscription plan variation that a subscription switches to, for a `SWAP_PLAN` action.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_action_type.py b/src/square/types/subscription_action_type.py
new file mode 100644
index 00000000..f7d061e4
--- /dev/null
+++ b/src/square/types/subscription_action_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SubscriptionActionType = typing.Union[
+ typing.Literal["CANCEL", "PAUSE", "RESUME", "SWAP_PLAN", "CHANGE_BILLING_ANCHOR_DATE", "COMPLETE"], typing.Any
+]
diff --git a/src/square/types/subscription_cadence.py b/src/square/types/subscription_cadence.py
new file mode 100644
index 00000000..31fd6cb1
--- /dev/null
+++ b/src/square/types/subscription_cadence.py
@@ -0,0 +1,22 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SubscriptionCadence = typing.Union[
+ typing.Literal[
+ "DAILY",
+ "WEEKLY",
+ "EVERY_TWO_WEEKS",
+ "THIRTY_DAYS",
+ "SIXTY_DAYS",
+ "NINETY_DAYS",
+ "MONTHLY",
+ "EVERY_TWO_MONTHS",
+ "QUARTERLY",
+ "EVERY_FOUR_MONTHS",
+ "EVERY_SIX_MONTHS",
+ "ANNUAL",
+ "EVERY_TWO_YEARS",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/subscription_created_event.py b/src/square/types/subscription_created_event.py
new file mode 100644
index 00000000..bb129258
--- /dev/null
+++ b/src/square/types/subscription_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .subscription_created_event_data import SubscriptionCreatedEventData
+
+
+class SubscriptionCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Subscription](entity:Subscription) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"subscription.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[SubscriptionCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_created_event_data.py b/src/square/types/subscription_created_event_data.py
new file mode 100644
index 00000000..b0c3dead
--- /dev/null
+++ b/src/square/types/subscription_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .subscription_created_event_object import SubscriptionCreatedEventObject
+
+
+class SubscriptionCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"subscription"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected subscription.
+ """
+
+ object: typing.Optional[SubscriptionCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created subscription.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_created_event_object.py b/src/square/types/subscription_created_event_object.py
new file mode 100644
index 00000000..9f11d483
--- /dev/null
+++ b/src/square/types/subscription_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .subscription import Subscription
+
+
+class SubscriptionCreatedEventObject(UncheckedBaseModel):
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The created subscription.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_event.py b/src/square/types/subscription_event.py
new file mode 100644
index 00000000..4c9d079b
--- /dev/null
+++ b/src/square/types/subscription_event.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .phase import Phase
+from .subscription_event_info import SubscriptionEventInfo
+from .subscription_event_subscription_event_type import SubscriptionEventSubscriptionEventType
+
+
+class SubscriptionEvent(UncheckedBaseModel):
+ """
+ Describes changes to a subscription and the subscription status.
+ """
+
+ id: str = pydantic.Field()
+ """
+ The ID of the subscription event.
+ """
+
+ subscription_event_type: SubscriptionEventSubscriptionEventType = pydantic.Field()
+ """
+ Type of the subscription event.
+ See [SubscriptionEventSubscriptionEventType](#type-subscriptioneventsubscriptioneventtype) for possible values
+ """
+
+ effective_date: str = pydantic.Field()
+ """
+ The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred.
+ """
+
+ monthly_billing_anchor_date: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The day-of-the-month the billing anchor date was changed to, if applicable.
+ """
+
+ info: typing.Optional[SubscriptionEventInfo] = pydantic.Field(default=None)
+ """
+ Additional information about the subscription event.
+ """
+
+ phases: typing.Optional[typing.List[Phase]] = pydantic.Field(default=None)
+ """
+ A list of Phases, to pass phase-specific information used in the swap.
+ """
+
+ plan_variation_id: str = pydantic.Field()
+ """
+ The ID of the subscription plan variation associated with the subscription.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_event_info.py b/src/square/types/subscription_event_info.py
new file mode 100644
index 00000000..edb3de01
--- /dev/null
+++ b/src/square/types/subscription_event_info.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .subscription_event_info_code import SubscriptionEventInfoCode
+
+
+class SubscriptionEventInfo(UncheckedBaseModel):
+ """
+ Provides information about the subscription event.
+ """
+
+ detail: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A human-readable explanation for the event.
+ """
+
+ code: typing.Optional[SubscriptionEventInfoCode] = pydantic.Field(default=None)
+ """
+ An info code indicating the subscription event that occurred.
+ See [InfoCode](#type-infocode) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_event_info_code.py b/src/square/types/subscription_event_info_code.py
new file mode 100644
index 00000000..6fe7f368
--- /dev/null
+++ b/src/square/types/subscription_event_info_code.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SubscriptionEventInfoCode = typing.Union[
+ typing.Literal[
+ "LOCATION_NOT_ACTIVE",
+ "LOCATION_CANNOT_ACCEPT_PAYMENT",
+ "CUSTOMER_DELETED",
+ "CUSTOMER_NO_EMAIL",
+ "CUSTOMER_NO_NAME",
+ "USER_PROVIDED",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/subscription_event_subscription_event_type.py b/src/square/types/subscription_event_subscription_event_type.py
new file mode 100644
index 00000000..72a88b5f
--- /dev/null
+++ b/src/square/types/subscription_event_subscription_event_type.py
@@ -0,0 +1,16 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SubscriptionEventSubscriptionEventType = typing.Union[
+ typing.Literal[
+ "START_SUBSCRIPTION",
+ "PLAN_CHANGE",
+ "STOP_SUBSCRIPTION",
+ "DEACTIVATE_SUBSCRIPTION",
+ "RESUME_SUBSCRIPTION",
+ "PAUSE_SUBSCRIPTION",
+ "BILLING_ANCHOR_DATE_CHANGED",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/subscription_phase.py b/src/square/types/subscription_phase.py
new file mode 100644
index 00000000..b25287d6
--- /dev/null
+++ b/src/square/types/subscription_phase.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .subscription_cadence import SubscriptionCadence
+from .subscription_pricing import SubscriptionPricing
+
+
+class SubscriptionPhase(UncheckedBaseModel):
+ """
+ Describes a phase in a subscription plan variation. For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations).
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-assigned ID of the subscription phase. This field cannot be changed after a `SubscriptionPhase` is created.
+ """
+
+ cadence: SubscriptionCadence = pydantic.Field()
+ """
+ The billing cadence of the phase. For example, weekly or monthly. This field cannot be changed after a `SubscriptionPhase` is created.
+ See [SubscriptionCadence](#type-subscriptioncadence) for possible values
+ """
+
+ periods: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of `cadence`s the phase lasts. If not set, the phase never ends. Only the last phase can be indefinite. This field cannot be changed after a `SubscriptionPhase` is created.
+ """
+
+ recurring_price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount to bill for each `cadence`. Failure to specify this field results in a `MISSING_REQUIRED_PARAMETER` error at runtime.
+ """
+
+ ordinal: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The position this phase appears in the sequence of phases defined for the plan, indexed from 0. This field cannot be changed after a `SubscriptionPhase` is created.
+ """
+
+ pricing: typing.Optional[SubscriptionPricing] = pydantic.Field(default=None)
+ """
+ The subscription pricing.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_pricing.py b/src/square/types/subscription_pricing.py
new file mode 100644
index 00000000..cbcc5f41
--- /dev/null
+++ b/src/square/types/subscription_pricing.py
@@ -0,0 +1,40 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+from .subscription_pricing_type import SubscriptionPricingType
+
+
+class SubscriptionPricing(UncheckedBaseModel):
+ """
+ Describes the pricing for the subscription.
+ """
+
+ type: typing.Optional[SubscriptionPricingType] = pydantic.Field(default=None)
+ """
+ RELATIVE or STATIC
+ See [SubscriptionPricingType](#type-subscriptionpricingtype) for possible values
+ """
+
+ discount_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The ids of the discount catalog objects
+ """
+
+ price_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The price of the subscription, if STATIC
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_pricing_type.py b/src/square/types/subscription_pricing_type.py
new file mode 100644
index 00000000..d0655c70
--- /dev/null
+++ b/src/square/types/subscription_pricing_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SubscriptionPricingType = typing.Union[typing.Literal["STATIC", "RELATIVE"], typing.Any]
diff --git a/src/square/types/subscription_source.py b/src/square/types/subscription_source.py
new file mode 100644
index 00000000..e9f89474
--- /dev/null
+++ b/src/square/types/subscription_source.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class SubscriptionSource(UncheckedBaseModel):
+ """
+ The origination details of the subscription.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name used to identify the place (physical or digital) that
+ a subscription originates. If unset, the name defaults to the name
+ of the application that created the subscription.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_status.py b/src/square/types/subscription_status.py
new file mode 100644
index 00000000..e1452152
--- /dev/null
+++ b/src/square/types/subscription_status.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SubscriptionStatus = typing.Union[
+ typing.Literal["PENDING", "ACTIVE", "CANCELED", "DEACTIVATED", "PAUSED", "COMPLETED"], typing.Any
+]
diff --git a/src/square/types/subscription_test_result.py b/src/square/types/subscription_test_result.py
new file mode 100644
index 00000000..8285d133
--- /dev/null
+++ b/src/square/types/subscription_test_result.py
@@ -0,0 +1,59 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class SubscriptionTestResult(UncheckedBaseModel):
+ """
+ Represents the result of testing a webhook subscription. Note: The actual API returns these fields at the root level of TestWebhookSubscriptionResponse, not nested under this object.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A Square-generated unique ID for the subscription test result.
+ """
+
+ status_code: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The HTTP status code returned by the notification URL.
+ """
+
+ payload: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
+ """
+ The payload that was sent in the test notification.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the subscription was created, in RFC 3339 format.
+ For example, "2016-09-04T23:59:33.123Z".
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the subscription was updated, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z".
+ Because a subscription test result is unique, this field is the same as the `created_at` field.
+ """
+
+ notification_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL that was used for the webhook notification test.
+ """
+
+ passes_filter: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the notification passed any configured filters.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_updated_event.py b/src/square/types/subscription_updated_event.py
new file mode 100644
index 00000000..927d6a25
--- /dev/null
+++ b/src/square/types/subscription_updated_event.py
@@ -0,0 +1,50 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .subscription_updated_event_data import SubscriptionUpdatedEventData
+
+
+class SubscriptionUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Subscription](entity:Subscription) is updated.
+ Typically the `subscription.status` is updated as subscriptions become active
+ or cancelled.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"subscription.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[SubscriptionUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_updated_event_data.py b/src/square/types/subscription_updated_event_data.py
new file mode 100644
index 00000000..868d9b7d
--- /dev/null
+++ b/src/square/types/subscription_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .subscription_updated_event_object import SubscriptionUpdatedEventObject
+
+
+class SubscriptionUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"subscription"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected subscription.
+ """
+
+ object: typing.Optional[SubscriptionUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated subscription.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/subscription_updated_event_object.py b/src/square/types/subscription_updated_event_object.py
new file mode 100644
index 00000000..99d715cd
--- /dev/null
+++ b/src/square/types/subscription_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .subscription import Subscription
+
+
+class SubscriptionUpdatedEventObject(UncheckedBaseModel):
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The updated subscription.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/swap_plan_response.py b/src/square/types/swap_plan_response.py
new file mode 100644
index 00000000..f459dc62
--- /dev/null
+++ b/src/square/types/swap_plan_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription import Subscription
+from .subscription_action import SubscriptionAction
+
+
+class SwapPlanResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response of the
+ [SwapPlan](api-endpoint:Subscriptions-SwapPlan) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The subscription with the updated subscription plan.
+ """
+
+ actions: typing.Optional[typing.List[SubscriptionAction]] = pydantic.Field(default=None)
+ """
+ A list of a `SWAP_PLAN` action created by the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/tax_calculation_phase.py b/src/square/types/tax_calculation_phase.py
new file mode 100644
index 00000000..3443872d
--- /dev/null
+++ b/src/square/types/tax_calculation_phase.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TaxCalculationPhase = typing.Union[typing.Literal["TAX_SUBTOTAL_PHASE", "TAX_TOTAL_PHASE"], typing.Any]
diff --git a/src/square/types/tax_ids.py b/src/square/types/tax_ids.py
new file mode 100644
index 00000000..fc6a5a58
--- /dev/null
+++ b/src/square/types/tax_ids.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class TaxIds(UncheckedBaseModel):
+ """
+ Identifiers for the location used by various governments for tax purposes.
+ """
+
+ eu_vat: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The EU VAT number for this location. For example, `IE3426675K`.
+ If the EU VAT number is present, it is well-formed and has been
+ validated with VIES, the VAT Information Exchange System.
+ """
+
+ fr_siret: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements)
+ number is a 14-digit code issued by the French INSEE. For example, `39922799000021`.
+ """
+
+ fr_naf: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The French government uses the NAF (Nomenclature des Activités Françaises) to display and
+ track economic statistical data. This is also called the APE (Activite Principale de l’Entreprise) code.
+ For example, `6910Z`.
+ """
+
+ es_nif: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The NIF (Numero de Identificacion Fiscal) number is a nine-character tax identifier used in Spain.
+ If it is present, it has been validated. For example, `73628495A`.
+ """
+
+ jp_qii: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The QII (Qualified Invoice Issuer) number is a 14-character tax identifier used in Japan.
+ For example, `T1234567890123`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/tax_inclusion_type.py b/src/square/types/tax_inclusion_type.py
new file mode 100644
index 00000000..5e2b0502
--- /dev/null
+++ b/src/square/types/tax_inclusion_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TaxInclusionType = typing.Union[typing.Literal["ADDITIVE", "INCLUSIVE"], typing.Any]
diff --git a/src/square/types/team_member.py b/src/square/types/team_member.py
new file mode 100644
index 00000000..52d5054f
--- /dev/null
+++ b/src/square/types/team_member.py
@@ -0,0 +1,89 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member_assigned_locations import TeamMemberAssignedLocations
+from .team_member_status import TeamMemberStatus
+from .wage_setting import WageSetting
+
+
+class TeamMember(UncheckedBaseModel):
+ """
+ A record representing an individual team member for a business.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique ID for the team member.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A second ID used to associate the team member with an entity in another system.
+ """
+
+ is_owner: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the team member is the owner of the Square account.
+ """
+
+ status: typing.Optional[TeamMemberStatus] = pydantic.Field(default=None)
+ """
+ Describes the status of the team member.
+ See [TeamMemberStatus](#type-teammemberstatus) for possible values
+ """
+
+ given_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The given name (that is, the first name) associated with the team member.
+ """
+
+ family_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The family name (that is, the last name) associated with the team member.
+ """
+
+ email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address associated with the team member. After accepting the invitation
+ from Square, only the team member can change this value.
+ """
+
+ phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The team member's phone number, in E.164 format. For example:
+ +14155552671 - the country code is 1 for US
+ +551155256325 - the country code is 55 for BR
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the team member was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the team member was last updated, in RFC 3339 format.
+ """
+
+ assigned_locations: typing.Optional[TeamMemberAssignedLocations] = pydantic.Field(default=None)
+ """
+ Describes the team member's assigned locations.
+ """
+
+ wage_setting: typing.Optional[WageSetting] = pydantic.Field(default=None)
+ """
+ Information about the team member's overtime exemption status, job assignments, and compensation.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_assigned_locations.py b/src/square/types/team_member_assigned_locations.py
new file mode 100644
index 00000000..b99dd87d
--- /dev/null
+++ b/src/square/types/team_member_assigned_locations.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member_assigned_locations_assignment_type import TeamMemberAssignedLocationsAssignmentType
+
+
+class TeamMemberAssignedLocations(UncheckedBaseModel):
+ """
+ An object that represents a team member's assignment to locations.
+ """
+
+ assignment_type: typing.Optional[TeamMemberAssignedLocationsAssignmentType] = pydantic.Field(default=None)
+ """
+ The current assignment type of the team member.
+ See [TeamMemberAssignedLocationsAssignmentType](#type-teammemberassignedlocationsassignmenttype) for possible values
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The explicit locations that the team member is assigned to.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_assigned_locations_assignment_type.py b/src/square/types/team_member_assigned_locations_assignment_type.py
new file mode 100644
index 00000000..b6c184ba
--- /dev/null
+++ b/src/square/types/team_member_assigned_locations_assignment_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TeamMemberAssignedLocationsAssignmentType = typing.Union[
+ typing.Literal["ALL_CURRENT_AND_FUTURE_LOCATIONS", "EXPLICIT_LOCATIONS"], typing.Any
+]
diff --git a/src/square/types/team_member_booking_profile.py b/src/square/types/team_member_booking_profile.py
new file mode 100644
index 00000000..e276c001
--- /dev/null
+++ b/src/square/types/team_member_booking_profile.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class TeamMemberBookingProfile(UncheckedBaseModel):
+ """
+ The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider.
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [TeamMember](entity:TeamMember) object for the team member associated with the booking profile.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the team member.
+ """
+
+ display_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The display name of the team member.
+ """
+
+ is_bookable: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the team member can be booked through the Bookings API or the seller's online booking channel or site (`true`) or not (`false`).
+ """
+
+ profile_image_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL of the team member's image for the bookings profile.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_created_event.py b/src/square/types/team_member_created_event.py
new file mode 100644
index 00000000..c2c3c7a4
--- /dev/null
+++ b/src/square/types/team_member_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member_created_event_data import TeamMemberCreatedEventData
+
+
+class TeamMemberCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a Team Member is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"team_member.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[TeamMemberCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_created_event_data.py b/src/square/types/team_member_created_event_data.py
new file mode 100644
index 00000000..8255ebed
--- /dev/null
+++ b/src/square/types/team_member_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member_created_event_object import TeamMemberCreatedEventObject
+
+
+class TeamMemberCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"team_member"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the created team member.
+ """
+
+ object: typing.Optional[TeamMemberCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created team member.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_created_event_object.py b/src/square/types/team_member_created_event_object.py
new file mode 100644
index 00000000..10c23a3b
--- /dev/null
+++ b/src/square/types/team_member_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member import TeamMember
+
+
+class TeamMemberCreatedEventObject(UncheckedBaseModel):
+ team_member: typing.Optional[TeamMember] = pydantic.Field(default=None)
+ """
+ The created team member.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_invitation_status.py b/src/square/types/team_member_invitation_status.py
new file mode 100644
index 00000000..71856960
--- /dev/null
+++ b/src/square/types/team_member_invitation_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TeamMemberInvitationStatus = typing.Union[typing.Literal["UNINVITED", "PENDING", "ACCEPTED"], typing.Any]
diff --git a/src/square/types/team_member_status.py b/src/square/types/team_member_status.py
new file mode 100644
index 00000000..e8be2ebd
--- /dev/null
+++ b/src/square/types/team_member_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TeamMemberStatus = typing.Union[typing.Literal["ACTIVE", "INACTIVE"], typing.Any]
diff --git a/src/square/types/team_member_updated_event.py b/src/square/types/team_member_updated_event.py
new file mode 100644
index 00000000..c1ced542
--- /dev/null
+++ b/src/square/types/team_member_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member_updated_event_data import TeamMemberUpdatedEventData
+
+
+class TeamMemberUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a Team Member is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"team_member.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[TeamMemberUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_updated_event_data.py b/src/square/types/team_member_updated_event_data.py
new file mode 100644
index 00000000..0992f618
--- /dev/null
+++ b/src/square/types/team_member_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member_updated_event_object import TeamMemberUpdatedEventObject
+
+
+class TeamMemberUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"team_member"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected team member.
+ """
+
+ object: typing.Optional[TeamMemberUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated team member.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_updated_event_object.py b/src/square/types/team_member_updated_event_object.py
new file mode 100644
index 00000000..42cb4955
--- /dev/null
+++ b/src/square/types/team_member_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member import TeamMember
+
+
+class TeamMemberUpdatedEventObject(UncheckedBaseModel):
+ team_member: typing.Optional[TeamMember] = pydantic.Field(default=None)
+ """
+ The updated team member.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_wage.py b/src/square/types/team_member_wage.py
new file mode 100644
index 00000000..f90e7c2c
--- /dev/null
+++ b/src/square/types/team_member_wage.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class TeamMemberWage(UncheckedBaseModel):
+ """
+ Job and wage information for a [team member](entity:TeamMember).
+ This convenience object provides details needed to specify the `wage`
+ field for a [timecard](entity:Timecard).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The UUID for this object.
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `TeamMember` that this wage is assigned to.
+ """
+
+ title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The job title that this wage relates to.
+ """
+
+ hourly_rate: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ Can be a custom-set hourly wage or the calculated effective hourly
+ wage based on the annual wage and hours worked per week.
+ """
+
+ job_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An identifier for the [job](entity:Job) that this wage relates to.
+ """
+
+ tip_eligible: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether team members are eligible for tips when working this job.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_wage_setting_updated_event.py b/src/square/types/team_member_wage_setting_updated_event.py
new file mode 100644
index 00000000..5588869e
--- /dev/null
+++ b/src/square/types/team_member_wage_setting_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member_wage_setting_updated_event_data import TeamMemberWageSettingUpdatedEventData
+
+
+class TeamMemberWageSettingUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a Wage Setting is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"team_member.wage_setting.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[TeamMemberWageSettingUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_wage_setting_updated_event_data.py b/src/square/types/team_member_wage_setting_updated_event_data.py
new file mode 100644
index 00000000..43daf7c5
--- /dev/null
+++ b/src/square/types/team_member_wage_setting_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member_wage_setting_updated_event_object import TeamMemberWageSettingUpdatedEventObject
+
+
+class TeamMemberWageSettingUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"wage_setting"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the updated team member wage setting.
+ """
+
+ object: typing.Optional[TeamMemberWageSettingUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated team member wage setting.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/team_member_wage_setting_updated_event_object.py b/src/square/types/team_member_wage_setting_updated_event_object.py
new file mode 100644
index 00000000..af41e735
--- /dev/null
+++ b/src/square/types/team_member_wage_setting_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .wage_setting import WageSetting
+
+
+class TeamMemberWageSettingUpdatedEventObject(UncheckedBaseModel):
+ wage_setting: typing.Optional[WageSetting] = pydantic.Field(default=None)
+ """
+ The updated team member wage setting.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/tender.py b/src/square/types/tender.py
new file mode 100644
index 00000000..a1f8e8e2
--- /dev/null
+++ b/src/square/types/tender.py
@@ -0,0 +1,134 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .additional_recipient import AdditionalRecipient
+from .money import Money
+from .tender_bank_account_details import TenderBankAccountDetails
+from .tender_buy_now_pay_later_details import TenderBuyNowPayLaterDetails
+from .tender_card_details import TenderCardDetails
+from .tender_cash_details import TenderCashDetails
+from .tender_square_account_details import TenderSquareAccountDetails
+from .tender_type import TenderType
+
+
+class Tender(UncheckedBaseModel):
+ """
+ Represents a tender (i.e., a method of payment) used in a Square transaction.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The tender's unique ID. It is the associated payment ID.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the transaction's associated location.
+ """
+
+ transaction_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the tender's associated transaction.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the tender was created, in RFC 3339 format.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional note associated with the tender at the time of payment.
+ """
+
+ amount_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of the tender, including `tip_money`. If the tender has a `payment_id`,
+ the `total_money` of the corresponding [Payment](entity:Payment) will be equal to the
+ `amount_money` of the tender.
+ """
+
+ tip_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The tip's amount of the tender.
+ """
+
+ processing_fee_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of any Square processing fees applied to the tender.
+
+ This field is not immediately populated when a new transaction is created.
+ It is usually available after about ten seconds.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ If the tender is associated with a customer or represents a customer's card on file,
+ this is the ID of the associated customer.
+ """
+
+ type: TenderType = pydantic.Field()
+ """
+ The type of tender, such as `CARD` or `CASH`.
+ See [TenderType](#type-tendertype) for possible values
+ """
+
+ card_details: typing.Optional[TenderCardDetails] = pydantic.Field(default=None)
+ """
+ The details of the card tender.
+
+ This value is present only if the value of `type` is `CARD`.
+ """
+
+ cash_details: typing.Optional[TenderCashDetails] = pydantic.Field(default=None)
+ """
+ The details of the cash tender.
+
+ This value is present only if the value of `type` is `CASH`.
+ """
+
+ bank_account_details: typing.Optional[TenderBankAccountDetails] = pydantic.Field(default=None)
+ """
+ The details of the bank account tender.
+
+ This value is present only if the value of `type` is `BANK_ACCOUNT`.
+ """
+
+ buy_now_pay_later_details: typing.Optional[TenderBuyNowPayLaterDetails] = pydantic.Field(default=None)
+ """
+ The details of a Buy Now Pay Later tender.
+
+ This value is present only if the value of `type` is `BUY_NOW_PAY_LATER`.
+ """
+
+ square_account_details: typing.Optional[TenderSquareAccountDetails] = pydantic.Field(default=None)
+ """
+ The details of a Square Account tender.
+
+ This value is present only if the value of `type` is `SQUARE_ACCOUNT`.
+ """
+
+ additional_recipients: typing.Optional[typing.List[AdditionalRecipient]] = pydantic.Field(default=None)
+ """
+ Additional recipients (other than the merchant) receiving a portion of this tender.
+ For example, fees assessed on the purchase by a third party integration.
+ """
+
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [Payment](entity:Payment) that corresponds to this tender.
+ This value is only present for payments created with the v2 Payments API.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/tender_bank_account_details.py b/src/square/types/tender_bank_account_details.py
new file mode 100644
index 00000000..5b7aa424
--- /dev/null
+++ b/src/square/types/tender_bank_account_details.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .tender_bank_account_details_status import TenderBankAccountDetailsStatus
+
+
+class TenderBankAccountDetails(UncheckedBaseModel):
+ """
+ Represents the details of a tender with `type` `BANK_ACCOUNT`.
+
+ See [BankAccountPaymentDetails](entity:BankAccountPaymentDetails)
+ for more exposed details of a bank account payment.
+ """
+
+ status: typing.Optional[TenderBankAccountDetailsStatus] = pydantic.Field(default=None)
+ """
+ The bank account payment's current state.
+
+ See [TenderBankAccountPaymentDetailsStatus](entity:TenderBankAccountDetailsStatus) for possible values.
+ See [TenderBankAccountDetailsStatus](#type-tenderbankaccountdetailsstatus) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/tender_bank_account_details_status.py b/src/square/types/tender_bank_account_details_status.py
new file mode 100644
index 00000000..c7bb236e
--- /dev/null
+++ b/src/square/types/tender_bank_account_details_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TenderBankAccountDetailsStatus = typing.Union[typing.Literal["PENDING", "COMPLETED", "FAILED"], typing.Any]
diff --git a/src/square/types/tender_buy_now_pay_later_details.py b/src/square/types/tender_buy_now_pay_later_details.py
new file mode 100644
index 00000000..bdc35650
--- /dev/null
+++ b/src/square/types/tender_buy_now_pay_later_details.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .tender_buy_now_pay_later_details_brand import TenderBuyNowPayLaterDetailsBrand
+from .tender_buy_now_pay_later_details_status import TenderBuyNowPayLaterDetailsStatus
+
+
+class TenderBuyNowPayLaterDetails(UncheckedBaseModel):
+ """
+ Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`.
+ """
+
+ buy_now_pay_later_brand: typing.Optional[TenderBuyNowPayLaterDetailsBrand] = pydantic.Field(default=None)
+ """
+ The Buy Now Pay Later brand.
+ See [Brand](#type-brand) for possible values
+ """
+
+ status: typing.Optional[TenderBuyNowPayLaterDetailsStatus] = pydantic.Field(default=None)
+ """
+ The buy now pay later payment's current state (such as `AUTHORIZED` or
+ `CAPTURED`). See [TenderBuyNowPayLaterDetailsStatus](entity:TenderBuyNowPayLaterDetailsStatus)
+ for possible values.
+ See [Status](#type-status) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/tender_buy_now_pay_later_details_brand.py b/src/square/types/tender_buy_now_pay_later_details_brand.py
new file mode 100644
index 00000000..61006218
--- /dev/null
+++ b/src/square/types/tender_buy_now_pay_later_details_brand.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TenderBuyNowPayLaterDetailsBrand = typing.Union[typing.Literal["OTHER_BRAND", "AFTERPAY"], typing.Any]
diff --git a/src/square/types/tender_buy_now_pay_later_details_status.py b/src/square/types/tender_buy_now_pay_later_details_status.py
new file mode 100644
index 00000000..3e684216
--- /dev/null
+++ b/src/square/types/tender_buy_now_pay_later_details_status.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TenderBuyNowPayLaterDetailsStatus = typing.Union[
+ typing.Literal["AUTHORIZED", "CAPTURED", "VOIDED", "FAILED"], typing.Any
+]
diff --git a/src/square/types/tender_card_details.py b/src/square/types/tender_card_details.py
new file mode 100644
index 00000000..d544f761
--- /dev/null
+++ b/src/square/types/tender_card_details.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .card import Card
+from .tender_card_details_entry_method import TenderCardDetailsEntryMethod
+from .tender_card_details_status import TenderCardDetailsStatus
+
+
+class TenderCardDetails(UncheckedBaseModel):
+ """
+ Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD`
+ """
+
+ status: typing.Optional[TenderCardDetailsStatus] = pydantic.Field(default=None)
+ """
+ The credit card payment's current state (such as `AUTHORIZED` or
+ `CAPTURED`). See [TenderCardDetailsStatus](entity:TenderCardDetailsStatus)
+ for possible values.
+ See [TenderCardDetailsStatus](#type-tendercarddetailsstatus) for possible values
+ """
+
+ card: typing.Optional[Card] = pydantic.Field(default=None)
+ """
+ The credit card's non-confidential details.
+ """
+
+ entry_method: typing.Optional[TenderCardDetailsEntryMethod] = pydantic.Field(default=None)
+ """
+ The method used to enter the card's details for the transaction.
+ See [TenderCardDetailsEntryMethod](#type-tendercarddetailsentrymethod) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/tender_card_details_entry_method.py b/src/square/types/tender_card_details_entry_method.py
new file mode 100644
index 00000000..dac1d3ac
--- /dev/null
+++ b/src/square/types/tender_card_details_entry_method.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TenderCardDetailsEntryMethod = typing.Union[
+ typing.Literal["SWIPED", "KEYED", "EMV", "ON_FILE", "CONTACTLESS"], typing.Any
+]
diff --git a/src/square/types/tender_card_details_status.py b/src/square/types/tender_card_details_status.py
new file mode 100644
index 00000000..6f58643f
--- /dev/null
+++ b/src/square/types/tender_card_details_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TenderCardDetailsStatus = typing.Union[typing.Literal["AUTHORIZED", "CAPTURED", "VOIDED", "FAILED"], typing.Any]
diff --git a/src/square/types/tender_cash_details.py b/src/square/types/tender_cash_details.py
new file mode 100644
index 00000000..06589de2
--- /dev/null
+++ b/src/square/types/tender_cash_details.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class TenderCashDetails(UncheckedBaseModel):
+ """
+ Represents the details of a tender with `type` `CASH`.
+ """
+
+ buyer_tendered_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount of cash provided by the buyer, before change is given.
+ """
+
+ change_back_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount of change returned to the buyer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/tender_square_account_details.py b/src/square/types/tender_square_account_details.py
new file mode 100644
index 00000000..1a9cd7f9
--- /dev/null
+++ b/src/square/types/tender_square_account_details.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .tender_square_account_details_status import TenderSquareAccountDetailsStatus
+
+
+class TenderSquareAccountDetails(UncheckedBaseModel):
+ """
+ Represents the details of a tender with `type` `SQUARE_ACCOUNT`.
+ """
+
+ status: typing.Optional[TenderSquareAccountDetailsStatus] = pydantic.Field(default=None)
+ """
+ The Square Account payment's current state (such as `AUTHORIZED` or
+ `CAPTURED`). See [TenderSquareAccountDetailsStatus](entity:TenderSquareAccountDetailsStatus)
+ for possible values.
+ See [Status](#type-status) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/tender_square_account_details_status.py b/src/square/types/tender_square_account_details_status.py
new file mode 100644
index 00000000..92733b43
--- /dev/null
+++ b/src/square/types/tender_square_account_details_status.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TenderSquareAccountDetailsStatus = typing.Union[
+ typing.Literal["AUTHORIZED", "CAPTURED", "VOIDED", "FAILED"], typing.Any
+]
diff --git a/src/square/types/tender_type.py b/src/square/types/tender_type.py
new file mode 100644
index 00000000..b9060a79
--- /dev/null
+++ b/src/square/types/tender_type.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TenderType = typing.Union[
+ typing.Literal[
+ "CARD",
+ "CASH",
+ "THIRD_PARTY_CARD",
+ "SQUARE_GIFT_CARD",
+ "NO_SALE",
+ "BANK_ACCOUNT",
+ "WALLET",
+ "BUY_NOW_PAY_LATER",
+ "SQUARE_ACCOUNT",
+ "OTHER",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/terminal_action.py b/src/square/types/terminal_action.py
new file mode 100644
index 00000000..428417dd
--- /dev/null
+++ b/src/square/types/terminal_action.py
@@ -0,0 +1,153 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .action_cancel_reason import ActionCancelReason
+from .confirmation_options import ConfirmationOptions
+from .data_collection_options import DataCollectionOptions
+from .device_metadata import DeviceMetadata
+from .qr_code_options import QrCodeOptions
+from .receipt_options import ReceiptOptions
+from .save_card_options import SaveCardOptions
+from .select_options import SelectOptions
+from .signature_options import SignatureOptions
+from .terminal_action_action_type import TerminalActionActionType
+
+
+class TerminalAction(UncheckedBaseModel):
+ """
+ Represents an action processed by the Square Terminal.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for this `TerminalAction`.
+ """
+
+ device_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique Id of the device intended for this `TerminalAction`.
+ The Id can be retrieved from /v2/devices api.
+ """
+
+ deadline_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The duration as an RFC 3339 duration, after which the action will be automatically canceled.
+ TerminalActions that are `PENDING` will be automatically `CANCELED` and have a cancellation reason
+ of `TIMED_OUT`
+
+ Default: 5 minutes from creation
+
+ Maximum: 5 minutes
+ """
+
+ status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The status of the `TerminalAction`.
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED`
+ """
+
+ cancel_reason: typing.Optional[ActionCancelReason] = pydantic.Field(default=None)
+ """
+ The reason why `TerminalAction` is canceled. Present if the status is `CANCELED`.
+ See [ActionCancelReason](#type-actioncancelreason) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the `TerminalAction` was created as an RFC 3339 timestamp.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the `TerminalAction` was last updated as an RFC 3339 timestamp.
+ """
+
+ app_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the application that created the action.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The location id the action is attached to, if a link can be made.
+ """
+
+ type: typing.Optional[TerminalActionActionType] = pydantic.Field(default=None)
+ """
+ Represents the type of the action.
+ See [ActionType](#type-actiontype) for possible values
+ """
+
+ qr_code_options: typing.Optional[QrCodeOptions] = pydantic.Field(default=None)
+ """
+ Describes configuration for the QR code action. Requires `QR_CODE` type.
+ """
+
+ save_card_options: typing.Optional[SaveCardOptions] = pydantic.Field(default=None)
+ """
+ Describes configuration for the save-card action. Requires `SAVE_CARD` type.
+ """
+
+ signature_options: typing.Optional[SignatureOptions] = pydantic.Field(default=None)
+ """
+ Describes configuration for the signature capture action. Requires `SIGNATURE` type.
+ """
+
+ confirmation_options: typing.Optional[ConfirmationOptions] = pydantic.Field(default=None)
+ """
+ Describes configuration for the confirmation action. Requires `CONFIRMATION` type.
+ """
+
+ receipt_options: typing.Optional[ReceiptOptions] = pydantic.Field(default=None)
+ """
+ Describes configuration for the receipt action. Requires `RECEIPT` type.
+ """
+
+ data_collection_options: typing.Optional[DataCollectionOptions] = pydantic.Field(default=None)
+ """
+ Describes configuration for the data collection action. Requires `DATA_COLLECTION` type.
+ """
+
+ select_options: typing.Optional[SelectOptions] = pydantic.Field(default=None)
+ """
+ Describes configuration for the select action. Requires `SELECT` type.
+ """
+
+ device_metadata: typing.Optional[DeviceMetadata] = pydantic.Field(default=None)
+ """
+ Details about the Terminal that received the action request (such as battery level,
+ operating system version, and network connection settings).
+
+ Only available for `PING` action type.
+ """
+
+ await_next_action: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates the action will be linked to another action and requires a waiting dialog to be
+ displayed instead of returning to the idle screen on completion of the action.
+
+ Only supported on SIGNATURE, CONFIRMATION, DATA_COLLECTION, and SELECT types.
+ """
+
+ await_next_action_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timeout duration of the waiting dialog as an RFC 3339 duration, after which the
+ waiting dialog will no longer be displayed and the Terminal will return to the idle screen.
+
+ Default: 5 minutes from when the waiting dialog is displayed
+
+ Maximum: 5 minutes
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_action_action_type.py b/src/square/types/terminal_action_action_type.py
new file mode 100644
index 00000000..7b993aeb
--- /dev/null
+++ b/src/square/types/terminal_action_action_type.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TerminalActionActionType = typing.Union[
+ typing.Literal["QR_CODE", "PING", "SAVE_CARD", "SIGNATURE", "CONFIRMATION", "RECEIPT", "DATA_COLLECTION", "SELECT"],
+ typing.Any,
+]
diff --git a/src/square/types/terminal_action_created_event.py b/src/square/types/terminal_action_created_event.py
new file mode 100644
index 00000000..121e01db
--- /dev/null
+++ b/src/square/types/terminal_action_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_action_created_event_data import TerminalActionCreatedEventData
+
+
+class TerminalActionCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a TerminalAction is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"terminal.action.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing.Optional[TerminalActionCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_action_created_event_data.py b/src/square/types/terminal_action_created_event_data.py
new file mode 100644
index 00000000..c82760b7
--- /dev/null
+++ b/src/square/types/terminal_action_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_action_created_event_object import TerminalActionCreatedEventObject
+
+
+class TerminalActionCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the created object’s type, `"action"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the created terminal action.
+ """
+
+ object: typing.Optional[TerminalActionCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created terminal action.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_action_created_event_object.py b/src/square/types/terminal_action_created_event_object.py
new file mode 100644
index 00000000..acb9eeb0
--- /dev/null
+++ b/src/square/types/terminal_action_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_action import TerminalAction
+
+
+class TerminalActionCreatedEventObject(UncheckedBaseModel):
+ action: typing.Optional[TerminalAction] = pydantic.Field(default=None)
+ """
+ The created terminal action.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_action_query.py b/src/square/types/terminal_action_query.py
new file mode 100644
index 00000000..2de9c807
--- /dev/null
+++ b/src/square/types/terminal_action_query.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_action_query_filter import TerminalActionQueryFilter
+from .terminal_action_query_sort import TerminalActionQuerySort
+
+
+class TerminalActionQuery(UncheckedBaseModel):
+ filter: typing.Optional[TerminalActionQueryFilter] = pydantic.Field(default=None)
+ """
+ Options for filtering returned `TerminalAction`s
+ """
+
+ sort: typing.Optional[TerminalActionQuerySort] = pydantic.Field(default=None)
+ """
+ Option for sorting returned `TerminalAction` objects.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_action_query_filter.py b/src/square/types/terminal_action_query_filter.py
new file mode 100644
index 00000000..7b3941d4
--- /dev/null
+++ b/src/square/types/terminal_action_query_filter.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_action_action_type import TerminalActionActionType
+from .time_range import TimeRange
+
+
+class TerminalActionQueryFilter(UncheckedBaseModel):
+ device_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ `TerminalAction`s associated with a specific device. If no device is specified then all
+ `TerminalAction`s for the merchant will be displayed.
+ """
+
+ created_at: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ Time range for the beginning of the reporting period. Inclusive.
+ Default value: The current time minus one day.
+ Note that `TerminalAction`s are available for 30 days after creation.
+ """
+
+ status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Filter results with the desired status of the `TerminalAction`
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED`
+ """
+
+ type: typing.Optional[TerminalActionActionType] = pydantic.Field(default=None)
+ """
+ Filter results with the requested ActionType.
+ See [TerminalActionActionType](#type-terminalactionactiontype) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_action_query_sort.py b/src/square/types/terminal_action_query_sort.py
new file mode 100644
index 00000000..53d01e60
--- /dev/null
+++ b/src/square/types/terminal_action_query_sort.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .sort_order import SortOrder
+
+
+class TerminalActionQuerySort(UncheckedBaseModel):
+ sort_order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The order in which results are listed.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_action_updated_event.py b/src/square/types/terminal_action_updated_event.py
new file mode 100644
index 00000000..3d0efd10
--- /dev/null
+++ b/src/square/types/terminal_action_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_action_updated_event_data import TerminalActionUpdatedEventData
+
+
+class TerminalActionUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a TerminalAction is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"terminal.action.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing.Optional[TerminalActionUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_action_updated_event_data.py b/src/square/types/terminal_action_updated_event_data.py
new file mode 100644
index 00000000..8cfe0ca7
--- /dev/null
+++ b/src/square/types/terminal_action_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_action_updated_event_object import TerminalActionUpdatedEventObject
+
+
+class TerminalActionUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the updated object’s type, `"action"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the updated terminal action.
+ """
+
+ object: typing.Optional[TerminalActionUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated terminal action.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_action_updated_event_object.py b/src/square/types/terminal_action_updated_event_object.py
new file mode 100644
index 00000000..12f97a9b
--- /dev/null
+++ b/src/square/types/terminal_action_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_action import TerminalAction
+
+
+class TerminalActionUpdatedEventObject(UncheckedBaseModel):
+ action: typing.Optional[TerminalAction] = pydantic.Field(default=None)
+ """
+ The updated terminal action.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_checkout.py b/src/square/types/terminal_checkout.py
new file mode 100644
index 00000000..9ab4312b
--- /dev/null
+++ b/src/square/types/terminal_checkout.py
@@ -0,0 +1,159 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .action_cancel_reason import ActionCancelReason
+from .checkout_options_payment_type import CheckoutOptionsPaymentType
+from .device_checkout_options import DeviceCheckoutOptions
+from .money import Money
+from .payment_options import PaymentOptions
+
+
+class TerminalCheckout(UncheckedBaseModel):
+ """
+ Represents a checkout processed by the Square Terminal.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for this `TerminalCheckout`.
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount of money (including the tax amount) that the Square Terminal device should try to collect.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional user-defined reference ID that can be used to associate
+ this `TerminalCheckout` to another entity in an external system. For example, an order
+ ID generated by a third-party shopping cart. The ID is also associated with any payments
+ used to complete the checkout.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional note to associate with the checkout, as well as with any payments used to complete the checkout.
+ Note: maximum 500 characters
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The reference to the Square order ID for the checkout request.
+ """
+
+ payment_options: typing.Optional[PaymentOptions] = pydantic.Field(default=None)
+ """
+ Payment-specific options for the checkout request.
+ """
+
+ device_options: DeviceCheckoutOptions = pydantic.Field()
+ """
+ Options to control the display and behavior of the Square Terminal device.
+ """
+
+ deadline_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An RFC 3339 duration, after which the checkout is automatically canceled.
+ A `TerminalCheckout` that is `PENDING` is automatically `CANCELED` and has a cancellation reason
+ of `TIMED_OUT`.
+
+ Default: 5 minutes from creation
+
+ Maximum: 5 minutes
+ """
+
+ status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The status of the `TerminalCheckout`.
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED`
+ """
+
+ cancel_reason: typing.Optional[ActionCancelReason] = pydantic.Field(default=None)
+ """
+ The reason why `TerminalCheckout` is canceled. Present if the status is `CANCELED`.
+ See [ActionCancelReason](#type-actioncancelreason) for possible values
+ """
+
+ payment_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ A list of IDs for payments created by this `TerminalCheckout`.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the `TerminalCheckout` was created, as an RFC 3339 timestamp.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the `TerminalCheckout` was last updated, as an RFC 3339 timestamp.
+ """
+
+ app_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the application that created the checkout.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The location of the device where the `TerminalCheckout` was directed.
+ """
+
+ payment_type: typing.Optional[CheckoutOptionsPaymentType] = pydantic.Field(default=None)
+ """
+ The type of payment the terminal should attempt to capture from. Defaults to `CARD_PRESENT`.
+ See [CheckoutOptionsPaymentType](#type-checkoutoptionspaymenttype) for possible values
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional ID of the team member associated with creating the checkout.
+ """
+
+ customer_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional ID of the customer associated with the checkout.
+ """
+
+ app_fee_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount the developer is taking as a fee for facilitating the payment on behalf
+ of the seller.
+
+ The amount cannot be more than 90% of the total amount of the payment.
+
+ The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
+
+ The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller.
+
+ For more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
+
+ To set this field, PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
+ """
+
+ statement_description_identifier: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional additional payment information to include on the customer's card statement as
+ part of the statement description. This can be, for example, an invoice number, ticket number,
+ or short description that uniquely identifies the purchase.
+ """
+
+ tip_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The amount designated as a tip, in addition to `amount_money`. This may only be set for a
+ checkout that has tipping disabled (`tip_settings.allow_tipping` is `false`).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_checkout_created_event.py b/src/square/types/terminal_checkout_created_event.py
new file mode 100644
index 00000000..072a3790
--- /dev/null
+++ b/src/square/types/terminal_checkout_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_checkout_created_event_data import TerminalCheckoutCreatedEventData
+
+
+class TerminalCheckoutCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [TerminalCheckout](entity:TerminalCheckout) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"terminal.checkout.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing.Optional[TerminalCheckoutCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_checkout_created_event_data.py b/src/square/types/terminal_checkout_created_event_data.py
new file mode 100644
index 00000000..d4aa4de6
--- /dev/null
+++ b/src/square/types/terminal_checkout_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_checkout_created_event_object import TerminalCheckoutCreatedEventObject
+
+
+class TerminalCheckoutCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the created object’s type, `"checkout"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the created terminal checkout.
+ """
+
+ object: typing.Optional[TerminalCheckoutCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created terminal checkout
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_checkout_created_event_object.py b/src/square/types/terminal_checkout_created_event_object.py
new file mode 100644
index 00000000..00da1e00
--- /dev/null
+++ b/src/square/types/terminal_checkout_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_checkout import TerminalCheckout
+
+
+class TerminalCheckoutCreatedEventObject(UncheckedBaseModel):
+ checkout: typing.Optional[TerminalCheckout] = pydantic.Field(default=None)
+ """
+ The created terminal checkout
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_checkout_query.py b/src/square/types/terminal_checkout_query.py
new file mode 100644
index 00000000..0407a249
--- /dev/null
+++ b/src/square/types/terminal_checkout_query.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_checkout_query_filter import TerminalCheckoutQueryFilter
+from .terminal_checkout_query_sort import TerminalCheckoutQuerySort
+
+
+class TerminalCheckoutQuery(UncheckedBaseModel):
+ filter: typing.Optional[TerminalCheckoutQueryFilter] = pydantic.Field(default=None)
+ """
+ Options for filtering returned `TerminalCheckout` objects.
+ """
+
+ sort: typing.Optional[TerminalCheckoutQuerySort] = pydantic.Field(default=None)
+ """
+ Option for sorting returned `TerminalCheckout` objects.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_checkout_query_filter.py b/src/square/types/terminal_checkout_query_filter.py
new file mode 100644
index 00000000..cad30585
--- /dev/null
+++ b/src/square/types/terminal_checkout_query_filter.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .time_range import TimeRange
+
+
+class TerminalCheckoutQueryFilter(UncheckedBaseModel):
+ device_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `TerminalCheckout` objects associated with a specific device. If no device is specified, then all
+ `TerminalCheckout` objects for the merchant are displayed.
+ """
+
+ created_at: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ The time range for the beginning of the reporting period, which is inclusive.
+ Default value: The current time minus one day.
+ Note that `TerminalCheckout`s are available for 30 days after creation.
+ """
+
+ status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Filtered results with the desired status of the `TerminalCheckout`.
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED`
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_checkout_query_sort.py b/src/square/types/terminal_checkout_query_sort.py
new file mode 100644
index 00000000..ce364d11
--- /dev/null
+++ b/src/square/types/terminal_checkout_query_sort.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .sort_order import SortOrder
+
+
+class TerminalCheckoutQuerySort(UncheckedBaseModel):
+ sort_order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The order in which results are listed.
+ Default: `DESC`
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_checkout_updated_event.py b/src/square/types/terminal_checkout_updated_event.py
new file mode 100644
index 00000000..bdaa80ba
--- /dev/null
+++ b/src/square/types/terminal_checkout_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_checkout_updated_event_data import TerminalCheckoutUpdatedEventData
+
+
+class TerminalCheckoutUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [TerminalCheckout](entity:TerminalCheckout) is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"terminal.checkout.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing.Optional[TerminalCheckoutUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_checkout_updated_event_data.py b/src/square/types/terminal_checkout_updated_event_data.py
new file mode 100644
index 00000000..15c5c766
--- /dev/null
+++ b/src/square/types/terminal_checkout_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_checkout_updated_event_object import TerminalCheckoutUpdatedEventObject
+
+
+class TerminalCheckoutUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the updated object’s type, `"checkout"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the updated terminal checkout.
+ """
+
+ object: typing.Optional[TerminalCheckoutUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated terminal checkout
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_checkout_updated_event_object.py b/src/square/types/terminal_checkout_updated_event_object.py
new file mode 100644
index 00000000..dcb38b2d
--- /dev/null
+++ b/src/square/types/terminal_checkout_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_checkout import TerminalCheckout
+
+
+class TerminalCheckoutUpdatedEventObject(UncheckedBaseModel):
+ checkout: typing.Optional[TerminalCheckout] = pydantic.Field(default=None)
+ """
+ The updated terminal checkout
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_refund.py b/src/square/types/terminal_refund.py
new file mode 100644
index 00000000..7c30e1a7
--- /dev/null
+++ b/src/square/types/terminal_refund.py
@@ -0,0 +1,105 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .action_cancel_reason import ActionCancelReason
+from .money import Money
+
+
+class TerminalRefund(UncheckedBaseModel):
+ """
+ Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for this `TerminalRefund`.
+ """
+
+ refund_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The reference to the payment refund created by completing this `TerminalRefund`.
+ """
+
+ payment_id: str = pydantic.Field()
+ """
+ The unique ID of the payment being refunded.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The reference to the Square order ID for the payment identified by the `payment_id`.
+ """
+
+ amount_money: Money = pydantic.Field()
+ """
+ The amount of money, inclusive of `tax_money`, that the `TerminalRefund` should return.
+ This value is limited to the amount taken in the original payment minus any completed or
+ pending refunds.
+ """
+
+ reason: str = pydantic.Field()
+ """
+ A description of the reason for the refund.
+ """
+
+ device_id: str = pydantic.Field()
+ """
+ The unique ID of the device intended for this `TerminalRefund`.
+ The Id can be retrieved from /v2/devices api.
+ """
+
+ deadline_duration: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The RFC 3339 duration, after which the refund is automatically canceled.
+ A `TerminalRefund` that is `PENDING` is automatically `CANCELED` and has a cancellation reason
+ of `TIMED_OUT`.
+
+ Default: 5 minutes from creation.
+
+ Maximum: 5 minutes
+ """
+
+ status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The status of the `TerminalRefund`.
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`.
+ """
+
+ cancel_reason: typing.Optional[ActionCancelReason] = pydantic.Field(default=None)
+ """
+ Present if the status is `CANCELED`.
+ See [ActionCancelReason](#type-actioncancelreason) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the `TerminalRefund` was created, as an RFC 3339 timestamp.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the `TerminalRefund` was last updated, as an RFC 3339 timestamp.
+ """
+
+ app_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the application that created the refund.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The location of the device where the `TerminalRefund` was directed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_refund_created_event.py b/src/square/types/terminal_refund_created_event.py
new file mode 100644
index 00000000..d3a046a5
--- /dev/null
+++ b/src/square/types/terminal_refund_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_refund_created_event_data import TerminalRefundCreatedEventData
+
+
+class TerminalRefundCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a Terminal API refund is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"terminal.refund.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing.Optional[TerminalRefundCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_refund_created_event_data.py b/src/square/types/terminal_refund_created_event_data.py
new file mode 100644
index 00000000..a0b2bd3d
--- /dev/null
+++ b/src/square/types/terminal_refund_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_refund_created_event_object import TerminalRefundCreatedEventObject
+
+
+class TerminalRefundCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the created object’s type, `"refund"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the created terminal refund.
+ """
+
+ object: typing.Optional[TerminalRefundCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created terminal refund.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_refund_created_event_object.py b/src/square/types/terminal_refund_created_event_object.py
new file mode 100644
index 00000000..0ecf984c
--- /dev/null
+++ b/src/square/types/terminal_refund_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_refund import TerminalRefund
+
+
+class TerminalRefundCreatedEventObject(UncheckedBaseModel):
+ refund: typing.Optional[TerminalRefund] = pydantic.Field(default=None)
+ """
+ The created terminal refund.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_refund_query.py b/src/square/types/terminal_refund_query.py
new file mode 100644
index 00000000..0d6e0a33
--- /dev/null
+++ b/src/square/types/terminal_refund_query.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_refund_query_filter import TerminalRefundQueryFilter
+from .terminal_refund_query_sort import TerminalRefundQuerySort
+
+
+class TerminalRefundQuery(UncheckedBaseModel):
+ filter: typing.Optional[TerminalRefundQueryFilter] = pydantic.Field(default=None)
+ """
+ The filter for the Terminal refund query.
+ """
+
+ sort: typing.Optional[TerminalRefundQuerySort] = pydantic.Field(default=None)
+ """
+ The sort order for the Terminal refund query.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_refund_query_filter.py b/src/square/types/terminal_refund_query_filter.py
new file mode 100644
index 00000000..36a96588
--- /dev/null
+++ b/src/square/types/terminal_refund_query_filter.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .time_range import TimeRange
+
+
+class TerminalRefundQueryFilter(UncheckedBaseModel):
+ device_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ `TerminalRefund` objects associated with a specific device. If no device is specified, then all
+ `TerminalRefund` objects for the signed-in account are displayed.
+ """
+
+ created_at: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ The timestamp for the beginning of the reporting period, in RFC 3339 format. Inclusive.
+ Default value: The current time minus one day.
+ Note that `TerminalRefund`s are available for 30 days after creation.
+ """
+
+ status: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Filtered results with the desired status of the `TerminalRefund`.
+ Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_refund_query_sort.py b/src/square/types/terminal_refund_query_sort.py
new file mode 100644
index 00000000..d1df5e3d
--- /dev/null
+++ b/src/square/types/terminal_refund_query_sort.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class TerminalRefundQuerySort(UncheckedBaseModel):
+ sort_order: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The order in which results are listed.
+ - `ASC` - Oldest to newest.
+ - `DESC` - Newest to oldest (default).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_refund_updated_event.py b/src/square/types/terminal_refund_updated_event.py
new file mode 100644
index 00000000..a12bfa44
--- /dev/null
+++ b/src/square/types/terminal_refund_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_refund_updated_event_data import TerminalRefundUpdatedEventData
+
+
+class TerminalRefundUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a Terminal API refund is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"terminal.refund.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ RFC 3339 timestamp of when the event was created.
+ """
+
+ data: typing.Optional[TerminalRefundUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_refund_updated_event_data.py b/src/square/types/terminal_refund_updated_event_data.py
new file mode 100644
index 00000000..0fa96666
--- /dev/null
+++ b/src/square/types/terminal_refund_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_refund_updated_event_object import TerminalRefundUpdatedEventObject
+
+
+class TerminalRefundUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the updated object’s type, `"refund"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the updated terminal refund.
+ """
+
+ object: typing.Optional[TerminalRefundUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated terminal refund.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/terminal_refund_updated_event_object.py b/src/square/types/terminal_refund_updated_event_object.py
new file mode 100644
index 00000000..5710cc4e
--- /dev/null
+++ b/src/square/types/terminal_refund_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .terminal_refund import TerminalRefund
+
+
+class TerminalRefundUpdatedEventObject(UncheckedBaseModel):
+ refund: typing.Optional[TerminalRefund] = pydantic.Field(default=None)
+ """
+ The updated terminal refund.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/test_webhook_subscription_response.py b/src/square/types/test_webhook_subscription_response.py
new file mode 100644
index 00000000..68e189b0
--- /dev/null
+++ b/src/square/types/test_webhook_subscription_response.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription_test_result import SubscriptionTestResult
+
+
+class TestWebhookSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of a request to the TestWebhookSubscription endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ subscription_test_result: typing.Optional[SubscriptionTestResult] = pydantic.Field(default=None)
+ """
+ The [SubscriptionTestResult](entity:SubscriptionTestResult).
+ """
+
+ notification_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL that was used for the webhook notification test.
+ """
+
+ status_code: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The HTTP status code returned by the notification URL.
+ """
+
+ passes_filter: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the notification passed any configured filters.
+ """
+
+ payload: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
+ """
+ The payload that was sent in the test notification.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/time_dimension.py b/src/square/types/time_dimension.py
new file mode 100644
index 00000000..6912be99
--- /dev/null
+++ b/src/square/types/time_dimension.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.serialization import FieldMetadata
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .time_dimension_date_range import TimeDimensionDateRange
+
+
+class TimeDimension(UncheckedBaseModel):
+ dimension: str
+ granularity: typing.Optional[str] = None
+ date_range: typing_extensions.Annotated[
+ typing.Optional[TimeDimensionDateRange], FieldMetadata(alias="dateRange"), pydantic.Field(alias="dateRange")
+ ] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/time_dimension_date_range.py b/src/square/types/time_dimension_date_range.py
new file mode 100644
index 00000000..00728a74
--- /dev/null
+++ b/src/square/types/time_dimension_date_range.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TimeDimensionDateRange = typing.Union[str, typing.List[str], typing.Dict[str, typing.Any]]
diff --git a/src/square/types/time_range.py b/src/square/types/time_range.py
new file mode 100644
index 00000000..2f50a984
--- /dev/null
+++ b/src/square/types/time_range.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class TimeRange(UncheckedBaseModel):
+ """
+ Represents a generic time range. The start and end values are
+ represented in RFC 3339 format. Time ranges are customized to be
+ inclusive or exclusive based on the needs of a particular endpoint.
+ Refer to the relevant endpoint-specific documentation to determine
+ how time ranges are handled.
+ """
+
+ start_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A datetime value in RFC 3339 format indicating when the time range
+ starts.
+ """
+
+ end_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A datetime value in RFC 3339 format indicating when the time range
+ ends.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/timecard.py b/src/square/types/timecard.py
new file mode 100644
index 00000000..74b9ab6f
--- /dev/null
+++ b/src/square/types/timecard.py
@@ -0,0 +1,103 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .break_ import Break
+from .money import Money
+from .timecard_status import TimecardStatus
+from .timecard_wage import TimecardWage
+
+
+class Timecard(UncheckedBaseModel):
+ """
+ A record of the hourly rate, start time, and end time of a single timecard (shift)
+ for a team member. This might include a record of the start and end times of breaks
+ taken during the shift.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ **Read only** The Square-issued UUID for this object.
+ """
+
+ location_id: str = pydantic.Field()
+ """
+ The ID of the [location](entity:Location) for this timecard. The location should be based on
+ where the team member clocked in.
+ """
+
+ timezone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ **Read only** The time zone calculated from the location based on the `location_id`,
+ provided as a convenience value. Format: the IANA time zone database identifier for the
+ location time zone.
+ """
+
+ start_at: str = pydantic.Field()
+ """
+ The start time of the timecard, in RFC 3339 format and shifted to the location
+ timezone + offset. Precision up to the minute is respected; seconds are truncated.
+ """
+
+ end_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The end time of the timecard, in RFC 3339 format and shifted to the location
+ timezone + offset. Precision up to the minute is respected; seconds are truncated.
+ """
+
+ wage: typing.Optional[TimecardWage] = pydantic.Field(default=None)
+ """
+ Job and pay related information. If the wage is not set on create, it defaults to a wage
+ of zero. If the title is not set on create, it defaults to the name of the role the team member
+ is assigned to, if any.
+ """
+
+ breaks: typing.Optional[typing.List[Break]] = pydantic.Field(default=None)
+ """
+ A list of all the paid or unpaid breaks that were taken during this timecard.
+ """
+
+ status: typing.Optional[TimecardStatus] = pydantic.Field(default=None)
+ """
+ Describes the working state of the timecard.
+ See [TimecardStatus](#type-timecardstatus) for possible values
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ **Read only** The current version of the timecard, which is incremented with each update.
+ This field is used for [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
+ control to ensure that requests don't overwrite data from another request.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the timecard was created, in RFC 3339 format presented as UTC.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the timecard was last updated, in RFC 3339 format presented as UTC.
+ """
+
+ team_member_id: str = pydantic.Field()
+ """
+ The ID of the [team member](entity:TeamMember) this timecard belongs to.
+ """
+
+ declared_cash_tip_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The cash tips declared by the team member for this timecard.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/timecard_filter.py b/src/square/types/timecard_filter.py
new file mode 100644
index 00000000..dffeff91
--- /dev/null
+++ b/src/square/types/timecard_filter.py
@@ -0,0 +1,57 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .time_range import TimeRange
+from .timecard_filter_status import TimecardFilterStatus
+from .timecard_workday import TimecardWorkday
+
+
+class TimecardFilter(UncheckedBaseModel):
+ """
+ Defines a filter used in a search for `Timecard` records. `AND` logic is
+ used by Square's servers to apply each filter property specified.
+ """
+
+ location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Fetch timecards for the specified location.
+ """
+
+ status: typing.Optional[TimecardFilterStatus] = pydantic.Field(default=None)
+ """
+ Fetch a `Timecard` instance by `Timecard.status`.
+ See [TimecardFilterStatus](#type-timecardfilterstatus) for possible values
+ """
+
+ start: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ Fetch `Timecard` instances that start in the time range - Inclusive.
+ """
+
+ end: typing.Optional[TimeRange] = pydantic.Field(default=None)
+ """
+ Fetch the `Timecard` instances that end in the time range - Inclusive.
+ """
+
+ workday: typing.Optional[TimecardWorkday] = pydantic.Field(default=None)
+ """
+ Fetch the `Timecard` instances based on the workday date range.
+ """
+
+ team_member_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Fetch timecards for the specified team members.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/timecard_filter_status.py b/src/square/types/timecard_filter_status.py
new file mode 100644
index 00000000..c46d8ebd
--- /dev/null
+++ b/src/square/types/timecard_filter_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TimecardFilterStatus = typing.Union[typing.Literal["OPEN", "CLOSED"], typing.Any]
diff --git a/src/square/types/timecard_query.py b/src/square/types/timecard_query.py
new file mode 100644
index 00000000..5fd791ce
--- /dev/null
+++ b/src/square/types/timecard_query.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .timecard_filter import TimecardFilter
+from .timecard_sort import TimecardSort
+
+
+class TimecardQuery(UncheckedBaseModel):
+ """
+ The parameters of a `Timecard` search query, which includes filter and sort options.
+ """
+
+ filter: typing.Optional[TimecardFilter] = pydantic.Field(default=None)
+ """
+ Query filter options.
+ """
+
+ sort: typing.Optional[TimecardSort] = pydantic.Field(default=None)
+ """
+ Sort order details.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/timecard_sort.py b/src/square/types/timecard_sort.py
new file mode 100644
index 00000000..1c234c67
--- /dev/null
+++ b/src/square/types/timecard_sort.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .sort_order import SortOrder
+from .timecard_sort_field import TimecardSortField
+
+
+class TimecardSort(UncheckedBaseModel):
+ """
+ Sets the sort order of search results.
+ """
+
+ field: typing.Optional[TimecardSortField] = pydantic.Field(default=None)
+ """
+ The field to sort on.
+ See [TimecardSortField](#type-timecardsortfield) for possible values
+ """
+
+ order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The order in which results are returned. Defaults to DESC.
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/timecard_sort_field.py b/src/square/types/timecard_sort_field.py
new file mode 100644
index 00000000..d7bed199
--- /dev/null
+++ b/src/square/types/timecard_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TimecardSortField = typing.Union[typing.Literal["START_AT", "END_AT", "CREATED_AT", "UPDATED_AT"], typing.Any]
diff --git a/src/square/types/timecard_status.py b/src/square/types/timecard_status.py
new file mode 100644
index 00000000..67e30818
--- /dev/null
+++ b/src/square/types/timecard_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TimecardStatus = typing.Union[typing.Literal["OPEN", "CLOSED"], typing.Any]
diff --git a/src/square/types/timecard_wage.py b/src/square/types/timecard_wage.py
new file mode 100644
index 00000000..77bf904d
--- /dev/null
+++ b/src/square/types/timecard_wage.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class TimecardWage(UncheckedBaseModel):
+ """
+ The hourly wage rate used to compensate a team member for a [timecard](entity:Timecard).
+ """
+
+ title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the job performed during this timecard.
+ """
+
+ hourly_rate: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ Can be a custom-set hourly wage or the calculated effective hourly
+ wage based on the annual wage and hours worked per week.
+ """
+
+ job_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the [job](entity:Job) performed for this timecard. Square
+ labor-reporting UIs might group timecards together by ID.
+ """
+
+ tip_eligible: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether team members are eligible for tips when working this job.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/timecard_workday.py b/src/square/types/timecard_workday.py
new file mode 100644
index 00000000..3392c904
--- /dev/null
+++ b/src/square/types/timecard_workday.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .date_range import DateRange
+from .timecard_workday_matcher import TimecardWorkdayMatcher
+
+
+class TimecardWorkday(UncheckedBaseModel):
+ """
+ A `Timecard` search query filter parameter that sets a range of days that
+ a `Timecard` must start or end in before passing the filter condition.
+ """
+
+ date_range: typing.Optional[DateRange] = pydantic.Field(default=None)
+ """
+ Dates for fetching the timecards.
+ """
+
+ match_timecards_by: typing.Optional[TimecardWorkdayMatcher] = pydantic.Field(default=None)
+ """
+ The strategy on which the dates are applied.
+ See [TimecardWorkdayMatcher](#type-timecardworkdaymatcher) for possible values
+ """
+
+ default_timezone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Location-specific timezones convert workdays to datetime filters.
+ Every location included in the query must have a timezone or this field
+ must be provided as a fallback. Format: the IANA timezone database
+ identifier for the relevant timezone.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/timecard_workday_matcher.py b/src/square/types/timecard_workday_matcher.py
new file mode 100644
index 00000000..870898eb
--- /dev/null
+++ b/src/square/types/timecard_workday_matcher.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TimecardWorkdayMatcher = typing.Union[typing.Literal["START_AT", "END_AT", "INTERSECTION"], typing.Any]
diff --git a/src/square/types/tip_settings.py b/src/square/types/tip_settings.py
new file mode 100644
index 00000000..ceea9585
--- /dev/null
+++ b/src/square/types/tip_settings.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class TipSettings(UncheckedBaseModel):
+ allow_tipping: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether tipping is enabled for this checkout. Defaults to false.
+ """
+
+ separate_tip_screen: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether tip options should be presented on the screen before presenting
+ the signature screen during card payment. Defaults to false.
+ """
+
+ custom_tip_field: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether custom tip amounts are allowed during the checkout flow. Defaults to false.
+ """
+
+ tip_percentages: typing.Optional[typing.List[int]] = pydantic.Field(default=None)
+ """
+ A list of tip percentages that should be presented during the checkout flow, specified as
+ up to 3 non-negative integers from 0 to 100 (inclusive). Defaults to 15, 20, and 25.
+ """
+
+ smart_tipping: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Enables the "Smart Tip Amounts" behavior.
+ Exact tipping options depend on the region in which the Square seller is active.
+
+ For payments under 10.00, in the Australia, Canada, Ireland, United Kingdom, and United States, tipping options are presented as no tip, .50, 1.00 or 2.00.
+
+ For payment amounts of 10.00 or greater, tipping options are presented as the following percentages: 0%, 5%, 10%, 15%.
+
+ If set to true, the `tip_percentages` settings is ignored.
+ Defaults to false.
+
+ To learn more about smart tipping, see [Accept Tips with the Square App](https://squareup.com/help/us/en/article/5069-accept-tips-with-the-square-app).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transaction.py b/src/square/types/transaction.py
new file mode 100644
index 00000000..3085a5cb
--- /dev/null
+++ b/src/square/types/transaction.py
@@ -0,0 +1,92 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .refund import Refund
+from .tender import Tender
+from .transaction_product import TransactionProduct
+
+
+class Transaction(UncheckedBaseModel):
+ """
+ Represents a transaction processed with Square, either with the
+ Connect API or with Square Point of Sale.
+
+ The `tenders` field of this object lists all methods of payment used to pay in
+ the transaction.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The transaction's unique ID, issued by Square payments servers.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the transaction's associated location.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp for when the transaction was created, in RFC 3339 format.
+ """
+
+ tenders: typing.Optional[typing.List[Tender]] = pydantic.Field(default=None)
+ """
+ The tenders used to pay in the transaction.
+ """
+
+ refunds: typing.Optional[typing.List[Refund]] = pydantic.Field(default=None)
+ """
+ Refunds that have been applied to any tender in the transaction.
+ """
+
+ reference_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ If the transaction was created with the [Charge](api-endpoint:Transactions-Charge)
+ endpoint, this value is the same as the value provided for the `reference_id`
+ parameter in the request to that endpoint. Otherwise, it is not set.
+ """
+
+ product: typing.Optional[TransactionProduct] = pydantic.Field(default=None)
+ """
+ The Square product that processed the transaction.
+ See [TransactionProduct](#type-transactionproduct) for possible values
+ """
+
+ client_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ If the transaction was created in the Square Point of Sale app, this value
+ is the ID generated for the transaction by Square Point of Sale.
+
+ This ID has no relationship to the transaction's canonical `id`, which is
+ generated by Square's backend servers. This value is generated for bookkeeping
+ purposes, in case the transaction cannot immediately be completed (for example,
+ if the transaction is processed in offline mode).
+
+ It is not currently possible with the Connect API to perform a transaction
+ lookup by this value.
+ """
+
+ shipping_address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The shipping address provided in the request, if any.
+ """
+
+ order_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The order_id is an identifier for the order associated with this transaction, if any.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transaction_product.py b/src/square/types/transaction_product.py
new file mode 100644
index 00000000..2b08ceed
--- /dev/null
+++ b/src/square/types/transaction_product.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TransactionProduct = typing.Union[
+ typing.Literal[
+ "REGISTER", "EXTERNAL_API", "BILLING", "APPOINTMENTS", "INVOICES", "ONLINE_STORE", "PAYROLL", "OTHER"
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/transaction_type.py b/src/square/types/transaction_type.py
new file mode 100644
index 00000000..361f0a10
--- /dev/null
+++ b/src/square/types/transaction_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TransactionType = typing.Union[typing.Literal["DEBIT", "CREDIT"], typing.Any]
diff --git a/src/square/types/transfer_order.py b/src/square/types/transfer_order.py
new file mode 100644
index 00000000..0e17bfd1
--- /dev/null
+++ b/src/square/types/transfer_order.py
@@ -0,0 +1,142 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order_line import TransferOrderLine
+from .transfer_order_status import TransferOrderStatus
+
+
+class TransferOrder(UncheckedBaseModel):
+ """
+ Represents a transfer order for moving [CatalogItemVariation](entity:CatalogItemVariation)s
+ between [Location](entity:Location)s. Transfer orders track the entire lifecycle of an inventory
+ transfer, including:
+ - What items and quantities are being moved
+ - Source and destination locations
+ - Current [TransferOrderStatus](entity:TransferOrderStatus)
+ - Shipping information and tracking
+ - Which [TeamMember](entity:TeamMember) initiated the transfer
+
+ This object is commonly used to:
+ - Track [CatalogItemVariation](entity:CatalogItemVariation) movements between [Location](entity:Location)s
+ - Reconcile expected vs received quantities
+ - Monitor transfer progress and shipping status
+ - Audit inventory movement history
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique system-generated identifier for this transfer order. Use this ID for:
+ - Retrieving transfer order details
+ - Tracking status changes via webhooks
+ - Linking transfers in external systems
+ """
+
+ source_location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The source [Location](entity:Location) sending the [CatalogItemVariation](entity:CatalogItemVariation)s.
+ This location must:
+ - Be active in your Square organization
+ - Have sufficient inventory for the items being transferred
+ - Not be the same as the destination location
+
+ This field is not updatable.
+ """
+
+ destination_location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The destination [Location](entity:Location) receiving the [CatalogItemVariation](entity:CatalogItemVariation)s.
+ This location must:
+ - Be active in your Square organization
+ - Not be the same as the source location
+
+ This field is not updatable.
+ """
+
+ status: typing.Optional[TransferOrderStatus] = pydantic.Field(default=None)
+ """
+ Current [TransferOrderStatus](entity:TransferOrderStatus) indicating where the order is in its lifecycle.
+ Status transitions follow this progression:
+ 1. [DRAFT](entity:TransferOrderStatus) -> [STARTED](entity:TransferOrderStatus) via [StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder)
+ 2. [STARTED](entity:TransferOrderStatus) -> [PARTIALLY_RECEIVED](entity:TransferOrderStatus) via [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder)
+ 3. [PARTIALLY_RECEIVED](entity:TransferOrderStatus) -> [COMPLETED](entity:TransferOrderStatus) after all items received
+
+ Orders can be [CANCELED](entity:TransferOrderStatus) from [STARTED](entity:TransferOrderStatus) or
+ [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status.
+
+ This field is read-only and reflects the current state of the transfer order, and cannot be updated directly. Use the appropriate
+ endpoints (e.g. [StartPurchaseOrder](api-endpoint:TransferOrders-StartTransferOrder), to change the status.
+ See [TransferOrderStatus](#type-transferorderstatus) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp when the transfer order was created, in RFC 3339 format.
+ Used for:
+ - Auditing transfer history
+ - Tracking order age
+ - Reporting and analytics
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp when the transfer order was last updated, in RFC 3339 format.
+ Updated when:
+ - Order status changes
+ - Items are received
+ - Notes or metadata are modified
+ """
+
+ expected_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Expected transfer completion date, in RFC 3339 format.
+ Used for:
+ - Planning inventory availability
+ - Scheduling receiving staff
+ - Monitoring transfer timeliness
+ """
+
+ completed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp when the transfer order was completed or canceled, in RFC 3339 format (e.g. "2023-10-01T12:00:00Z").
+ """
+
+ notes: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional notes about the transfer.
+ """
+
+ tracking_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Shipment tracking number for monitoring transfer progress.
+ """
+
+ created_by_team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the [TeamMember](entity:TeamMember) who created this transfer order. This field is not writeable by the Connect V2 API.
+ """
+
+ line_items: typing.Optional[typing.List[TransferOrderLine]] = pydantic.Field(default=None)
+ """
+ List of [CatalogItemVariation](entity:CatalogItemVariation)s being transferred.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Version for optimistic concurrency control. This is a monotonically increasing integer
+ that changes whenever the transfer order is modified. Use this when calling
+ [UpdateTransferOrder](api-endpoint:TransferOrders-UpdateTransferOrder) and other endpoints to ensure you're
+ not overwriting concurrent changes.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_created_event.py b/src/square/types/transfer_order_created_event.py
new file mode 100644
index 00000000..0665a675
--- /dev/null
+++ b/src/square/types/transfer_order_created_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order_created_event_data import TransferOrderCreatedEventData
+
+
+class TransferOrderCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a transfer_order is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"transfer_order.created"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[TransferOrderCreatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_created_event_data.py b/src/square/types/transfer_order_created_event_data.py
new file mode 100644
index 00000000..534debe8
--- /dev/null
+++ b/src/square/types/transfer_order_created_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order_created_event_object import TransferOrderCreatedEventObject
+
+
+class TransferOrderCreatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"transfer_order"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected transfer_order.
+ """
+
+ object: typing.Optional[TransferOrderCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created transfer_order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_created_event_object.py b/src/square/types/transfer_order_created_event_object.py
new file mode 100644
index 00000000..484682d2
--- /dev/null
+++ b/src/square/types/transfer_order_created_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order import TransferOrder
+
+
+class TransferOrderCreatedEventObject(UncheckedBaseModel):
+ transfer_order: typing.Optional[TransferOrder] = pydantic.Field(default=None)
+ """
+ The created transfer_order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_deleted_event.py b/src/square/types/transfer_order_deleted_event.py
new file mode 100644
index 00000000..ff2863af
--- /dev/null
+++ b/src/square/types/transfer_order_deleted_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order_deleted_event_data import TransferOrderDeletedEventData
+
+
+class TransferOrderDeletedEvent(UncheckedBaseModel):
+ """
+ Published when a transfer_order is deleted.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"transfer_order.deleted"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[TransferOrderDeletedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_deleted_event_data.py b/src/square/types/transfer_order_deleted_event_data.py
new file mode 100644
index 00000000..74453b3b
--- /dev/null
+++ b/src/square/types/transfer_order_deleted_event_data.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class TransferOrderDeletedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"transfer_order"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected transfer_order.
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Is true if the affected object was deleted. Otherwise absent.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_filter.py b/src/square/types/transfer_order_filter.py
new file mode 100644
index 00000000..ab914898
--- /dev/null
+++ b/src/square/types/transfer_order_filter.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order_status import TransferOrderStatus
+
+
+class TransferOrderFilter(UncheckedBaseModel):
+ """
+ Filter criteria for searching transfer orders
+ """
+
+ source_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Filter by source location IDs
+ """
+
+ destination_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Filter by destination location IDs
+ """
+
+ statuses: typing.Optional[typing.List[TransferOrderStatus]] = pydantic.Field(default=None)
+ """
+ Filter by order statuses
+ See [TransferOrderStatus](#type-transferorderstatus) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_goods_receipt.py b/src/square/types/transfer_order_goods_receipt.py
new file mode 100644
index 00000000..51534d37
--- /dev/null
+++ b/src/square/types/transfer_order_goods_receipt.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order_goods_receipt_line_item import TransferOrderGoodsReceiptLineItem
+
+
+class TransferOrderGoodsReceipt(UncheckedBaseModel):
+ """
+ The goods receipt details for a transfer order. This object represents a single receipt
+ of goods against a transfer order, tracking:
+
+ - Which [CatalogItemVariation](entity:CatalogItemVariation)s were received
+ - Quantities received in good condition
+ - Quantities damaged during transit/handling
+ - Quantities canceled during receipt
+
+ Multiple goods receipts can be created for a single transfer order to handle:
+ - Partial deliveries
+ - Multiple shipments
+ - Split receipts across different dates
+ - Cancellations of specific quantities
+
+ Each receipt automatically:
+ - Updates the transfer order status
+ - Adjusts received quantities
+ - Updates inventory levels at both source and destination [Location](entity:Location)s
+ """
+
+ line_items: typing.Optional[typing.List[TransferOrderGoodsReceiptLineItem]] = pydantic.Field(default=None)
+ """
+ Line items being received. Each line item specifies:
+ - The item being received
+ - Quantity received in good condition
+ - Quantity received damaged
+ - Quantity canceled
+
+ Constraints:
+ - Must include at least one line item
+ - Maximum of 1000 line items per receipt
+ - Each line item must reference a valid item from the transfer order
+ - Total of received, damaged, and canceled quantities cannot exceed ordered quantity
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_goods_receipt_line_item.py b/src/square/types/transfer_order_goods_receipt_line_item.py
new file mode 100644
index 00000000..e1d414f2
--- /dev/null
+++ b/src/square/types/transfer_order_goods_receipt_line_item.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class TransferOrderGoodsReceiptLineItem(UncheckedBaseModel):
+ """
+ A simplified line item for goods receipts in transfer orders
+ """
+
+ transfer_order_line_uid: str = pydantic.Field()
+ """
+ The unique identifier of the Transfer Order line being received
+ """
+
+ quantity_received: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The quantity received for this line item as a decimal string (e.g. "10.5").
+ These items will be added to the destination [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of IN_STOCK.
+ """
+
+ quantity_damaged: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The quantity that was damaged during shipping/handling as a decimal string (e.g. "1.5").
+ These items will be added to the destination [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of WASTE.
+ """
+
+ quantity_canceled: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The quantity that was canceled during shipping/handling as a decimal string (e.g. "1.5"). These will be immediately added to inventory in the source location.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_line.py b/src/square/types/transfer_order_line.py
new file mode 100644
index 00000000..611b5de9
--- /dev/null
+++ b/src/square/types/transfer_order_line.py
@@ -0,0 +1,70 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class TransferOrderLine(UncheckedBaseModel):
+ """
+ Represents a line item in a transfer order. Each line item tracks a specific
+ [CatalogItemVariation](entity:CatalogItemVariation) being transferred, including ordered quantities
+ and receipt status.
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique system-generated identifier for the line item. Provide when updating/removing a line via [UpdateTransferOrder](api-endpoint:TransferOrders-UpdateTransferOrder).
+ """
+
+ item_variation_id: str = pydantic.Field()
+ """
+ The required identifier of the [CatalogItemVariation](entity:CatalogItemVariation) being transferred. Must reference
+ a valid catalog item variation that exists in the [Catalog](api:Catalog).
+ """
+
+ quantity_ordered: str = pydantic.Field()
+ """
+ Total quantity ordered, formatted as a decimal string (e.g. "10 or 10.0000"). Required to be a positive number.
+
+ To remove a line item, set `remove` to `true` in [UpdateTransferOrder](api-endpoint:TransferOrders-UpdateTransferOrder).
+ """
+
+ quantity_pending: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Calculated quantity of this line item's yet to be received stock. This is the difference between the total quantity ordered and the sum of quantities received, canceled, and damaged.
+ """
+
+ quantity_received: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Quantity received at destination. These items are added to the destination
+ [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of IN_STOCK.
+
+ This field cannot be updated directly in Create/Update operations, instead use [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder).
+ """
+
+ quantity_damaged: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Quantity received in damaged condition. These items are added to the destination
+ [Location](entity:Location)'s inventory with [InventoryState](entity:InventoryState) of WASTE.
+
+ This field cannot be updated directly in Create/Update operations, instead use [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder).
+ """
+
+ quantity_canceled: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Quantity that was canceled. These items will be immediately added to inventory in the source location.
+
+ This field cannot be updated directly in Create/Update operations, instead use [ReceiveTransferOrder](api-endpoint:TransferOrders-ReceiveTransferOrder) or [CancelTransferOrder](api-endpoint:TransferOrders-CancelTransferOrder).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_query.py b/src/square/types/transfer_order_query.py
new file mode 100644
index 00000000..b365a0fd
--- /dev/null
+++ b/src/square/types/transfer_order_query.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order_filter import TransferOrderFilter
+from .transfer_order_sort import TransferOrderSort
+
+
+class TransferOrderQuery(UncheckedBaseModel):
+ """
+ Query parameters for searching transfer orders
+ """
+
+ filter: typing.Optional[TransferOrderFilter] = pydantic.Field(default=None)
+ """
+ Filter criteria
+ """
+
+ sort: typing.Optional[TransferOrderSort] = pydantic.Field(default=None)
+ """
+ Sort configuration
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_sort.py b/src/square/types/transfer_order_sort.py
new file mode 100644
index 00000000..f6edc9c7
--- /dev/null
+++ b/src/square/types/transfer_order_sort.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .sort_order import SortOrder
+from .transfer_order_sort_field import TransferOrderSortField
+
+
+class TransferOrderSort(UncheckedBaseModel):
+ """
+ Sort configuration for search results
+ """
+
+ field: typing.Optional[TransferOrderSortField] = pydantic.Field(default=None)
+ """
+ Field to sort by
+ See [TransferOrderSortField](#type-transferordersortfield) for possible values
+ """
+
+ order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ Sort order direction
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_sort_field.py b/src/square/types/transfer_order_sort_field.py
new file mode 100644
index 00000000..f785b651
--- /dev/null
+++ b/src/square/types/transfer_order_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TransferOrderSortField = typing.Union[typing.Literal["CREATED_AT", "UPDATED_AT"], typing.Any]
diff --git a/src/square/types/transfer_order_status.py b/src/square/types/transfer_order_status.py
new file mode 100644
index 00000000..894cee4d
--- /dev/null
+++ b/src/square/types/transfer_order_status.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TransferOrderStatus = typing.Union[
+ typing.Literal["DRAFT", "STARTED", "PARTIALLY_RECEIVED", "COMPLETED", "CANCELED"], typing.Any
+]
diff --git a/src/square/types/transfer_order_updated_event.py b/src/square/types/transfer_order_updated_event.py
new file mode 100644
index 00000000..35942a7d
--- /dev/null
+++ b/src/square/types/transfer_order_updated_event.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order_updated_event_data import TransferOrderUpdatedEventData
+
+
+class TransferOrderUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a transfer_order is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the target merchant associated with the event.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of event this represents, `"transfer_order.updated"`.
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for the event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Timestamp of when the event was created, in RFC 3339 format.
+ """
+
+ data: typing.Optional[TransferOrderUpdatedEventData] = pydantic.Field(default=None)
+ """
+ Data associated with the event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_updated_event_data.py b/src/square/types/transfer_order_updated_event_data.py
new file mode 100644
index 00000000..3c0c177f
--- /dev/null
+++ b/src/square/types/transfer_order_updated_event_data.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order_updated_event_object import TransferOrderUpdatedEventObject
+
+
+class TransferOrderUpdatedEventData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the affected object’s type, `"transfer_order"`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the affected transfer_order.
+ """
+
+ object: typing.Optional[TransferOrderUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the updated transfer_order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/transfer_order_updated_event_object.py b/src/square/types/transfer_order_updated_event_object.py
new file mode 100644
index 00000000..d29e8489
--- /dev/null
+++ b/src/square/types/transfer_order_updated_event_object.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .transfer_order import TransferOrder
+
+
+class TransferOrderUpdatedEventObject(UncheckedBaseModel):
+ transfer_order: typing.Optional[TransferOrder] = pydantic.Field(default=None)
+ """
+ The updated transfer_order.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/unlink_customer_from_gift_card_response.py b/src/square/types/unlink_customer_from_gift_card_response.py
new file mode 100644
index 00000000..0a3a4d69
--- /dev/null
+++ b/src/square/types/unlink_customer_from_gift_card_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .gift_card import GiftCard
+
+
+class UnlinkCustomerFromGiftCardResponse(UncheckedBaseModel):
+ """
+ A response that contains the unlinked `GiftCard` object. If the request resulted in errors,
+ the response contains a set of `Error` objects.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ gift_card: typing.Optional[GiftCard] = pydantic.Field(default=None)
+ """
+ The gift card with the ID of the unlinked customer removed from the `customer_ids` field.
+ If no other customers are linked, the `customer_ids` field is also removed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_booking_custom_attribute_definition_response.py b/src/square/types/update_booking_custom_attribute_definition_response.py
new file mode 100644
index 00000000..a2cf16e0
--- /dev/null
+++ b/src/square/types/update_booking_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class UpdateBookingCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents an [UpdateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-UpdateBookingCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The updated custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_booking_response.py b/src/square/types/update_booking_response.py
new file mode 100644
index 00000000..781964fd
--- /dev/null
+++ b/src/square/types/update_booking_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .booking import Booking
+from .error import Error
+
+
+class UpdateBookingResponse(UncheckedBaseModel):
+ booking: typing.Optional[Booking] = pydantic.Field(default=None)
+ """
+ The booking that was updated.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_break_type_response.py b/src/square/types/update_break_type_response.py
new file mode 100644
index 00000000..9bbf9ebe
--- /dev/null
+++ b/src/square/types/update_break_type_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .break_type import BreakType
+from .error import Error
+
+
+class UpdateBreakTypeResponse(UncheckedBaseModel):
+ """
+ A response to a request to update a `BreakType`. The response contains
+ the requested `BreakType` objects and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ break_type: typing.Optional[BreakType] = pydantic.Field(default=None)
+ """
+ The response object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_catalog_image_request.py b/src/square/types/update_catalog_image_request.py
new file mode 100644
index 00000000..5b25edd6
--- /dev/null
+++ b/src/square/types/update_catalog_image_request.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class UpdateCatalogImageRequest(UncheckedBaseModel):
+ idempotency_key: str = pydantic.Field()
+ """
+ A unique string that identifies this UpdateCatalogImage request.
+ Keys can be any valid string but must be unique for every UpdateCatalogImage request.
+
+ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_catalog_image_response.py b/src/square/types/update_catalog_image_response.py
new file mode 100644
index 00000000..05200a1d
--- /dev/null
+++ b/src/square/types/update_catalog_image_response.py
@@ -0,0 +1,56 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class UpdateCatalogImageResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ image: typing.Optional["CatalogObject"] = pydantic.Field(default=None)
+ """
+ The newly updated `CatalogImage` including a Square-generated
+ URL for the encapsulated image file.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ UpdateCatalogImageResponse,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/update_customer_custom_attribute_definition_response.py b/src/square/types/update_customer_custom_attribute_definition_response.py
new file mode 100644
index 00000000..a0d678b4
--- /dev/null
+++ b/src/square/types/update_customer_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class UpdateCustomerCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents an [UpdateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-UpdateCustomerCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The updated custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_customer_group_response.py b/src/square/types/update_customer_group_response.py
new file mode 100644
index 00000000..6abc2678
--- /dev/null
+++ b/src/square/types/update_customer_group_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer_group import CustomerGroup
+from .error import Error
+
+
+class UpdateCustomerGroupResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [UpdateCustomerGroup](api-endpoint:CustomerGroups-UpdateCustomerGroup) endpoint.
+
+ Either `errors` or `group` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ group: typing.Optional[CustomerGroup] = pydantic.Field(default=None)
+ """
+ The successfully updated customer group.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_customer_response.py b/src/square/types/update_customer_response.py
new file mode 100644
index 00000000..f894b19e
--- /dev/null
+++ b/src/square/types/update_customer_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .customer import Customer
+from .error import Error
+
+
+class UpdateCustomerResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [UpdateCustomer](api-endpoint:Customers-UpdateCustomer) or
+ [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) endpoint.
+
+ Either `errors` or `customer` is present in a given response (never both).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ customer: typing.Optional[Customer] = pydantic.Field(default=None)
+ """
+ The updated customer.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_inventory_adjustment_reason_response.py b/src/square/types/update_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..089f153d
--- /dev/null
+++ b/src/square/types/update_inventory_adjustment_reason_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class UpdateInventoryAdjustmentReasonResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [UpdateInventoryAdjustmentReason](api-endpoint:Inventory-UpdateInventoryAdjustmentReason).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing.Optional[InventoryAdjustmentReason] = pydantic.Field(default=None)
+ """
+ The successfully updated inventory adjustment reason.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_inventory_adjustment_response.py b/src/square/types/update_inventory_adjustment_response.py
new file mode 100644
index 00000000..f5f25978
--- /dev/null
+++ b/src/square/types/update_inventory_adjustment_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment import InventoryAdjustment
+
+
+class UpdateInventoryAdjustmentResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ adjustment: typing.Optional[InventoryAdjustment] = pydantic.Field(default=None)
+ """
+ The newly updated adjustment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_invoice_response.py b/src/square/types/update_invoice_response.py
new file mode 100644
index 00000000..1a3d6d27
--- /dev/null
+++ b/src/square/types/update_invoice_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .invoice import Invoice
+
+
+class UpdateInvoiceResponse(UncheckedBaseModel):
+ """
+ Describes a `UpdateInvoice` response.
+ """
+
+ invoice: typing.Optional[Invoice] = pydantic.Field(default=None)
+ """
+ The updated invoice.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_item_modifier_lists_response.py b/src/square/types/update_item_modifier_lists_response.py
new file mode 100644
index 00000000..df256188
--- /dev/null
+++ b/src/square/types/update_item_modifier_lists_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class UpdateItemModifierListsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The database [timestamp](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_item_taxes_response.py b/src/square/types/update_item_taxes_response.py
new file mode 100644
index 00000000..1630227f
--- /dev/null
+++ b/src/square/types/update_item_taxes_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class UpdateItemTaxesResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_job_response.py b/src/square/types/update_job_response.py
new file mode 100644
index 00000000..75e299f5
--- /dev/null
+++ b/src/square/types/update_job_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .job import Job
+
+
+class UpdateJobResponse(UncheckedBaseModel):
+ """
+ Represents an [UpdateJob](api-endpoint:Team-UpdateJob) response. Either `job` or `errors`
+ is present in the response.
+ """
+
+ job: typing.Optional[Job] = pydantic.Field(default=None)
+ """
+ The updated job.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_location_custom_attribute_definition_response.py b/src/square/types/update_location_custom_attribute_definition_response.py
new file mode 100644
index 00000000..f08f9005
--- /dev/null
+++ b/src/square/types/update_location_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class UpdateLocationCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents an [UpdateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-UpdateLocationCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The updated custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_location_response.py b/src/square/types/update_location_response.py
new file mode 100644
index 00000000..0c5e7f44
--- /dev/null
+++ b/src/square/types/update_location_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .location import Location
+
+
+class UpdateLocationResponse(UncheckedBaseModel):
+ """
+ The response object returned by the [UpdateLocation](api-endpoint:Locations-UpdateLocation) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information about errors encountered during the request.
+ """
+
+ location: typing.Optional[Location] = pydantic.Field(default=None)
+ """
+ The updated `Location` object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_location_settings_response.py b/src/square/types/update_location_settings_response.py
new file mode 100644
index 00000000..a37dc787
--- /dev/null
+++ b/src/square/types/update_location_settings_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_location_settings import CheckoutLocationSettings
+from .error import Error
+
+
+class UpdateLocationSettingsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred when updating the location settings.
+ """
+
+ location_settings: typing.Optional[CheckoutLocationSettings] = pydantic.Field(default=None)
+ """
+ The updated location settings.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_merchant_custom_attribute_definition_response.py b/src/square/types/update_merchant_custom_attribute_definition_response.py
new file mode 100644
index 00000000..174630c7
--- /dev/null
+++ b/src/square/types/update_merchant_custom_attribute_definition_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class UpdateMerchantCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents an [UpdateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-UpdateMerchantCustomAttributeDefinition) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The updated custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_merchant_settings_response.py b/src/square/types/update_merchant_settings_response.py
new file mode 100644
index 00000000..31971d81
--- /dev/null
+++ b/src/square/types/update_merchant_settings_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .checkout_merchant_settings import CheckoutMerchantSettings
+from .error import Error
+
+
+class UpdateMerchantSettingsResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred when updating the merchant settings.
+ """
+
+ merchant_settings: typing.Optional[CheckoutMerchantSettings] = pydantic.Field(default=None)
+ """
+ The updated merchant settings.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_order_custom_attribute_definition_response.py b/src/square/types/update_order_custom_attribute_definition_response.py
new file mode 100644
index 00000000..b84de324
--- /dev/null
+++ b/src/square/types/update_order_custom_attribute_definition_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute_definition import CustomAttributeDefinition
+from .error import Error
+
+
+class UpdateOrderCustomAttributeDefinitionResponse(UncheckedBaseModel):
+ """
+ Represents a response from updating an order custom attribute definition.
+ """
+
+ custom_attribute_definition: typing.Optional[CustomAttributeDefinition] = pydantic.Field(default=None)
+ """
+ The updated order custom attribute definition.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_order_response.py b/src/square/types/update_order_response.py
new file mode 100644
index 00000000..66461c39
--- /dev/null
+++ b/src/square/types/update_order_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .order import Order
+
+
+class UpdateOrderResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint.
+ """
+
+ order: typing.Optional[Order] = pydantic.Field(default=None)
+ """
+ The updated order.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_payment_link_response.py b/src/square/types/update_payment_link_response.py
new file mode 100644
index 00000000..7f3b3ef0
--- /dev/null
+++ b/src/square/types/update_payment_link_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment_link import PaymentLink
+
+
+class UpdatePaymentLinkResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred when updating the payment link.
+ """
+
+ payment_link: typing.Optional[PaymentLink] = pydantic.Field(default=None)
+ """
+ The updated payment link.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_payment_response.py b/src/square/types/update_payment_response.py
new file mode 100644
index 00000000..0a3ffb0e
--- /dev/null
+++ b/src/square/types/update_payment_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .payment import Payment
+
+
+class UpdatePaymentResponse(UncheckedBaseModel):
+ """
+ Defines the response returned by
+ [UpdatePayment](api-endpoint:Payments-UpdatePayment).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ payment: typing.Optional[Payment] = pydantic.Field(default=None)
+ """
+ The updated payment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_scheduled_shift_response.py b/src/square/types/update_scheduled_shift_response.py
new file mode 100644
index 00000000..3767cde7
--- /dev/null
+++ b/src/square/types/update_scheduled_shift_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .scheduled_shift import ScheduledShift
+
+
+class UpdateScheduledShiftResponse(UncheckedBaseModel):
+ """
+ Represents an [UpdateScheduledShift](api-endpoint:Labor-UpdateScheduledShift) response.
+ Either `scheduled_shift` or `errors` is present in the response.
+ """
+
+ scheduled_shift: typing.Optional[ScheduledShift] = pydantic.Field(default=None)
+ """
+ The updated scheduled shift. To make the changes public, call
+ [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) or
+ [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_shift_response.py b/src/square/types/update_shift_response.py
new file mode 100644
index 00000000..77cb7903
--- /dev/null
+++ b/src/square/types/update_shift_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .shift import Shift
+
+
+class UpdateShiftResponse(UncheckedBaseModel):
+ """
+ The response to a request to update a `Shift`. The response contains
+ the updated `Shift` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ shift: typing.Optional[Shift] = pydantic.Field(default=None)
+ """
+ The updated `Shift`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_subscription_response.py b/src/square/types/update_subscription_response.py
new file mode 100644
index 00000000..ce0604a5
--- /dev/null
+++ b/src/square/types/update_subscription_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .subscription import Subscription
+
+
+class UpdateSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines output parameters in a response from the
+ [UpdateSubscription](api-endpoint:Subscriptions-UpdateSubscription) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered during the request.
+ """
+
+ subscription: typing.Optional[Subscription] = pydantic.Field(default=None)
+ """
+ The updated subscription.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_team_member_request.py b/src/square/types/update_team_member_request.py
new file mode 100644
index 00000000..9a1ce566
--- /dev/null
+++ b/src/square/types/update_team_member_request.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .team_member import TeamMember
+
+
+class UpdateTeamMemberRequest(UncheckedBaseModel):
+ """
+ Represents an update request for a `TeamMember` object.
+ """
+
+ team_member: typing.Optional[TeamMember] = pydantic.Field(default=None)
+ """
+ The team member fields to add, change, or clear. Fields can be cleared using a null value. To update
+ `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed, call
+ [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_team_member_response.py b/src/square/types/update_team_member_response.py
new file mode 100644
index 00000000..0af78489
--- /dev/null
+++ b/src/square/types/update_team_member_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .team_member import TeamMember
+
+
+class UpdateTeamMemberResponse(UncheckedBaseModel):
+ """
+ Represents a response from an update request containing the updated `TeamMember` object or error messages.
+ """
+
+ team_member: typing.Optional[TeamMember] = pydantic.Field(default=None)
+ """
+ The successfully updated `TeamMember` object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_timecard_response.py b/src/square/types/update_timecard_response.py
new file mode 100644
index 00000000..83d6c73e
--- /dev/null
+++ b/src/square/types/update_timecard_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .timecard import Timecard
+
+
+class UpdateTimecardResponse(UncheckedBaseModel):
+ """
+ The response to a request to update a `Timecard`. The response contains
+ the updated `Timecard` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ timecard: typing.Optional[Timecard] = pydantic.Field(default=None)
+ """
+ The updated `Timecard`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_transfer_order_data.py b/src/square/types/update_transfer_order_data.py
new file mode 100644
index 00000000..56e35fac
--- /dev/null
+++ b/src/square/types/update_transfer_order_data.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .update_transfer_order_line_data import UpdateTransferOrderLineData
+
+
+class UpdateTransferOrderData(UncheckedBaseModel):
+ """
+ Data model for updating a transfer order. All fields are optional.
+ """
+
+ source_location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The source [Location](entity:Location) that will send the items. Must be an active location
+ in your Square account with sufficient inventory of the requested items.
+ """
+
+ destination_location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The destination [Location](entity:Location) that will receive the items. Must be an active location
+ in your Square account.
+ """
+
+ expected_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Expected transfer date in RFC 3339 format (e.g. "2023-10-01T12:00:00Z").
+ """
+
+ notes: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional notes about the transfer
+ """
+
+ tracking_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Shipment tracking number
+ """
+
+ line_items: typing.Optional[typing.List[UpdateTransferOrderLineData]] = pydantic.Field(default=None)
+ """
+ List of items being transferred
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_transfer_order_line_data.py b/src/square/types/update_transfer_order_line_data.py
new file mode 100644
index 00000000..a2b3bc8b
--- /dev/null
+++ b/src/square/types/update_transfer_order_line_data.py
@@ -0,0 +1,44 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class UpdateTransferOrderLineData(UncheckedBaseModel):
+ """
+ Represents a line item update in a transfer order
+ """
+
+ uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Line item id being updated. Required for updating/removing existing line items, but should not be set for new line items.
+ """
+
+ item_variation_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Catalog item variation being transferred
+
+ Required for new line items, but otherwise is not updatable.
+ """
+
+ quantity_ordered: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Total quantity ordered
+ """
+
+ remove: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Flag to remove the line item during update. Must include `uid` in removal request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_transfer_order_response.py b/src/square/types/update_transfer_order_response.py
new file mode 100644
index 00000000..c76abd76
--- /dev/null
+++ b/src/square/types/update_transfer_order_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .transfer_order import TransferOrder
+
+
+class UpdateTransferOrderResponse(UncheckedBaseModel):
+ """
+ Response for updating a transfer order
+ """
+
+ transfer_order: typing.Optional[TransferOrder] = pydantic.Field(default=None)
+ """
+ The updated transfer order
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_vendor_request.py b/src/square/types/update_vendor_request.py
new file mode 100644
index 00000000..4d4dcde0
--- /dev/null
+++ b/src/square/types/update_vendor_request.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .vendor import Vendor
+
+
+class UpdateVendorRequest(UncheckedBaseModel):
+ """
+ Represents an input to a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor).
+ """
+
+ idempotency_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+ """
+
+ vendor: Vendor = pydantic.Field()
+ """
+ The specified [Vendor](entity:Vendor) to be updated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_vendor_response.py b/src/square/types/update_vendor_response.py
new file mode 100644
index 00000000..89873e6f
--- /dev/null
+++ b/src/square/types/update_vendor_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .vendor import Vendor
+
+
+class UpdateVendorResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors occurred when the request fails.
+ """
+
+ vendor: typing.Optional[Vendor] = pydantic.Field(default=None)
+ """
+ The [Vendor](entity:Vendor) that has been updated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_wage_setting_response.py b/src/square/types/update_wage_setting_response.py
new file mode 100644
index 00000000..7ffcb822
--- /dev/null
+++ b/src/square/types/update_wage_setting_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .wage_setting import WageSetting
+
+
+class UpdateWageSettingResponse(UncheckedBaseModel):
+ """
+ Represents a response from an update request containing the updated `WageSetting` object
+ or error messages.
+ """
+
+ wage_setting: typing.Optional[WageSetting] = pydantic.Field(default=None)
+ """
+ The successfully updated `WageSetting` object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ The errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_webhook_subscription_response.py b/src/square/types/update_webhook_subscription_response.py
new file mode 100644
index 00000000..09de73e2
--- /dev/null
+++ b/src/square/types/update_webhook_subscription_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .webhook_subscription import WebhookSubscription
+
+
+class UpdateWebhookSubscriptionResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [UpdateWebhookSubscription](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscription) endpoint.
+
+ Note: If there are errors processing the request, the [Subscription](entity:WebhookSubscription) is not
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ subscription: typing.Optional[WebhookSubscription] = pydantic.Field(default=None)
+ """
+ The updated [Subscription](entity:WebhookSubscription).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_webhook_subscription_signature_key_response.py b/src/square/types/update_webhook_subscription_signature_key_response.py
new file mode 100644
index 00000000..4965ff7f
--- /dev/null
+++ b/src/square/types/update_webhook_subscription_signature_key_response.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class UpdateWebhookSubscriptionSignatureKeyResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) endpoint.
+
+ Note: If there are errors processing the request, the [Subscription](entity:WebhookSubscription) is not
+ present.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Information on errors encountered during the request.
+ """
+
+ signature_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The new Square-generated signature key used to validate the origin of the webhook event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_workweek_config_response.py b/src/square/types/update_workweek_config_response.py
new file mode 100644
index 00000000..b5c22959
--- /dev/null
+++ b/src/square/types/update_workweek_config_response.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .workweek_config import WorkweekConfig
+
+
+class UpdateWorkweekConfigResponse(UncheckedBaseModel):
+ """
+ The response to a request to update a `WorkweekConfig` object. The response contains
+ the updated `WorkweekConfig` object and might contain a set of `Error` objects if
+ the request resulted in errors.
+ """
+
+ workweek_config: typing.Optional[WorkweekConfig] = pydantic.Field(default=None)
+ """
+ The response object.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/upsert_booking_custom_attribute_response.py b/src/square/types/upsert_booking_custom_attribute_response.py
new file mode 100644
index 00000000..72f5ce5c
--- /dev/null
+++ b/src/square/types/upsert_booking_custom_attribute_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class UpsertBookingCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents an [UpsertBookingCustomAttribute](api-endpoint:BookingCustomAttributes-UpsertBookingCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/upsert_catalog_object_response.py b/src/square/types/upsert_catalog_object_response.py
new file mode 100644
index 00000000..9f386a8b
--- /dev/null
+++ b/src/square/types/upsert_catalog_object_response.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .catalog_id_mapping import CatalogIdMapping
+from .error import Error
+
+
+class UpsertCatalogObjectResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ catalog_object: typing.Optional["CatalogObject"] = pydantic.Field(default=None)
+ """
+ The successfully created or updated CatalogObject.
+ """
+
+ id_mappings: typing.Optional[typing.List[CatalogIdMapping]] = pydantic.Field(default=None)
+ """
+ The mapping between client and server IDs for this upsert.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .catalog_item import CatalogItem # noqa: E402, I001
+from .catalog_item_option import CatalogItemOption # noqa: E402, I001
+from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001
+from .catalog_object import CatalogObject # noqa: E402, I001
+from .catalog_object_item import CatalogObjectItem # noqa: E402, I001
+from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001
+from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001
+from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001
+from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001
+
+update_forward_refs(
+ UpsertCatalogObjectResponse,
+ CatalogItem=CatalogItem,
+ CatalogItemOption=CatalogItemOption,
+ CatalogModifierList=CatalogModifierList,
+ CatalogObject=CatalogObject,
+ CatalogObjectItem=CatalogObjectItem,
+ CatalogObjectItemOption=CatalogObjectItemOption,
+ CatalogObjectModifierList=CatalogObjectModifierList,
+ CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan,
+ CatalogSubscriptionPlan=CatalogSubscriptionPlan,
+)
diff --git a/src/square/types/upsert_customer_custom_attribute_response.py b/src/square/types/upsert_customer_custom_attribute_response.py
new file mode 100644
index 00000000..e5bed92a
--- /dev/null
+++ b/src/square/types/upsert_customer_custom_attribute_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class UpsertCustomerCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents an [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/upsert_location_custom_attribute_response.py b/src/square/types/upsert_location_custom_attribute_response.py
new file mode 100644
index 00000000..665752a2
--- /dev/null
+++ b/src/square/types/upsert_location_custom_attribute_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class UpsertLocationCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents an [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/upsert_merchant_custom_attribute_response.py b/src/square/types/upsert_merchant_custom_attribute_response.py
new file mode 100644
index 00000000..2754a6a1
--- /dev/null
+++ b/src/square/types/upsert_merchant_custom_attribute_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class UpsertMerchantCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents an [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) response.
+ Either `custom_attribute_definition` or `errors` is present in the response.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The new or updated custom attribute.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/upsert_order_custom_attribute_response.py b/src/square/types/upsert_order_custom_attribute_response.py
new file mode 100644
index 00000000..ded81590
--- /dev/null
+++ b/src/square/types/upsert_order_custom_attribute_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .custom_attribute import CustomAttribute
+from .error import Error
+
+
+class UpsertOrderCustomAttributeResponse(UncheckedBaseModel):
+ """
+ Represents a response from upserting order custom attribute definitions.
+ """
+
+ custom_attribute: typing.Optional[CustomAttribute] = pydantic.Field(default=None)
+ """
+ The order custom attribute that was created or modified.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/upsert_snippet_response.py b/src/square/types/upsert_snippet_response.py
new file mode 100644
index 00000000..eee955d8
--- /dev/null
+++ b/src/square/types/upsert_snippet_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .snippet import Snippet
+
+
+class UpsertSnippetResponse(UncheckedBaseModel):
+ """
+ Represents an `UpsertSnippet` response. The response can include either `snippet` or `errors`.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ snippet: typing.Optional[Snippet] = pydantic.Field(default=None)
+ """
+ The new or updated snippet.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/v1get_payment_request.py b/src/square/types/v1get_payment_request.py
new file mode 100644
index 00000000..6d3cf15c
--- /dev/null
+++ b/src/square/types/v1get_payment_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+V1GetPaymentRequest = typing.Any
diff --git a/src/square/types/v1get_settlement_request.py b/src/square/types/v1get_settlement_request.py
new file mode 100644
index 00000000..0204d1e4
--- /dev/null
+++ b/src/square/types/v1get_settlement_request.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+V1GetSettlementRequest = typing.Any
diff --git a/src/square/types/v1money.py b/src/square/types/v1money.py
new file mode 100644
index 00000000..7aed356a
--- /dev/null
+++ b/src/square/types/v1money.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .currency import Currency
+
+
+class V1Money(UncheckedBaseModel):
+ amount: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Amount in the lowest denominated value of this Currency. E.g. in USD
+ these are cents, in JPY they are Yen (which do not have a 'cent' concept).
+ """
+
+ currency_code: typing.Optional[Currency] = pydantic.Field(default=None)
+ """
+
+ See [Currency](#type-currency) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/v1order.py b/src/square/types/v1order.py
new file mode 100644
index 00000000..6cbbab09
--- /dev/null
+++ b/src/square/types/v1order.py
@@ -0,0 +1,154 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .error import Error
+from .v1money import V1Money
+from .v1order_history_entry import V1OrderHistoryEntry
+from .v1order_state import V1OrderState
+from .v1tender import V1Tender
+
+
+class V1Order(UncheckedBaseModel):
+ """
+ V1Order
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The order's unique identifier.
+ """
+
+ buyer_email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address of the order's buyer.
+ """
+
+ recipient_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the order's buyer.
+ """
+
+ recipient_phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The phone number to use for the order's delivery.
+ """
+
+ state: typing.Optional[V1OrderState] = pydantic.Field(default=None)
+ """
+ Whether the tax is an ADDITIVE tax or an INCLUSIVE tax.
+ See [V1OrderState](#type-v1orderstate) for possible values
+ """
+
+ shipping_address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The address to ship the order to.
+ """
+
+ subtotal_money: typing.Optional[V1Money] = pydantic.Field(default=None)
+ """
+ The amount of all items purchased in the order, before taxes and shipping.
+ """
+
+ total_shipping_money: typing.Optional[V1Money] = pydantic.Field(default=None)
+ """
+ The shipping cost for the order.
+ """
+
+ total_tax_money: typing.Optional[V1Money] = pydantic.Field(default=None)
+ """
+ The total of all taxes applied to the order.
+ """
+
+ total_price_money: typing.Optional[V1Money] = pydantic.Field(default=None)
+ """
+ The total cost of the order.
+ """
+
+ total_discount_money: typing.Optional[V1Money] = pydantic.Field(default=None)
+ """
+ The total of all discounts applied to the order.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the order was created, in ISO 8601 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the order was last modified, in ISO 8601 format.
+ """
+
+ expires_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the order expires if no action is taken, in ISO 8601 format.
+ """
+
+ payment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique identifier of the payment associated with the order.
+ """
+
+ buyer_note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note provided by the buyer when the order was created, if any.
+ """
+
+ completed_note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note provided by the merchant when the order's state was set to COMPLETED, if any
+ """
+
+ refunded_note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note provided by the merchant when the order's state was set to REFUNDED, if any.
+ """
+
+ canceled_note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note provided by the merchant when the order's state was set to CANCELED, if any.
+ """
+
+ tender: typing.Optional[V1Tender] = pydantic.Field(default=None)
+ """
+ The tender used to pay for the order.
+ """
+
+ order_history: typing.Optional[typing.List[V1OrderHistoryEntry]] = pydantic.Field(default=None)
+ """
+ The history of actions associated with the order.
+ """
+
+ promo_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The promo code provided by the buyer, if any.
+ """
+
+ btc_receive_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ For Bitcoin transactions, the address that the buyer sent Bitcoin to.
+ """
+
+ btc_price_satoshi: typing.Optional[float] = pydantic.Field(default=None)
+ """
+ For Bitcoin transactions, the price of the buyer's order in satoshi (100 million satoshi equals 1 BTC).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/v1order_history_entry.py b/src/square/types/v1order_history_entry.py
new file mode 100644
index 00000000..d14d9f22
--- /dev/null
+++ b/src/square/types/v1order_history_entry.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .v1order_history_entry_action import V1OrderHistoryEntryAction
+
+
+class V1OrderHistoryEntry(UncheckedBaseModel):
+ """
+ V1OrderHistoryEntry
+ """
+
+ action: typing.Optional[V1OrderHistoryEntryAction] = pydantic.Field(default=None)
+ """
+ The type of action performed on the order.
+ See [V1OrderHistoryEntryAction](#type-v1orderhistoryentryaction) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the action was performed, in ISO 8601 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/v1order_history_entry_action.py b/src/square/types/v1order_history_entry_action.py
new file mode 100644
index 00000000..93f4f4e5
--- /dev/null
+++ b/src/square/types/v1order_history_entry_action.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+V1OrderHistoryEntryAction = typing.Union[
+ typing.Literal["ORDER_PLACED", "DECLINED", "PAYMENT_RECEIVED", "CANCELED", "COMPLETED", "REFUNDED", "EXPIRED"],
+ typing.Any,
+]
diff --git a/src/square/types/v1order_state.py b/src/square/types/v1order_state.py
new file mode 100644
index 00000000..28509e25
--- /dev/null
+++ b/src/square/types/v1order_state.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+V1OrderState = typing.Union[
+ typing.Literal["PENDING", "OPEN", "COMPLETED", "CANCELED", "REFUNDED", "REJECTED"], typing.Any
+]
diff --git a/src/square/types/v1tender.py b/src/square/types/v1tender.py
new file mode 100644
index 00000000..62732ec1
--- /dev/null
+++ b/src/square/types/v1tender.py
@@ -0,0 +1,130 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .v1money import V1Money
+from .v1tender_card_brand import V1TenderCardBrand
+from .v1tender_entry_method import V1TenderEntryMethod
+from .v1tender_type import V1TenderType
+
+
+class V1Tender(UncheckedBaseModel):
+ """
+ A tender represents a discrete monetary exchange. Square represents this
+ exchange as a money object with a specific currency and amount, where the
+ amount is given in the smallest denomination of the given currency.
+
+ Square POS can accept more than one form of tender for a single payment (such
+ as by splitting a bill between a credit card and a gift card). The `tender`
+ field of the Payment object lists all forms of tender used for the payment.
+
+ Split tender payments behave slightly differently from single tender payments:
+
+ The receipt_url for a split tender corresponds only to the first tender listed
+ in the tender field. To get the receipt URLs for the remaining tenders, use
+ the receipt_url fields of the corresponding Tender objects.
+
+ *A note on gift cards**: when a customer purchases a Square gift card from a
+ merchant, the merchant receives the full amount of the gift card in the
+ associated payment.
+
+ When that gift card is used as a tender, the balance of the gift card is
+ reduced and the merchant receives no funds. A `Tender` object with a type of
+ `SQUARE_GIFT_CARD` indicates a gift card was used for some or all of the
+ associated payment.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The tender's unique ID.
+ """
+
+ type: typing.Optional[V1TenderType] = pydantic.Field(default=None)
+ """
+ The type of tender.
+ See [V1TenderType](#type-v1tendertype) for possible values
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A human-readable description of the tender.
+ """
+
+ employee_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the employee that processed the tender.
+ """
+
+ receipt_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL of the receipt for the tender.
+ """
+
+ card_brand: typing.Optional[V1TenderCardBrand] = pydantic.Field(default=None)
+ """
+ The brand of credit card provided.
+ See [V1TenderCardBrand](#type-v1tendercardbrand) for possible values
+ """
+
+ pan_suffix: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The last four digits of the provided credit card's account number.
+ """
+
+ entry_method: typing.Optional[V1TenderEntryMethod] = pydantic.Field(default=None)
+ """
+ The tender's unique ID.
+ See [V1TenderEntryMethod](#type-v1tenderentrymethod) for possible values
+ """
+
+ payment_note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Notes entered by the merchant about the tender at the time of payment, if any. Typically only present for tender with the type: OTHER.
+ """
+
+ total_money: typing.Optional[V1Money] = pydantic.Field(default=None)
+ """
+ The total amount of money provided in this form of tender.
+ """
+
+ tendered_money: typing.Optional[V1Money] = pydantic.Field(default=None)
+ """
+ The amount of total_money applied to the payment.
+ """
+
+ tendered_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the tender was created, in ISO 8601 format.
+ """
+
+ settled_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The time when the tender was settled, in ISO 8601 format.
+ """
+
+ change_back_money: typing.Optional[V1Money] = pydantic.Field(default=None)
+ """
+ The amount of total_money returned to the buyer as change.
+ """
+
+ refunded_money: typing.Optional[V1Money] = pydantic.Field(default=None)
+ """
+ The total of all refunds applied to this tender. This amount is always negative or zero.
+ """
+
+ is_exchange: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether or not the tender is associated with an exchange. If is_exchange is true, the tender represents the value of goods returned in an exchange not the actual money paid. The exchange value reduces the tender amounts needed to pay for items purchased in the exchange.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/v1tender_card_brand.py b/src/square/types/v1tender_card_brand.py
new file mode 100644
index 00000000..1f49af42
--- /dev/null
+++ b/src/square/types/v1tender_card_brand.py
@@ -0,0 +1,18 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+V1TenderCardBrand = typing.Union[
+ typing.Literal[
+ "OTHER_BRAND",
+ "VISA",
+ "MASTER_CARD",
+ "AMERICAN_EXPRESS",
+ "DISCOVER",
+ "DISCOVER_DINERS",
+ "JCB",
+ "CHINA_UNIONPAY",
+ "SQUARE_GIFT_CARD",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/v1tender_entry_method.py b/src/square/types/v1tender_entry_method.py
new file mode 100644
index 00000000..cdd9042e
--- /dev/null
+++ b/src/square/types/v1tender_entry_method.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+V1TenderEntryMethod = typing.Union[
+ typing.Literal["MANUAL", "SCANNED", "SQUARE_CASH", "SQUARE_WALLET", "SWIPED", "WEB_FORM", "OTHER"], typing.Any
+]
diff --git a/src/square/types/v1tender_type.py b/src/square/types/v1tender_type.py
new file mode 100644
index 00000000..e5217361
--- /dev/null
+++ b/src/square/types/v1tender_type.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+V1TenderType = typing.Union[
+ typing.Literal[
+ "CREDIT_CARD", "CASH", "THIRD_PARTY_CARD", "NO_SALE", "SQUARE_WALLET", "SQUARE_GIFT_CARD", "UNKNOWN", "OTHER"
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/v1update_order_request_action.py b/src/square/types/v1update_order_request_action.py
new file mode 100644
index 00000000..5ae55098
--- /dev/null
+++ b/src/square/types/v1update_order_request_action.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+V1UpdateOrderRequestAction = typing.Union[typing.Literal["COMPLETE", "CANCEL", "REFUND"], typing.Any]
diff --git a/src/square/types/vendor.py b/src/square/types/vendor.py
new file mode 100644
index 00000000..d36736fd
--- /dev/null
+++ b/src/square/types/vendor.py
@@ -0,0 +1,80 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .address import Address
+from .vendor_contact import VendorContact
+from .vendor_status import VendorStatus
+
+
+class Vendor(UncheckedBaseModel):
+ """
+ Represents a supplier to a seller.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique Square-generated ID for the [Vendor](entity:Vendor).
+ This field is required when attempting to update a [Vendor](entity:Vendor).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An RFC 3339-formatted timestamp that indicates when the
+ [Vendor](entity:Vendor) was created.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An RFC 3339-formatted timestamp that indicates when the
+ [Vendor](entity:Vendor) was last updated.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the [Vendor](entity:Vendor).
+ This field is required when attempting to create or update a [Vendor](entity:Vendor).
+ """
+
+ address: typing.Optional[Address] = pydantic.Field(default=None)
+ """
+ The address of the [Vendor](entity:Vendor).
+ """
+
+ contacts: typing.Optional[typing.List[VendorContact]] = pydantic.Field(default=None)
+ """
+ The contacts of the [Vendor](entity:Vendor).
+ """
+
+ account_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The account number of the [Vendor](entity:Vendor).
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note detailing information about the [Vendor](entity:Vendor).
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The version of the [Vendor](entity:Vendor).
+ """
+
+ status: typing.Optional[VendorStatus] = pydantic.Field(default=None)
+ """
+ The status of the [Vendor](entity:Vendor).
+ See [Status](#type-status) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/vendor_contact.py b/src/square/types/vendor_contact.py
new file mode 100644
index 00000000..59fbf12a
--- /dev/null
+++ b/src/square/types/vendor_contact.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class VendorContact(UncheckedBaseModel):
+ """
+ Represents a contact of a [Vendor](entity:Vendor).
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique Square-generated ID for the [VendorContact](entity:VendorContact).
+ This field is required when attempting to update a [VendorContact](entity:VendorContact).
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the [VendorContact](entity:VendorContact).
+ This field is required when attempting to create a [Vendor](entity:Vendor).
+ """
+
+ email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address of the [VendorContact](entity:VendorContact).
+ """
+
+ phone_number: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The phone number of the [VendorContact](entity:VendorContact).
+ """
+
+ removed: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ The state of the [VendorContact](entity:VendorContact).
+ """
+
+ ordinal: int = pydantic.Field()
+ """
+ The ordinal of the [VendorContact](entity:VendorContact).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/vendor_created_event.py b/src/square/types/vendor_created_event.py
new file mode 100644
index 00000000..c8954e1d
--- /dev/null
+++ b/src/square/types/vendor_created_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .vendor_created_event_data import VendorCreatedEventData
+
+
+class VendorCreatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Vendor](entity:Vendor) is created.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of a seller associated with this event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of a location associated with the event, if the event is associated with the location of the seller.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"vendor.created".`
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for this event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The RFC 3339-formatted time when the underlying event data object is created.
+ """
+
+ data: typing.Optional[VendorCreatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with this event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/vendor_created_event_data.py b/src/square/types/vendor_created_event_data.py
new file mode 100644
index 00000000..02e877ca
--- /dev/null
+++ b/src/square/types/vendor_created_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .vendor_created_event_object import VendorCreatedEventObject
+
+
+class VendorCreatedEventData(UncheckedBaseModel):
+ """
+ Defines the `vendor.created` event data structure.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `vendor`
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[VendorCreatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing the created vendor.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/vendor_created_event_object.py b/src/square/types/vendor_created_event_object.py
new file mode 100644
index 00000000..4246ce5d
--- /dev/null
+++ b/src/square/types/vendor_created_event_object.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .vendor import Vendor
+from .vendor_created_event_object_operation import VendorCreatedEventObjectOperation
+
+
+class VendorCreatedEventObject(UncheckedBaseModel):
+ operation: typing.Optional[VendorCreatedEventObjectOperation] = pydantic.Field(default=None)
+ """
+ The operation on the vendor that caused the event to be published. The value is `CREATED`.
+ See [Operation](#type-operation) for possible values
+ """
+
+ vendor: typing.Optional[Vendor] = pydantic.Field(default=None)
+ """
+ The created vendor as the result of the specified operation.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/vendor_created_event_object_operation.py b/src/square/types/vendor_created_event_object_operation.py
new file mode 100644
index 00000000..2dfd74aa
--- /dev/null
+++ b/src/square/types/vendor_created_event_object_operation.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+VendorCreatedEventObjectOperation = typing.Literal["CREATED"]
diff --git a/src/square/types/vendor_status.py b/src/square/types/vendor_status.py
new file mode 100644
index 00000000..4c8f936e
--- /dev/null
+++ b/src/square/types/vendor_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+VendorStatus = typing.Union[typing.Literal["ACTIVE", "INACTIVE"], typing.Any]
diff --git a/src/square/types/vendor_updated_event.py b/src/square/types/vendor_updated_event.py
new file mode 100644
index 00000000..0445eaaf
--- /dev/null
+++ b/src/square/types/vendor_updated_event.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .vendor_updated_event_data import VendorUpdatedEventData
+
+
+class VendorUpdatedEvent(UncheckedBaseModel):
+ """
+ Published when a [Vendor](entity:Vendor) is updated.
+ """
+
+ merchant_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of a seller associated with this event.
+ """
+
+ location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of a seller location associated with this event, if the event is associated with the location.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of this event. The value is `"vendor.updated".`
+ """
+
+ event_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A unique ID for this webhoook event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The RFC 3339-formatted time when the underlying event data object is created.
+ """
+
+ data: typing.Optional[VendorUpdatedEventData] = pydantic.Field(default=None)
+ """
+ The data associated with this event.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/vendor_updated_event_data.py b/src/square/types/vendor_updated_event_data.py
new file mode 100644
index 00000000..76cfa95d
--- /dev/null
+++ b/src/square/types/vendor_updated_event_data.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .vendor_updated_event_object import VendorUpdatedEventObject
+
+
+class VendorUpdatedEventData(UncheckedBaseModel):
+ """
+ Defines the `vendor.updated` event data structure.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the event data object. The value is `vendor`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the event data object.
+ """
+
+ object: typing.Optional[VendorUpdatedEventObject] = pydantic.Field(default=None)
+ """
+ An object containing updated vendor.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/vendor_updated_event_object.py b/src/square/types/vendor_updated_event_object.py
new file mode 100644
index 00000000..4fa355b3
--- /dev/null
+++ b/src/square/types/vendor_updated_event_object.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .vendor import Vendor
+from .vendor_updated_event_object_operation import VendorUpdatedEventObjectOperation
+
+
+class VendorUpdatedEventObject(UncheckedBaseModel):
+ operation: typing.Optional[VendorUpdatedEventObjectOperation] = pydantic.Field(default=None)
+ """
+ The operation on the vendor that caused the event to be published. The value is `UPDATED`.
+ See [Operation](#type-operation) for possible values
+ """
+
+ vendor: typing.Optional[Vendor] = pydantic.Field(default=None)
+ """
+ The updated vendor as the result of the specified operation.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/vendor_updated_event_object_operation.py b/src/square/types/vendor_updated_event_object_operation.py
new file mode 100644
index 00000000..0b4bfa4f
--- /dev/null
+++ b/src/square/types/vendor_updated_event_object_operation.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+VendorUpdatedEventObjectOperation = typing.Literal["UPDATED"]
diff --git a/src/square/types/visibility_filter.py b/src/square/types/visibility_filter.py
new file mode 100644
index 00000000..c12e342c
--- /dev/null
+++ b/src/square/types/visibility_filter.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+VisibilityFilter = typing.Union[typing.Literal["ALL", "READ", "READ_WRITE"], typing.Any]
diff --git a/src/square/types/void_transaction_response.py b/src/square/types/void_transaction_response.py
new file mode 100644
index 00000000..8c12f32e
--- /dev/null
+++ b/src/square/types/void_transaction_response.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+
+
+class VoidTransactionResponse(UncheckedBaseModel):
+ """
+ Defines the fields that are included in the response body of
+ a request to the [VoidTransaction](api-endpoint:Transactions-VoidTransaction) endpoint.
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/wage_setting.py b/src/square/types/wage_setting.py
new file mode 100644
index 00000000..3ab91671
--- /dev/null
+++ b/src/square/types/wage_setting.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .job_assignment import JobAssignment
+
+
+class WageSetting(UncheckedBaseModel):
+ """
+ Represents information about the overtime exemption status, job assignments, and compensation
+ for a [team member](entity:TeamMember).
+ """
+
+ team_member_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the team member associated with the wage setting.
+ """
+
+ job_assignments: typing.Optional[typing.List[JobAssignment]] = pydantic.Field(default=None)
+ """
+ **Required** The ordered list of jobs that the team member is assigned to.
+ The first job assignment is considered the team member's primary job.
+ """
+
+ is_overtime_exempt: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the team member is exempt from the overtime rules of the seller's country.
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ **Read only** Used for resolving concurrency issues. The request fails if the version
+ provided does not match the server version at the time of the request. If not provided,
+ Square executes a blind write, potentially overwriting data from another write. For more information,
+ see [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency).
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the wage setting was created, in RFC 3339 format.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp when the wage setting was last updated, in RFC 3339 format.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/webhook_subscription.py b/src/square/types/webhook_subscription.py
new file mode 100644
index 00000000..1bfb5791
--- /dev/null
+++ b/src/square/types/webhook_subscription.py
@@ -0,0 +1,71 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+
+
+class WebhookSubscription(UncheckedBaseModel):
+ """
+ Represents the details of a webhook subscription, including notification URL,
+ event types, and signature key.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A Square-generated unique ID for the subscription.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of this subscription.
+ """
+
+ enabled: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether the subscription is enabled (`true`) or not (`false`).
+ """
+
+ event_types: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ The event types associated with this subscription.
+ """
+
+ notification_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL to which webhooks are sent.
+ """
+
+ api_version: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The API version of the subscription.
+ This field is optional for `CreateWebhookSubscription`.
+ The value defaults to the API version used by the application.
+ """
+
+ signature_key: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated signature key used to validate the origin of the webhook event.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the subscription was created, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z".
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timestamp of when the subscription was last updated, in RFC 3339 format.
+ For example, "2016-09-04T23:59:33.123Z".
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/weekday.py b/src/square/types/weekday.py
new file mode 100644
index 00000000..e07041a7
--- /dev/null
+++ b/src/square/types/weekday.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+Weekday = typing.Union[typing.Literal["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"], typing.Any]
diff --git a/src/square/types/workweek_config.py b/src/square/types/workweek_config.py
new file mode 100644
index 00000000..17bda221
--- /dev/null
+++ b/src/square/types/workweek_config.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .weekday import Weekday
+
+
+class WorkweekConfig(UncheckedBaseModel):
+ """
+ Sets the day of the week and hour of the day that a business starts a
+ workweek. This is used to calculate overtime pay.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The UUID for this object.
+ """
+
+ start_of_week: Weekday = pydantic.Field()
+ """
+ The day of the week on which a business week starts for
+ compensation purposes.
+ See [Weekday](#type-weekday) for possible values
+ """
+
+ start_of_day_local_time: str = pydantic.Field()
+ """
+ The local time at which a business week starts. Represented as a
+ string in `HH:MM` format (`HH:MM:SS` is also accepted, but seconds are
+ truncated).
+ """
+
+ version: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Used for resolving concurrency issues. The request fails if the version
+ provided does not match the server version at the time of the request. If not provided,
+ Square executes a blind write; potentially overwriting data from another
+ write.
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A read-only timestamp in RFC 3339 format; presented in UTC.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A read-only timestamp in RFC 3339 format; presented in UTC.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/utils/reporting_helper.py b/src/square/utils/reporting_helper.py
new file mode 100644
index 00000000..a5b375ff
--- /dev/null
+++ b/src/square/utils/reporting_helper.py
@@ -0,0 +1,187 @@
+import asyncio
+import threading
+import time
+import typing
+
+from ..core.request_options import RequestOptions
+from ..requests.query import QueryParams
+from ..types.cache_mode import CacheMode
+from ..types.load_response import LoadResponse
+
+if typing.TYPE_CHECKING:
+ from ..client import AsyncSquare, Square
+
+# Sentinel returned by the Reporting API on an HTTP 200 while a /v1/load query is
+# still processing. It is NOT an error -- the request should be retried. See the
+# Reporting API docs: https://developer.squareup.com/docs/reporting-api/overview
+CONTINUE_WAIT = "Continue wait"
+
+# Defaults for the polling loop: up to 20 attempts with exponential backoff
+# starting at 2s and capped at 20s.
+DEFAULT_MAX_ATTEMPTS = 20
+DEFAULT_INITIAL_DELAY_S = 2.0
+DEFAULT_MAX_DELAY_S = 20.0
+DEFAULT_BACKOFF_FACTOR = 2.0
+
+
+class ReportingPollTimeoutError(Exception):
+ """Raised when a reporting query does not resolve within the allotted attempts."""
+
+
+class ReportingPollCancelledError(Exception):
+ """Raised when a reporting poll loop is cancelled via its ``cancel_event``."""
+
+
+def _is_continue_wait(response: LoadResponse) -> bool:
+ # A "Continue wait" body parses into a LoadResponse (LoadResponse is an
+ # UncheckedBaseModel, so validation is skipped) with the extra ``error`` field
+ # preserved (the model is configured with extra="allow") and ``data`` left as
+ # None. That surviving ``error`` sentinel is the signal to retry.
+ return getattr(response, "error", None) == CONTINUE_WAIT
+
+
+def _build_load_kwargs(
+ *,
+ query_type: typing.Optional[str],
+ cache: typing.Optional[CacheMode],
+ query: typing.Optional[QueryParams],
+ request_options: typing.Optional[RequestOptions],
+) -> typing.Dict[str, typing.Any]:
+ # Forward only the inputs the caller actually set; the generated ``load`` omits
+ # anything we leave out (its params default to a sentinel), so a ``None`` here
+ # means "don't send it" rather than "send null".
+ load_kwargs: typing.Dict[str, typing.Any] = {"request_options": request_options}
+ if query_type is not None:
+ load_kwargs["query_type"] = query_type
+ if cache is not None:
+ load_kwargs["cache"] = cache
+ if query is not None:
+ load_kwargs["query"] = query
+ return load_kwargs
+
+
+def _next_delay(delay: float, backoff_factor: float, max_delay_s: float) -> float:
+ return min(delay * backoff_factor, max_delay_s)
+
+
+def _timeout_error(max_attempts: int) -> ReportingPollTimeoutError:
+ return ReportingPollTimeoutError(
+ f'Reporting query did not complete after {max_attempts} attempts ("{CONTINUE_WAIT}").'
+ )
+
+
+def load_and_wait(
+ client: "Square",
+ *,
+ query_type: typing.Optional[str] = None,
+ cache: typing.Optional[CacheMode] = None,
+ query: typing.Optional[QueryParams] = None,
+ max_attempts: int = DEFAULT_MAX_ATTEMPTS,
+ initial_delay_s: float = DEFAULT_INITIAL_DELAY_S,
+ max_delay_s: float = DEFAULT_MAX_DELAY_S,
+ backoff_factor: float = DEFAULT_BACKOFF_FACTOR,
+ cancel_event: typing.Optional[threading.Event] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+) -> LoadResponse:
+ """
+ Runs a reporting query and transparently polls until it resolves, returning the
+ final ``LoadResponse``. Re-sends the identical request with exponential backoff
+ while the Reporting API answers "Continue wait".
+
+ Args:
+ client: A configured synchronous ``Square`` client.
+ query_type: Optional query type (passed through to ``client.reporting.load``).
+ cache: Optional cache strategy.
+ query: The reporting query (measures, dimensions, filters, ...).
+ max_attempts: Maximum poll attempts before giving up. Default 20.
+ initial_delay_s: Delay before the first retry, in seconds. Default 2.0.
+ max_delay_s: Upper bound on the backoff delay, in seconds. Default 20.0.
+ backoff_factor: Multiplier applied to the delay after each attempt. Default 2.0.
+ cancel_event: Optional ``threading.Event``; when set, the loop stops promptly
+ (interrupting any in-flight backoff sleep) and raises
+ ``ReportingPollCancelledError``.
+ request_options: Forwarded to each underlying ``client.reporting.load`` call.
+
+ Returns:
+ The resolved ``LoadResponse`` (never the "Continue wait" sentinel).
+
+ Raises:
+ ReportingPollTimeoutError: if the query does not resolve within ``max_attempts``.
+ ReportingPollCancelledError: if ``cancel_event`` is set before the query resolves.
+ """
+ load_kwargs = _build_load_kwargs(
+ query_type=query_type, cache=cache, query=query, request_options=request_options
+ )
+ delay = initial_delay_s
+ for attempt in range(1, max_attempts + 1):
+ if cancel_event is not None and cancel_event.is_set():
+ raise ReportingPollCancelledError("Reporting query polling was cancelled.")
+ response = client.reporting.load(**load_kwargs)
+ if not _is_continue_wait(response):
+ return response
+ if attempt == max_attempts:
+ break
+ # ``Event.wait`` doubles as an interruptible sleep: it returns True as soon as
+ # the event is set, so cancellation does not wait out the remaining backoff.
+ if cancel_event is not None:
+ if cancel_event.wait(delay):
+ raise ReportingPollCancelledError("Reporting query polling was cancelled.")
+ else:
+ time.sleep(delay)
+ delay = _next_delay(delay, backoff_factor, max_delay_s)
+
+ raise _timeout_error(max_attempts)
+
+
+async def load_and_wait_async(
+ client: "AsyncSquare",
+ *,
+ query_type: typing.Optional[str] = None,
+ cache: typing.Optional[CacheMode] = None,
+ query: typing.Optional[QueryParams] = None,
+ max_attempts: int = DEFAULT_MAX_ATTEMPTS,
+ initial_delay_s: float = DEFAULT_INITIAL_DELAY_S,
+ max_delay_s: float = DEFAULT_MAX_DELAY_S,
+ backoff_factor: float = DEFAULT_BACKOFF_FACTOR,
+ request_options: typing.Optional[RequestOptions] = None,
+) -> LoadResponse:
+ """
+ Async counterpart to :func:`load_and_wait` for the ``AsyncSquare`` client. Polls
+ ``client.reporting.load`` with exponential backoff while the Reporting API answers
+ "Continue wait", returning the resolved ``LoadResponse``.
+
+ Cancellation is handled the idiomatic asyncio way: cancel the awaiting task (e.g.
+ via ``asyncio.wait_for`` / ``Task.cancel``) and the in-flight ``asyncio.sleep``
+ raises ``asyncio.CancelledError``, which propagates out of this coroutine.
+
+ Args:
+ client: A configured ``AsyncSquare`` client.
+ query_type: Optional query type (passed through to ``client.reporting.load``).
+ cache: Optional cache strategy.
+ query: The reporting query (measures, dimensions, filters, ...).
+ max_attempts: Maximum poll attempts before giving up. Default 20.
+ initial_delay_s: Delay before the first retry, in seconds. Default 2.0.
+ max_delay_s: Upper bound on the backoff delay, in seconds. Default 20.0.
+ backoff_factor: Multiplier applied to the delay after each attempt. Default 2.0.
+ request_options: Forwarded to each underlying ``client.reporting.load`` call.
+
+ Returns:
+ The resolved ``LoadResponse`` (never the "Continue wait" sentinel).
+
+ Raises:
+ ReportingPollTimeoutError: if the query does not resolve within ``max_attempts``.
+ """
+ load_kwargs = _build_load_kwargs(
+ query_type=query_type, cache=cache, query=query, request_options=request_options
+ )
+ delay = initial_delay_s
+ for attempt in range(1, max_attempts + 1):
+ response = await client.reporting.load(**load_kwargs)
+ if not _is_continue_wait(response):
+ return response
+ if attempt == max_attempts:
+ break
+ await asyncio.sleep(delay)
+ delay = _next_delay(delay, backoff_factor, max_delay_s)
+
+ raise _timeout_error(max_attempts)
diff --git a/src/square/utils/webhooks_helper.py b/src/square/utils/webhooks_helper.py
new file mode 100644
index 00000000..5a11f13a
--- /dev/null
+++ b/src/square/utils/webhooks_helper.py
@@ -0,0 +1,55 @@
+import base64
+import hashlib
+import hmac
+
+
+def verify_signature(
+ *,
+ request_body: str,
+ signature_header: str,
+ signature_key: str,
+ notification_url: str,
+) -> bool:
+ """
+ Verifies and validates an event notification. See the `documentation`_ for more details.
+
+ Args:
+ request_body: The JSON body of the request.
+ signature_header: The value for the `x-square-hmacsha256-signature` header.
+ signature_key: The signature key from the Square Developer portal for the webhook subscription.
+ notification_url: The notification endpoint URL as defined in the Square Developer portal for the webhook
+ subscription.
+
+ Returns:
+ bool: True if the signature is valid, indicating that the event can be trusted as it came from Square.
+ False if the signature validation fails, indicating that the event did not come from Square, so it may
+ be malicious and should be discarded.
+
+ Raises:
+ ValueError: if `signature_key` or `notification_url` are empty.
+
+ .. _documentation:
+ https://developer.squareup.com/docs/webhooks/step3validate
+ """
+ if not request_body:
+ return False
+ if not signature_key:
+ raise ValueError("signature_key is empty")
+ if not notification_url:
+ raise ValueError("notification_url is empty")
+
+ # Perform UTF-8 encoding to bytes
+ payload = notification_url + request_body
+ payload_bytes = payload.encode("utf-8")
+ signature_header_bytes = signature_header.encode("utf-8")
+ signature_key_bytes = signature_key.encode("utf-8")
+
+ # Compute the hash value
+ hashing_obj = hmac.new(
+ key=signature_key_bytes, msg=payload_bytes, digestmod=hashlib.sha256
+ )
+ hash_bytes = hashing_obj.digest()
+
+ # Compare the computed hash vs the value in the signature header
+ hash_base64 = base64.b64encode(hash_bytes)
+ return hmac.compare_digest(hash_base64, signature_header_bytes)
diff --git a/src/square/v1transactions/__init__.py b/src/square/v1transactions/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/v1transactions/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/v1transactions/client.py b/src/square/v1transactions/client.py
new file mode 100644
index 00000000..1fb8e5ff
--- /dev/null
+++ b/src/square/v1transactions/client.py
@@ -0,0 +1,395 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..types.sort_order import SortOrder
+from ..types.v1order import V1Order
+from ..types.v1update_order_request_action import V1UpdateOrderRequestAction
+from .raw_client import AsyncRawV1TransactionsClient, RawV1TransactionsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class V1TransactionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawV1TransactionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawV1TransactionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawV1TransactionsClient
+ """
+ return self._raw_client
+
+ def v1list_orders(
+ self,
+ location_id: str,
+ *,
+ order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ batch_token: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> typing.List[V1Order]:
+ """
+ Provides summary information for a merchant's online store orders.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to list online store orders for.
+
+ order : typing.Optional[SortOrder]
+ The order in which payments are listed in the response.
+
+ limit : typing.Optional[int]
+ The maximum number of payments to return in a single response. This value cannot exceed 200.
+
+ batch_token : typing.Optional[str]
+ A pagination cursor to retrieve the next set of results for your
+ original query to the endpoint.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ typing.List[V1Order]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.v1transactions.v1list_orders(
+ location_id="location_id",
+ order="DESC",
+ limit=1,
+ batch_token="batch_token",
+ )
+ """
+ _response = self._raw_client.v1list_orders(
+ location_id, order=order, limit=limit, batch_token=batch_token, request_options=request_options
+ )
+ return _response.data
+
+ def v1retrieve_order(
+ self, location_id: str, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> V1Order:
+ """
+ Provides comprehensive information for a single online store order, including the order's history.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the order's associated location.
+
+ order_id : str
+ The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ V1Order
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.v1transactions.v1retrieve_order(
+ location_id="location_id",
+ order_id="order_id",
+ )
+ """
+ _response = self._raw_client.v1retrieve_order(location_id, order_id, request_options=request_options)
+ return _response.data
+
+ def v1update_order(
+ self,
+ location_id: str,
+ order_id: str,
+ *,
+ action: V1UpdateOrderRequestAction,
+ shipped_tracking_number: typing.Optional[str] = OMIT,
+ completed_note: typing.Optional[str] = OMIT,
+ refunded_note: typing.Optional[str] = OMIT,
+ canceled_note: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> V1Order:
+ """
+ Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions:
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the order's associated location.
+
+ order_id : str
+ The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint
+
+ action : V1UpdateOrderRequestAction
+ The action to perform on the order (COMPLETE, CANCEL, or REFUND).
+ See [V1UpdateOrderRequestAction](#type-v1updateorderrequestaction) for possible values
+
+ shipped_tracking_number : typing.Optional[str]
+ The tracking number of the shipment associated with the order. Only valid if action is COMPLETE.
+
+ completed_note : typing.Optional[str]
+ A merchant-specified note about the completion of the order. Only valid if action is COMPLETE.
+
+ refunded_note : typing.Optional[str]
+ A merchant-specified note about the refunding of the order. Only valid if action is REFUND.
+
+ canceled_note : typing.Optional[str]
+ A merchant-specified note about the canceling of the order. Only valid if action is CANCEL.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ V1Order
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.v1transactions.v1update_order(
+ location_id="location_id",
+ order_id="order_id",
+ action="COMPLETE",
+ )
+ """
+ _response = self._raw_client.v1update_order(
+ location_id,
+ order_id,
+ action=action,
+ shipped_tracking_number=shipped_tracking_number,
+ completed_note=completed_note,
+ refunded_note=refunded_note,
+ canceled_note=canceled_note,
+ request_options=request_options,
+ )
+ return _response.data
+
+
+class AsyncV1TransactionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawV1TransactionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawV1TransactionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawV1TransactionsClient
+ """
+ return self._raw_client
+
+ async def v1list_orders(
+ self,
+ location_id: str,
+ *,
+ order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ batch_token: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> typing.List[V1Order]:
+ """
+ Provides summary information for a merchant's online store orders.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to list online store orders for.
+
+ order : typing.Optional[SortOrder]
+ The order in which payments are listed in the response.
+
+ limit : typing.Optional[int]
+ The maximum number of payments to return in a single response. This value cannot exceed 200.
+
+ batch_token : typing.Optional[str]
+ A pagination cursor to retrieve the next set of results for your
+ original query to the endpoint.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ typing.List[V1Order]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.v1transactions.v1list_orders(
+ location_id="location_id",
+ order="DESC",
+ limit=1,
+ batch_token="batch_token",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.v1list_orders(
+ location_id, order=order, limit=limit, batch_token=batch_token, request_options=request_options
+ )
+ return _response.data
+
+ async def v1retrieve_order(
+ self, location_id: str, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> V1Order:
+ """
+ Provides comprehensive information for a single online store order, including the order's history.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the order's associated location.
+
+ order_id : str
+ The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ V1Order
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.v1transactions.v1retrieve_order(
+ location_id="location_id",
+ order_id="order_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.v1retrieve_order(location_id, order_id, request_options=request_options)
+ return _response.data
+
+ async def v1update_order(
+ self,
+ location_id: str,
+ order_id: str,
+ *,
+ action: V1UpdateOrderRequestAction,
+ shipped_tracking_number: typing.Optional[str] = OMIT,
+ completed_note: typing.Optional[str] = OMIT,
+ refunded_note: typing.Optional[str] = OMIT,
+ canceled_note: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> V1Order:
+ """
+ Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions:
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the order's associated location.
+
+ order_id : str
+ The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint
+
+ action : V1UpdateOrderRequestAction
+ The action to perform on the order (COMPLETE, CANCEL, or REFUND).
+ See [V1UpdateOrderRequestAction](#type-v1updateorderrequestaction) for possible values
+
+ shipped_tracking_number : typing.Optional[str]
+ The tracking number of the shipment associated with the order. Only valid if action is COMPLETE.
+
+ completed_note : typing.Optional[str]
+ A merchant-specified note about the completion of the order. Only valid if action is COMPLETE.
+
+ refunded_note : typing.Optional[str]
+ A merchant-specified note about the refunding of the order. Only valid if action is REFUND.
+
+ canceled_note : typing.Optional[str]
+ A merchant-specified note about the canceling of the order. Only valid if action is CANCEL.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ V1Order
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.v1transactions.v1update_order(
+ location_id="location_id",
+ order_id="order_id",
+ action="COMPLETE",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.v1update_order(
+ location_id,
+ order_id,
+ action=action,
+ shipped_tracking_number=shipped_tracking_number,
+ completed_note=completed_note,
+ refunded_note=refunded_note,
+ canceled_note=canceled_note,
+ request_options=request_options,
+ )
+ return _response.data
diff --git a/src/square/v1transactions/raw_client.py b/src/square/v1transactions/raw_client.py
new file mode 100644
index 00000000..5ed5246c
--- /dev/null
+++ b/src/square/v1transactions/raw_client.py
@@ -0,0 +1,387 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.request_options import RequestOptions
+from ..core.unchecked_base_model import construct_type
+from ..types.sort_order import SortOrder
+from ..types.v1order import V1Order
+from ..types.v1update_order_request_action import V1UpdateOrderRequestAction
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawV1TransactionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def v1list_orders(
+ self,
+ location_id: str,
+ *,
+ order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ batch_token: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[typing.List[V1Order]]:
+ """
+ Provides summary information for a merchant's online store orders.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to list online store orders for.
+
+ order : typing.Optional[SortOrder]
+ The order in which payments are listed in the response.
+
+ limit : typing.Optional[int]
+ The maximum number of payments to return in a single response. This value cannot exceed 200.
+
+ batch_token : typing.Optional[str]
+ A pagination cursor to retrieve the next set of results for your
+ original query to the endpoint.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[typing.List[V1Order]]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v1/{jsonable_encoder(location_id)}/orders",
+ method="GET",
+ params={
+ "order": order,
+ "limit": limit,
+ "batch_token": batch_token,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ typing.List[V1Order],
+ construct_type(
+ type_=typing.List[V1Order], # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def v1retrieve_order(
+ self, location_id: str, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[V1Order]:
+ """
+ Provides comprehensive information for a single online store order, including the order's history.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the order's associated location.
+
+ order_id : str
+ The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[V1Order]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v1/{jsonable_encoder(location_id)}/orders/{jsonable_encoder(order_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ V1Order,
+ construct_type(
+ type_=V1Order, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def v1update_order(
+ self,
+ location_id: str,
+ order_id: str,
+ *,
+ action: V1UpdateOrderRequestAction,
+ shipped_tracking_number: typing.Optional[str] = OMIT,
+ completed_note: typing.Optional[str] = OMIT,
+ refunded_note: typing.Optional[str] = OMIT,
+ canceled_note: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[V1Order]:
+ """
+ Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions:
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the order's associated location.
+
+ order_id : str
+ The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint
+
+ action : V1UpdateOrderRequestAction
+ The action to perform on the order (COMPLETE, CANCEL, or REFUND).
+ See [V1UpdateOrderRequestAction](#type-v1updateorderrequestaction) for possible values
+
+ shipped_tracking_number : typing.Optional[str]
+ The tracking number of the shipment associated with the order. Only valid if action is COMPLETE.
+
+ completed_note : typing.Optional[str]
+ A merchant-specified note about the completion of the order. Only valid if action is COMPLETE.
+
+ refunded_note : typing.Optional[str]
+ A merchant-specified note about the refunding of the order. Only valid if action is REFUND.
+
+ canceled_note : typing.Optional[str]
+ A merchant-specified note about the canceling of the order. Only valid if action is CANCEL.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[V1Order]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v1/{jsonable_encoder(location_id)}/orders/{jsonable_encoder(order_id)}",
+ method="PUT",
+ json={
+ "action": action,
+ "shipped_tracking_number": shipped_tracking_number,
+ "completed_note": completed_note,
+ "refunded_note": refunded_note,
+ "canceled_note": canceled_note,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ V1Order,
+ construct_type(
+ type_=V1Order, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawV1TransactionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def v1list_orders(
+ self,
+ location_id: str,
+ *,
+ order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ batch_token: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[typing.List[V1Order]]:
+ """
+ Provides summary information for a merchant's online store orders.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the location to list online store orders for.
+
+ order : typing.Optional[SortOrder]
+ The order in which payments are listed in the response.
+
+ limit : typing.Optional[int]
+ The maximum number of payments to return in a single response. This value cannot exceed 200.
+
+ batch_token : typing.Optional[str]
+ A pagination cursor to retrieve the next set of results for your
+ original query to the endpoint.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[typing.List[V1Order]]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v1/{jsonable_encoder(location_id)}/orders",
+ method="GET",
+ params={
+ "order": order,
+ "limit": limit,
+ "batch_token": batch_token,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ typing.List[V1Order],
+ construct_type(
+ type_=typing.List[V1Order], # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def v1retrieve_order(
+ self, location_id: str, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[V1Order]:
+ """
+ Provides comprehensive information for a single online store order, including the order's history.
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the order's associated location.
+
+ order_id : str
+ The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[V1Order]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v1/{jsonable_encoder(location_id)}/orders/{jsonable_encoder(order_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ V1Order,
+ construct_type(
+ type_=V1Order, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def v1update_order(
+ self,
+ location_id: str,
+ order_id: str,
+ *,
+ action: V1UpdateOrderRequestAction,
+ shipped_tracking_number: typing.Optional[str] = OMIT,
+ completed_note: typing.Optional[str] = OMIT,
+ refunded_note: typing.Optional[str] = OMIT,
+ canceled_note: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[V1Order]:
+ """
+ Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions:
+
+ Parameters
+ ----------
+ location_id : str
+ The ID of the order's associated location.
+
+ order_id : str
+ The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint
+
+ action : V1UpdateOrderRequestAction
+ The action to perform on the order (COMPLETE, CANCEL, or REFUND).
+ See [V1UpdateOrderRequestAction](#type-v1updateorderrequestaction) for possible values
+
+ shipped_tracking_number : typing.Optional[str]
+ The tracking number of the shipment associated with the order. Only valid if action is COMPLETE.
+
+ completed_note : typing.Optional[str]
+ A merchant-specified note about the completion of the order. Only valid if action is COMPLETE.
+
+ refunded_note : typing.Optional[str]
+ A merchant-specified note about the refunding of the order. Only valid if action is REFUND.
+
+ canceled_note : typing.Optional[str]
+ A merchant-specified note about the canceling of the order. Only valid if action is CANCEL.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[V1Order]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v1/{jsonable_encoder(location_id)}/orders/{jsonable_encoder(order_id)}",
+ method="PUT",
+ json={
+ "action": action,
+ "shipped_tracking_number": shipped_tracking_number,
+ "completed_note": completed_note,
+ "refunded_note": refunded_note,
+ "canceled_note": canceled_note,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ V1Order,
+ construct_type(
+ type_=V1Order, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/vendors/__init__.py b/src/square/vendors/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/vendors/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/vendors/client.py b/src/square/vendors/client.py
new file mode 100644
index 00000000..288d6041
--- /dev/null
+++ b/src/square/vendors/client.py
@@ -0,0 +1,777 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..requests.search_vendors_request_filter import SearchVendorsRequestFilterParams
+from ..requests.search_vendors_request_sort import SearchVendorsRequestSortParams
+from ..requests.update_vendor_request import UpdateVendorRequestParams
+from ..requests.vendor import VendorParams
+from ..types.batch_create_vendors_response import BatchCreateVendorsResponse
+from ..types.batch_get_vendors_response import BatchGetVendorsResponse
+from ..types.batch_update_vendors_response import BatchUpdateVendorsResponse
+from ..types.create_vendor_response import CreateVendorResponse
+from ..types.get_vendor_response import GetVendorResponse
+from ..types.search_vendors_response import SearchVendorsResponse
+from ..types.update_vendor_response import UpdateVendorResponse
+from .raw_client import AsyncRawVendorsClient, RawVendorsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class VendorsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawVendorsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawVendorsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawVendorsClient
+ """
+ return self._raw_client
+
+ def batch_create(
+ self, *, vendors: typing.Dict[str, VendorParams], request_options: typing.Optional[RequestOptions] = None
+ ) -> BatchCreateVendorsResponse:
+ """
+ Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller.
+
+ Parameters
+ ----------
+ vendors : typing.Dict[str, VendorParams]
+ Specifies a set of new [Vendor](entity:Vendor) objects as represented by a collection of idempotency-key/`Vendor`-object pairs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchCreateVendorsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.vendors.batch_create(
+ vendors={
+ "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": {
+ "name": "Joe's Fresh Seafood",
+ "address": {
+ "address_line1": "505 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ "contacts": [
+ {
+ "name": "Joe Burrow",
+ "email_address": "joe@joesfreshseafood.com",
+ "phone_number": "1-212-555-4250",
+ "ordinal": 1,
+ }
+ ],
+ "account_number": "4025391",
+ "note": "a vendor",
+ }
+ },
+ )
+ """
+ _response = self._raw_client.batch_create(vendors=vendors, request_options=request_options)
+ return _response.data
+
+ def batch_get(
+ self,
+ *,
+ vendor_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchGetVendorsResponse:
+ """
+ Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs.
+
+ Parameters
+ ----------
+ vendor_ids : typing.Optional[typing.Sequence[str]]
+ IDs of the [Vendor](entity:Vendor) objects to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchGetVendorsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.vendors.batch_get(
+ vendor_ids=["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"],
+ )
+ """
+ _response = self._raw_client.batch_get(vendor_ids=vendor_ids, request_options=request_options)
+ return _response.data
+
+ def batch_update(
+ self,
+ *,
+ vendors: typing.Dict[str, UpdateVendorRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchUpdateVendorsResponse:
+ """
+ Updates one or more of existing [Vendor](entity:Vendor) objects as suppliers to a seller.
+
+ Parameters
+ ----------
+ vendors : typing.Dict[str, UpdateVendorRequestParams]
+ A set of [UpdateVendorRequest](entity:UpdateVendorRequest) objects encapsulating to-be-updated [Vendor](entity:Vendor)
+ objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorRequest`-object pairs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchUpdateVendorsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.vendors.batch_update(
+ vendors={
+ "FMCYHBWT1TPL8MFH52PBMEN92A": {"vendor": {}},
+ "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4": {"vendor": {}},
+ },
+ )
+ """
+ _response = self._raw_client.batch_update(vendors=vendors, request_options=request_options)
+ return _response.data
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ vendor: typing.Optional[VendorParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateVendorResponse:
+ """
+ Creates a single [Vendor](entity:Vendor) object to represent a supplier to a seller.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) to make this [CreateVendor](api-endpoint:Vendors-CreateVendor) call idempotent.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ vendor : typing.Optional[VendorParams]
+ The requested [Vendor](entity:Vendor) to be created.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateVendorResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.vendors.create(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ vendor={
+ "name": "Joe's Fresh Seafood",
+ "address": {
+ "address_line1": "505 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ "contacts": [
+ {
+ "name": "Joe Burrow",
+ "email_address": "joe@joesfreshseafood.com",
+ "phone_number": "1-212-555-4250",
+ "ordinal": 1,
+ }
+ ],
+ "account_number": "4025391",
+ "note": "a vendor",
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ idempotency_key=idempotency_key, vendor=vendor, request_options=request_options
+ )
+ return _response.data
+
+ def search(
+ self,
+ *,
+ filter: typing.Optional[SearchVendorsRequestFilterParams] = OMIT,
+ sort: typing.Optional[SearchVendorsRequestSortParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchVendorsResponse:
+ """
+ Searches for vendors using a filter against supported [Vendor](entity:Vendor) properties and a supported sorter.
+
+ Parameters
+ ----------
+ filter : typing.Optional[SearchVendorsRequestFilterParams]
+ Specifies a filter used to search for vendors.
+
+ sort : typing.Optional[SearchVendorsRequestSortParams]
+ Specifies a sorter used to sort the returned vendors.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchVendorsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.vendors.search()
+ """
+ _response = self._raw_client.search(filter=filter, sort=sort, cursor=cursor, request_options=request_options)
+ return _response.data
+
+ def get(self, vendor_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetVendorResponse:
+ """
+ Retrieves the vendor of a specified [Vendor](entity:Vendor) ID.
+
+ Parameters
+ ----------
+ vendor_id : str
+ ID of the [Vendor](entity:Vendor) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetVendorResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.vendors.get(
+ vendor_id="vendor_id",
+ )
+ """
+ _response = self._raw_client.get(vendor_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ vendor_id: str,
+ *,
+ vendor: VendorParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateVendorResponse:
+ """
+ Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller.
+
+ Parameters
+ ----------
+ vendor_id : str
+ ID of the [Vendor](entity:Vendor) to retrieve.
+
+ vendor : VendorParams
+ The specified [Vendor](entity:Vendor) to be updated.
+
+ idempotency_key : typing.Optional[str]
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateVendorResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.vendors.update(
+ vendor_id="vendor_id",
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ vendor={
+ "id": "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4",
+ "name": "Jack's Chicken Shack",
+ "version": 1,
+ "status": "ACTIVE",
+ },
+ )
+ """
+ _response = self._raw_client.update(
+ vendor_id, vendor=vendor, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+
+class AsyncVendorsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawVendorsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawVendorsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawVendorsClient
+ """
+ return self._raw_client
+
+ async def batch_create(
+ self, *, vendors: typing.Dict[str, VendorParams], request_options: typing.Optional[RequestOptions] = None
+ ) -> BatchCreateVendorsResponse:
+ """
+ Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller.
+
+ Parameters
+ ----------
+ vendors : typing.Dict[str, VendorParams]
+ Specifies a set of new [Vendor](entity:Vendor) objects as represented by a collection of idempotency-key/`Vendor`-object pairs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchCreateVendorsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.vendors.batch_create(
+ vendors={
+ "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": {
+ "name": "Joe's Fresh Seafood",
+ "address": {
+ "address_line1": "505 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ "contacts": [
+ {
+ "name": "Joe Burrow",
+ "email_address": "joe@joesfreshseafood.com",
+ "phone_number": "1-212-555-4250",
+ "ordinal": 1,
+ }
+ ],
+ "account_number": "4025391",
+ "note": "a vendor",
+ }
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_create(vendors=vendors, request_options=request_options)
+ return _response.data
+
+ async def batch_get(
+ self,
+ *,
+ vendor_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchGetVendorsResponse:
+ """
+ Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs.
+
+ Parameters
+ ----------
+ vendor_ids : typing.Optional[typing.Sequence[str]]
+ IDs of the [Vendor](entity:Vendor) objects to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchGetVendorsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.vendors.batch_get(
+ vendor_ids=["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"],
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_get(vendor_ids=vendor_ids, request_options=request_options)
+ return _response.data
+
+ async def batch_update(
+ self,
+ *,
+ vendors: typing.Dict[str, UpdateVendorRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> BatchUpdateVendorsResponse:
+ """
+ Updates one or more of existing [Vendor](entity:Vendor) objects as suppliers to a seller.
+
+ Parameters
+ ----------
+ vendors : typing.Dict[str, UpdateVendorRequestParams]
+ A set of [UpdateVendorRequest](entity:UpdateVendorRequest) objects encapsulating to-be-updated [Vendor](entity:Vendor)
+ objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorRequest`-object pairs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ BatchUpdateVendorsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.vendors.batch_update(
+ vendors={
+ "FMCYHBWT1TPL8MFH52PBMEN92A": {"vendor": {}},
+ "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4": {"vendor": {}},
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.batch_update(vendors=vendors, request_options=request_options)
+ return _response.data
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ vendor: typing.Optional[VendorParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateVendorResponse:
+ """
+ Creates a single [Vendor](entity:Vendor) object to represent a supplier to a seller.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) to make this [CreateVendor](api-endpoint:Vendors-CreateVendor) call idempotent.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ vendor : typing.Optional[VendorParams]
+ The requested [Vendor](entity:Vendor) to be created.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateVendorResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.vendors.create(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ vendor={
+ "name": "Joe's Fresh Seafood",
+ "address": {
+ "address_line1": "505 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ "contacts": [
+ {
+ "name": "Joe Burrow",
+ "email_address": "joe@joesfreshseafood.com",
+ "phone_number": "1-212-555-4250",
+ "ordinal": 1,
+ }
+ ],
+ "account_number": "4025391",
+ "note": "a vendor",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ idempotency_key=idempotency_key, vendor=vendor, request_options=request_options
+ )
+ return _response.data
+
+ async def search(
+ self,
+ *,
+ filter: typing.Optional[SearchVendorsRequestFilterParams] = OMIT,
+ sort: typing.Optional[SearchVendorsRequestSortParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SearchVendorsResponse:
+ """
+ Searches for vendors using a filter against supported [Vendor](entity:Vendor) properties and a supported sorter.
+
+ Parameters
+ ----------
+ filter : typing.Optional[SearchVendorsRequestFilterParams]
+ Specifies a filter used to search for vendors.
+
+ sort : typing.Optional[SearchVendorsRequestSortParams]
+ Specifies a sorter used to sort the returned vendors.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SearchVendorsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.vendors.search()
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.search(
+ filter=filter, sort=sort, cursor=cursor, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, vendor_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetVendorResponse:
+ """
+ Retrieves the vendor of a specified [Vendor](entity:Vendor) ID.
+
+ Parameters
+ ----------
+ vendor_id : str
+ ID of the [Vendor](entity:Vendor) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetVendorResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.vendors.get(
+ vendor_id="vendor_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(vendor_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ vendor_id: str,
+ *,
+ vendor: VendorParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateVendorResponse:
+ """
+ Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller.
+
+ Parameters
+ ----------
+ vendor_id : str
+ ID of the [Vendor](entity:Vendor) to retrieve.
+
+ vendor : VendorParams
+ The specified [Vendor](entity:Vendor) to be updated.
+
+ idempotency_key : typing.Optional[str]
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateVendorResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.vendors.update(
+ vendor_id="vendor_id",
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ vendor={
+ "id": "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4",
+ "name": "Jack's Chicken Shack",
+ "version": 1,
+ "status": "ACTIVE",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ vendor_id, vendor=vendor, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
diff --git a/src/square/vendors/raw_client.py b/src/square/vendors/raw_client.py
new file mode 100644
index 00000000..a3187be4
--- /dev/null
+++ b/src/square/vendors/raw_client.py
@@ -0,0 +1,794 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.jsonable_encoder import jsonable_encoder
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..requests.search_vendors_request_filter import SearchVendorsRequestFilterParams
+from ..requests.search_vendors_request_sort import SearchVendorsRequestSortParams
+from ..requests.update_vendor_request import UpdateVendorRequestParams
+from ..requests.vendor import VendorParams
+from ..types.batch_create_vendors_response import BatchCreateVendorsResponse
+from ..types.batch_get_vendors_response import BatchGetVendorsResponse
+from ..types.batch_update_vendors_response import BatchUpdateVendorsResponse
+from ..types.create_vendor_response import CreateVendorResponse
+from ..types.get_vendor_response import GetVendorResponse
+from ..types.search_vendors_response import SearchVendorsResponse
+from ..types.update_vendor_response import UpdateVendorResponse
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawVendorsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def batch_create(
+ self, *, vendors: typing.Dict[str, VendorParams], request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[BatchCreateVendorsResponse]:
+ """
+ Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller.
+
+ Parameters
+ ----------
+ vendors : typing.Dict[str, VendorParams]
+ Specifies a set of new [Vendor](entity:Vendor) objects as represented by a collection of idempotency-key/`Vendor`-object pairs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchCreateVendorsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/vendors/bulk-create",
+ method="POST",
+ json={
+ "vendors": convert_and_respect_annotation_metadata(
+ object_=vendors, annotation=typing.Dict[str, VendorParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchCreateVendorsResponse,
+ construct_type(
+ type_=BatchCreateVendorsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_get(
+ self,
+ *,
+ vendor_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BatchGetVendorsResponse]:
+ """
+ Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs.
+
+ Parameters
+ ----------
+ vendor_ids : typing.Optional[typing.Sequence[str]]
+ IDs of the [Vendor](entity:Vendor) objects to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchGetVendorsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/vendors/bulk-retrieve",
+ method="POST",
+ json={
+ "vendor_ids": vendor_ids,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchGetVendorsResponse,
+ construct_type(
+ type_=BatchGetVendorsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def batch_update(
+ self,
+ *,
+ vendors: typing.Dict[str, UpdateVendorRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[BatchUpdateVendorsResponse]:
+ """
+ Updates one or more of existing [Vendor](entity:Vendor) objects as suppliers to a seller.
+
+ Parameters
+ ----------
+ vendors : typing.Dict[str, UpdateVendorRequestParams]
+ A set of [UpdateVendorRequest](entity:UpdateVendorRequest) objects encapsulating to-be-updated [Vendor](entity:Vendor)
+ objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorRequest`-object pairs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[BatchUpdateVendorsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/vendors/bulk-update",
+ method="PUT",
+ json={
+ "vendors": convert_and_respect_annotation_metadata(
+ object_=vendors, annotation=typing.Dict[str, UpdateVendorRequestParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchUpdateVendorsResponse,
+ construct_type(
+ type_=BatchUpdateVendorsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ idempotency_key: str,
+ vendor: typing.Optional[VendorParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateVendorResponse]:
+ """
+ Creates a single [Vendor](entity:Vendor) object to represent a supplier to a seller.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) to make this [CreateVendor](api-endpoint:Vendors-CreateVendor) call idempotent.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ vendor : typing.Optional[VendorParams]
+ The requested [Vendor](entity:Vendor) to be created.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateVendorResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/vendors/create",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "vendor": convert_and_respect_annotation_metadata(
+ object_=vendor, annotation=VendorParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateVendorResponse,
+ construct_type(
+ type_=CreateVendorResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def search(
+ self,
+ *,
+ filter: typing.Optional[SearchVendorsRequestFilterParams] = OMIT,
+ sort: typing.Optional[SearchVendorsRequestSortParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[SearchVendorsResponse]:
+ """
+ Searches for vendors using a filter against supported [Vendor](entity:Vendor) properties and a supported sorter.
+
+ Parameters
+ ----------
+ filter : typing.Optional[SearchVendorsRequestFilterParams]
+ Specifies a filter used to search for vendors.
+
+ sort : typing.Optional[SearchVendorsRequestSortParams]
+ Specifies a sorter used to sort the returned vendors.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[SearchVendorsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/vendors/search",
+ method="POST",
+ json={
+ "filter": convert_and_respect_annotation_metadata(
+ object_=filter, annotation=SearchVendorsRequestFilterParams, direction="write"
+ ),
+ "sort": convert_and_respect_annotation_metadata(
+ object_=sort, annotation=SearchVendorsRequestSortParams, direction="write"
+ ),
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchVendorsResponse,
+ construct_type(
+ type_=SearchVendorsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, vendor_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetVendorResponse]:
+ """
+ Retrieves the vendor of a specified [Vendor](entity:Vendor) ID.
+
+ Parameters
+ ----------
+ vendor_id : str
+ ID of the [Vendor](entity:Vendor) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetVendorResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/vendors/{jsonable_encoder(vendor_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetVendorResponse,
+ construct_type(
+ type_=GetVendorResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ vendor_id: str,
+ *,
+ vendor: VendorParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateVendorResponse]:
+ """
+ Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller.
+
+ Parameters
+ ----------
+ vendor_id : str
+ ID of the [Vendor](entity:Vendor) to retrieve.
+
+ vendor : VendorParams
+ The specified [Vendor](entity:Vendor) to be updated.
+
+ idempotency_key : typing.Optional[str]
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateVendorResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/vendors/{jsonable_encoder(vendor_id)}",
+ method="PUT",
+ json={
+ "idempotency_key": idempotency_key,
+ "vendor": convert_and_respect_annotation_metadata(
+ object_=vendor, annotation=VendorParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateVendorResponse,
+ construct_type(
+ type_=UpdateVendorResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawVendorsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def batch_create(
+ self, *, vendors: typing.Dict[str, VendorParams], request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[BatchCreateVendorsResponse]:
+ """
+ Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller.
+
+ Parameters
+ ----------
+ vendors : typing.Dict[str, VendorParams]
+ Specifies a set of new [Vendor](entity:Vendor) objects as represented by a collection of idempotency-key/`Vendor`-object pairs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchCreateVendorsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/vendors/bulk-create",
+ method="POST",
+ json={
+ "vendors": convert_and_respect_annotation_metadata(
+ object_=vendors, annotation=typing.Dict[str, VendorParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchCreateVendorsResponse,
+ construct_type(
+ type_=BatchCreateVendorsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_get(
+ self,
+ *,
+ vendor_ids: typing.Optional[typing.Sequence[str]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BatchGetVendorsResponse]:
+ """
+ Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs.
+
+ Parameters
+ ----------
+ vendor_ids : typing.Optional[typing.Sequence[str]]
+ IDs of the [Vendor](entity:Vendor) objects to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchGetVendorsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/vendors/bulk-retrieve",
+ method="POST",
+ json={
+ "vendor_ids": vendor_ids,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchGetVendorsResponse,
+ construct_type(
+ type_=BatchGetVendorsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def batch_update(
+ self,
+ *,
+ vendors: typing.Dict[str, UpdateVendorRequestParams],
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[BatchUpdateVendorsResponse]:
+ """
+ Updates one or more of existing [Vendor](entity:Vendor) objects as suppliers to a seller.
+
+ Parameters
+ ----------
+ vendors : typing.Dict[str, UpdateVendorRequestParams]
+ A set of [UpdateVendorRequest](entity:UpdateVendorRequest) objects encapsulating to-be-updated [Vendor](entity:Vendor)
+ objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorRequest`-object pairs.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[BatchUpdateVendorsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/vendors/bulk-update",
+ method="PUT",
+ json={
+ "vendors": convert_and_respect_annotation_metadata(
+ object_=vendors, annotation=typing.Dict[str, UpdateVendorRequestParams], direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ BatchUpdateVendorsResponse,
+ construct_type(
+ type_=BatchUpdateVendorsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ idempotency_key: str,
+ vendor: typing.Optional[VendorParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateVendorResponse]:
+ """
+ Creates a single [Vendor](entity:Vendor) object to represent a supplier to a seller.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier (UUID) to make this [CreateVendor](api-endpoint:Vendors-CreateVendor) call idempotent.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ vendor : typing.Optional[VendorParams]
+ The requested [Vendor](entity:Vendor) to be created.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateVendorResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/vendors/create",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "vendor": convert_and_respect_annotation_metadata(
+ object_=vendor, annotation=VendorParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateVendorResponse,
+ construct_type(
+ type_=CreateVendorResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def search(
+ self,
+ *,
+ filter: typing.Optional[SearchVendorsRequestFilterParams] = OMIT,
+ sort: typing.Optional[SearchVendorsRequestSortParams] = OMIT,
+ cursor: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[SearchVendorsResponse]:
+ """
+ Searches for vendors using a filter against supported [Vendor](entity:Vendor) properties and a supported sorter.
+
+ Parameters
+ ----------
+ filter : typing.Optional[SearchVendorsRequestFilterParams]
+ Specifies a filter used to search for vendors.
+
+ sort : typing.Optional[SearchVendorsRequestSortParams]
+ Specifies a sorter used to sort the returned vendors.
+
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for the original query.
+
+ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[SearchVendorsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/vendors/search",
+ method="POST",
+ json={
+ "filter": convert_and_respect_annotation_metadata(
+ object_=filter, annotation=SearchVendorsRequestFilterParams, direction="write"
+ ),
+ "sort": convert_and_respect_annotation_metadata(
+ object_=sort, annotation=SearchVendorsRequestSortParams, direction="write"
+ ),
+ "cursor": cursor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ SearchVendorsResponse,
+ construct_type(
+ type_=SearchVendorsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, vendor_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetVendorResponse]:
+ """
+ Retrieves the vendor of a specified [Vendor](entity:Vendor) ID.
+
+ Parameters
+ ----------
+ vendor_id : str
+ ID of the [Vendor](entity:Vendor) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetVendorResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/vendors/{jsonable_encoder(vendor_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetVendorResponse,
+ construct_type(
+ type_=GetVendorResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ vendor_id: str,
+ *,
+ vendor: VendorParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateVendorResponse]:
+ """
+ Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller.
+
+ Parameters
+ ----------
+ vendor_id : str
+ ID of the [Vendor](entity:Vendor) to retrieve.
+
+ vendor : VendorParams
+ The specified [Vendor](entity:Vendor) to be updated.
+
+ idempotency_key : typing.Optional[str]
+ A client-supplied, universally unique identifier (UUID) for the
+ request.
+
+ See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
+ [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateVendorResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/vendors/{jsonable_encoder(vendor_id)}",
+ method="PUT",
+ json={
+ "idempotency_key": idempotency_key,
+ "vendor": convert_and_respect_annotation_metadata(
+ object_=vendor, annotation=VendorParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateVendorResponse,
+ construct_type(
+ type_=UpdateVendorResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/version.py b/src/square/version.py
new file mode 100644
index 00000000..e488fcca
--- /dev/null
+++ b/src/square/version.py
@@ -0,0 +1,3 @@
+from importlib import metadata
+
+__version__ = metadata.version("squareup")
diff --git a/src/square/webhooks/__init__.py b/src/square/webhooks/__init__.py
new file mode 100644
index 00000000..022f9d17
--- /dev/null
+++ b/src/square/webhooks/__init__.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+import typing
+from importlib import import_module
+
+if typing.TYPE_CHECKING:
+ from . import event_types, subscriptions
+_dynamic_imports: typing.Dict[str, str] = {"event_types": ".event_types", "subscriptions": ".subscriptions"}
+
+
+def __getattr__(attr_name: str) -> typing.Any:
+ module_name = _dynamic_imports.get(attr_name)
+ if module_name is None:
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
+ try:
+ module = import_module(module_name, __package__)
+ if module_name == f".{attr_name}":
+ return module
+ else:
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
+ except AttributeError as e:
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
+
+
+def __dir__():
+ lazy_attrs = list(_dynamic_imports.keys())
+ return sorted(lazy_attrs)
+
+
+__all__ = ["event_types", "subscriptions"]
diff --git a/src/square/webhooks/client.py b/src/square/webhooks/client.py
new file mode 100644
index 00000000..ab1deaf3
--- /dev/null
+++ b/src/square/webhooks/client.py
@@ -0,0 +1,82 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from .raw_client import AsyncRawWebhooksClient, RawWebhooksClient
+
+if typing.TYPE_CHECKING:
+ from .event_types.client import AsyncEventTypesClient, EventTypesClient
+ from .subscriptions.client import AsyncSubscriptionsClient, SubscriptionsClient
+
+
+class WebhooksClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawWebhooksClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._event_types: typing.Optional[EventTypesClient] = None
+ self._subscriptions: typing.Optional[SubscriptionsClient] = None
+
+ @property
+ def with_raw_response(self) -> RawWebhooksClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawWebhooksClient
+ """
+ return self._raw_client
+
+ @property
+ def event_types(self):
+ if self._event_types is None:
+ from .event_types.client import EventTypesClient # noqa: E402
+
+ self._event_types = EventTypesClient(client_wrapper=self._client_wrapper)
+ return self._event_types
+
+ @property
+ def subscriptions(self):
+ if self._subscriptions is None:
+ from .subscriptions.client import SubscriptionsClient # noqa: E402
+
+ self._subscriptions = SubscriptionsClient(client_wrapper=self._client_wrapper)
+ return self._subscriptions
+
+
+class AsyncWebhooksClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawWebhooksClient(client_wrapper=client_wrapper)
+ self._client_wrapper = client_wrapper
+ self._event_types: typing.Optional[AsyncEventTypesClient] = None
+ self._subscriptions: typing.Optional[AsyncSubscriptionsClient] = None
+
+ @property
+ def with_raw_response(self) -> AsyncRawWebhooksClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawWebhooksClient
+ """
+ return self._raw_client
+
+ @property
+ def event_types(self):
+ if self._event_types is None:
+ from .event_types.client import AsyncEventTypesClient # noqa: E402
+
+ self._event_types = AsyncEventTypesClient(client_wrapper=self._client_wrapper)
+ return self._event_types
+
+ @property
+ def subscriptions(self):
+ if self._subscriptions is None:
+ from .subscriptions.client import AsyncSubscriptionsClient # noqa: E402
+
+ self._subscriptions = AsyncSubscriptionsClient(client_wrapper=self._client_wrapper)
+ return self._subscriptions
diff --git a/src/square/webhooks/event_types/__init__.py b/src/square/webhooks/event_types/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/webhooks/event_types/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/webhooks/event_types/client.py b/src/square/webhooks/event_types/client.py
new file mode 100644
index 00000000..1fd60550
--- /dev/null
+++ b/src/square/webhooks/event_types/client.py
@@ -0,0 +1,114 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...types.list_webhook_event_types_response import ListWebhookEventTypesResponse
+from .raw_client import AsyncRawEventTypesClient, RawEventTypesClient
+
+
+class EventTypesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawEventTypesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawEventTypesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawEventTypesClient
+ """
+ return self._raw_client
+
+ def list(
+ self, *, api_version: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> ListWebhookEventTypesResponse:
+ """
+ Lists all webhook event types that can be subscribed to.
+
+ Parameters
+ ----------
+ api_version : typing.Optional[str]
+ The API version for which to list event types. Setting this field overrides the default version used by the application.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListWebhookEventTypesResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.webhooks.event_types.list(
+ api_version="api_version",
+ )
+ """
+ _response = self._raw_client.list(api_version=api_version, request_options=request_options)
+ return _response.data
+
+
+class AsyncEventTypesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawEventTypesClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawEventTypesClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawEventTypesClient
+ """
+ return self._raw_client
+
+ async def list(
+ self, *, api_version: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> ListWebhookEventTypesResponse:
+ """
+ Lists all webhook event types that can be subscribed to.
+
+ Parameters
+ ----------
+ api_version : typing.Optional[str]
+ The API version for which to list event types. Setting this field overrides the default version used by the application.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListWebhookEventTypesResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.webhooks.event_types.list(
+ api_version="api_version",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.list(api_version=api_version, request_options=request_options)
+ return _response.data
diff --git a/src/square/webhooks/event_types/raw_client.py b/src/square/webhooks/event_types/raw_client.py
new file mode 100644
index 00000000..91faa77f
--- /dev/null
+++ b/src/square/webhooks/event_types/raw_client.py
@@ -0,0 +1,105 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.request_options import RequestOptions
+from ...core.unchecked_base_model import construct_type
+from ...types.list_webhook_event_types_response import ListWebhookEventTypesResponse
+
+
+class RawEventTypesClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self, *, api_version: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[ListWebhookEventTypesResponse]:
+ """
+ Lists all webhook event types that can be subscribed to.
+
+ Parameters
+ ----------
+ api_version : typing.Optional[str]
+ The API version for which to list event types. Setting this field overrides the default version used by the application.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[ListWebhookEventTypesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/webhooks/event-types",
+ method="GET",
+ params={
+ "api_version": api_version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListWebhookEventTypesResponse,
+ construct_type(
+ type_=ListWebhookEventTypesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawEventTypesClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self, *, api_version: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[ListWebhookEventTypesResponse]:
+ """
+ Lists all webhook event types that can be subscribed to.
+
+ Parameters
+ ----------
+ api_version : typing.Optional[str]
+ The API version for which to list event types. Setting this field overrides the default version used by the application.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ListWebhookEventTypesResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/webhooks/event-types",
+ method="GET",
+ params={
+ "api_version": api_version,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListWebhookEventTypesResponse,
+ construct_type(
+ type_=ListWebhookEventTypesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/webhooks/raw_client.py b/src/square/webhooks/raw_client.py
new file mode 100644
index 00000000..74782346
--- /dev/null
+++ b/src/square/webhooks/raw_client.py
@@ -0,0 +1,13 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+
+
+class RawWebhooksClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+
+class AsyncRawWebhooksClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
diff --git a/src/square/webhooks/subscriptions/__init__.py b/src/square/webhooks/subscriptions/__init__.py
new file mode 100644
index 00000000..5cde0202
--- /dev/null
+++ b/src/square/webhooks/subscriptions/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/square/webhooks/subscriptions/client.py b/src/square/webhooks/subscriptions/client.py
new file mode 100644
index 00000000..684bff7c
--- /dev/null
+++ b/src/square/webhooks/subscriptions/client.py
@@ -0,0 +1,738 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...requests.webhook_subscription import WebhookSubscriptionParams
+from ...types.create_webhook_subscription_response import CreateWebhookSubscriptionResponse
+from ...types.delete_webhook_subscription_response import DeleteWebhookSubscriptionResponse
+from ...types.get_webhook_subscription_response import GetWebhookSubscriptionResponse
+from ...types.list_webhook_subscriptions_response import ListWebhookSubscriptionsResponse
+from ...types.sort_order import SortOrder
+from ...types.test_webhook_subscription_response import TestWebhookSubscriptionResponse
+from ...types.update_webhook_subscription_response import UpdateWebhookSubscriptionResponse
+from ...types.update_webhook_subscription_signature_key_response import UpdateWebhookSubscriptionSignatureKeyResponse
+from ...types.webhook_subscription import WebhookSubscription
+from .raw_client import AsyncRawSubscriptionsClient, RawSubscriptionsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class SubscriptionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawSubscriptionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawSubscriptionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawSubscriptionsClient
+ """
+ return self._raw_client
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ include_disabled: typing.Optional[bool] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]:
+ """
+ Lists all webhook subscriptions owned by your application.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ include_disabled : typing.Optional[bool]
+ Includes disabled [Subscription](entity:WebhookSubscription)s.
+ By default, all enabled [Subscription](entity:WebhookSubscription)s are returned.
+
+ sort_order : typing.Optional[SortOrder]
+ Sorts the returned list by when the [Subscription](entity:WebhookSubscription) was created with the specified order.
+ This field defaults to ASC.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value.
+
+ Default: 100
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.webhooks.subscriptions.list(
+ cursor="cursor",
+ include_disabled=True,
+ sort_order="DESC",
+ limit=1,
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.list(
+ cursor=cursor,
+ include_disabled=include_disabled,
+ sort_order=sort_order,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ def create(
+ self,
+ *,
+ subscription: WebhookSubscriptionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateWebhookSubscriptionResponse:
+ """
+ Creates a webhook subscription.
+
+ Parameters
+ ----------
+ subscription : WebhookSubscriptionParams
+ The [Subscription](entity:WebhookSubscription) to create.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateWebhookSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.webhooks.subscriptions.create(
+ idempotency_key="63f84c6c-2200-4c99-846c-2670a1311fbf",
+ subscription={
+ "name": "Example Webhook Subscription",
+ "event_types": ["payment.created", "payment.updated"],
+ "notification_url": "https://example-webhook-url.com",
+ "api_version": "2021-12-15",
+ },
+ )
+ """
+ _response = self._raw_client.create(
+ subscription=subscription, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def get(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetWebhookSubscriptionResponse:
+ """
+ Retrieves a webhook subscription identified by its ID.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetWebhookSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.webhooks.subscriptions.get(
+ subscription_id="subscription_id",
+ )
+ """
+ _response = self._raw_client.get(subscription_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self,
+ subscription_id: str,
+ *,
+ subscription: typing.Optional[WebhookSubscriptionParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateWebhookSubscriptionResponse:
+ """
+ Updates a webhook subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update.
+
+ subscription : typing.Optional[WebhookSubscriptionParams]
+ The [Subscription](entity:WebhookSubscription) to update.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateWebhookSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.webhooks.subscriptions.update(
+ subscription_id="subscription_id",
+ subscription={
+ "name": "Updated Example Webhook Subscription",
+ "enabled": False,
+ },
+ )
+ """
+ _response = self._raw_client.update(subscription_id, subscription=subscription, request_options=request_options)
+ return _response.data
+
+ def delete(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteWebhookSubscriptionResponse:
+ """
+ Deletes a webhook subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteWebhookSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.webhooks.subscriptions.delete(
+ subscription_id="subscription_id",
+ )
+ """
+ _response = self._raw_client.delete(subscription_id, request_options=request_options)
+ return _response.data
+
+ def update_signature_key(
+ self,
+ subscription_id: str,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateWebhookSubscriptionSignatureKeyResponse:
+ """
+ Updates a webhook subscription by replacing the existing signature key with a new one.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateWebhookSubscriptionSignatureKeyResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.webhooks.subscriptions.update_signature_key(
+ subscription_id="subscription_id",
+ idempotency_key="ed80ae6b-0654-473b-bbab-a39aee89a60d",
+ )
+ """
+ _response = self._raw_client.update_signature_key(
+ subscription_id, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ def test(
+ self,
+ subscription_id: str,
+ *,
+ event_type: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> TestWebhookSubscriptionResponse:
+ """
+ Tests a webhook subscription by sending a test event to the notification URL.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to test.
+
+ event_type : typing.Optional[str]
+ The event type that will be used to test the [Subscription](entity:WebhookSubscription). The event type must be
+ contained in the list of event types in the [Subscription](entity:WebhookSubscription).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ TestWebhookSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.webhooks.subscriptions.test(
+ subscription_id="subscription_id",
+ event_type="payment.created",
+ )
+ """
+ _response = self._raw_client.test(subscription_id, event_type=event_type, request_options=request_options)
+ return _response.data
+
+
+class AsyncSubscriptionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawSubscriptionsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawSubscriptionsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawSubscriptionsClient
+ """
+ return self._raw_client
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ include_disabled: typing.Optional[bool] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]:
+ """
+ Lists all webhook subscriptions owned by your application.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ include_disabled : typing.Optional[bool]
+ Includes disabled [Subscription](entity:WebhookSubscription)s.
+ By default, all enabled [Subscription](entity:WebhookSubscription)s are returned.
+
+ sort_order : typing.Optional[SortOrder]
+ Sorts the returned list by when the [Subscription](entity:WebhookSubscription) was created with the specified order.
+ This field defaults to ASC.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value.
+
+ Default: 100
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ response = await client.webhooks.subscriptions.list(
+ cursor="cursor",
+ include_disabled=True,
+ sort_order="DESC",
+ limit=1,
+ )
+ async for item in response:
+ yield item
+
+ # alternatively, you can paginate page-by-page
+ async for page in response.iter_pages():
+ yield page
+
+
+ asyncio.run(main())
+ """
+ return await self._raw_client.list(
+ cursor=cursor,
+ include_disabled=include_disabled,
+ sort_order=sort_order,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ async def create(
+ self,
+ *,
+ subscription: WebhookSubscriptionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateWebhookSubscriptionResponse:
+ """
+ Creates a webhook subscription.
+
+ Parameters
+ ----------
+ subscription : WebhookSubscriptionParams
+ The [Subscription](entity:WebhookSubscription) to create.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateWebhookSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.webhooks.subscriptions.create(
+ idempotency_key="63f84c6c-2200-4c99-846c-2670a1311fbf",
+ subscription={
+ "name": "Example Webhook Subscription",
+ "event_types": ["payment.created", "payment.updated"],
+ "notification_url": "https://example-webhook-url.com",
+ "api_version": "2021-12-15",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create(
+ subscription=subscription, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def get(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> GetWebhookSubscriptionResponse:
+ """
+ Retrieves a webhook subscription identified by its ID.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ GetWebhookSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.webhooks.subscriptions.get(
+ subscription_id="subscription_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get(subscription_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self,
+ subscription_id: str,
+ *,
+ subscription: typing.Optional[WebhookSubscriptionParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateWebhookSubscriptionResponse:
+ """
+ Updates a webhook subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update.
+
+ subscription : typing.Optional[WebhookSubscriptionParams]
+ The [Subscription](entity:WebhookSubscription) to update.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateWebhookSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.webhooks.subscriptions.update(
+ subscription_id="subscription_id",
+ subscription={
+ "name": "Updated Example Webhook Subscription",
+ "enabled": False,
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(
+ subscription_id, subscription=subscription, request_options=request_options
+ )
+ return _response.data
+
+ async def delete(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteWebhookSubscriptionResponse:
+ """
+ Deletes a webhook subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteWebhookSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.webhooks.subscriptions.delete(
+ subscription_id="subscription_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete(subscription_id, request_options=request_options)
+ return _response.data
+
+ async def update_signature_key(
+ self,
+ subscription_id: str,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateWebhookSubscriptionSignatureKeyResponse:
+ """
+ Updates a webhook subscription by replacing the existing signature key with a new one.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateWebhookSubscriptionSignatureKeyResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.webhooks.subscriptions.update_signature_key(
+ subscription_id="subscription_id",
+ idempotency_key="ed80ae6b-0654-473b-bbab-a39aee89a60d",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update_signature_key(
+ subscription_id, idempotency_key=idempotency_key, request_options=request_options
+ )
+ return _response.data
+
+ async def test(
+ self,
+ subscription_id: str,
+ *,
+ event_type: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> TestWebhookSubscriptionResponse:
+ """
+ Tests a webhook subscription by sending a test event to the notification URL.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to test.
+
+ event_type : typing.Optional[str]
+ The event type that will be used to test the [Subscription](entity:WebhookSubscription). The event type must be
+ contained in the list of event types in the [Subscription](entity:WebhookSubscription).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ TestWebhookSubscriptionResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.webhooks.subscriptions.test(
+ subscription_id="subscription_id",
+ event_type="payment.created",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.test(subscription_id, event_type=event_type, request_options=request_options)
+ return _response.data
diff --git a/src/square/webhooks/subscriptions/raw_client.py b/src/square/webhooks/subscriptions/raw_client.py
new file mode 100644
index 00000000..2f5d0d92
--- /dev/null
+++ b/src/square/webhooks/subscriptions/raw_client.py
@@ -0,0 +1,789 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.jsonable_encoder import jsonable_encoder
+from ...core.pagination import AsyncPager, SyncPager
+from ...core.request_options import RequestOptions
+from ...core.serialization import convert_and_respect_annotation_metadata
+from ...core.unchecked_base_model import construct_type
+from ...requests.webhook_subscription import WebhookSubscriptionParams
+from ...types.create_webhook_subscription_response import CreateWebhookSubscriptionResponse
+from ...types.delete_webhook_subscription_response import DeleteWebhookSubscriptionResponse
+from ...types.get_webhook_subscription_response import GetWebhookSubscriptionResponse
+from ...types.list_webhook_subscriptions_response import ListWebhookSubscriptionsResponse
+from ...types.sort_order import SortOrder
+from ...types.test_webhook_subscription_response import TestWebhookSubscriptionResponse
+from ...types.update_webhook_subscription_response import UpdateWebhookSubscriptionResponse
+from ...types.update_webhook_subscription_signature_key_response import UpdateWebhookSubscriptionSignatureKeyResponse
+from ...types.webhook_subscription import WebhookSubscription
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawSubscriptionsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ include_disabled: typing.Optional[bool] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]:
+ """
+ Lists all webhook subscriptions owned by your application.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ include_disabled : typing.Optional[bool]
+ Includes disabled [Subscription](entity:WebhookSubscription)s.
+ By default, all enabled [Subscription](entity:WebhookSubscription)s are returned.
+
+ sort_order : typing.Optional[SortOrder]
+ Sorts the returned list by when the [Subscription](entity:WebhookSubscription) was created with the specified order.
+ This field defaults to ASC.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value.
+
+ Default: 100
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/webhooks/subscriptions",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "include_disabled": include_disabled,
+ "sort_order": sort_order,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListWebhookSubscriptionsResponse,
+ construct_type(
+ type_=ListWebhookSubscriptionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.subscriptions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.list(
+ cursor=_parsed_next,
+ include_disabled=include_disabled,
+ sort_order=sort_order,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def create(
+ self,
+ *,
+ subscription: WebhookSubscriptionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateWebhookSubscriptionResponse]:
+ """
+ Creates a webhook subscription.
+
+ Parameters
+ ----------
+ subscription : WebhookSubscriptionParams
+ The [Subscription](entity:WebhookSubscription) to create.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[CreateWebhookSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/webhooks/subscriptions",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "subscription": convert_and_respect_annotation_metadata(
+ object_=subscription, annotation=WebhookSubscriptionParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateWebhookSubscriptionResponse,
+ construct_type(
+ type_=CreateWebhookSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetWebhookSubscriptionResponse]:
+ """
+ Retrieves a webhook subscription identified by its ID.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[GetWebhookSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/webhooks/subscriptions/{jsonable_encoder(subscription_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetWebhookSubscriptionResponse,
+ construct_type(
+ type_=GetWebhookSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self,
+ subscription_id: str,
+ *,
+ subscription: typing.Optional[WebhookSubscriptionParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateWebhookSubscriptionResponse]:
+ """
+ Updates a webhook subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update.
+
+ subscription : typing.Optional[WebhookSubscriptionParams]
+ The [Subscription](entity:WebhookSubscription) to update.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateWebhookSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/webhooks/subscriptions/{jsonable_encoder(subscription_id)}",
+ method="PUT",
+ json={
+ "subscription": convert_and_respect_annotation_metadata(
+ object_=subscription, annotation=WebhookSubscriptionParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateWebhookSubscriptionResponse,
+ construct_type(
+ type_=UpdateWebhookSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def delete(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteWebhookSubscriptionResponse]:
+ """
+ Deletes a webhook subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteWebhookSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/webhooks/subscriptions/{jsonable_encoder(subscription_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteWebhookSubscriptionResponse,
+ construct_type(
+ type_=DeleteWebhookSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update_signature_key(
+ self,
+ subscription_id: str,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateWebhookSubscriptionSignatureKeyResponse]:
+ """
+ Updates a webhook subscription by replacing the existing signature key with a new one.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateWebhookSubscriptionSignatureKeyResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/webhooks/subscriptions/{jsonable_encoder(subscription_id)}/signature-key",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateWebhookSubscriptionSignatureKeyResponse,
+ construct_type(
+ type_=UpdateWebhookSubscriptionSignatureKeyResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def test(
+ self,
+ subscription_id: str,
+ *,
+ event_type: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[TestWebhookSubscriptionResponse]:
+ """
+ Tests a webhook subscription by sending a test event to the notification URL.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to test.
+
+ event_type : typing.Optional[str]
+ The event type that will be used to test the [Subscription](entity:WebhookSubscription). The event type must be
+ contained in the list of event types in the [Subscription](entity:WebhookSubscription).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[TestWebhookSubscriptionResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"v2/webhooks/subscriptions/{jsonable_encoder(subscription_id)}/test",
+ method="POST",
+ json={
+ "event_type": event_type,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ TestWebhookSubscriptionResponse,
+ construct_type(
+ type_=TestWebhookSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawSubscriptionsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list(
+ self,
+ *,
+ cursor: typing.Optional[str] = None,
+ include_disabled: typing.Optional[bool] = None,
+ sort_order: typing.Optional[SortOrder] = None,
+ limit: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]:
+ """
+ Lists all webhook subscriptions owned by your application.
+
+ Parameters
+ ----------
+ cursor : typing.Optional[str]
+ A pagination cursor returned by a previous call to this endpoint.
+ Provide this to retrieve the next set of results for your original query.
+
+ For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
+
+ include_disabled : typing.Optional[bool]
+ Includes disabled [Subscription](entity:WebhookSubscription)s.
+ By default, all enabled [Subscription](entity:WebhookSubscription)s are returned.
+
+ sort_order : typing.Optional[SortOrder]
+ Sorts the returned list by when the [Subscription](entity:WebhookSubscription) was created with the specified order.
+ This field defaults to ASC.
+
+ limit : typing.Optional[int]
+ The maximum number of results to be returned in a single page.
+ It is possible to receive fewer results than the specified limit on a given page.
+ The default value of 100 is also the maximum allowed value.
+
+ Default: 100
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/webhooks/subscriptions",
+ method="GET",
+ params={
+ "cursor": cursor,
+ "include_disabled": include_disabled,
+ "sort_order": sort_order,
+ "limit": limit,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ ListWebhookSubscriptionsResponse,
+ construct_type(
+ type_=ListWebhookSubscriptionsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.subscriptions
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+
+ async def _get_next():
+ return await self.list(
+ cursor=_parsed_next,
+ include_disabled=include_disabled,
+ sort_order=sort_order,
+ limit=limit,
+ request_options=request_options,
+ )
+
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def create(
+ self,
+ *,
+ subscription: WebhookSubscriptionParams,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateWebhookSubscriptionResponse]:
+ """
+ Creates a webhook subscription.
+
+ Parameters
+ ----------
+ subscription : WebhookSubscriptionParams
+ The [Subscription](entity:WebhookSubscription) to create.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[CreateWebhookSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/webhooks/subscriptions",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "subscription": convert_and_respect_annotation_metadata(
+ object_=subscription, annotation=WebhookSubscriptionParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ CreateWebhookSubscriptionResponse,
+ construct_type(
+ type_=CreateWebhookSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[GetWebhookSubscriptionResponse]:
+ """
+ Retrieves a webhook subscription identified by its ID.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[GetWebhookSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/webhooks/subscriptions/{jsonable_encoder(subscription_id)}",
+ method="GET",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ GetWebhookSubscriptionResponse,
+ construct_type(
+ type_=GetWebhookSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self,
+ subscription_id: str,
+ *,
+ subscription: typing.Optional[WebhookSubscriptionParams] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateWebhookSubscriptionResponse]:
+ """
+ Updates a webhook subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update.
+
+ subscription : typing.Optional[WebhookSubscriptionParams]
+ The [Subscription](entity:WebhookSubscription) to update.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateWebhookSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/webhooks/subscriptions/{jsonable_encoder(subscription_id)}",
+ method="PUT",
+ json={
+ "subscription": convert_and_respect_annotation_metadata(
+ object_=subscription, annotation=WebhookSubscriptionParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateWebhookSubscriptionResponse,
+ construct_type(
+ type_=UpdateWebhookSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def delete(
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteWebhookSubscriptionResponse]:
+ """
+ Deletes a webhook subscription.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteWebhookSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/webhooks/subscriptions/{jsonable_encoder(subscription_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteWebhookSubscriptionResponse,
+ construct_type(
+ type_=DeleteWebhookSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update_signature_key(
+ self,
+ subscription_id: str,
+ *,
+ idempotency_key: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateWebhookSubscriptionSignatureKeyResponse]:
+ """
+ Updates a webhook subscription by replacing the existing signature key with a new one.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update.
+
+ idempotency_key : typing.Optional[str]
+ A unique string that identifies the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) request.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateWebhookSubscriptionSignatureKeyResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/webhooks/subscriptions/{jsonable_encoder(subscription_id)}/signature-key",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateWebhookSubscriptionSignatureKeyResponse,
+ construct_type(
+ type_=UpdateWebhookSubscriptionSignatureKeyResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def test(
+ self,
+ subscription_id: str,
+ *,
+ event_type: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[TestWebhookSubscriptionResponse]:
+ """
+ Tests a webhook subscription by sending a test event to the notification URL.
+
+ Parameters
+ ----------
+ subscription_id : str
+ [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to test.
+
+ event_type : typing.Optional[str]
+ The event type that will be used to test the [Subscription](entity:WebhookSubscription). The event type must be
+ contained in the list of event types in the [Subscription](entity:WebhookSubscription).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[TestWebhookSubscriptionResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"v2/webhooks/subscriptions/{jsonable_encoder(subscription_id)}/test",
+ method="POST",
+ json={
+ "event_type": event_type,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ TestWebhookSubscriptionResponse,
+ construct_type(
+ type_=TestWebhookSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/tests/custom/test_client.py b/tests/custom/test_client.py
new file mode 100644
index 00000000..ab04ce63
--- /dev/null
+++ b/tests/custom/test_client.py
@@ -0,0 +1,7 @@
+import pytest
+
+
+# Get started with writing tests with pytest at https://docs.pytest.org
+@pytest.mark.skip(reason="Unimplemented")
+def test_client() -> None:
+ assert True
diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py
new file mode 100644
index 00000000..9cf0dc52
--- /dev/null
+++ b/tests/integration/helpers.py
@@ -0,0 +1,155 @@
+import os
+import uuid
+from datetime import datetime
+from typing import List
+
+from square import Square
+from square.core import File
+from square.environment import SquareEnvironment
+from square.types.address import Address
+from square.types.catalog_item import CatalogItem
+from square.types.catalog_item_variation import CatalogItemVariation
+from square.types.catalog_object import CatalogObject, CatalogObject_Item, CatalogObject_ItemVariation
+from square.types.location import Location
+from square.types.money import Money
+
+
+class CreateCatalogItemVariationOptions:
+ name: str
+ price_money: Money
+
+ def __init__(self):
+ self.name = "Variation " + str(uuid.uuid4())
+ self.price_money = new_test_money(1000)
+
+ def variation(self) -> CatalogItemVariation:
+ return CatalogItemVariation(
+ name=self.name,
+ track_inventory=True,
+ pricing_type="FIXED_PRICING",
+ price_money=self.price_money,
+ )
+
+
+class CreateCatalogItemOptions:
+ name: str
+ description: str
+ abbreviation: str
+ variation_opts: List[CreateCatalogItemVariationOptions]
+
+ def __init__(self):
+ self.name = "Item " + str(uuid.uuid4())
+ self.description = "Test item description"
+ self.abbreviation = "TST"
+ self.variation_opts = [CreateCatalogItemVariationOptions()]
+
+ def variations(self) -> List[CatalogObject]:
+ return [
+ CatalogObject_ItemVariation(
+ type="ITEM_VARIATION",
+ id="#variation" + str(uuid.uuid4()),
+ present_at_all_locations=True,
+ item_variation_data=opts.variation(),
+ )
+ for opts in self.variation_opts
+ ]
+
+
+def test_client() -> Square:
+ return Square(
+ token=os.getenv("TEST_SQUARE_TOKEN"),
+ environment=SquareEnvironment.SANDBOX,
+ )
+
+
+def new_test_money(amount: int) -> Money:
+ return Money(amount=amount, currency="USD")
+
+
+def create_test_catalog_item(opts: CreateCatalogItemOptions) -> CatalogObject:
+ return CatalogObject_Item(
+ type="ITEM",
+ id="#" + str(uuid.uuid4()),
+ present_at_all_locations=True,
+ item_data=CatalogItem(
+ name=opts.name,
+ description=opts.description,
+ abbreviation=opts.abbreviation,
+ variations=opts.variations(),
+ ),
+ )
+
+
+def get_test_file() -> File:
+ with open("tests/integration/testdata/image.jpeg", "rb") as file:
+ return file.read()
+
+
+def create_location(client: Square) -> str:
+ locations_response = client.locations.create(
+ location={"name": "Test location " + str(uuid.uuid4())}
+ )
+
+ location = locations_response.location
+ if location is None or not isinstance(location, Location):
+ raise Exception("Could not get location.")
+ location_id = location.id
+ if location_id is None:
+ raise Exception("Could not get location ID.")
+ return location_id
+
+
+def create_test_customer(client: Square) -> str:
+ address = test_address()
+ response = client.customers.create(
+ idempotency_key=str(uuid.uuid4()),
+ given_name="Amelia",
+ family_name="Earhart",
+ phone_number="1-212-555-4240",
+ note="test customer",
+ address={
+ "address_line1": address.address_line1,
+ "address_line2": address.address_line2,
+ "locality": address.locality,
+ "administrative_district_level1": address.administrative_district_level1,
+ "postal_code": address.postal_code,
+ "country": address.country,
+ },
+ )
+ customer = response.customer
+ if customer is None:
+ raise Exception("Could not get customer.")
+ customer_id = customer.id
+ if customer_id is None:
+ raise Exception("Could not get customer ID.")
+ return customer_id
+
+
+def test_address() -> Address:
+ return Address(
+ address_line1="500 Electric Ave",
+ address_line2="Suite 600A",
+ locality="New York",
+ administrative_district_level1="NY",
+ postal_code="10003",
+ country="US",
+ )
+
+
+def get_default_location_id(client: Square) -> str:
+ response = client.locations.list()
+ locations = response.locations
+ if locations is None or len(locations) == 0:
+ raise Exception("Could not get locations.")
+ location_id = locations[0].id
+ if location_id is None:
+ raise Exception("Could not get location ID.")
+ return location_id
+
+
+def new_test_square_id() -> str:
+ return "#" + str(uuid.uuid4())
+
+
+def format_date_string(date: datetime) -> str:
+ return date.isoformat()[:19] + "Z"
diff --git a/tests/integration/test_api_error.py b/tests/integration/test_api_error.py
new file mode 100644
index 00000000..ca0cca64
--- /dev/null
+++ b/tests/integration/test_api_error.py
@@ -0,0 +1,172 @@
+from square.core.api_error import ApiError
+from square.types.error import Error
+
+
+class TestResponse:
+ def __init__(self, data):
+ for key, value in data.items():
+ if isinstance(value, list):
+ setattr(
+ self,
+ key,
+ [
+ TestResponse(item) if isinstance(item, dict) else item
+ for item in value
+ ],
+ )
+ else:
+ setattr(self, key, value)
+
+
+def test_exception_without_body():
+ exception = ApiError(status_code=400, body=None)
+
+ assert "status_code: 400" in str(exception)
+ assert exception.status_code == 400
+ assert len(exception.errors) == 1
+ assert isinstance(exception.errors[0], Error)
+ assert exception.errors[0].code == "Unknown"
+ assert exception.errors[0].category == "API_ERROR"
+ assert exception.errors[0].field is None
+ assert exception.errors[0].detail is None
+
+
+def test_exception_with_v1_error():
+ error_string = """{
+ "type": "INVALID_REQUEST",
+ "message": "Invalid field value",
+ "field": "customer_id"
+ }"""
+ exception = ApiError(status_code=400, body=error_string)
+
+ assert "status_code: 400" in str(exception)
+ assert "body:" in str(exception)
+ assert exception.status_code == 400
+ assert len(exception.errors) == 1
+ assert isinstance(exception.errors[0], Error)
+ assert exception.errors[0].code == "INVALID_REQUEST"
+ assert exception.errors[0].category == "API_ERROR"
+ assert exception.errors[0].field == "customer_id"
+ assert exception.errors[0].detail == "Invalid field value"
+
+
+def test_exception_with_v1_error_without_type():
+ error_string = """{
+ "message": "Invalid field value",
+ "field": "customer_id"
+ }"""
+ exception = ApiError(status_code=400, body=error_string)
+
+ assert "status_code: 400" in str(exception)
+ assert exception.status_code == 400
+ assert len(exception.errors) == 1
+ assert isinstance(exception.errors[0], Error)
+ assert exception.errors[0].code == "Unknown"
+ assert exception.errors[0].category == "API_ERROR"
+ assert exception.errors[0].field == "customer_id"
+ assert exception.errors[0].detail == "Invalid field value"
+
+
+def test_exception_with_v2_error():
+ error_string = """{
+ "errors": [{
+ "category": "API_ERROR",
+ "code": "BAD_REQUEST",
+ "detail": "Invalid input",
+ "field": "email"
+ }]
+ }"""
+ exception = ApiError(status_code=400, body=error_string)
+
+ assert "status_code: 400" in str(exception)
+ assert exception.status_code == 400
+ assert len(exception.errors) == 1
+ assert isinstance(exception.errors[0], Error)
+ assert exception.errors[0].category == "API_ERROR"
+ assert exception.errors[0].code == "BAD_REQUEST"
+ assert exception.errors[0].detail == "Invalid input"
+ assert exception.errors[0].field == "email"
+
+
+def test_exception_with_v2_error_as_dict():
+ errors = {
+ "errors": [
+ {
+ "category": "API_ERROR",
+ "code": "BAD_REQUEST",
+ "detail": "Invalid input",
+ "field": "email",
+ }
+ ]
+ }
+ exception = ApiError(status_code=400, body=errors)
+
+ assert "status_code: 400" in str(exception)
+ assert exception.status_code == 400
+ assert len(exception.errors) == 1
+ assert isinstance(exception.errors[0], Error)
+ assert exception.errors[0].category == "API_ERROR"
+ assert exception.errors[0].code == "BAD_REQUEST"
+ assert exception.errors[0].detail == "Invalid input"
+ assert exception.errors[0].field == "email"
+
+
+def test_exception_with_v2_error_as_object():
+ errors = TestResponse(
+ {
+ "errors": [
+ {
+ "category": "API_ERROR",
+ "code": "BAD_REQUEST",
+ "detail": "Invalid input",
+ "field": "email",
+ }
+ ]
+ }
+ )
+
+ exception = ApiError(status_code=400, body=errors)
+
+ assert "status_code: 400" in str(exception)
+ assert exception.status_code == 400
+ assert len(exception.errors) == 1
+ assert isinstance(exception.errors[0], Error)
+ assert exception.errors[0].category == "API_ERROR"
+ assert exception.errors[0].code == "BAD_REQUEST"
+ assert exception.errors[0].detail == "Invalid input"
+ assert exception.errors[0].field == "email"
+
+
+def test_exception_with_multiple_errors():
+ errors = {
+ "errors": [
+ {
+ "category": "API_ERROR",
+ "code": "BAD_REQUEST",
+ "detail": "Invalid input",
+ "field": "email",
+ },
+ {
+ "category": "AUTHENTICATION_ERROR",
+ "code": "UNAUTHORIZED",
+ "detail": "Not authorized",
+ "field": None,
+ },
+ ]
+ }
+ exception = ApiError(status_code=400, body=errors)
+
+ assert exception.status_code == 400
+ assert len(exception.errors) == 2
+
+ # First error
+ assert exception.errors[0].category == "API_ERROR"
+ assert exception.errors[0].code == "BAD_REQUEST"
+ assert exception.errors[0].detail == "Invalid input"
+ assert exception.errors[0].field == "email"
+
+ # Second error
+ assert exception.errors[1].category == "AUTHENTICATION_ERROR"
+ assert exception.errors[1].code == "UNAUTHORIZED"
+ assert exception.errors[1].detail == "Not authorized"
+ assert exception.errors[1].field is None
diff --git a/tests/integration/test_cash_drawers.py b/tests/integration/test_cash_drawers.py
new file mode 100644
index 00000000..b7596aae
--- /dev/null
+++ b/tests/integration/test_cash_drawers.py
@@ -0,0 +1,16 @@
+from datetime import datetime, timedelta
+
+from . import helpers
+
+
+def test_list_cash_drawer_shifts():
+ client = helpers.test_client()
+ begin_time = (datetime.now() - timedelta(seconds=1)).isoformat()
+ end_time = datetime.now().isoformat()
+ location_id = helpers.get_default_location_id(client)
+
+ response = client.cash_drawers.shifts.list(
+ location_id=location_id, begin_time=begin_time, end_time=end_time
+ )
+
+ assert response is not None
diff --git a/tests/integration/test_catalog.py b/tests/integration/test_catalog.py
new file mode 100644
index 00000000..0a3b533f
--- /dev/null
+++ b/tests/integration/test_catalog.py
@@ -0,0 +1,359 @@
+import pytest
+import time
+import uuid
+from functools import wraps
+
+from square.core.api_error import ApiError
+from square.core.request_options import RequestOptions
+from square.types.catalog_item import CatalogItem
+from square.types.catalog_item_variation import CatalogItemVariation
+from square.types.catalog_modifier import CatalogModifier
+from square.types.catalog_modifier_list import CatalogModifierList
+from square.types.catalog_object_batch import CatalogObjectBatch
+from square.types.catalog_object_image import CatalogObjectImage
+from square.types.catalog_object_item import CatalogObjectItem
+from square.types.catalog_object_modifier import CatalogObjectModifier
+from square.types.catalog_object_modifier_list import CatalogObjectModifierList
+from square.types.catalog_object_tax import CatalogObjectTax
+from square.types.catalog_tax import CatalogTax
+
+from . import helpers
+
+MAX_RETRIES = 5
+MAX_TIMEOUT = 120
+
+
+def retry_on_rate_limit(max_retries=5, base_delay=2):
+ def decorator(func):
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ for attempt in range(max_retries):
+ try:
+ return func(*args, **kwargs)
+ except ApiError as e:
+ if e.status_code == 429 and attempt < max_retries - 1:
+ delay = base_delay * (2 ** attempt) # exponential backoff
+ print(f"Rate limited. Retrying in {delay} seconds...")
+ time.sleep(delay)
+ continue
+ raise
+ return None
+ return wrapper
+ return decorator
+
+
+
+@retry_on_rate_limit()
+@pytest.mark.skip(reason="Temporarily skipping test_upload_catalog_image")
+def test_upload_catalog_image():
+ # Wait to kick off the first test to avoid being rate limited.
+ time.sleep(3)
+
+ client = helpers.test_client()
+
+ try:
+ # Setup: Create a catalog object to associate the image with
+ catalog_object = helpers.create_test_catalog_item(
+ helpers.CreateCatalogItemOptions()
+ )
+ create_catalog_resp = client.catalog.batch_upsert(
+ idempotency_key=str(uuid.uuid4()),
+ batches=[CatalogObjectBatch(objects=[catalog_object])],
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ time.sleep(2) # Add delay after creation
+
+ objects = create_catalog_resp.objects
+ assert objects is not None
+ assert 1 == len(objects)
+ created_catalog_object = objects[0]
+ assert isinstance(created_catalog_object, CatalogObjectItem)
+ assert created_catalog_object.id is not None
+
+ # Create a new catalog image
+ image_name = "Test Image " + str(uuid.uuid4())
+ create_catalog_image_resp = client.catalog.images.create(
+ image_file=helpers.get_test_file(),
+ request={
+ "idempotency_key": str(uuid.uuid4()),
+ "image": {
+ "type": "IMAGE",
+ "id": helpers.new_test_square_id(),
+ "image_data": {"name": image_name},
+ },
+ "object_id": created_catalog_object.id,
+ },
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ time.sleep(2) # Add delay after image creation
+
+ image = create_catalog_image_resp.image
+ assert image is not None
+ assert isinstance(image, CatalogObjectImage)
+
+ # Add retry logic for cleanup
+ for attempt in range(MAX_RETRIES):
+ try:
+ time.sleep(2) # Add delay before cleanup attempt
+ # Cleanup
+ client.catalog.batch_delete(
+ object_ids=[created_catalog_object.id, image.id],
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ break
+ except ApiError as e:
+ if e.status_code == 429 and attempt < MAX_RETRIES - 1:
+ delay = 2 * (2 ** attempt)
+ print(f"Cleanup rate limited. Retrying in {delay} seconds...")
+ time.sleep(delay)
+ continue
+ raise
+ except Exception as e:
+ print(f"Error in test_upload_catalog_image: {str(e)}")
+ raise
+
+
+@retry_on_rate_limit()
+@pytest.mark.skip(reason="Temporarily skipping test_upsert_catalog_object")
+def test_upsert_catalog_object():
+ time.sleep(2) # Add initial delay
+ client = helpers.test_client()
+
+ coffee_variation_opts = helpers.CreateCatalogItemVariationOptions()
+ coffee_variation_opts.price_money = helpers.new_test_money(100)
+ coffee_variation_opts.name = "Colombian Fair Trade"
+
+ coffee_opts = helpers.CreateCatalogItemOptions()
+ coffee_opts.name = "Coffee"
+ coffee_opts.description = "Strong coffee"
+ coffee_opts.abbreviation = "C"
+ coffee_opts.variation_opts = [coffee_variation_opts]
+
+ coffee = helpers.create_test_catalog_item(coffee_opts)
+
+ response = client.catalog.object.upsert(
+ idempotency_key=str(uuid.uuid4()),
+ object=coffee,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ catalog_object = response.catalog_object
+ assert catalog_object is not None
+ assert isinstance(catalog_object, CatalogObjectItem)
+ item = catalog_object.item_data
+ assert item is not None
+ assert isinstance(item, CatalogItem)
+ variations = item.variations
+ assert variations is not None
+ assert 1 == len(variations)
+
+ variation_object = variations[0]
+ item_variation_data = variation_object.item_variation_data
+ assert item_variation_data is not None
+ assert isinstance(item_variation_data, CatalogItemVariation)
+ assert "Colombian Fair Trade" == item_variation_data.name
+
+
+@retry_on_rate_limit()
+def test_catalog_info():
+ time.sleep(2) # Add initial delay
+ client = helpers.test_client()
+ response = client.catalog.search(
+ limit=1, request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT)
+ )
+
+ assert response.objects is not None
+ assert len(response.objects) > 0
+
+
+@retry_on_rate_limit()
+def test_search_catalog_items():
+ time.sleep(2) # Add initial delay
+ client = helpers.test_client()
+ response = client.catalog.search_items(
+ limit=1, request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT)
+ )
+ assert response is not None
+
+
+@retry_on_rate_limit()
+@pytest.mark.skip(reason="Temporarily skipping test_batch_upsert_catalog_objects")
+def test_batch_upsert_catalog_objects():
+ # Wait to kick off this test to avoid being rate limited.
+ time.sleep(3)
+
+ client = helpers.test_client()
+
+ modifier = CatalogObjectModifier(
+ type="MODIFIER",
+ id="#temp-modifier-id",
+ modifier_data=CatalogModifier(
+ name="Limited Time Only Price", price_money=helpers.new_test_money(200)
+ ),
+ )
+
+ modifier_list = CatalogObjectModifierList(
+ type="MODIFIER_LIST",
+ id="#temp-modifier-list-id",
+ modifier_list_data=CatalogModifierList(
+ name="Special weekend deals", modifiers=[modifier]
+ ),
+ )
+
+ tax = CatalogObjectTax(
+ type="TAX",
+ id="#temp-tax-id",
+ tax_data=CatalogTax(
+ name="Online only Tax",
+ calculation_phase="TAX_SUBTOTAL_PHASE",
+ inclusion_type="ADDITIVE",
+ percentage="5.0",
+ applies_to_custom_amounts=True,
+ enabled=True,
+ ),
+ )
+
+ response = client.catalog.batch_upsert(
+ idempotency_key=str(uuid.uuid4()),
+ batches=[
+ {
+ "objects": [
+ {
+ "type": tax.type,
+ "id": tax.id,
+ "tax_data": {
+ "name": tax.tax_data.name,
+ "calculation_phase": tax.tax_data.calculation_phase,
+ "inclusion_type": tax.tax_data.inclusion_type,
+ "percentage": tax.tax_data.percentage,
+ "applies_to_custom_amounts": tax.tax_data.applies_to_custom_amounts,
+ "enabled": tax.tax_data.enabled,
+ },
+ },
+ {
+ "type": modifier_list.type,
+ "id": modifier_list.id,
+ "modifier_list_data": {
+ "name": modifier_list.modifier_list_data.name,
+ "modifiers": [modifier],
+ },
+ },
+ ]
+ }
+ ],
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ time.sleep(2) # Add delay after batch upsert
+
+ objects = response.objects
+ assert objects is not None
+ assert 2 == len(objects)
+
+ id_mappings = response.id_mappings
+ assert id_mappings is not None
+
+ catalog_tax_ids = [
+ mapping.object_id
+ for mapping in id_mappings
+ if mapping.client_object_id == "#temp-tax-id"
+ ]
+ assert len(catalog_tax_ids) > 0
+ catalog_tax_id = catalog_tax_ids[0]
+
+ catalog_modifier_ids = [
+ mapping.object_id
+ for mapping in id_mappings
+ if mapping.client_object_id == "#temp-modifier-id"
+ ]
+ assert len(catalog_modifier_ids) > 0
+ catalog_modifier_id = catalog_modifier_ids[0]
+
+ catalog_modifier_list_ids = [
+ mapping.object_id
+ for mapping in id_mappings
+ if mapping.client_object_id == "#temp-modifier-list-id"
+ ]
+ assert len(catalog_modifier_list_ids) > 0
+ catalog_modifier_list_id = catalog_modifier_list_ids[0]
+
+ time.sleep(2) # Add delay before batch get
+
+ response = client.catalog.batch_get(
+ object_ids=[catalog_modifier_id, catalog_modifier_list_id, catalog_tax_id],
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ assert response.objects is not None
+ assert 3 == len(response.objects)
+ resp_objects = response.objects
+ resp_object_ids = [obj.id for obj in resp_objects if obj.id is not None]
+ assert set(resp_object_ids) == {
+ catalog_modifier_id,
+ catalog_modifier_list_id,
+ catalog_tax_id,
+ }
+
+ time.sleep(2) # Add delay before catalog item creation
+
+ catalog_item = helpers.create_test_catalog_item(helpers.CreateCatalogItemOptions())
+ catalog_response = client.catalog.object.upsert(
+ idempotency_key=str(uuid.uuid4()),
+ object=catalog_item,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ catalog_object = catalog_response.catalog_object
+ assert catalog_object is not None
+ assert isinstance(catalog_object, CatalogObjectItem)
+ catalog_object_id = catalog_object.id
+
+ time.sleep(2) # Add delay before update taxes
+
+ response = client.catalog.update_item_taxes(
+ item_ids=[catalog_object_id],
+ taxes_to_enable=[catalog_tax_id],
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ assert response.updated_at is not None
+ assert response.errors is None
+
+ time.sleep(2) # Add delay before update modifier lists
+
+ response = client.catalog.update_item_modifier_lists(
+ item_ids=[catalog_object_id],
+ modifier_lists_to_enable=[catalog_modifier_list_id],
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ assert response.updated_at is not None
+ assert response.errors is None
+
+
+@retry_on_rate_limit()
+@pytest.mark.skip(reason="Temporarily skipping test_delete_catalog_object")
+def test_delete_catalog_object():
+ time.sleep(2) # Add initial delay
+ client = helpers.test_client()
+
+ catalog_item = helpers.create_test_catalog_item(helpers.CreateCatalogItemOptions())
+ catalog_response = client.catalog.object.upsert(
+ idempotency_key=str(uuid.uuid4()),
+ object=catalog_item,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ catalog_object = catalog_response.catalog_object
+ assert catalog_object is not None
+ assert isinstance(catalog_object, CatalogObjectItem)
+ catalog_object_id = catalog_object.id
+
+ time.sleep(2) # Add delay before delete
+
+ response = client.catalog.object.delete(
+ object_id=catalog_object_id,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ assert response is not None
\ No newline at end of file
diff --git a/tests/integration/test_customer_groups.py b/tests/integration/test_customer_groups.py
new file mode 100644
index 00000000..12556509
--- /dev/null
+++ b/tests/integration/test_customer_groups.py
@@ -0,0 +1,72 @@
+import time
+import uuid
+
+import pytest
+
+from square.types.customer_group import CustomerGroup
+
+from . import helpers
+
+
+def create_test_customer_group() -> str:
+ client = helpers.test_client()
+ response = client.customers.groups.create(
+ group={"name": "Default-" + str(uuid.uuid4())},
+ idempotency_key=str(uuid.uuid4()),
+ )
+ group = response.group
+ assert group is not None
+ assert isinstance(group, CustomerGroup)
+ assert group.id is not None
+ return group.id
+
+
+def delete_test_customer_group(group_id: str):
+ client = helpers.test_client()
+ client.customers.groups.delete(group_id=group_id)
+
+
+def test_create_and_list_customer_group():
+ group_id = create_test_customer_group()
+ client = helpers.test_client()
+ response = client.customers.groups.list()
+ assert response is not None
+ groups = response.items
+ assert groups is not None
+ assert len(groups) > 0
+ delete_test_customer_group(group_id)
+
+
+def test_retrieve_customer_group():
+ group_id = create_test_customer_group()
+ client = helpers.test_client()
+ response = client.customers.groups.get(group_id=group_id)
+ assert response.group is not None
+ assert isinstance(response.group, CustomerGroup)
+ assert group_id == response.group.id
+ delete_test_customer_group(group_id)
+
+
+def test_update_customer_group():
+ # This test often gets rate limited; we'll wait a few
+ # seconds before proceeding.
+ time.sleep(3)
+
+ group_id = create_test_customer_group()
+ client = helpers.test_client()
+ new_name = "Updated-" + str(uuid.uuid4())
+ response = client.customers.groups.update(
+ group_id=group_id, group={"name": new_name}
+ )
+ assert response.group is not None
+ assert isinstance(response.group, CustomerGroup)
+ assert new_name == response.group.name
+ delete_test_customer_group(group_id)
+
+
+def test_retrieve_non_existent_group():
+ client = helpers.test_client()
+ with pytest.raises(Exception):
+ client.customers.groups.create(
+ group={"name": ""}, idempotency_key=str(uuid.uuid4())
+ )
diff --git a/tests/integration/test_customer_segments.py b/tests/integration/test_customer_segments.py
new file mode 100644
index 00000000..811e8b95
--- /dev/null
+++ b/tests/integration/test_customer_segments.py
@@ -0,0 +1,25 @@
+from square.types.customer_segment import CustomerSegment
+
+from . import helpers
+
+
+def test_list_customer_segments():
+ client = helpers.test_client()
+ response = client.customers.segments.list()
+ assert response.items is not None
+ assert len(response.items) > 0
+
+
+def test_retrieve_customer_segment():
+ client = helpers.test_client()
+ list_response = client.customers.segments.list()
+ segments = list_response.items
+ assert segments is not None
+ assert len(segments) > 0
+ segment = segments[0]
+ segment_id = segment.id
+ assert segment_id is not None
+ response = client.customers.segments.get(segment_id=segment_id)
+ assert response.segment is not None
+ assert isinstance(response.segment, CustomerSegment)
+ assert response.segment.name is not None
diff --git a/tests/integration/test_customers.py b/tests/integration/test_customers.py
new file mode 100644
index 00000000..cbec2adb
--- /dev/null
+++ b/tests/integration/test_customers.py
@@ -0,0 +1,228 @@
+import uuid
+
+from square.types.card import Card
+from square.types.custom_attribute import CustomAttribute
+from square.types.customer import Customer
+from square.types.customer_group import CustomerGroup
+
+from . import helpers
+
+
+def create_customer() -> str:
+ client = helpers.test_client()
+ customer_response = client.customers.create(
+ idempotency_key=str(uuid.uuid4()),
+ given_name="Amelia",
+ family_name="Earhart",
+ phone_number="1-212-555-4240",
+ note="a customer",
+ address={
+ "address_line1": "500 Electric Ave",
+ "address_line2": "Suite 600",
+ "locality": "New York",
+ "administrative_district_level1": "NY",
+ "postal_code": "10003",
+ "country": "US",
+ },
+ )
+ customer = customer_response.customer
+ assert customer is not None
+ assert isinstance(customer, Customer)
+ assert customer.id is not None
+ return customer.id
+
+
+def delete_customer(customer_id: str):
+ client = helpers.test_client()
+ try:
+ client.customers.delete(customer_id=customer_id)
+ except Exception as e:
+ raise RuntimeError(e)
+
+
+def create_customer_group() -> str:
+ client = helpers.test_client()
+ create_groups_response = client.customers.groups.create(
+ group={"name": "Test Group " + str(uuid.uuid4())},
+ idempotency_key=str(uuid.uuid4()),
+ )
+ group = create_groups_response.group
+ assert group is not None
+ assert isinstance(group, CustomerGroup)
+ assert group.id is not None
+ return group.id
+
+
+def delete_customer_group(customer_group_id: str):
+ client = helpers.test_client()
+ try:
+ client.customers.groups.delete(group_id=customer_group_id)
+ except Exception as e:
+ raise RuntimeError(e)
+
+
+def create_custom_attribute_definition() -> str:
+ client = helpers.test_client()
+ custom_attribute_key = "favorite-drink-" + str(uuid.uuid4())
+ client.customers.custom_attribute_definitions.create(
+ custom_attribute_definition={
+ "key": custom_attribute_key,
+ "name": "Favorite Drink" + str(uuid.uuid4()),
+ "description": "A customer's favorite drink",
+ "visibility": "VISIBILITY_READ_WRITE_VALUES",
+ "schema": {
+ "$ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"
+ },
+ }
+ )
+ return custom_attribute_key
+
+
+def delete_custom_attribute_definition(key: str):
+ client = helpers.test_client()
+ try:
+ client.customers.custom_attribute_definitions.delete(key=key)
+ except Exception as e:
+ raise RuntimeError(e)
+
+
+def test_retrieve_customer():
+ client = helpers.test_client()
+ customer_id = create_customer()
+ response = client.customers.get(customer_id=customer_id)
+ assert response.customer is not None
+ assert isinstance(response.customer, Customer)
+ assert customer_id == response.customer.id
+ delete_customer(customer_id)
+
+
+def test_update_customer():
+ client = helpers.test_client()
+ customer_id = create_customer()
+ response = client.customers.update(
+ customer_id=customer_id,
+ given_name="Updated Amelia",
+ family_name="Updated Earhart",
+ )
+ customer = response.customer
+ assert customer is not None
+ assert isinstance(customer, Customer)
+ assert "Updated Amelia" == customer.given_name
+ assert "Updated Earhart" == customer.family_name
+ delete_customer(customer_id)
+
+
+def test_create_customer_card():
+ client = helpers.test_client()
+ customer_id = create_customer()
+ create_card_response = client.customers.cards.create(
+ customer_id=customer_id, card_nonce="cnon:card-nonce-ok"
+ )
+ assert create_card_response.card is not None
+ assert isinstance(create_card_response.card, Card)
+ customer_card_id = create_card_response.card.id
+ assert customer_card_id is not None
+ delete_card_response = client.customers.cards.delete(
+ customer_id=customer_id, card_id=customer_card_id
+ )
+ assert delete_card_response is not None
+ delete_customer(customer_id)
+
+
+def test_add_customer_to_group():
+ client = helpers.test_client()
+ customer_id = create_customer()
+ customer_group_id = create_customer_group()
+ add_group_response = client.customers.groups.add(
+ customer_id=customer_id, group_id=customer_group_id
+ )
+ assert add_group_response is not None
+
+ remove_group_response = client.customers.groups.remove(
+ customer_id=customer_id, group_id=customer_group_id
+ )
+ assert remove_group_response is not None
+ delete_customer(customer_id)
+ delete_customer_group(customer_group_id)
+
+
+def test_create_customer_custom_attribute():
+ client = helpers.test_client()
+ customer_id = create_customer()
+ custom_attribute_key = create_custom_attribute_definition()
+ create_attr_response = client.customers.custom_attributes.upsert(
+ customer_id=customer_id,
+ key=custom_attribute_key,
+ custom_attribute={"value": "Double-shot breve", "key": custom_attribute_key},
+ )
+ assert create_attr_response.custom_attribute is not None
+ assert isinstance(create_attr_response.custom_attribute, CustomAttribute)
+ assert "Double-shot breve" == create_attr_response.custom_attribute.value
+
+ delete_customer(customer_id)
+ delete_custom_attribute_definition(custom_attribute_key)
+
+
+def test_update_customer_custom_attribute():
+ client = helpers.test_client()
+ customer_id = create_customer()
+ custom_attribute_key = create_custom_attribute_definition()
+ update_attr_response = client.customers.custom_attributes.upsert(
+ customer_id=customer_id,
+ key=custom_attribute_key,
+ custom_attribute={"value": "Black coffee"},
+ )
+ custom_attribute = update_attr_response.custom_attribute
+ assert custom_attribute is not None
+ assert isinstance(custom_attribute, CustomAttribute)
+ assert "Black coffee" == custom_attribute.value
+
+ delete_customer(customer_id)
+ delete_custom_attribute_definition(custom_attribute_key)
+
+
+def test_list_customer_custom_attributes():
+ client = helpers.test_client()
+ customer_id = create_customer()
+ custom_attribute_key = create_custom_attribute_definition()
+ client.customers.custom_attributes.upsert(
+ customer_id=customer_id,
+ key=custom_attribute_key,
+ custom_attribute={"value": "Double-shot breve"},
+ )
+
+ pager = client.customers.custom_attributes.list(
+ customer_id=customer_id, with_definitions=True
+ )
+ assert pager is not None
+
+ attributes = pager.items
+ assert attributes is not None
+
+ delete_attr_response = client.customers.custom_attributes.delete(
+ customer_id=customer_id,
+ key=custom_attribute_key,
+ )
+ assert delete_attr_response is not None
+
+ delete_customer(customer_id)
+ delete_custom_attribute_definition(custom_attribute_key)
+
+
+def test_delete_customer_custom_attribute():
+ client = helpers.test_client()
+ customer_id = create_customer()
+ custom_attribute_key = create_custom_attribute_definition()
+ client.customers.custom_attributes.upsert(
+ customer_id=customer_id,
+ key=custom_attribute_key,
+ custom_attribute={"value": "Double-shot breve"},
+ )
+
+ response = client.customers.custom_attributes.delete(
+ customer_id=customer_id, key=custom_attribute_key
+ )
+ assert response is not None
+
+ delete_customer(customer_id)
+ delete_custom_attribute_definition(custom_attribute_key)
diff --git a/tests/integration/test_devices.py b/tests/integration/test_devices.py
new file mode 100644
index 00000000..b38d4f94
--- /dev/null
+++ b/tests/integration/test_devices.py
@@ -0,0 +1,45 @@
+import uuid
+import pytest
+from square.types.device_code import DeviceCode
+
+from . import helpers
+
+
+def create_device_code():
+ client = helpers.test_client()
+ create_response = client.devices.codes.create(
+ idempotency_key=str(uuid.uuid4()), device_code={"product_type": "TERMINAL_API"}
+ )
+ device_code = create_response.device_code
+ assert device_code is not None
+ assert isinstance(device_code, DeviceCode)
+ assert device_code.id is not None
+ return device_code.id
+
+@pytest.mark.skip(reason="Temporarily skipping test_list_device_codes")
+def test_list_device_codes():
+ client = helpers.test_client()
+ create_device_code()
+ response = client.devices.codes.list()
+ assert response.items is not None
+ assert len(response.items) > 0
+
+
+def test_create_device_code():
+ client = helpers.test_client()
+ response = client.devices.codes.create(
+ idempotency_key=str(uuid.uuid4()), device_code={"product_type": "TERMINAL_API"}
+ )
+ assert response.device_code is not None
+ assert isinstance(response.device_code, DeviceCode)
+ assert "TERMINAL_API" == response.device_code.product_type
+
+
+def test_get_device_code():
+ client = helpers.test_client()
+ device_code_id = create_device_code()
+ response = client.devices.codes.get(id=device_code_id)
+ assert response.device_code is not None
+ assert isinstance(response.device_code, DeviceCode)
+ assert response.device_code.id
+ assert "TERMINAL_API" == response.device_code.product_type
diff --git a/tests/integration/test_disputes.py b/tests/integration/test_disputes.py
new file mode 100644
index 00000000..738484fe
--- /dev/null
+++ b/tests/integration/test_disputes.py
@@ -0,0 +1,180 @@
+import time
+import uuid
+
+import pytest
+
+from square.types.dispute import Dispute
+from square.types.dispute_evidence import DisputeEvidence
+from square.types.get_dispute_evidence_response import GetDisputeEvidenceResponse
+
+from . import helpers
+
+pytestmark = pytest.mark.skip(
+ reason="Sandbox account is not provisioned for the Disputes API (401 UNAUTHORIZED); unrelated to SDK changes"
+)
+
+
+def create_dispute() -> str:
+ client = helpers.test_client()
+
+ # Create a payment that will generate a dispute
+ client.payments.create(
+ source_id="cnon:card-nonce-ok",
+ idempotency_key=str(uuid.uuid4()),
+ amount_money={"amount": 8803, "currency": "USD"},
+ )
+
+ # Poll for dispute to be created
+ for _ in range(100):
+ dispute_response = client.disputes.list(states="EVIDENCE_REQUIRED")
+ if dispute_response.items is not None and len(dispute_response.items) > 0:
+ assert dispute_response.items[0].id is not None
+ return dispute_response.items[0].id
+
+ # Wait for 2 seconds before polling again
+ time.sleep(2)
+
+ raise Exception("Could not create dispute")
+
+
+def create_evidence_text(dispute_id: str) -> str:
+ client = helpers.test_client()
+ evidence_response = client.disputes.create_evidence_text(
+ dispute_id=dispute_id,
+ idempotency_key=str(uuid.uuid4()),
+ evidence_text="This is not a duplicate",
+ evidence_type="GENERIC_EVIDENCE",
+ )
+ evidence = evidence_response.evidence
+ assert evidence is not None
+ assert isinstance(evidence, DisputeEvidence)
+ assert evidence.id is not None
+ return evidence.id
+
+
+def delete_dispute_evidence(*, dispute_id: str, text_evidence_id: str):
+ client = helpers.test_client()
+ # Clean up evidence if it exists
+ try:
+ client.disputes.evidence.delete(
+ dispute_id=dispute_id, evidence_id=text_evidence_id
+ )
+ except Exception as e:
+ # Evidence might already be deleted by test
+ pass
+
+
+def test_list_disputes():
+ client = helpers.test_client()
+ dispute_id = create_dispute()
+ text_evidence_id = create_evidence_text(dispute_id)
+
+ response = client.disputes.list(states="EVIDENCE_REQUIRED")
+ assert response.items is not None
+ assert len(response.items) > 0
+ assert isinstance(response.items[0], Dispute)
+ assert "DUPLICATE" == response.items[0].reason
+ assert "EVIDENCE_REQUIRED" == response.items[0].state
+ assert "VISA" == response.items[0].card_brand
+
+ delete_dispute_evidence(dispute_id=dispute_id, text_evidence_id=text_evidence_id)
+
+
+def test_retrieve_dispute():
+ client = helpers.test_client()
+ dispute_id = create_dispute()
+ text_evidence_id = create_evidence_text(dispute_id)
+ response = client.disputes.get(dispute_id=dispute_id)
+ assert response.dispute is not None
+ assert isinstance(response.dispute, Dispute)
+ assert response.dispute.id
+
+ delete_dispute_evidence(dispute_id=dispute_id, text_evidence_id=text_evidence_id)
+
+
+def test_create_dispute_evidence_text():
+ client = helpers.test_client()
+ dispute_id = create_dispute()
+ text_evidence_id = create_evidence_text(dispute_id)
+ response = client.disputes.create_evidence_text(
+ dispute_id=dispute_id,
+ idempotency_key=str(uuid.uuid4()),
+ evidence_text="This is not a duplicate",
+ evidence_type="GENERIC_EVIDENCE",
+ )
+ assert response.evidence is not None
+
+ delete_dispute_evidence(dispute_id=dispute_id, text_evidence_id=text_evidence_id)
+
+
+def test_retrieve_dispute_evidence():
+ client = helpers.test_client()
+ dispute_id = create_dispute()
+ text_evidence_id = create_evidence_text(dispute_id)
+ response = client.disputes.evidence.get(
+ dispute_id=dispute_id, evidence_id=text_evidence_id
+ )
+ assert response.evidence is not None
+ assert isinstance(response, GetDisputeEvidenceResponse)
+ assert text_evidence_id == response.evidence.id
+
+ delete_dispute_evidence(dispute_id=dispute_id, text_evidence_id=text_evidence_id)
+
+
+def test_list_dispute_evidence():
+ client = helpers.test_client()
+ dispute_id = create_dispute()
+ text_evidence_id = create_evidence_text(dispute_id)
+ response = client.disputes.evidence.delete(
+ dispute_id=dispute_id, evidence_id=text_evidence_id
+ )
+ assert response is not None
+
+ delete_dispute_evidence(dispute_id=dispute_id, text_evidence_id=text_evidence_id)
+
+
+@pytest.mark.skip(
+ reason="Temporarily skipping test_create_dispute_evidence_file; 'Evidence"
+)
+def test_create_dispute_evidence_file():
+ client = helpers.test_client()
+ dispute_id = create_dispute()
+ text_evidence_id = create_evidence_text(dispute_id)
+
+ response = client.disputes.create_evidence_file(
+ dispute_id=dispute_id,
+ image_file=helpers.get_test_file(),
+ request={
+ "idempotency_key": str(uuid.uuid4()),
+ "content_type": "image/jpeg",
+ "evidence_type": "GENERIC_EVIDENCE",
+ },
+ )
+
+ assert response.evidence is not None
+ assert isinstance(response.evidence, DisputeEvidence)
+ assert dispute_id == response.evidence.id
+
+ delete_dispute_evidence(dispute_id=dispute_id, text_evidence_id=text_evidence_id)
+
+
+def test_submit_evidence():
+ client = helpers.test_client()
+ dispute_id = create_dispute()
+ text_evidence_id = create_evidence_text(dispute_id)
+
+ response = client.disputes.submit_evidence(dispute_id=dispute_id)
+ assert response is not None
+
+ delete_dispute_evidence(dispute_id=dispute_id, text_evidence_id=text_evidence_id)
+
+
+def test_accept_dispute():
+ client = helpers.test_client()
+ dispute_id = create_dispute()
+ text_evidence_id = create_evidence_text(dispute_id)
+
+ response = client.disputes.accept(dispute_id=dispute_id)
+ assert response is not None
+
+ delete_dispute_evidence(dispute_id=dispute_id, text_evidence_id=text_evidence_id)
diff --git a/tests/integration/test_inventory.py b/tests/integration/test_inventory.py
new file mode 100644
index 00000000..d83708ec
--- /dev/null
+++ b/tests/integration/test_inventory.py
@@ -0,0 +1,288 @@
+import uuid
+import time
+import pytest
+from datetime import datetime, timedelta
+from typing import Optional
+
+from square.core.api_error import ApiError
+from square.requests.catalog_item import CatalogItemParams
+from square.requests.catalog_item_variation import CatalogItemVariationParams
+from square.requests.catalog_object import (
+ CatalogObject_ItemVariationParams,
+)
+from square.types.inventory_adjustment import InventoryAdjustment
+from square.types.inventory_physical_count import InventoryPhysicalCount
+
+from . import helpers
+
+
+def retry_on_rate_limit(func):
+ """Decorator to retry functions on rate limit errors"""
+ def wrapper(*args, **kwargs):
+ max_retries = 5
+ base_delay = 2 # seconds
+
+ for attempt in range(max_retries):
+ try:
+ return func(*args, **kwargs)
+ except ApiError as e:
+ if e.status_code == 429 and attempt < max_retries - 1:
+ delay = base_delay * (2 ** attempt) # exponential backoff
+ print(f"Rate limited. Retrying in {delay} seconds...")
+ time.sleep(delay)
+ continue
+ raise
+ return None
+ return wrapper
+
+
+@retry_on_rate_limit
+def create_catalog_item_variation() -> str:
+ client = helpers.test_client()
+
+ variation_data: CatalogItemVariationParams = {
+ "name": "Colombian Fair Trade",
+ "track_inventory": True,
+ "pricing_type": "FIXED_PRICING",
+ "price_money": {"amount": 100, "currency": "USD"},
+ }
+
+ variation: CatalogObject_ItemVariationParams = {
+ "type": "ITEM_VARIATION",
+ "id": "#colombian-coffee",
+ "present_at_all_locations": True,
+ "item_variation_data": variation_data,
+ }
+
+ item_data: CatalogItemParams = {
+ "name": "Coffee",
+ "description": "Strong coffee",
+ "abbreviation": "C",
+ "variations": [variation],
+ }
+
+ catalog_response = client.catalog.object.upsert(
+ idempotency_key=str(uuid.uuid4()),
+ object={
+ "type": "ITEM",
+ "id": "#single-item",
+ "present_at_all_locations": True,
+ "item_data": item_data,
+ },
+ )
+
+ assert catalog_response.catalog_object is not None
+ # Note: catalog_object may deserialize as a raw dict on some pydantic
+ # versions (the CatalogObject discriminated union is not always resolved),
+ # so resolve the variation ID from id_mappings instead of the parsed object.
+ assert catalog_response.id_mappings is not None
+ item_variation_ids = [
+ mapping.object_id
+ for mapping in catalog_response.id_mappings
+ if mapping.client_object_id == "#colombian-coffee"
+ ]
+ assert len(item_variation_ids) > 0
+ assert item_variation_ids[0] is not None
+ return item_variation_ids[0]
+
+
+@retry_on_rate_limit
+def create_initial_adjustment(item_variation_id: str) -> Optional[str]:
+ """
+ Create an initial inventory adjustment and return the physical count ID
+ """
+ client = helpers.test_client()
+ location_id = helpers.get_default_location_id(client)
+ response = client.inventory.batch_create_changes(
+ idempotency_key=str(uuid.uuid4()),
+ changes=[
+ {
+ "type": "ADJUSTMENT",
+ "adjustment": {
+ "from_state": "NONE",
+ "to_state": "IN_STOCK",
+ "from_location_id": location_id,
+ "to_location_id": location_id,
+ "catalog_object_id": item_variation_id,
+ "quantity": "100",
+ "occurred_at": helpers.format_date_string(
+ datetime.now() - timedelta(hours=8)
+ ),
+ },
+ }
+ ],
+ )
+
+ # Add delay after the first operation
+ time.sleep(2)
+
+ changes = response.changes
+ assert changes is not None
+ assert len(changes) > 0
+ assert changes[0].adjustment is not None
+ assert isinstance(changes[0].adjustment, InventoryAdjustment)
+ adjustment_id = changes[0].adjustment.id
+ assert adjustment_id is not None
+
+ client.inventory.batch_create_changes(
+ idempotency_key=str(uuid.uuid4()),
+ changes=[
+ {
+ "type": "PHYSICAL_COUNT",
+ "physical_count": {
+ "catalog_object_id": item_variation_id,
+ "location_id": helpers.get_default_location_id(client),
+ "quantity": "1",
+ "state": "IN_STOCK",
+ "occurred_at": helpers.format_date_string(datetime.now()),
+ },
+ }
+ ],
+ )
+
+ # Add delay after the second operation
+ time.sleep(2)
+
+ physical_changes_response = client.inventory.batch_get_changes(
+ types=["PHYSICAL_COUNT"],
+ catalog_object_ids=[item_variation_id],
+ location_ids=[helpers.get_default_location_id(client)],
+ )
+ physical_changes = physical_changes_response.items
+ assert physical_changes is not None
+ assert len(physical_changes) > 0
+ physical_change = physical_changes[0]
+ assert physical_change.physical_count is not None
+ assert isinstance(physical_change.physical_count, InventoryPhysicalCount)
+ assert physical_change.physical_count.id is not None
+ return physical_change.physical_count.id
+
+
+def test_batch_change_inventory():
+ client = helpers.test_client()
+ item_variation_id = create_catalog_item_variation()
+ time.sleep(2) # Add delay after catalog operation
+ create_initial_adjustment(item_variation_id)
+ time.sleep(2) # Add delay after adjustment
+
+ location_id = helpers.get_default_location_id(client)
+ response = client.inventory.batch_create_changes(
+ idempotency_key=str(uuid.uuid4()),
+ changes=[
+ {
+ "type": "ADJUSTMENT",
+ "adjustment": {
+ "from_state": "NONE",
+ "to_state": "IN_STOCK",
+ "from_location_id": location_id,
+ "to_location_id": location_id,
+ "catalog_object_id": item_variation_id,
+ "quantity": "50",
+ "occurred_at": helpers.format_date_string(datetime.now()),
+ },
+ }
+ ],
+ )
+
+ assert response.changes is not None
+ assert len(response.changes) > 0
+ assert response.changes[0].adjustment is not None
+ assert isinstance(response.changes[0].adjustment, InventoryAdjustment)
+ assert "IN_STOCK" == response.changes[0].adjustment.to_state
+ assert "50" == response.changes[0].adjustment.quantity
+
+
+def test_batch_retrieve_inventory_changes():
+ client = helpers.test_client()
+ item_variation_id = create_catalog_item_variation()
+ time.sleep(2) # Add delay after catalog operation
+ create_initial_adjustment(item_variation_id)
+ time.sleep(2) # Add delay after adjustment
+
+ response = client.inventory.batch_get_changes(
+ catalog_object_ids=[item_variation_id]
+ )
+ assert response.items is not None
+ assert len(response.items) > 0
+
+
+def test_batch_retrieve_inventory_counts():
+ client = helpers.test_client()
+ item_variation_id = create_catalog_item_variation()
+ time.sleep(2) # Add delay after catalog operation
+ create_initial_adjustment(item_variation_id)
+ time.sleep(2) # Add delay after adjustment
+
+ response = client.inventory.batch_get_counts(catalog_object_ids=[item_variation_id])
+ assert response.items is not None
+ assert len(response.items) > 0
+
+
+def test_retrieve_inventory_changes():
+ client = helpers.test_client()
+ item_variation_id = create_catalog_item_variation()
+ time.sleep(2) # Add delay after catalog operation
+ create_initial_adjustment(item_variation_id)
+ time.sleep(2) # Add delay after adjustment
+
+ response = client.inventory.get(catalog_object_id=item_variation_id)
+ assert response.items is not None
+ assert len(response.items) > 0
+
+
+def test_retrieve_inventory_counts():
+ client = helpers.test_client()
+ item_variation_id = create_catalog_item_variation()
+ time.sleep(2) # Add delay after catalog operation
+ physical_count_id = create_initial_adjustment(item_variation_id)
+ time.sleep(2) # Add delay after adjustment
+
+ response = client.inventory.get_physical_count(physical_count_id=physical_count_id)
+ assert response.count is not None
+
+
+def test_retrieve_inventory_adjustments():
+ client = helpers.test_client()
+ item_variation_id = create_catalog_item_variation()
+ time.sleep(2) # Add delay after catalog operation
+ create_initial_adjustment(item_variation_id)
+ time.sleep(2) # Add delay after adjustment
+
+ location_id = helpers.get_default_location_id(client)
+ response = client.inventory.batch_create_changes(
+ idempotency_key=str(uuid.uuid4()),
+ changes=[
+ {
+ "type": "ADJUSTMENT",
+ "adjustment": {
+ "from_state": "NONE",
+ "to_state": "IN_STOCK",
+ "from_location_id": location_id,
+ "to_location_id": location_id,
+ "catalog_object_id": item_variation_id,
+ "quantity": "10",
+ "occurred_at": helpers.format_date_string(datetime.now()),
+ },
+ }
+ ],
+ )
+
+ changes = response.changes
+ assert changes is not None
+ assert len(changes) > 0
+ assert changes[0].adjustment is not None
+ assert isinstance(changes[0].adjustment, InventoryAdjustment)
+ assert changes[0].adjustment.id is not None
+ adjustment_id = changes[0].adjustment.id
+
+ time.sleep(2) # Add delay before retrieve
+
+ retrieve_response = client.inventory.get_adjustment(adjustment_id=adjustment_id)
+ retrieve_adjustment = retrieve_response.adjustment
+ assert retrieve_adjustment is not None
+ assert isinstance(retrieve_adjustment, InventoryAdjustment)
+ retrieve_adjustment_id = retrieve_adjustment.id
+ assert retrieve_adjustment_id is not None
+
+ assert retrieve_response.adjustment is not None
+ assert adjustment_id == retrieve_adjustment_id
\ No newline at end of file
diff --git a/tests/integration/test_labor.py b/tests/integration/test_labor.py
new file mode 100644
index 00000000..2bb659e7
--- /dev/null
+++ b/tests/integration/test_labor.py
@@ -0,0 +1,376 @@
+import time
+import uuid
+from datetime import datetime, timedelta
+from functools import wraps
+
+from square.core.api_error import ApiError
+from square.core.request_options import RequestOptions
+from square.types.break_type import BreakType
+from square.types.money import Money
+from square.types.shift import Shift
+from square.types.shift_wage import ShiftWage
+from square.types.team_member import TeamMember
+
+from . import helpers
+
+MAX_TIMEOUT = 120
+MAX_RETRIES = 5
+
+
+def retry_with_backoff(max_retries=5, base_delay=2):
+ def decorator(func):
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ for attempt in range(max_retries):
+ try:
+ return func(*args, **kwargs)
+ except (ApiError, Exception) as e:
+ if attempt < max_retries - 1:
+ delay = base_delay * (2 ** attempt) # exponential backoff
+ print(f"Request failed. Retrying in {delay} seconds... Error: {str(e)}")
+ time.sleep(delay)
+ continue
+ raise
+ return None
+ return wrapper
+ return decorator
+
+
+@retry_with_backoff()
+def get_first_team_member() -> str:
+ client = helpers.test_client()
+
+ # Search for active team members at the default location
+ team_response = client.team_members.search(
+ query={
+ "filter": {
+ "location_ids": [helpers.get_default_location_id(client)],
+ "status": "ACTIVE"
+ }
+ },
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ if not team_response.team_members or len(team_response.team_members) == 0:
+ raise Exception(f"No team members available at location {helpers.get_default_location_id(client)}")
+
+ team_member = team_response.team_members[0]
+ assert team_member is not None
+ assert isinstance(team_member, TeamMember)
+ assert team_member.id is not None
+ return team_member.id
+
+
+@retry_with_backoff()
+def create_break_type() -> str:
+ client = helpers.test_client()
+
+ break_response = client.labor.break_types.create(
+ break_type={
+ "location_id": helpers.get_default_location_id(client),
+ "break_name": "Lunch_" + str(uuid.uuid4()),
+ "expected_duration": "PT0H30M0S",
+ "is_paid": True,
+ },
+ idempotency_key=str(uuid.uuid4()),
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ break_type = break_response.break_type
+ assert break_type is not None
+ assert isinstance(break_type, BreakType)
+ assert break_type.id is not None
+ return break_type.id
+
+
+def delete_break_type(break_type_id: str):
+ client = helpers.test_client()
+ try:
+ client.labor.break_types.delete(
+ id=break_type_id,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ except Exception as e:
+ # test may have already deleted the break
+ print(f"Error deleting break type: {str(e)}")
+ pass
+
+
+@retry_with_backoff()
+def create_shift(team_member_id: str) -> str:
+ client = helpers.test_client()
+
+ shift_response = client.labor.shifts.create(
+ shift={
+ "location_id": helpers.get_default_location_id(client),
+ "start_at": helpers.format_date_string(datetime.now()),
+ "team_member_id": team_member_id,
+ },
+ idempotency_key=str(uuid.uuid4()),
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ shift = shift_response.shift
+ assert shift is not None
+ assert isinstance(shift, Shift)
+ assert shift.id is not None
+ return shift.id
+
+
+def delete_shift(shift_id: str):
+ client = helpers.test_client()
+ try:
+ client.labor.shifts.delete(
+ id=shift_id,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ except Exception as e:
+ # test may have already deleted the shift
+ print(f"Error deleting shift: {str(e)}")
+ pass
+
+
+@retry_with_backoff()
+def get_first_break_type_id() -> str:
+ client = helpers.test_client()
+ response = client.labor.break_types.list(
+ location_id=helpers.get_default_location_id(client),
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ break_types = response.items
+ if break_types is not None and len(break_types) > 0:
+ return break_types[0].id or ""
+ raise Exception("No break types found")
+
+
+@retry_with_backoff()
+def test_get_break_type():
+ # Wait to kick off the first test to avoid being rate limited.
+ time.sleep(3)
+
+ client = helpers.test_client()
+ team_member_id = get_first_team_member()
+ time.sleep(2) # Add delay between operations
+ break_type_id = create_break_type()
+ time.sleep(2) # Add delay between operations
+ shift_id = create_shift(team_member_id)
+
+ response = client.labor.break_types.get(
+ id=break_type_id,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ assert response.break_type is not None
+ assert isinstance(response.break_type, BreakType)
+ assert break_type_id == response.break_type.id
+
+ list_response = client.labor.break_types.list(
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ assert list_response.items is not None
+ assert len(list_response.items) > 0
+
+ time.sleep(2) # Add delay before cleanup
+ delete_break_type(break_type_id)
+ delete_shift(shift_id)
+
+
+@retry_with_backoff()
+def test_update_break_type():
+ client = helpers.test_client()
+ team_member_id = get_first_team_member()
+ time.sleep(2) # Add delay between operations
+ break_type_id = create_break_type()
+ time.sleep(2) # Add delay between operations
+ shift_id = create_shift(team_member_id)
+
+ response = client.labor.break_types.update(
+ id=break_type_id,
+ break_type={
+ "location_id": helpers.get_default_location_id(client),
+ "break_name": "Lunch_" + str(uuid.uuid4()),
+ "expected_duration": "PT1H0M0S",
+ "is_paid": True,
+ },
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ assert response.break_type is not None
+ assert isinstance(response.break_type, BreakType)
+ assert break_type_id == response.break_type.id
+ assert "PT1H" == response.break_type.expected_duration
+
+ time.sleep(2) # Add delay before cleanup
+ delete_break_type(break_type_id)
+ delete_shift(shift_id)
+
+
+@retry_with_backoff()
+def test_search_shifts():
+ client = helpers.test_client()
+ team_member_id = get_first_team_member()
+ time.sleep(2) # Add delay between operations
+ break_type_id = create_break_type()
+ time.sleep(2) # Add delay between operations
+ shift_id = create_shift(team_member_id)
+
+ response = client.labor.shifts.search(
+ limit=1,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ assert response.shifts is not None
+ assert len(response.shifts) > 0
+
+ time.sleep(2) # Add delay before cleanup
+ delete_break_type(break_type_id)
+ delete_shift(shift_id)
+
+
+@retry_with_backoff()
+def test_get_shift():
+ client = helpers.test_client()
+ team_member_id = get_first_team_member()
+ time.sleep(2) # Add delay between operations
+ break_type_id = create_break_type()
+ time.sleep(2) # Add delay between operations
+ shift_id = create_shift(team_member_id)
+
+ response = client.labor.shifts.get(
+ id=shift_id,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ assert response.shift is not None
+ assert isinstance(response.shift, Shift)
+ assert shift_id == response.shift.id
+
+ time.sleep(2) # Add delay before cleanup
+ delete_break_type(break_type_id)
+ delete_shift(shift_id)
+
+
+@retry_with_backoff()
+def test_update_shift():
+ client = helpers.test_client()
+ team_member_id = get_first_team_member()
+ time.sleep(2) # Add delay between operations
+ break_type_id = create_break_type()
+ time.sleep(2) # Add delay between operations
+ shift_id = create_shift(team_member_id)
+
+ response = client.labor.shifts.update(
+ id=shift_id,
+ shift={
+ "location_id": helpers.get_default_location_id(client),
+ "start_at": helpers.format_date_string(
+ datetime.now() - timedelta(minutes=1)
+ ),
+ "team_member_id": team_member_id,
+ "wage": {
+ "title": "Manager",
+ "hourly_rate": {"amount": 2500, "currency": "USD"},
+ },
+ },
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ shift = response.shift
+ assert shift is not None
+ assert isinstance(shift, Shift)
+ assert shift.wage is not None
+ assert isinstance(shift.wage, ShiftWage)
+ assert "Manager" == shift.wage.title
+ assert isinstance(shift.wage.hourly_rate, Money)
+ assert 2500 == shift.wage.hourly_rate.amount
+ assert "USD" == shift.wage.hourly_rate.currency
+
+ time.sleep(2) # Add delay before cleanup
+ delete_break_type(break_type_id)
+ delete_shift(shift_id)
+
+
+@retry_with_backoff()
+def test_delete_shift():
+ client = helpers.test_client()
+
+ # Search for existing shifts for this team member
+ team_member_id = get_first_team_member()
+
+ # Search for existing shifts
+ existing_shifts = client.labor.shifts.search(
+ query={
+ "filter": {
+ "team_member_ids": [team_member_id]
+ }
+ },
+ limit=100,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ # Delete any existing shifts
+ if existing_shifts.shifts:
+ for shift in existing_shifts.shifts:
+ if shift.id:
+ delete_shift(shift.id)
+
+ # Start the shift 10 seconds from now and end it 20 seconds from now
+ start_time = datetime.now() + timedelta(seconds=10)
+ end_time = start_time + timedelta(seconds=10)
+
+ # Create shift
+ shift_response = client.labor.shifts.create(
+ shift={
+ "location_id": helpers.get_default_location_id(client),
+ "start_at": helpers.format_date_string(start_time),
+ "end_at": helpers.format_date_string(end_time),
+ "team_member_id": team_member_id,
+ },
+ idempotency_key=str(uuid.uuid4()),
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ assert shift_response.shift is not None
+ assert isinstance(shift_response.shift, Shift)
+ assert shift_response.shift.id is not None
+ shift_id = shift_response.shift.id
+
+ time.sleep(1) # Add small delay to ensure the shift is fully created
+
+ response = client.labor.shifts.delete(
+ id=shift_id,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ assert response is not None
+
+
+@retry_with_backoff()
+def test_delete_break_type():
+ client = helpers.test_client()
+
+ break_response = client.labor.break_types.create(
+ break_type={
+ "location_id": helpers.get_default_location_id(client),
+ "break_name": "Lunch_" + str(uuid.uuid4()),
+ "expected_duration": "PT0H30M0S",
+ "is_paid": True,
+ },
+ idempotency_key=str(uuid.uuid4()),
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+
+ break_type = break_response.break_type
+ assert break_type is not None
+ assert isinstance(break_type, BreakType)
+ assert break_type.id is not None
+ break_id = break_type.id
+
+ time.sleep(2) # Add delay before delete
+
+ response = client.labor.break_types.delete(
+ id=break_id,
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ assert response is not None
+
+
+@retry_with_backoff()
+def test_list_workweek_configs():
+ client = helpers.test_client()
+ response = client.labor.workweek_configs.list(
+ request_options=RequestOptions(timeout_in_seconds=MAX_TIMEOUT),
+ )
+ assert response.items is not None
+ assert len(response.items) > 0
\ No newline at end of file
diff --git a/tests/integration/test_locations.py b/tests/integration/test_locations.py
new file mode 100644
index 00000000..0625a2d8
--- /dev/null
+++ b/tests/integration/test_locations.py
@@ -0,0 +1,9 @@
+from . import helpers
+
+
+def test_list_locations():
+ client = helpers.test_client()
+
+ response = client.locations.list()
+ assert response.locations is not None
+ assert len(response.locations) > 0
diff --git a/tests/integration/test_merchants.py b/tests/integration/test_merchants.py
new file mode 100644
index 00000000..82d33869
--- /dev/null
+++ b/tests/integration/test_merchants.py
@@ -0,0 +1,31 @@
+from square.types.merchant import Merchant
+
+from . import helpers
+
+
+def get_merchant_id() -> str:
+ client = helpers.test_client()
+
+ merchants_response = client.merchants.list()
+ assert merchants_response.items is not None
+ assert len(merchants_response.items) > 0
+ merchant = merchants_response.items[0]
+ assert merchant.id is not None
+ return merchant.id
+
+
+def test_list_merchants():
+ client = helpers.test_client()
+ response = client.merchants.list()
+ assert response.items is not None
+ assert len(response.items) > 0
+
+
+def test_retrieve_merchant():
+ client = helpers.test_client()
+ merchant_id = get_merchant_id()
+
+ response = client.merchants.get(merchant_id=merchant_id)
+ assert response.merchant is not None
+ assert isinstance(response.merchant, Merchant)
+ assert merchant_id == response.merchant.id
diff --git a/tests/integration/test_orders.py b/tests/integration/test_orders.py
new file mode 100644
index 00000000..828fd7e9
--- /dev/null
+++ b/tests/integration/test_orders.py
@@ -0,0 +1,158 @@
+import uuid
+
+from square.types.order import Order
+
+from . import helpers
+
+
+def create_order() -> str:
+ client = helpers.test_client()
+ location_id = helpers.get_default_location_id(client)
+
+ order_response = client.orders.create(
+ idempotency_key=str(uuid.uuid4()),
+ order={
+ "location_id": location_id,
+ "line_items": [
+ {
+ "quantity": "1",
+ "name": "New Item",
+ "base_price_money": {"amount": 100, "currency": "USD"},
+ }
+ ],
+ },
+ )
+ order = order_response.order
+ assert order is not None
+ assert isinstance(order, Order)
+ assert order.id is not None
+ return order.id
+
+
+def get_line_item_id(order_id: str) -> str:
+ client = helpers.test_client()
+
+ order_response = client.orders.get(order_id=order_id)
+ order = order_response.order
+ assert order is not None
+ assert isinstance(order, Order)
+ line_items = order.line_items
+ assert line_items is not None
+ assert len(line_items) > 0
+ line_item = line_items[0]
+ assert line_item.uid is not None
+ return line_item.uid
+
+
+def test_create_order():
+ client = helpers.test_client()
+
+ response = client.orders.create(
+ order={
+ "location_id": helpers.get_default_location_id(client),
+ "line_items": [
+ {
+ "quantity": "1",
+ "name": "New Item",
+ "base_price_money": {"amount": 100, "currency": "USD"},
+ }
+ ],
+ }
+ )
+
+ order = response.order
+ assert order is not None
+ assert isinstance(order, Order)
+ line_items = order.line_items
+ assert line_items is not None
+ assert len(line_items) > 0
+ assert "New Item" == line_items[0].name
+
+
+def test_batch_retrieve_orders():
+ client = helpers.test_client()
+ order_id = create_order()
+ line_item_id = get_line_item_id(order_id)
+
+ response = client.orders.batch_get(order_ids=[order_id])
+ orders = response.orders
+ assert orders is not None
+ assert len(orders) > 0
+ order = orders[0]
+ assert order_id == order.id
+
+
+def test_search_orders():
+ client = helpers.test_client()
+ order_id = create_order()
+ line_item_id = get_line_item_id(order_id)
+
+ response = client.orders.search(
+ limit=1, location_ids=[helpers.get_default_location_id(client)]
+ )
+ assert response.orders is not None
+ assert len(response.orders) > 0
+
+
+def test_update_order():
+ client = helpers.test_client()
+ order_id = create_order()
+ line_item_id = get_line_item_id(order_id)
+
+ response = client.orders.update(
+ order_id=order_id,
+ idempotency_key=str(uuid.uuid4()),
+ order={
+ "location_id": helpers.get_default_location_id(client),
+ "line_items": [
+ {
+ "quantity": "1",
+ "name": "Updated Item",
+ "base_price_money": {"amount": 0, "currency": "USD"},
+ }
+ ],
+ "version": 1,
+ },
+ fields_to_clear=["line_items[" + line_item_id + "]"],
+ )
+
+ assert response.order is not None
+ assert isinstance(response.order, Order)
+ assert order_id == response.order.id
+ line_items = response.order.line_items
+ assert line_items is not None
+ assert len(line_items) > 0
+ assert "Updated Item" == line_items[0].name
+
+ response = client.orders.pay(
+ order_id=order_id,
+ idempotency_key=str(uuid.uuid4()),
+ order_version=2,
+ payment_ids=[],
+ )
+ assert response.order is not None
+ assert isinstance(response.order, Order)
+ assert order_id == response.order.id
+
+
+def test_calculate_order():
+ client = helpers.test_client()
+ order_id = create_order()
+ line_item_id = get_line_item_id(order_id)
+
+ response = client.orders.calculate(
+ order={
+ "location_id": helpers.get_default_location_id(client),
+ "line_items": [
+ {
+ "quantity": "1",
+ "name": "New Item",
+ "base_price_money": {"amount": 100, "currency": "USD"},
+ }
+ ],
+ }
+ )
+
+ assert response.order is not None
+ assert isinstance(response.order, Order)
+ assert response.order.total_money is not None
diff --git a/tests/integration/test_pagination.py b/tests/integration/test_pagination.py
new file mode 100644
index 00000000..bb5c46ca
--- /dev/null
+++ b/tests/integration/test_pagination.py
@@ -0,0 +1,17 @@
+from . import helpers
+
+
+def test_customers_pagination():
+ client = helpers.test_client()
+
+ for _ in range(5):
+ helpers.create_test_customer(client)
+
+ pager = client.customers.list()
+ count = 0
+ for customer in pager:
+ assert customer is not None
+ assert customer.id is not None
+ count += 1
+
+ assert count > 4
diff --git a/tests/integration/test_payments.py b/tests/integration/test_payments.py
new file mode 100644
index 00000000..9b005073
--- /dev/null
+++ b/tests/integration/test_payments.py
@@ -0,0 +1,120 @@
+import uuid
+
+from square.types.money import Money
+from square.types.payment import Payment
+
+from . import helpers
+
+
+def create_payment() -> str:
+ client = helpers.test_client()
+ payment_response = client.payments.create(
+ source_id="cnon:card-nonce-ok",
+ idempotency_key=str(uuid.uuid4()),
+ amount_money={"amount": 200, "currency": "USD"},
+ app_fee_money={"amount": 10, "currency": "USD"},
+ autocomplete=False,
+ )
+ payment = payment_response.payment
+ assert payment is not None
+ assert isinstance(payment, Payment)
+ assert payment.id is not None
+ return payment.id
+
+
+def test_list_payments():
+ client = helpers.test_client()
+
+ response = client.payments.list()
+ page = response.next_page()
+ payments = page.items
+ assert payments is not None
+ assert len(payments) > 0
+
+
+def test_create_payment():
+ client = helpers.test_client()
+
+ response = client.payments.create(
+ source_id="cnon:card-nonce-ok",
+ idempotency_key=str(uuid.uuid4()),
+ amount_money={"amount": 200, "currency": "USD"},
+ app_fee_money={"amount": 10, "currency": "USD"},
+ autocomplete=False,
+ )
+ payment = response.payment
+ assert payment is not None
+ assert isinstance(payment, Payment)
+ assert payment.app_fee_money is not None
+ assert isinstance(payment.app_fee_money, Money)
+ assert 10 == payment.app_fee_money.amount
+ assert "USD" == payment.app_fee_money.currency
+ assert payment.amount_money is not None
+ assert isinstance(payment.amount_money, Money)
+ assert 200 == payment.amount_money.amount
+ assert "USD" == payment.amount_money.currency
+
+
+def test_get_payment():
+ client = helpers.test_client()
+ payment_id = create_payment()
+
+ response = client.payments.get(payment_id=payment_id)
+
+ assert response.payment is not None
+ assert isinstance(response.payment, Payment)
+ assert payment_id == response.payment.id
+
+
+def test_cancel_payment():
+ client = helpers.test_client()
+ payment_id = create_payment()
+
+ response = client.payments.cancel(payment_id=payment_id)
+
+ assert response.payment is not None
+ assert isinstance(response.payment, Payment)
+ assert payment_id == response.payment.id
+
+
+def test_cancel_payment_by_idempotency_key():
+ client = helpers.test_client()
+
+ idempotency_key = str(uuid.uuid4())
+
+ client.payments.create(
+ source_id="cnon:card-nonce-ok",
+ idempotency_key=idempotency_key,
+ amount_money={"amount": 200, "currency": "USD"},
+ app_fee_money={"amount": 10, "currency": "USD"},
+ autocomplete=False,
+ )
+
+ response = client.payments.cancel_by_idempotency_key(
+ idempotency_key=idempotency_key
+ )
+ assert response is not None
+
+
+def test_complete_payment():
+ client = helpers.test_client()
+ payment_id = create_payment()
+
+ create_response = client.payments.create(
+ source_id="cnon:card-nonce-ok",
+ idempotency_key=str(uuid.uuid4()),
+ amount_money={"amount": 200, "currency": "USD"},
+ app_fee_money={"amount": 10, "currency": "USD"},
+ autocomplete=False,
+ )
+
+ payment = create_response.payment
+ assert payment is not None
+ assert isinstance(payment, Payment)
+
+ payment_id = payment.id
+ response = client.payments.complete(payment_id=payment_id)
+
+ assert response.payment is not None
+ assert isinstance(response.payment, Payment)
+ assert "COMPLETED" == response.payment.status
diff --git a/tests/integration/test_refunds.py b/tests/integration/test_refunds.py
new file mode 100644
index 00000000..5b5cfa16
--- /dev/null
+++ b/tests/integration/test_refunds.py
@@ -0,0 +1,84 @@
+import uuid
+
+import pytest
+
+from square.types.payment import Payment
+from square.types.payment_refund import PaymentRefund
+
+from . import helpers
+
+
+def create_payment() -> str:
+ client = helpers.test_client()
+
+ payment_response = client.payments.create(
+ source_id="cnon:card-nonce-ok",
+ idempotency_key=str(uuid.uuid4()),
+ amount_money={"amount": 200, "currency": "USD"},
+ app_fee_money={"amount": 10, "currency": "USD"},
+ autocomplete=True,
+ )
+ payment = payment_response.payment
+ assert payment is not None
+ assert isinstance(payment, Payment)
+ assert payment.id is not None
+ return payment.id
+
+
+def create_refund(payment_id: str) -> str:
+ client = helpers.test_client()
+
+ refund_response = client.refunds.refund_payment(
+ idempotency_key=str(uuid.uuid4()),
+ amount_money={"amount": 200, "currency": "USD"},
+ payment_id=payment_id,
+ )
+ refund = refund_response.refund
+ assert refund is not None
+ assert isinstance(refund, PaymentRefund)
+ assert refund.id is not None
+ return refund.id
+
+
+def test_refund_payment():
+ client = helpers.test_client()
+
+ payment_response = client.payments.create(
+ source_id="cnon:card-nonce-ok",
+ idempotency_key=str(uuid.uuid4()),
+ amount_money={"amount": 200, "currency": "USD"},
+ app_fee_money={"amount": 10, "currency": "USD"},
+ autocomplete=True,
+ )
+ payment = payment_response.payment
+ assert payment is not None
+ assert isinstance(payment, Payment)
+ assert payment.id is not None
+ payment_id = payment.id
+
+ response = client.refunds.refund_payment(
+ idempotency_key=str(uuid.uuid4()),
+ amount_money={"amount": 200, "currency": "USD"},
+ payment_id=payment_id,
+ )
+ refund = response.refund
+ assert refund is not None
+ assert isinstance(refund, PaymentRefund)
+ assert payment_id == refund.payment_id
+
+
+def test_get_payment_refund():
+ client = helpers.test_client()
+ payment_id = create_payment()
+ refund_id = create_refund(payment_id)
+
+ response = client.refunds.get(refund_id=refund_id)
+ assert response.refund is not None
+ assert isinstance(response.refund, PaymentRefund)
+ assert payment_id == response.refund.payment_id
+
+
+def test_handle_invalid_refund_id():
+ client = helpers.test_client()
+ with pytest.raises(Exception):
+ client.refunds.get(refund_id="invalid-id")
diff --git a/tests/integration/test_reporting.py b/tests/integration/test_reporting.py
new file mode 100644
index 00000000..c332108d
--- /dev/null
+++ b/tests/integration/test_reporting.py
@@ -0,0 +1,92 @@
+"""Live, end-to-end tests for the Reporting API.
+
+The Reporting API is a beta, bespoke offering served ONLY from production
+(connect.squareup.com/reporting) -- it is not routed on sandbox (which 404s),
+and a sandbox token 401s against prod. Validating it live therefore needs a
+production, reporting-provisioned access token. CI's regular ``TEST_SQUARE_TOKEN``
+is sandbox-only, so this suite is gated behind ``TEST_SQUARE_REPORTING`` -- which
+is itself the prod, reporting-provisioned token -- and skips by default when it is
+unset, keeping CI green. The endpoints exercised are read-only (schema
+discovery + queries). The polling *logic* is covered without a live account in
+``test_reporting_helper.py``.
+
+Run it against a real prod account:
+
+ TEST_SQUARE_REPORTING= \
+ poetry run pytest tests/integration/test_reporting.py
+ # Override the host with TEST_SQUARE_BASE_URL= if reporting moves.
+"""
+
+import os
+
+import pytest
+
+from square import Square
+from square.environment import SquareEnvironment
+from square.utils.reporting_helper import load_and_wait
+
+pytestmark = pytest.mark.skipif(
+ not os.getenv("TEST_SQUARE_REPORTING"),
+ reason="Set TEST_SQUARE_REPORTING to a prod, reporting-provisioned token to run the live Reporting API suite.",
+)
+
+
+def reporting_client() -> Square:
+ token = os.getenv("TEST_SQUARE_REPORTING")
+ if not token:
+ raise RuntimeError("TEST_SQUARE_REPORTING must be set to a prod, reporting-provisioned token to run the reporting integration suite.")
+ # Reporting only exists on production; allow overriding the host via TEST_SQUARE_BASE_URL.
+ base_url = os.getenv("TEST_SQUARE_BASE_URL")
+ if base_url:
+ return Square(token=token, base_url=base_url)
+ return Square(token=token, environment=SquareEnvironment.PRODUCTION)
+
+
+def first_measure_name(client: Square) -> str:
+ metadata = client.reporting.get_metadata()
+ cubes = metadata.cubes or []
+ for cube in cubes:
+ for measure in cube.measures or []:
+ if measure.name:
+ return measure.name
+ raise RuntimeError("No cubes/measures are available on the reporting schema for this account.")
+
+
+def test_get_metadata_returns_queryable_schema() -> None:
+ client = reporting_client()
+ metadata = client.reporting.get_metadata()
+
+ assert metadata.cubes is not None
+ assert len(metadata.cubes) > 0
+
+
+def test_load_returns_results_or_continue_wait_sentinel() -> None:
+ client = reporting_client()
+ measure = first_measure_name(client)
+
+ response = client.reporting.load(query={"measures": [measure]})
+
+ sentinel = getattr(response, "error", None)
+ if sentinel is not None:
+ # Documented async behavior: a still-processing query comes back as HTTP 200
+ # with {"error": "Continue wait"} instead of results.
+ assert sentinel == "Continue wait"
+ else:
+ assert response.data is not None
+
+
+def test_load_and_wait_resolves_without_continue_wait() -> None:
+ client = reporting_client()
+ measure = first_measure_name(client)
+
+ response = load_and_wait(
+ client,
+ query={"measures": [measure]},
+ max_attempts=20,
+ initial_delay_s=2.0,
+ max_delay_s=20.0,
+ )
+
+ # The polling helper must never hand back the raw "Continue wait" sentinel.
+ assert getattr(response, "error", None) is None
+ assert response.data is not None
diff --git a/tests/integration/test_reporting_helper.py b/tests/integration/test_reporting_helper.py
new file mode 100644
index 00000000..0b5e6ee4
--- /dev/null
+++ b/tests/integration/test_reporting_helper.py
@@ -0,0 +1,190 @@
+"""Offline unit tests for the Reporting API polling helper.
+
+The Reporting API answers a still-processing ``/v1/load`` query with an HTTP 200
+whose body is ``{"error": "Continue wait"}``. ``load_and_wait`` /
+``load_and_wait_async`` own the retry loop around that sentinel. These tests
+exercise that loop without a network by scripting ``client.reporting.load``, plus
+one test that proves the sentinel actually survives the generated client's
+deserialization. They run offline, so they stay green in CI.
+
+The live, end-to-end suite lives in ``test_reporting.py`` (gated behind
+``TEST_SQUARE_REPORTING``).
+"""
+
+import threading
+import typing
+
+import pytest
+
+from square.core.unchecked_base_model import construct_type
+from square.types.load_response import LoadResponse
+from square.utils.reporting_helper import (
+ CONTINUE_WAIT,
+ ReportingPollCancelledError,
+ ReportingPollTimeoutError,
+ load_and_wait,
+ load_and_wait_async,
+)
+
+if typing.TYPE_CHECKING:
+ from square.client import AsyncSquare, Square
+
+
+def _continue_wait() -> LoadResponse:
+ # Build the sentinel the same way the generated client does, so the tests
+ # exercise the real type rather than a hand-rolled stand-in.
+ return typing.cast(LoadResponse, construct_type(type_=LoadResponse, object_={"error": CONTINUE_WAIT}))
+
+
+def _resolved() -> LoadResponse:
+ return typing.cast(
+ LoadResponse,
+ construct_type(type_=LoadResponse, object_={"data": [{"Orders.count": "128"}]}),
+ )
+
+
+class _FakeReporting:
+ """A ``reporting`` stub whose ``load`` returns a scripted sequence of responses."""
+
+ def __init__(
+ self,
+ sequence: typing.List[LoadResponse],
+ on_call: typing.Optional[typing.Callable[[int], None]] = None,
+ ) -> None:
+ self._sequence = sequence
+ self._on_call = on_call
+ self.calls = 0
+
+ def load(self, **_kwargs: typing.Any) -> LoadResponse:
+ response = self._sequence[min(self.calls, len(self._sequence) - 1)]
+ self.calls += 1
+ if self._on_call is not None:
+ self._on_call(self.calls)
+ return response
+
+
+class _FakeAsyncReporting:
+ def __init__(self, sequence: typing.List[LoadResponse]) -> None:
+ self._sequence = sequence
+ self.calls = 0
+
+ async def load(self, **_kwargs: typing.Any) -> LoadResponse:
+ response = self._sequence[min(self.calls, len(self._sequence) - 1)]
+ self.calls += 1
+ return response
+
+
+def _fake_client(reporting: typing.Any) -> "Square":
+ class _FakeClient:
+ pass
+
+ client = _FakeClient()
+ client.reporting = reporting # type: ignore[attr-defined]
+ return typing.cast("Square", client)
+
+
+def test_polls_past_continue_wait_and_returns_resolved_result() -> None:
+ reporting = _FakeReporting([_continue_wait(), _continue_wait(), _resolved()])
+ client = _fake_client(reporting)
+
+ response = load_and_wait(
+ client,
+ query={"measures": ["Orders.count"]},
+ initial_delay_s=0.001,
+ max_delay_s=0.001,
+ max_attempts=5,
+ )
+
+ # The helper must never hand back the raw sentinel.
+ assert getattr(response, "error", None) is None
+ assert response.data is not None
+ assert reporting.calls == 3
+
+
+def test_returns_immediately_when_first_response_has_results() -> None:
+ reporting = _FakeReporting([_resolved()])
+ client = _fake_client(reporting)
+
+ response = load_and_wait(client, initial_delay_s=0.001)
+
+ assert response.data is not None
+ assert reporting.calls == 1
+
+
+def test_raises_timeout_once_max_attempts_exhausted() -> None:
+ reporting = _FakeReporting([_continue_wait()]) # never resolves
+ client = _fake_client(reporting)
+
+ with pytest.raises(ReportingPollTimeoutError, match="did not complete after 3 attempts"):
+ load_and_wait(client, initial_delay_s=0.001, max_delay_s=0.001, max_attempts=3)
+
+ assert reporting.calls == 3
+
+
+def test_cancel_event_set_before_start_aborts_without_calling() -> None:
+ reporting = _FakeReporting([_continue_wait()])
+ client = _fake_client(reporting)
+ cancel_event = threading.Event()
+ cancel_event.set()
+
+ with pytest.raises(ReportingPollCancelledError):
+ load_and_wait(client, initial_delay_s=10, max_attempts=10, cancel_event=cancel_event)
+
+ assert reporting.calls == 0
+
+
+def test_cancel_event_interrupts_backoff_sleep() -> None:
+ cancel_event = threading.Event()
+
+ # Trip the event after the first poll; the helper's interruptible backoff sleep
+ # must then return promptly and raise rather than waiting out the delay.
+ def on_call(_count: int) -> None:
+ cancel_event.set()
+
+ reporting = _FakeReporting([_continue_wait()], on_call=on_call)
+ client = _fake_client(reporting)
+
+ with pytest.raises(ReportingPollCancelledError):
+ load_and_wait(client, initial_delay_s=30, max_attempts=10, cancel_event=cancel_event)
+
+ assert reporting.calls == 1
+
+
+def test_continue_wait_body_survives_real_deserialization_as_sentinel() -> None:
+ # The crux of the design: the generated ``reporting.load`` parses the body with
+ # ``construct_type`` (skip-validation + extra="allow"), so the ``error`` sentinel
+ # survives onto a LoadResponse-shaped object while ``data`` stays None. If this
+ # ever stops being true, load_and_wait would mistake "Continue wait" for a result.
+ parsed = typing.cast(
+ typing.Any, construct_type(type_=LoadResponse, object_={"error": CONTINUE_WAIT})
+ )
+
+ assert parsed.error == CONTINUE_WAIT
+ assert parsed.data is None
+
+
+async def test_async_polls_past_continue_wait_and_resolves() -> None:
+ reporting = _FakeAsyncReporting([_continue_wait(), _continue_wait(), _resolved()])
+ client = typing.cast("AsyncSquare", _fake_client(reporting))
+
+ response = await load_and_wait_async(
+ client,
+ query={"measures": ["Orders.count"]},
+ initial_delay_s=0.001,
+ max_delay_s=0.001,
+ max_attempts=5,
+ )
+
+ assert getattr(response, "error", None) is None
+ assert response.data is not None
+ assert reporting.calls == 3
+
+
+async def test_async_raises_timeout_once_max_attempts_exhausted() -> None:
+ reporting = _FakeAsyncReporting([_continue_wait()]) # never resolves
+ client = typing.cast("AsyncSquare", _fake_client(reporting))
+
+ with pytest.raises(ReportingPollTimeoutError, match="did not complete after 3 attempts"):
+ await load_and_wait_async(client, initial_delay_s=0.001, max_delay_s=0.001, max_attempts=3)
+
+ assert reporting.calls == 3
diff --git a/tests/integration/test_teams.py b/tests/integration/test_teams.py
new file mode 100644
index 00000000..c670e9ab
--- /dev/null
+++ b/tests/integration/test_teams.py
@@ -0,0 +1,162 @@
+import uuid
+from typing import List
+
+import pytest
+
+from square.types.money import Money
+from square.types.team_member import TeamMember
+from square.types.wage_setting import WageSetting
+
+from . import helpers
+
+
+def create_team_member() -> str:
+ client = helpers.test_client()
+
+ member_response = client.team_members.create(
+ idempotency_key=str(uuid.uuid4()),
+ team_member={"given_name": "Sherlock", "family_name": "Holmes"},
+ )
+ member = member_response.team_member
+ assert member is not None
+ assert isinstance(member, TeamMember)
+ assert member.id is not None
+ return member.id
+
+
+def create_bulk_team_members() -> List[str]:
+ client = helpers.test_client()
+
+ bulk_response = client.team_members.batch_create(
+ team_members={
+ "id1": {
+ "team_member": {"given_name": "Donatello", "family_name": "Splinter"}
+ },
+ "id2": {
+ "team_member": {"given_name": "Leonardo", "family_name": "Splinter"}
+ },
+ }
+ )
+
+ bulk_member_ids = []
+
+ team_members = bulk_response.team_members
+ assert team_members is not None
+ team_members = team_members if team_members else dict()
+ for value in team_members.values():
+ team_member = value.team_member
+ assert team_member is not None
+ assert isinstance(team_member, TeamMember)
+ assert team_member.id is not None
+ bulk_member_ids.append(team_member.id)
+
+ return bulk_member_ids
+
+
+@pytest.mark.skip(reason="Team members API returns ApiError in CI")
+def test_search_team_members():
+ client = helpers.test_client()
+ member_id = create_team_member()
+ bulk_member_ids = create_bulk_team_members()
+
+ response = client.team_members.search(limit=1)
+ assert response.team_members is not None
+ assert len(response.team_members) > 0
+
+
+@pytest.mark.skip(reason="Team members API returns ApiError in CI")
+def test_create_team_member():
+ client = helpers.test_client()
+
+ response = client.team_members.create(
+ idempotency_key=str(uuid.uuid4()),
+ team_member={"given_name": "John", "family_name": "Watson"},
+ )
+
+ assert response.team_member is not None
+ assert isinstance(response.team_member, TeamMember)
+ assert "John" == response.team_member.given_name
+ assert "Watson" == response.team_member.family_name
+
+
+@pytest.mark.skip(reason="Team members API returns ApiError in CI")
+def test_retrieve_team_member():
+ client = helpers.test_client()
+ member_id = create_team_member()
+ bulk_member_ids = create_bulk_team_members()
+
+ response = client.team_members.get(team_member_id=member_id)
+
+ assert response.team_member is not None
+ assert isinstance(response.team_member, TeamMember)
+ assert member_id == response.team_member.id
+
+
+@pytest.mark.skip(reason="Team members API returns ApiError in CI")
+def test_update_team_member():
+ client = helpers.test_client()
+ member_id = create_team_member()
+ bulk_member_ids = create_bulk_team_members()
+
+ client.team_members.update(
+ team_member_id=member_id,
+ team_member={"given_name": "Agent", "family_name": "Smith"},
+ )
+ get_response = client.team_members.get(team_member_id=member_id)
+
+ team_member = get_response.team_member
+ assert team_member is not None
+ assert isinstance(team_member, TeamMember)
+ assert "Agent" == team_member.given_name
+ assert "Smith" == team_member.family_name
+
+
+@pytest.mark.skip(reason="Team members API returns ApiError in CI")
+def test_update_wage_setting():
+ client = helpers.test_client()
+ member_id = create_team_member()
+ bulk_member_ids = create_bulk_team_members()
+
+ response = client.team_members.wage_setting.update(
+ team_member_id=member_id,
+ wage_setting={
+ "job_assignments": [
+ {
+ "pay_type": "HOURLY",
+ "hourly_rate": {"amount": 2500, "currency": "USD"},
+ "job_title": "Math tutor",
+ }
+ ]
+ },
+ )
+
+ assert response.wage_setting is not None
+ assert isinstance(response.wage_setting, WageSetting)
+ job_assignments = response.wage_setting.job_assignments
+ assert job_assignments is not None
+ assert len(job_assignments) > 0
+ assert "Math tutor" == job_assignments[0].job_title
+ hourly_rate = job_assignments[0].hourly_rate
+ assert hourly_rate is not None
+ assert isinstance(hourly_rate, Money)
+ assert 2500 == hourly_rate.amount
+
+
+@pytest.mark.skip(reason="Team members API returns ApiError in CI")
+def test_batch_update_team_members():
+ client = helpers.test_client()
+ member_id = create_team_member()
+ bulk_member_ids = create_bulk_team_members()
+
+ response = client.team_members.batch_update(
+ team_members={
+ bulk_member_ids[0]: {
+ "team_member": {"given_name": "Raphael", "family_name": "Splinter"}
+ },
+ bulk_member_ids[1]: {
+ "team_member": {"given_name": "Leonardo", "family_name": "Splinter"}
+ },
+ }
+ )
+ assert response.team_members is not None
+ assert 2 == len(response.team_members)
diff --git a/tests/integration/test_terminal.py b/tests/integration/test_terminal.py
new file mode 100644
index 00000000..e3c4d446
--- /dev/null
+++ b/tests/integration/test_terminal.py
@@ -0,0 +1,67 @@
+import uuid
+
+from square.types.device_checkout_options import DeviceCheckoutOptions
+from square.types.money import Money
+from square.types.terminal_checkout import TerminalCheckout
+
+from . import helpers
+
+sandbox_device_id = "da40d603-c2ea-4a65-8cfd-f42e36dab0c7"
+
+
+def create_terminal_checkout() -> str:
+ client = helpers.test_client()
+
+ checkout_response = client.terminal.checkouts.create(
+ idempotency_key=str(uuid.uuid4()),
+ checkout={
+ "amount_money": {"amount": 100, "currency": "USD"},
+ "device_options": {"device_id": sandbox_device_id},
+ },
+ )
+ assert checkout_response.checkout is not None
+ assert isinstance(checkout_response.checkout, TerminalCheckout)
+ checkout_id = checkout_response.checkout.id
+ assert checkout_id is not None
+ return checkout_id
+
+
+def test_create_terminal_checkout():
+ client = helpers.test_client()
+ checkout_id = create_terminal_checkout()
+
+ response = client.terminal.checkouts.create(
+ idempotency_key=str(uuid.uuid4()),
+ checkout={
+ "amount_money": {"amount": 100, "currency": "USD"},
+ "device_options": {"device_id": sandbox_device_id},
+ },
+ )
+
+ assert response.checkout is not None
+ assert isinstance(response.checkout, TerminalCheckout)
+ assert response.checkout.device_options is not None
+ assert isinstance(response.checkout.device_options, DeviceCheckoutOptions)
+ assert sandbox_device_id == response.checkout.device_options.device_id
+ assert response.checkout.amount_money is not None
+ assert isinstance(response.checkout.amount_money, Money)
+ assert 100 == response.checkout.amount_money.amount
+
+
+def test_search_terminal_checkouts():
+ client = helpers.test_client()
+ checkout_id = create_terminal_checkout()
+
+ response = client.terminal.checkouts.search(limit=1)
+ assert response.checkouts is not None
+ assert len(response.checkouts) > 0
+
+
+def test_get_terminal_checkout():
+ client = helpers.test_client()
+ checkout_id = create_terminal_checkout()
+
+ response = client.terminal.checkouts.cancel(checkout_id=checkout_id)
+ assert response.checkout is not None
+ assert isinstance(response.checkout, TerminalCheckout)
+ assert "CANCELED" == response.checkout.status
diff --git a/tests/integration/test_webhooks_helper.py b/tests/integration/test_webhooks_helper.py
new file mode 100644
index 00000000..1e4b67da
--- /dev/null
+++ b/tests/integration/test_webhooks_helper.py
@@ -0,0 +1,144 @@
+import pytest
+
+from square.utils.webhooks_helper import verify_signature
+
+REQUEST_BODY = '{"merchant_id":"MLEFBHHSJGVHD","type":"webhooks.test_notification","event_id":"ac3ac95b-f97d-458c-a6e6-18981597e05f","created_at":"2022-07-13T20:30:59.037339943Z","data":{"type":"webhooks","id":"bc368e64-01aa-407e-b46e-3231809b1129"}}'
+SIGNATURE_HEADER = "GF4YkrJgGBDZ9NIYbNXBnMzqb2HoL4RW/S6vkZ9/2N4="
+SIGNATURE_KEY = "Ibxx_5AKakO-3qeNVR61Dw"
+NOTIFICATION_URL = "https://webhook.site/679a4f3a-dcfa-49ee-bac5-9d0edad886b9"
+
+
+def test_signature_validation_pass():
+ is_valid = verify_signature(
+ request_body=REQUEST_BODY,
+ signature_header=SIGNATURE_HEADER,
+ signature_key=SIGNATURE_KEY,
+ notification_url=NOTIFICATION_URL,
+ )
+ assert is_valid
+
+
+def test_signature_validation_escaped_pass():
+ escaped_request_body = '{"data":{"type":"webhooks","id":">id<"}}'
+ new_signature_header = "Cxt7+aTi4rKgcA0bC4g9EHdVtLSDWdqccmL5MvihU4U="
+ signature_key = "signature-key"
+ url = "https://webhook.site/webhooks"
+
+ is_valid = verify_signature(
+ request_body=escaped_request_body,
+ signature_header=new_signature_header,
+ signature_key=signature_key,
+ notification_url=url,
+ )
+ assert is_valid
+
+
+def test_signature_validation_url_mismatch():
+ is_valid = verify_signature(
+ request_body=REQUEST_BODY,
+ signature_header=SIGNATURE_HEADER,
+ signature_key=SIGNATURE_KEY,
+ notification_url="https://webhook.site/79a4f3a-dcfa-49ee-bac5-9d0edad886b9",
+ )
+ assert not is_valid
+
+
+def test_signature_validation_invalid_signature_key():
+ is_valid = verify_signature(
+ request_body=REQUEST_BODY,
+ signature_header=SIGNATURE_HEADER,
+ signature_key="MCmhFRxGX82xMwg5FsaoQA",
+ notification_url=NOTIFICATION_URL,
+ )
+ assert not is_valid
+
+
+def test_signature_validation_invalid_signature_header():
+ is_valid = verify_signature(
+ request_body=REQUEST_BODY,
+ signature_header="1z2n3DEJJiUPKcPzQo1ftvbxGdw=",
+ signature_key=SIGNATURE_KEY,
+ notification_url=NOTIFICATION_URL,
+ )
+ assert not is_valid
+
+
+def test_signature_validation_body_mismatch():
+ request_body = """
+ {
+ "merchant_id": "MLEFBHHSJGVHD",
+ "type": "webhooks.test_notification",
+ "event_id": "ac3ac95b-f97d-458c-a6e6-18981597e05f",
+ "created_at": "2022-06-13T20:30:59.037339943Z",
+ "data": {"type": "webhooks", "id": "bc368e64-01aa-407e-b46e-3231809b1129"}
+ }
+ """
+ is_valid = verify_signature(
+ request_body=request_body,
+ signature_header=SIGNATURE_HEADER,
+ signature_key=SIGNATURE_KEY,
+ notification_url=NOTIFICATION_URL,
+ )
+ assert not is_valid
+
+
+def test_signature_validation_body_formatted():
+ request_body = """
+ {
+ "merchant_id": "MLEFBHHSJGVHD",
+ "type": "webhooks.test_notification",
+ "event_id": "ac3ac95b-f97d-458c-a6e6-18981597e05f",
+ "created_at": "2022-07-13T20:30:59.037339943Z",
+ "data": {
+ "type": "webhooks",
+ "id": "bc368e64-01aa-407e-b46e-3231809b1129"
+ }
+ }
+ """
+ is_valid = verify_signature(
+ request_body=request_body,
+ signature_header=SIGNATURE_HEADER,
+ signature_key=SIGNATURE_KEY,
+ notification_url=NOTIFICATION_URL,
+ )
+ assert not is_valid
+
+
+def test_signature_validation_empty_signature_key():
+ with pytest.raises(ValueError, match="signature_key is empty"):
+ verify_signature(
+ request_body=REQUEST_BODY,
+ signature_header=SIGNATURE_HEADER,
+ signature_key="",
+ notification_url=NOTIFICATION_URL,
+ )
+
+
+def test_signature_validation_signature_key_not_configured():
+ with pytest.raises(ValueError, match="signature_key is empty"):
+ verify_signature(
+ request_body=REQUEST_BODY,
+ signature_header=SIGNATURE_HEADER,
+ signature_key=None,
+ notification_url=NOTIFICATION_URL,
+ )
+
+
+def test_signature_validation_empty_notification_url():
+ with pytest.raises(ValueError, match="notification_url is empty"):
+ verify_signature(
+ request_body=REQUEST_BODY,
+ signature_header=SIGNATURE_HEADER,
+ signature_key=SIGNATURE_KEY,
+ notification_url="",
+ )
+
+
+def test_signature_validation_notification_url_not_configured():
+ with pytest.raises(ValueError, match="notification_url is empty"):
+ verify_signature(
+ request_body=REQUEST_BODY,
+ signature_header=SIGNATURE_HEADER,
+ signature_key=SIGNATURE_KEY,
+ notification_url=None,
+ )
diff --git a/tests/integration/testdata/image.jpeg b/tests/integration/testdata/image.jpeg
new file mode 100644
index 00000000..bb7bca31
Binary files /dev/null and b/tests/integration/testdata/image.jpeg differ
diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py
new file mode 100644
index 00000000..f3ea2659
--- /dev/null
+++ b/tests/utils/__init__.py
@@ -0,0 +1,2 @@
+# This file was auto-generated by Fern from our API Definition.
+
diff --git a/tests/utils/assets/models/__init__.py b/tests/utils/assets/models/__init__.py
new file mode 100644
index 00000000..2cf01263
--- /dev/null
+++ b/tests/utils/assets/models/__init__.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+from .circle import CircleParams
+from .object_with_defaults import ObjectWithDefaultsParams
+from .object_with_optional_field import ObjectWithOptionalFieldParams
+from .shape import Shape_CircleParams, Shape_SquareParams, ShapeParams
+from .square import SquareParams
+from .undiscriminated_shape import UndiscriminatedShapeParams
+
+__all__ = [
+ "CircleParams",
+ "ObjectWithDefaultsParams",
+ "ObjectWithOptionalFieldParams",
+ "ShapeParams",
+ "Shape_CircleParams",
+ "Shape_SquareParams",
+ "SquareParams",
+ "UndiscriminatedShapeParams",
+]
diff --git a/tests/utils/assets/models/circle.py b/tests/utils/assets/models/circle.py
new file mode 100644
index 00000000..2557fdc9
--- /dev/null
+++ b/tests/utils/assets/models/circle.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+from square.core.serialization import FieldMetadata
+
+
+class CircleParams(typing_extensions.TypedDict):
+ radius_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="radiusMeasurement")]
diff --git a/tests/utils/assets/models/color.py b/tests/utils/assets/models/color.py
new file mode 100644
index 00000000..2aa2c4c5
--- /dev/null
+++ b/tests/utils/assets/models/color.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+Color = typing.Union[typing.Literal["red", "blue"], typing.Any]
diff --git a/tests/utils/assets/models/object_with_defaults.py b/tests/utils/assets/models/object_with_defaults.py
new file mode 100644
index 00000000..a977b1d2
--- /dev/null
+++ b/tests/utils/assets/models/object_with_defaults.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class ObjectWithDefaultsParams(typing_extensions.TypedDict):
+ """
+ Defines properties with default values and validation rules.
+ """
+
+ decimal: typing_extensions.NotRequired[float]
+ string: typing_extensions.NotRequired[str]
+ required_string: str
diff --git a/tests/utils/assets/models/object_with_optional_field.py b/tests/utils/assets/models/object_with_optional_field.py
new file mode 100644
index 00000000..54a8d7bd
--- /dev/null
+++ b/tests/utils/assets/models/object_with_optional_field.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import datetime as dt
+import typing
+import uuid
+
+import typing_extensions
+from .color import Color
+from .shape import ShapeParams
+from .undiscriminated_shape import UndiscriminatedShapeParams
+
+from square.core.serialization import FieldMetadata
+
+
+class ObjectWithOptionalFieldParams(typing_extensions.TypedDict):
+ literal: typing.Literal["lit_one"]
+ string: typing_extensions.NotRequired[str]
+ integer: typing_extensions.NotRequired[int]
+ long_: typing_extensions.NotRequired[typing_extensions.Annotated[int, FieldMetadata(alias="long")]]
+ double: typing_extensions.NotRequired[float]
+ bool_: typing_extensions.NotRequired[typing_extensions.Annotated[bool, FieldMetadata(alias="bool")]]
+ datetime: typing_extensions.NotRequired[dt.datetime]
+ date: typing_extensions.NotRequired[dt.date]
+ uuid_: typing_extensions.NotRequired[typing_extensions.Annotated[uuid.UUID, FieldMetadata(alias="uuid")]]
+ base_64: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="base64")]]
+ list_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Sequence[str], FieldMetadata(alias="list")]]
+ set_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Set[str], FieldMetadata(alias="set")]]
+ map_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Dict[int, str], FieldMetadata(alias="map")]]
+ enum: typing_extensions.NotRequired[Color]
+ union: typing_extensions.NotRequired[ShapeParams]
+ second_union: typing_extensions.NotRequired[ShapeParams]
+ undiscriminated_union: typing_extensions.NotRequired[UndiscriminatedShapeParams]
+ any: typing.Optional[typing.Any]
diff --git a/tests/utils/assets/models/shape.py b/tests/utils/assets/models/shape.py
new file mode 100644
index 00000000..b5195609
--- /dev/null
+++ b/tests/utils/assets/models/shape.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+
+from square.core.serialization import FieldMetadata
+
+
+class Base(typing_extensions.TypedDict):
+ id: str
+
+
+class Shape_CircleParams(Base):
+ shape_type: typing_extensions.Annotated[typing.Literal["circle"], FieldMetadata(alias="shapeType")]
+ radius_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="radiusMeasurement")]
+
+
+class Shape_SquareParams(Base):
+ shape_type: typing_extensions.Annotated[typing.Literal["square"], FieldMetadata(alias="shapeType")]
+ length_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="lengthMeasurement")]
+
+
+ShapeParams = typing.Union[Shape_CircleParams, Shape_SquareParams]
diff --git a/tests/utils/assets/models/square.py b/tests/utils/assets/models/square.py
new file mode 100644
index 00000000..dac450bb
--- /dev/null
+++ b/tests/utils/assets/models/square.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+from square.core.serialization import FieldMetadata
+
+
+class SquareParams(typing_extensions.TypedDict):
+ length_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="lengthMeasurement")]
diff --git a/tests/utils/assets/models/undiscriminated_shape.py b/tests/utils/assets/models/undiscriminated_shape.py
new file mode 100644
index 00000000..99f12b30
--- /dev/null
+++ b/tests/utils/assets/models/undiscriminated_shape.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .circle import CircleParams
+from .square import SquareParams
+
+UndiscriminatedShapeParams = typing.Union[CircleParams, SquareParams]
diff --git a/tests/utils/test_http_client.py b/tests/utils/test_http_client.py
new file mode 100644
index 00000000..92d9e8df
--- /dev/null
+++ b/tests/utils/test_http_client.py
@@ -0,0 +1,300 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from typing import Any, Dict
+
+import pytest
+
+from square.core.http_client import (
+ AsyncHttpClient,
+ HttpClient,
+ _build_url,
+ get_request_body,
+ remove_none_from_dict,
+)
+from square.core.request_options import RequestOptions
+
+
+# Stub clients for testing HttpClient and AsyncHttpClient
+class _DummySyncClient:
+ """A minimal stub for httpx.Client that records request arguments."""
+
+ def __init__(self) -> None:
+ self.last_request_kwargs: Dict[str, Any] = {}
+
+ def request(self, **kwargs: Any) -> "_DummyResponse":
+ self.last_request_kwargs = kwargs
+ return _DummyResponse()
+
+
+class _DummyAsyncClient:
+ """A minimal stub for httpx.AsyncClient that records request arguments."""
+
+ def __init__(self) -> None:
+ self.last_request_kwargs: Dict[str, Any] = {}
+
+ async def request(self, **kwargs: Any) -> "_DummyResponse":
+ self.last_request_kwargs = kwargs
+ return _DummyResponse()
+
+
+class _DummyResponse:
+ """A minimal stub for httpx.Response."""
+
+ status_code = 200
+ headers: Dict[str, str] = {}
+
+
+def get_request_options() -> RequestOptions:
+ return {"additional_body_parameters": {"see you": "later"}}
+
+
+def get_request_options_with_none() -> RequestOptions:
+ return {"additional_body_parameters": {"see you": "later", "optional": None}}
+
+
+def test_get_json_request_body() -> None:
+ json_body, data_body = get_request_body(json={"hello": "world"}, data=None, request_options=None, omit=None)
+ assert json_body == {"hello": "world"}
+ assert data_body is None
+
+ json_body_extras, data_body_extras = get_request_body(
+ json={"goodbye": "world"}, data=None, request_options=get_request_options(), omit=None
+ )
+
+ assert json_body_extras == {"goodbye": "world", "see you": "later"}
+ assert data_body_extras is None
+
+
+def test_get_files_request_body() -> None:
+ json_body, data_body = get_request_body(json=None, data={"hello": "world"}, request_options=None, omit=None)
+ assert data_body == {"hello": "world"}
+ assert json_body is None
+
+ json_body_extras, data_body_extras = get_request_body(
+ json=None, data={"goodbye": "world"}, request_options=get_request_options(), omit=None
+ )
+
+ assert data_body_extras == {"goodbye": "world", "see you": "later"}
+ assert json_body_extras is None
+
+
+def test_get_none_request_body() -> None:
+ json_body, data_body = get_request_body(json=None, data=None, request_options=None, omit=None)
+ assert data_body is None
+ assert json_body is None
+
+ json_body_extras, data_body_extras = get_request_body(
+ json=None, data=None, request_options=get_request_options(), omit=None
+ )
+
+ assert json_body_extras == {"see you": "later"}
+ assert data_body_extras is None
+
+
+def test_get_empty_json_request_body() -> None:
+ """Test that implicit empty bodies (json=None) are collapsed to None."""
+ unrelated_request_options: RequestOptions = {"max_retries": 3}
+ json_body, data_body = get_request_body(json=None, data=None, request_options=unrelated_request_options, omit=None)
+ assert json_body is None
+ assert data_body is None
+
+
+def test_explicit_empty_json_body_is_preserved() -> None:
+ """Test that explicit empty bodies (json={}) are preserved and sent as {}.
+
+ This is important for endpoints where the request body is required but all
+ fields are optional. The server expects valid JSON ({}) not an empty body.
+ """
+ unrelated_request_options: RequestOptions = {"max_retries": 3}
+
+ # Explicit json={} should be preserved
+ json_body, data_body = get_request_body(json={}, data=None, request_options=unrelated_request_options, omit=None)
+ assert json_body == {}
+ assert data_body is None
+
+ # Explicit data={} should also be preserved
+ json_body2, data_body2 = get_request_body(json=None, data={}, request_options=unrelated_request_options, omit=None)
+ assert json_body2 is None
+ assert data_body2 == {}
+
+
+def test_json_body_preserves_none_values() -> None:
+ """Test that JSON bodies preserve None values (they become JSON null)."""
+ json_body, data_body = get_request_body(
+ json={"hello": "world", "optional": None}, data=None, request_options=None, omit=None
+ )
+ # JSON bodies should preserve None values
+ assert json_body == {"hello": "world", "optional": None}
+ assert data_body is None
+
+
+def test_data_body_preserves_none_values_without_multipart() -> None:
+ """Test that data bodies preserve None values when not using multipart.
+
+ The filtering of None values happens in HttpClient.request/stream methods,
+ not in get_request_body. This test verifies get_request_body doesn't filter None.
+ """
+ json_body, data_body = get_request_body(
+ json=None, data={"hello": "world", "optional": None}, request_options=None, omit=None
+ )
+ # get_request_body should preserve None values in data body
+ # The filtering happens later in HttpClient.request when multipart is detected
+ assert data_body == {"hello": "world", "optional": None}
+ assert json_body is None
+
+
+def test_remove_none_from_dict_filters_none_values() -> None:
+ """Test that remove_none_from_dict correctly filters out None values."""
+ original = {"hello": "world", "optional": None, "another": "value", "also_none": None}
+ filtered = remove_none_from_dict(original)
+ assert filtered == {"hello": "world", "another": "value"}
+ # Original should not be modified
+ assert original == {"hello": "world", "optional": None, "another": "value", "also_none": None}
+
+
+def test_remove_none_from_dict_empty_dict() -> None:
+ """Test that remove_none_from_dict handles empty dict."""
+ assert remove_none_from_dict({}) == {}
+
+
+def test_remove_none_from_dict_all_none() -> None:
+ """Test that remove_none_from_dict handles dict with all None values."""
+ assert remove_none_from_dict({"a": None, "b": None}) == {}
+
+
+def test_http_client_does_not_pass_empty_params_list() -> None:
+ """Test that HttpClient passes params=None when params are empty.
+
+ This prevents httpx from stripping existing query parameters from the URL,
+ which happens when params=[] or params={} is passed.
+ """
+ dummy_client = _DummySyncClient()
+ http_client = HttpClient(
+ httpx_client=dummy_client, # type: ignore[arg-type]
+ base_timeout=lambda: None,
+ base_headers=lambda: {},
+ base_url=lambda: "https://example.com",
+ )
+
+ # Use a path with query params (e.g., pagination cursor URL)
+ http_client.request(
+ path="resource?after=123",
+ method="GET",
+ params=None,
+ request_options=None,
+ )
+
+ # We care that httpx receives params=None, not [] or {}
+ assert "params" in dummy_client.last_request_kwargs
+ assert dummy_client.last_request_kwargs["params"] is None
+
+ # Verify the query string in the URL is preserved
+ url = str(dummy_client.last_request_kwargs["url"])
+ assert "after=123" in url, f"Expected query param 'after=123' in URL, got: {url}"
+
+
+def test_http_client_passes_encoded_params_when_present() -> None:
+ """Test that HttpClient passes encoded params when params are provided."""
+ dummy_client = _DummySyncClient()
+ http_client = HttpClient(
+ httpx_client=dummy_client, # type: ignore[arg-type]
+ base_timeout=lambda: None,
+ base_headers=lambda: {},
+ base_url=lambda: "https://example.com/resource",
+ )
+
+ http_client.request(
+ path="",
+ method="GET",
+ params={"after": "456"},
+ request_options=None,
+ )
+
+ params = dummy_client.last_request_kwargs["params"]
+ # For a simple dict, encode_query should give a single (key, value) tuple
+ assert params == [("after", "456")]
+
+
+@pytest.mark.asyncio
+async def test_async_http_client_does_not_pass_empty_params_list() -> None:
+ """Test that AsyncHttpClient passes params=None when params are empty.
+
+ This prevents httpx from stripping existing query parameters from the URL,
+ which happens when params=[] or params={} is passed.
+ """
+ dummy_client = _DummyAsyncClient()
+ http_client = AsyncHttpClient(
+ httpx_client=dummy_client, # type: ignore[arg-type]
+ base_timeout=lambda: None,
+ base_headers=lambda: {},
+ base_url=lambda: "https://example.com",
+ async_base_headers=None,
+ )
+
+ # Use a path with query params (e.g., pagination cursor URL)
+ await http_client.request(
+ path="resource?after=123",
+ method="GET",
+ params=None,
+ request_options=None,
+ )
+
+ # We care that httpx receives params=None, not [] or {}
+ assert "params" in dummy_client.last_request_kwargs
+ assert dummy_client.last_request_kwargs["params"] is None
+
+ # Verify the query string in the URL is preserved
+ url = str(dummy_client.last_request_kwargs["url"])
+ assert "after=123" in url, f"Expected query param 'after=123' in URL, got: {url}"
+
+
+@pytest.mark.asyncio
+async def test_async_http_client_passes_encoded_params_when_present() -> None:
+ """Test that AsyncHttpClient passes encoded params when params are provided."""
+ dummy_client = _DummyAsyncClient()
+ http_client = AsyncHttpClient(
+ httpx_client=dummy_client, # type: ignore[arg-type]
+ base_timeout=lambda: None,
+ base_headers=lambda: {},
+ base_url=lambda: "https://example.com/resource",
+ async_base_headers=None,
+ )
+
+ await http_client.request(
+ path="",
+ method="GET",
+ params={"after": "456"},
+ request_options=None,
+ )
+
+ params = dummy_client.last_request_kwargs["params"]
+ # For a simple dict, encode_query should give a single (key, value) tuple
+ assert params == [("after", "456")]
+
+
+def test_basic_url_joining() -> None:
+ """Test basic URL joining with a simple base URL and path."""
+ result = _build_url("https://api.example.com", "/users")
+ assert result == "https://api.example.com/users"
+
+
+def test_basic_url_joining_trailing_slash() -> None:
+ """Test basic URL joining with a simple base URL and path."""
+ result = _build_url("https://api.example.com/", "/users")
+ assert result == "https://api.example.com/users"
+
+
+def test_preserves_base_url_path_prefix() -> None:
+ """Test that path prefixes in base URL are preserved.
+
+ This is the critical bug fix - urllib.parse.urljoin() would strip
+ the path prefix when the path starts with '/'.
+ """
+ result = _build_url("https://cloud.example.com/org/tenant/api", "/users")
+ assert result == "https://cloud.example.com/org/tenant/api/users"
+
+
+def test_preserves_base_url_path_prefix_trailing_slash() -> None:
+ """Test that path prefixes in base URL are preserved."""
+ result = _build_url("https://cloud.example.com/org/tenant/api/", "/users")
+ assert result == "https://cloud.example.com/org/tenant/api/users"
diff --git a/tests/utils/test_query_encoding.py b/tests/utils/test_query_encoding.py
new file mode 100644
index 00000000..eedb28a4
--- /dev/null
+++ b/tests/utils/test_query_encoding.py
@@ -0,0 +1,36 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from square.core.query_encoder import encode_query
+
+
+def test_query_encoding_deep_objects() -> None:
+ assert encode_query({"hello world": "hello world"}) == [("hello world", "hello world")]
+ assert encode_query({"hello_world": {"hello": "world"}}) == [("hello_world[hello]", "world")]
+ assert encode_query({"hello_world": {"hello": {"world": "today"}, "test": "this"}, "hi": "there"}) == [
+ ("hello_world[hello][world]", "today"),
+ ("hello_world[test]", "this"),
+ ("hi", "there"),
+ ]
+
+
+def test_query_encoding_deep_object_arrays() -> None:
+ assert encode_query({"objects": [{"key": "hello", "value": "world"}, {"key": "foo", "value": "bar"}]}) == [
+ ("objects[key]", "hello"),
+ ("objects[value]", "world"),
+ ("objects[key]", "foo"),
+ ("objects[value]", "bar"),
+ ]
+ assert encode_query(
+ {"users": [{"name": "string", "tags": ["string"]}, {"name": "string2", "tags": ["string2", "string3"]}]}
+ ) == [
+ ("users[name]", "string"),
+ ("users[tags]", "string"),
+ ("users[name]", "string2"),
+ ("users[tags]", "string2"),
+ ("users[tags]", "string3"),
+ ]
+
+
+def test_encode_query_with_none() -> None:
+ encoded = encode_query(None)
+ assert encoded is None
diff --git a/tests/utils/test_serialization.py b/tests/utils/test_serialization.py
new file mode 100644
index 00000000..928ebfb7
--- /dev/null
+++ b/tests/utils/test_serialization.py
@@ -0,0 +1,72 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from typing import Any, List
+
+from .assets.models import ObjectWithOptionalFieldParams, ShapeParams
+
+from square.core.serialization import convert_and_respect_annotation_metadata
+
+UNION_TEST: ShapeParams = {"radius_measurement": 1.0, "shape_type": "circle", "id": "1"}
+UNION_TEST_CONVERTED = {"shapeType": "circle", "radiusMeasurement": 1.0, "id": "1"}
+
+
+def test_convert_and_respect_annotation_metadata() -> None:
+ data: ObjectWithOptionalFieldParams = {
+ "string": "string",
+ "long_": 12345,
+ "bool_": True,
+ "literal": "lit_one",
+ "any": "any",
+ }
+ converted = convert_and_respect_annotation_metadata(
+ object_=data, annotation=ObjectWithOptionalFieldParams, direction="write"
+ )
+ assert converted == {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"}
+
+
+def test_convert_and_respect_annotation_metadata_in_list() -> None:
+ data: List[ObjectWithOptionalFieldParams] = [
+ {"string": "string", "long_": 12345, "bool_": True, "literal": "lit_one", "any": "any"},
+ {"string": "another string", "long_": 67890, "list_": [], "literal": "lit_one", "any": "any"},
+ ]
+ converted = convert_and_respect_annotation_metadata(
+ object_=data, annotation=List[ObjectWithOptionalFieldParams], direction="write"
+ )
+
+ assert converted == [
+ {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"},
+ {"string": "another string", "long": 67890, "list": [], "literal": "lit_one", "any": "any"},
+ ]
+
+
+def test_convert_and_respect_annotation_metadata_in_nested_object() -> None:
+ data: ObjectWithOptionalFieldParams = {
+ "string": "string",
+ "long_": 12345,
+ "union": UNION_TEST,
+ "literal": "lit_one",
+ "any": "any",
+ }
+ converted = convert_and_respect_annotation_metadata(
+ object_=data, annotation=ObjectWithOptionalFieldParams, direction="write"
+ )
+
+ assert converted == {
+ "string": "string",
+ "long": 12345,
+ "union": UNION_TEST_CONVERTED,
+ "literal": "lit_one",
+ "any": "any",
+ }
+
+
+def test_convert_and_respect_annotation_metadata_in_union() -> None:
+ converted = convert_and_respect_annotation_metadata(object_=UNION_TEST, annotation=ShapeParams, direction="write")
+
+ assert converted == UNION_TEST_CONVERTED
+
+
+def test_convert_and_respect_annotation_metadata_with_empty_object() -> None:
+ data: Any = {}
+ converted = convert_and_respect_annotation_metadata(object_=data, annotation=ShapeParams, direction="write")
+ assert converted == data