Skip to content

Dispatch

Creating dispatch query

mutation {
  createUserDispatch(
      org:"b8d93193-83fa-4e18-b942-addeb2c7350d", 
      userId:"aeebf9b0-ec2b-44dd-bbe2-9f9aa0c5f9cd",
      when: "2021-01-23",
      body: "Hello, world!"      
  ) {
    result
    id
    records
    error
  }
}

Result[Of creation]

{
  "data": {
    "createUserDispatch": {
      "result": true,
      "id": "e2ceaee2-cc36-446b-ab8b-b0308c82bc3f",
      "records": 1,
      "error": null
    }
  }
}

Query[Listing the dispatches data]

query {
  query2:dispatches (
    org:"b8d93193-83fa-4e18-b942-addeb2c7350d"
    query:"id:e2ceaee2-cc36-446b-ab8b-b0308c82bc3f") {
    entries {
      displayName
      body
      when
      createdAt
    }
  }

  query1:dispatches (
    org:"b8d93193-83fa-4e18-b942-addeb2c7350d"
    query:"current user from today") {
    entries {
      displayName
      body
      when
      createdAt
    }
  }  

}

Result[of List query]

{
  "data": {
    "query2": {
      "entries": [
        {
          "displayName": "Rob Gagne",
          "body": "Hello, world!",
          "when": "2021-01-23",
          "createdAt": "2021-01-23T08:57:21.000+09:00"
        }
      ]
    },
    "query1": {
      "entries": [
        {
          "displayName": "Rob Gagne",
          "body": "Hello, world!",
          "when": "2021-01-23",
          "createdAt": "2021-01-23T08:57:21.000+09:00"
        }
      ]
    }
  }
}