Lesson 4: Set Up Availability

Skylark's availability system uses customisable values called dimensions for assigning specific parameters to your availability rules.

These could include things like the users device type, region or account type.

Below is a set of example mutations for making a set of dimensions and assigning values to them.

mutation {
  # Create customer type dimension
  customer_type_dimension: createDimension(
    dimension: {
      slug: "customer-types", 
      title: "Customer Types", 
      description: "Customer subscription type"}
  ) {
    uid
    slug
  }
  # Add standard customer type dimension value
  standard_customer_dimension_values: createDimensionValue(
    dimension_id: "customer-types"
    dimension_value: {
      slug: "standard", 
      title: "Standard"
    }
  ) {
    uid
  }
  # Add premium customer type dimension value
  premium_customer_dimension_values: createDimensionValue(
    dimension_id: "customer-types"
    dimension_value: {
      slug: "vip", 
      title: "VIP"
    }
  ) {
    uid
  }
  
# Create device type dimension
  device_type_dimension: createDimension(
    dimension: {
      slug: "device-types", 
      title: "Device Types", 
      description: "Customer device type"
    }
  ) {
    uid
    slug
  }
  # Add desktop device type dimension value
  mobile_device_type_value: createDimensionValue(
    dimension_id: "device-types"
    dimension_value: {
      slug: "mobile", 
      title: "Mobile"
    }
  ) {
    uid
  }
  # Add mobile device type dimension value
  desktop_device_type_value: createDimensionValue(
    dimension_id: "device-types"
    dimension_value: {
      slug: "desktop", 
      title: "Desktop"
    }
  ) {
    uid
  }
  
  # Create region dimension
  region_dimension: createDimension(
    dimension: {
      slug: "region", 
      title: "Region", 
      description: "Customer Region"
    }
  ) {
    uid
    slug
  }
  # Add Europe region dimension value
  europe_region_value: createDimensionValue(
    dimension_id: "region"
    dimension_value: {
      slug: "europe", 
      title: "Europe"
    }
  ) {
    uid
  }
  # Add North America region dimension value
  north_american_region_value: createDimensionValue(
    dimension_id: "region"
    dimension_value: {
      slug: "north-america", 
      title: "North America"
    }
  ) {
    uid
  }
}

Result:

{
  "data": {
    "customer_type_dimension": {
      "uid": "01GSD5R631ZVKDE8YV3D3VZ0TK",
      "slug": "customer-types"
    },
    "standard_customer_dimension_values": {
      "uid": "01GSD5R7Q453CKDPFWGA84VMGY"
    },
    "premium_customer_dimension_values": {
      "uid": "01GSD5R7SM9YBVPK09BN0N719Y"
    },
    "device_type_dimension": {
      "uid": "01GSD5R7TWMA1G0FG1SCB9DMCW",
      "slug": "device-types"
    },
    "mobile_device_type_value": {
      "uid": "01GSD5R7W7XK5VTXPZAD2R672X"
    },
    "desktop_device_type_value": {
      "uid": "01GSD5R7XHK89C6RE1BW73BVSR"
    },
    "region_dimension": {
      "uid": "01GSD5R7YTRWCFM4367EK5XWCJ",
      "slug": "region"
    },
    "europe_region_value": {
      "uid": "01GSD5R80AKMVC3FYEK6HPH42W"
    },
    "north_american_region_value": {
      "uid": "01GSD5R81JYGY7BHNF0K4XNE27"
    }
  }
}