Pricings
albert.collections.pricings
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
client_credentials: ClientCredentials | None = None,
retries: int | None = None,
)
Bases: Session
A session that has a base URL, which is prefixed to all request URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
The base URL to prefix to all requests. (e.g., "https://sandbox.albertinvent.com") |
required |
retries
|
int
|
The number of retries for failed requests. Defaults to 3. |
None
|
client_credentials
|
ClientCredentials | None
|
The client credentials for programmatic authentication. Optional if token is provided. |
None
|
token
|
str | None
|
The JWT token for authentication. Optional if client credentials are provided. |
None
|
Methods:
Name | Description |
---|---|
request |
|
Source code in src/albert/session.py
request
Source code in src/albert/session.py
BaseCollection
BaseCollection(*, session: AlbertSession)
BaseCollection is the base class for all collection classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert API Session instance. |
required |
Source code in src/albert/collections/base.py
InventoryPricings
Bases: BaseAlbertModel
Pricings for a given InventoryItem.
Attributes:
Name | Type | Description |
---|---|---|
inventory_id |
Inventory
|
The inventory ID the pricings belong to. |
pricings |
list[Pricing]
|
The list of pricings. |
OrderBy
Pricing
Bases: BaseResource
A Price of a given InventoryItem at a given Location.
Attributes:
Name | Type | Description |
---|---|---|
id |
str | None
|
The Albert ID of the pricing. Set when the pricing is retrieved from Albert. |
inventory_id |
str
|
The Albert ID of the inventory item. |
company |
Company
|
The company that the pricing belongs to. |
location |
Location
|
The location that the pricing belongs to. |
description |
str | None
|
The description of the pricing. Optional. |
pack_size |
str | None
|
The pack size of the pricing. Optional. Used to calculate the cost per unit. |
price |
float
|
The price of the pricing IN CURRENCY/ KG or CURRENCY/L! Must do the conversion! Depends on InventoryItem's unit of measure. |
currency |
str
|
The currency of the pricing. Defaults to |
fob |
str | None
|
The FOB of the pricing. Optional. |
lead_time |
int | None
|
The lead time of the pricing. Optional. |
lead_time_unit |
LeadTimeUnit | None
|
The unit of measure for the provided lead time. Optional. |
expiration_date |
str | None
|
The expiration date of the pricing. YYYY-MM-DD format. |
company
class-attribute
instance-attribute
company: SerializeAsEntityLink[Company] = Field(
alias="Company"
)
default
class-attribute
instance-attribute
default: int | None = Field(
default=None, exclude=True, frozen=True
)
expiration_date
class-attribute
instance-attribute
expiration_date: str | None = Field(
default=None, alias="expirationDate"
)
inventory_id
class-attribute
instance-attribute
inventory_id: str | None = Field(
default=None, alias="parentId"
)
lead_time
class-attribute
instance-attribute
lead_time: int | None = Field(
default=None, alias="leadTime"
)
lead_time_unit
class-attribute
instance-attribute
location
class-attribute
instance-attribute
location: SerializeAsEntityLink[Location] = Field(
alias="Location"
)
pack_size
class-attribute
instance-attribute
pack_size: str | None = Field(
default=None, alias="packSize"
)
PricingBy
PricingCollection
PricingCollection(*, session: AlbertSession)
Bases: BaseCollection
PricingCollection is a collection class for managing Pricing entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Creates a new Pricing entity. |
delete |
Deletes a Pricing entity by its ID. |
get_by_id |
Retrieves a Pricing entity by its ID. |
get_by_inventory_id |
Returns a list of Pricing entities for the given inventory ID as per the provided parameters. |
get_by_inventory_ids |
Returns a list of Pricing resources for each parent inventory ID. |
update |
Updates a Pricing entity. |
Source code in src/albert/collections/pricings.py
create
Creates a new Pricing entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pricing
|
Pricing
|
The Pricing entity to create. |
required |
Returns:
Type | Description |
---|---|
Pricing
|
The created Pricing entity. |
Source code in src/albert/collections/pricings.py
delete
delete(*, id: str) -> None
Deletes a Pricing entity by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the Pricing entity to delete. |
required |
get_by_id
Retrieves a Pricing entity by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the Pricing entity to retrieve. |
required |
Returns:
Type | Description |
---|---|
Pricing
|
The Pricing entity if found, None otherwise. |
Source code in src/albert/collections/pricings.py
get_by_inventory_id
get_by_inventory_id(
*,
inventory_id: str,
group_by: PricingBy | None = None,
filter_by: PricingBy | None = None,
filter_id: str | None = None,
order_by: OrderBy | None = None,
) -> list[Pricing]
Returns a list of Pricing entities for the given inventory ID as per the provided parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
str
|
The ID of the inventory to retrieve pricings for. |
required |
group_by
|
PricingBy | None
|
Grouping by PricingBy, by default None |
None
|
filter_by
|
PricingBy | None
|
Filter by PricingBy, by default None |
None
|
filter_id
|
str | None
|
The string to use as the filter, by default None |
None
|
order_by
|
OrderBy | None
|
The order to sort the results by, by default None |
None
|
Returns:
Type | Description |
---|---|
list[Pricing]
|
A list of Pricing entities matching the provided parameters. |
Source code in src/albert/collections/pricings.py
get_by_inventory_ids
get_by_inventory_ids(
*, inventory_ids: list[InventoryId]
) -> list[InventoryPricings]
Returns a list of Pricing resources for each parent inventory ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_ids
|
list[str]
|
The list of inventory IDs to retrieve pricings for. |
required |
Returns:
Type | Description |
---|---|
list[InventoryPricing]
|
A list of InventoryPricing objects matching the provided inventory. |
Source code in src/albert/collections/pricings.py
update
Updates a Pricing entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pricing
|
Pricing
|
The updated Pricing entity. |
required |
Returns:
Type | Description |
---|---|
Pricing
|
The updated Pricing entity as it appears in Albert. |