/birch-api

Primary LanguageJavaScript

TODOs

Mock

Test

Using REPL of graphQL https://github.com/graphql-cli/graphql-cli

Using /graphiql

query {
  conversations(clientId:"ddcd39c9-dcbc-4a26-bcf7-525d77c12d54") {
    id
    visitor
    client
    mode
    updatedAt
  }
}

An example with variable:

subscription onUpdateConversation($clientId:String) {
  updateConversation(clientId:$clientId) {
    id
    status
  } 
}

using variable:

{
  "clientId": "ddcd39c9-dcbc-4a26-bcf7-525d77c12d54"
}

with pagination:

query {
  conversations {
    id
     messagesConnection(first:2){
      edges {
        cursor
        node {
          id
          source
          text
        }
      }
    }
  }
}

query {
 NotificationsFeed(clientId:"abc") {
  notifications(first:1,last:10){
    totalCount
    edges{
      node {
        id
        text
      }
    }
    pageInfo{
      hasNextPage
      endCursor
    }
  }
 }
}
mutation {
  userCreate(record: {
    name: "My Name",
    age: 24,
    gender: ladyboy,
    contacts: {
      email: "mail@example.com",
      phones: [
        "111-222-333-444",
        "444-555-666-777"
      ]
    },
    languages: [{
      language: "english",
      skill: basic
    }],
    someMixed: {
      a: 1,
      b: 2,
      c: [ 1, 2, 3, true, false, { sub: 1 }]
    }
  }) {
    recordId
    record {
      name
      age
      gender
      languages {
        language
      }
      contacts {
        email
        phones
      }
      someMixed
    }
  }
}
query{
  userPagination(filter: { status: online }, perPage: 2, page: 2, sort: _ID_ASC) {
    items {
      name
    }
    count
    pageInfo {
      currentPage
      perPage
      itemCount
      pageCount
      hasPreviousPage
      hasNextPage
    }
  }
}

Code generator

Test

http://localhost:8003/playground

Permission

graphql-shield