import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.promotion.listRuleValues("rules", "attr_123")
.then(({ values }) => {
console.log(values)
}){
"limit": 123,
"offset": 123,
"count": 123,
"values": [
{
"value": "reg_123",
"label": "Europe Region"
}
]
}Retrieve all potential values for promotion rules and target and buy rules based on the specified rule attribute and type.
For example, if you provide the ID of the currency_code rule attribute, and set rule_type to rules, a list of currencies are retrieved in label-value pairs.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.promotion.listRuleValues("rules", "attr_123")
.then(({ values }) => {
console.log(values)
}){
"limit": 123,
"offset": 123,
"count": 123,
"values": [
{
"value": "reg_123",
"label": "Europe Region"
}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The rule type.
rules, target-rules, buy-rules The rule attribute's ID.
The number of items to skip when retrieving a list.
Limit the number of items returned in the list.
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
Whether to include deleted records in the result.
The application method target type to retrieve rules for.
Apply a search query on the rule values' searchable properties.
Filter by a specific rule value.
Comma-separated fields that should be included in the returned data. If a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. Without prefix it will replace the entire default fields.
OK
The paginated list of rule values.
The maximum number of items returned.
The number of items skipped before retrieving the returned items.
The total number of items.