SKU

A stock keeping unit.

Attributes

access_type : SKUAccessType

What kind of access the stock keeping unit provides for its content.

application_id : int

The stock keeping unit's owner application identifier.

features : None, tuple<SKUFeature>

The features of the stock keeping unit.

flags : SKUFlag

The flags of the stock keeping unit.

id : int

The unique identifier number of the stock keeping unit.

name : str

The name of the stock keeping unit.

premium : bool

Whether the stock keeping unit is a premium one.

release_at : None, DateTime

When the stock keeping unit has its release. Can be both in the past and in the future as well.

slug : None, str

System generated url to the stock keeping unit generated based on its name.

type : SKUType

The stock keeping unit's type.

Notes

Stock keeping unit instances are weakreferable.

Properties

created_at

When the entity was created.

Returns

created_at : datetime

partial

Returns whether the stock keeping unit is partial.

Returns

partial : bool

Methods

__new__(...)

Creates a new partial stock keeping unit.

ParameterTypeOptionalKeyword onlyDescription
access_type

SKUAccessType, int

What kind of access the stock keeping unit provides for its content.

features

None, iterable<SKUFeature | int>, SKUFeature, int

The features of the stock keeping unit.

flags

SKUFlag, int

The flags of the stock keeping unit.

name

str

The name of the stock keeping unit.

premium

bool

Whether the stock keeping unit is a premium one.

release_at

None, DateTime

When the stock keeping unit has its release.

sku_type

SKUType, int

The stock keeping unit's type.

Raises

TypeError

  • If a parameter's type is incorrect.

ValueError

  • If a parameter's value is incorrect.

copy()

Copies the stock keeping unit.

Returns

new : instance<type<self>>

copy_with(...)

Copies the stock keeping unit with the given fields.

ParameterTypeOptionalKeyword onlyDescription
access_type

SKUAccessType, int

What kind of access the stock keeping unit provides for its content.

features

None, iterable<SKUFeature | int>, SKUFeature, int

The features of the stock keeping unit.

flags

SKUFlag, int

The flags of the stock keeping unit.

name

str

The stock keeping unit's name.

premium

bool

Whether the stock keeping unit is a premium one.

release_at

None, DateTime

When the stock keeping unit has its release.

sku_type

SKUType, int

The stock keeping unit's type.

Returns

new : instance<type<self>>

Raises

TypeError

  • If a parameter's type is incorrect.

ValueError

  • If a parameter's value is incorrect.

from_data(data)

Creates a new stock keeping unit.

ParameterTypeDescription
data

dict<str, object>

Stock keeping unit data.

Returns

new : instance<cls>

has_feature(feature)

Returns whether the stock keeping unit has the give feature.

ParameterTypeDescription
feature

SKUFeature

The feature to look for.

Returns

has_feature : bool

iter_features()

Iterates over the features of the stock keeping unit.

This method is an iterable generator.

Yields

feature : SKUFeature

precreate(sku_id, ...)

Creates an stock keeping unit instance.

ParameterTypeOptionalKeyword onlyDescription
sku_id

int

The stock keeping unit's identifier.

**keyword_parameters

Keyword parameters

Additional keyword parameters.

access_type

SKUAccessType, int

What kind of access the stock keeping unit provides for its content.

application

int, Application

Alternative for application_id.

application_id

int, Application

The stock keeping unit's owner application identifier.

features

None, iterable<SKUFeature | int>, SKUFeature, int

The features of the stock keeping unit.

flags

SKUFlag, int

The flags of the stock keeping unit.

name

str

The stock keeping unit's name.

premium

bool

Whether the stock keeping unit is a premium one.

release_at

None, DateTime

When the stock keeping unit has its release.

slug

None, str

System generated url to the stock keeping unit generated based on its name.

sku_type

SKUType, int

The stock keeping unit's type.

Returns

self : instance<cls>

Raises

TypeError

  • If a parameter's type is incorrect.

ValueError

  • If a parameter's value is incorrect.

to_data(...)

Converts the stock keeping unit into a json serializable object.

ParameterTypeOptionalKeyword onlyDefaultDescription
defaults

bool

False

Whether default field values should be included.

include_internals

bool

False

Whether internal fields should be included.

Returns

data : dict of (str, object) items

_create_empty(sku_id)

Creates a new stock keeping unit instance with it's attribute set to their default values.

ParameterTypeDescription
sku_id

int

The stock keeping unit's identifier.

Returns

self : instance<cls>

_get_hash_partial()

Calculates the stock keeping unit's hash based on their fields.

This method is called by .__hash__ if the channel has no .id set.

Returns

hash_value : int

_is_equal_same_type(other)

Returns whether self is equal to other. Other must be same type as self.

ParameterTypeDescription
other

instance<type<self>>

The other instance.

Returns

is_equal : bool

_set_attributes(data)

Sets the stock keeping unit's attributes. (Except .id.)

ParameterTypeDescription
data

dict<str, object>

Stock keeping unit data.

__eq__()

Returns whether the two stock keeping units are equal.

__ge__()

Whether this entity's id is greater or equal than the other's.

__getattr__()

Drops a rich attribute error.

__gt__()

Whether this entity's id is greater than the other's.

__hash__()

Returns the hash value of the stock keeping unit.

__le__()

Whether this entity's id is less or equal than the other's.

__lt__()

Whether this entity's id is less than the other's.

__ne__()

Returns whether the two stock keeping units are not equal.

__repr__()

Returns the stock keeping unit's representation.