Create Objects

Introduction

Creating objects is handled by the create<Object Name> mutation. For example: createEpisode.

Creating a new object in Skylark will do the following:

  • Create global version 1
  • Create language version 1 for the language specified (or the default language)
  • Create a compiled object, combining the global and language data
  • Create availability slots if they have been defined in the input

For adding availability see here.
For adding relationships see here.

Create Basic Objects

Here's a recipe for creating an object:

In this example we're creating an Episode Object:

mutation MyMutation {
  createEpisode(
    language: "en-GB",
    episode: {
      episode_number: 1,
      title: "The Mandalorian", 
      synopsis: "An armored bounty hunter takes on a well-paying yet cryptic assignment."
    }) {
    # Return fields
    uid
    title
    synopsis
  }
}

This is the response:

{
  "data": {
    "createEpisode": {
      "uid": "4220f2b2-db6c-4c26-b870-204066bf534a",
      "title": "The Mandalorian",
      "synopsis": "An armored bounty hunter takes on a well-paying yet cryptic assignment."
    }
  }
}