Create Availability Rule
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:
title
: A human-friendly title for the availability rule that will display in the Skylark UIslug
: A computer-friendly name for the availability rulestart
: The starting availability dateend
: The ending availability datedimensions
: An array containing one or many availability dimensions to link, Each object contains: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.
When creating availability all input fields are optional. If you don’t supply data to a field the following will happen:
title
: Nothing will happen, title will just be left asnull
slug
: Nothing will happen, slug will just be left asnull
start
: The start date will be automatically set to a date in the distant past to simulate no effective start dateend
: The end date will be automatically set to a date in the distant future to simulate no effective end datedimensions
: If no dimensions are supplied this availability will be temporal only and will not be valid if the user supplies dimensions in a query
mutation MyMutation {
createAvailability(availability: {
title: "My availability",
slug: "my-availability",
start: "",
end: "",
dimensions: {
link: [
{
dimension_slug: "operating-system",
value_slugs: ["ios", "android"]
}
]
}
})
# Return fields
{
uid
title
}
}
Updated 3 months ago