Create Availability Rules
You can create an availability rule to link to objects later using the createAvailability
function.
Here's a recipe for creating availability
rules:
🚀
Create Availability Rules
Open Recipe
The inputs for availability
are:
Input | Additional | Description |
---|---|---|
title | A human-friendly title for the availability rule that will display in the Skylark UI | |
slug | A computer-friendly name for the availability rule | |
start | The starting availability date | |
end | The ending availability date | |
dimensions | Each object contains | An array containing one or many availability dimensions to link |
dimension_slug | The slug of the existing availability dimension. This dimension must already exist in the database or a NotFound error will be thrown. | |
value_slugs | An array of strings containing the slugs for dimension values, as with the dimension slug, these values must already exist in the database or a NotFound error will be thrown. |
Default Behaviours
When creating availability all input fields are optional. If you don’t supply data to a field the following will happen:
Field | Result |
---|---|
title | Nothing will happen, title will just be left as null |
slug | Nothing will happen, slug will just be left as null |
start | The start date will be automatically set to a date in the distant past to simulate no effective start date |
end | The end date will be automatically set to a date in the distant future to simulate no effective end date |
dimensions | If no dimensions are supplied this availability will be temporal only and will not be valid if the user supplies dimensions in a query |
Example
mutation createAvailability {
createAvailability(availability: {
title: "Tokyo Premiere",
slug: "tokyo-premiere",
start: "",
end: "",
dimensions: {
link: [
{
dimension_slug: "operating-system",
value_slugs: ["ios", "android"]
}
]
}
})
# Return fields
{
uid
title
}
}
Updated 5 months ago