Attribute set — an interface that indicates what data should be in the objects. They manage the content inside pages or products, as well as indicate the input parameters of forms.
Kotlin Multiplatform
All attribute sets
You can get a list of all attribute sets.
val result = AttributesSetsService.sets(
offset = 0,
limit = 30,
typeId = null,
sortBy = null,
)
val sets = result.items
Attributes within a set
You can get the attributes within a set. This can be useful for creating text fields for forms or forming a list of entity data.
You can also request a specific attribute, knowing the set marker and the attribute itself. This can be particularly useful when working with lists. This way, you can get all its elements.
val attribute = AttributesSetsService.attribute(
setMarker = "all",
attributeMarker = "list",
langCode = "en_US"
)
when(attribute) {
is Attribute.Entity -> TODO("Additional entity")
is Attribute.General -> TODO("A common attribute, such as an integer data type or string")
is Attribute.List -> TODO("List Attribute")
}
Swift
All attribute sets
You can get a list of all attribute sets.
let result = try await AttributesSetsService.sets(
offset: 0,
limit: 30,
typeId: nil,
sortBy: nil
)
let sets = result.items()
Attributes within a set
You can get the attributes within a set. This can be useful for creating text fields for forms or forming a list of entity data.
You can also request a specific attribute, knowing the set marker and the attribute itself. This can be particularly useful when working with lists. This way, you can get all its elements.
let attribute = try await AttributesSetsService.shared.attribute(
setMarker: "all",
attributeMarker: "list",
langCode: "en_US"
)
switch attribute {
case .general(let attribute):
break // TODO: A common attribute, such as an integer data type or string
case .list(let attribute):
break // TODO: List Attribute
case .entity(let attribute):
break // TODO: Additional entity
}