Create Sets

Creating a new set is handled by the createSkylarkSet mutation.

New sets can be assigned:

titleThe human readable name for the set
slugThe machine readable name for the set
availabilityRules for the sets availability
objectsObjects to related to the set

When assigning content to a set a position argument must be supplied. This value indicates the order of the content within the set.

Create an empty set with availability

This example shows creating a new empty set with availability rules and no content.

mutation createSkylarkSet {
  createSkylarkSet(
    skylark_set: {
      title: "Big In Japan"
      availability: {
        create: { start: "2024-01-01T00:00:00Z", end: "2025-01-01T00:00:00Z" }
      }
    }
  ) {
    uid
    title
    slug
  }
}

Create a set and create an object to assign

This example shows creating a new set and creating an episode, with the position of 1, to assign to the new set.

📘

Notice the UID for the related episode is also returned upon completion!

The create argument can either accept a single object, or an array of objects. This example shows an array of objects.

mutation createSkylarkSet {
  createSkylarkSet(
    skylark_set: {
      title: "Big In Japan"
      content: {
        Episode: {
          create: [
            { position: 1, object: { title: "Nier Automata ver1.1a - s01e01" } }
          ]
        }
      }
    }
  ) {
    uid
    title
    slug
    content {
      objects {
        uid
      }
    }
  }
}

Create a new set and assign a preexisting episode

This example shows creating a new set and linking a preexisting episode, with the position of 1, to assign to the new set.

The link argument can either accept a single object, or an array of objects. This example shows an array of objects.

mutation createSkylarkSet {
  createSkylarkSet(
    skylark_set: {
      title: "Big In Japan"
      content: {
        Episode: {
          link: [
            { uid: "b0b30f89-df27-4ccf-a347-29680a9c45ec", position: 1 }
          ]
        }
      }
    }
  ) {
    uid
    title
    slug
    content {
      objects {
        uid
      }
    }
  }
}

Mix and match relationship inputs

This example shows updating a season and doing 3 different relationship operations:

  • Creating a new related episode
  • Linking an existing episode
  • Unlinking an already related episode
mutation updateSeason {
  updateSeason(uid: "<season UID>", season: {
    relationships: {
      episode: {
        create: {
          title: "Nier Automata ver1.1a - s01e02"
        },
        link: ["<Episode UID>"],
        unlink: ["<Another episode UID>"]
      }
    }
  ) 
  {
    uid
    episodes {
      uid
    }
  }
}

Create multiple child types

This example shows creating multiple different related objects in the same request

mutation createSeason {
  createSeason(season: {
    title: "Nier Automata ver1.1a - Season One", 
    relationships: {
      episodes: {
        create: {
          title: "Nier Automata ver1.1a - s01e02"
        }
      },
      brands: {
        create: {
          title: "Nier Automata ver1.1a"
        }
      }
    }
  ) 
  {
    uid
    brands {
      uid
    }
    episodes {
      uid
    }
  }
}