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:

The inputs for availability are:

InputAdditionalDescription
titleA human-friendly title for the availability rule that will display in the Skylark UI
slugA computer-friendly name for the availability rule
startThe starting availability date
endThe ending availability date
dimensionsEach object containsAn array containing one or many availability dimensions to link
dimension_slugThe slug of the existing availability dimension. This dimension must already exist in the database or a NotFound error will be thrown.
value_slugsAn 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:

FieldResult
titleNothing will happen, title will just be left as null
slugNothing will happen, slug will just be left as null
startThe start date will be automatically set to a date in the distant past to simulate no effective start date
endThe end date will be automatically set to a date in the distant future to simulate no effective end date
dimensionsIf 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
  }
}