@timelab/api
timelab's api graphql endpoint.
Last updated 2 years ago by mxmxmx .
UNLICENSED · Original npm · Tarball · package.json
$ cnpm install @timelab/api 
SYNC missed versions from official npm registry.

timelab GraphQL API

Summary

Configuration

Use dotenv files for configuration :

  • .env
  • .env.(development|test|production)
  • .env.local
  • .env.(development|test|production).local

*.local files should be ignored by git.

From original spec :
The first value set (or those already defined in the environment) take precedence

Interaction API

Get interactions

Request

{
  viewer {
    teamFeature {
      allTeams {
        name
        interactionLiveConnection {
          liveId
          allInteractions {
            type
            objectId
            id
            user
            createdAt
            grantInfo {
              operation
              service
            }
            isRead
          }
        }
      }
    }
  }
}

InteractionNode:

  • type : can be JOIN, REJECT, INVITE, GRANT, UNGRANT
  • objectId : As always the id of the object.
  • id : As always the id of the node in the response graph (usefull for relay to update the store)
  • createdAt
  • grandInfo :
    • JOIN, REJECT, INVITE : null value
    • GRANT or UNGRANT : service and operation
  • isRead : true if the current viewer has read the interaction.

Response

{
  "data": {
    "viewer": {
      "teamFeature": {
        "allTeams": [
          {
            "name": "timelab-test",
            "interactionLiveConnection": {
              "liveId": "interactions-live-id-timelab-test-0a016345-741f-4538-a9ce-477659c0d9e6",
              "allInteractions": [
                {
                  "type": "JOIN",
                  "objectId": "timelab-test-a8ebc1de-0320-11e7-93ae-92361f002671-4002fd8e-30af-4c2f-8424-3546d610ee0a",
                  "id": "0a016345-741f-4538-a9ce-477659c0d9e6-timelab-test-timelab-test-a8ebc1de-0320-11e7-93ae-92361f002671-4002fd8e-30af-4c2f-8424-3546d610ee0a",
                  "user": "tristan@timelab.io",
                  "createdAt": 1512774614799,
                  "grantInfo": null,
                  "isRead": false
                },
                {
                  "type": "GRANT",
                  "objectId": "timelab-test-a8ebc1de-0320-11e7-93ae-92361f002671-bed2f040-49de-4645-831c-464bd0c096dc",
                  "id": "0a016345-741f-4538-a9ce-477659c0d9e6-timelab-test-timelab-test-a8ebc1de-0320-11e7-93ae-92361f002671-bed2f040-49de-4645-831c-464bd0c096dc",
                  "user": "tristan@timelab.io",
                  "createdAt": 1512774615192,
                  "grantInfo": {
                    "operation": "listMembers",
                    "service": "TeamService"
                  },
                  "isRead": false
                }
              ]
            }
          }
        ]
      }
    }
  }
}

Read an interaction

Request

mutation readInteraction_Mutation(team:String!, interactionId:String!) {
  viewer {
    teamFeature {
      team(name:$team) {
        name
        interactionLiveConnection {
          liveId
          interaction(id:$interactionId) {
            actions {
              read
            }
          }
        }
      }
    }
  }
}

Subscribe to liveQuery

1/ Request

{
  viewer {
    teamFeature {
      allTeams {
        name
        interactionLiveConnection(isAlive:true) {
          liveId
          allInteractions {
            type
            objectId
            id
            user
            createdAt
            grantInfo {
              operation
              service
            }
            isRead
          }
        }
      }
    }
  }
}

Don't forget to get the liveId and set isAlive:true to the liveConnection.

2/ live subscription

Using the previous liveIds to call the following request.

subscription interactionLiveQuery(liveId:String!, team:String!) {
  live(liveId:$liveId) {
    viewer {
      teamFeature {
        team(name:$team) {
          name
          interactionLiveConnection {
            liveId
            allInteractions {
              type
              objectId
              id
              user
              createdAt
              grantInfo {
                operation
                service
              }
              isRead
            }
          }
        }
      }
    }
  }
}

This node inside the live is the same as the previous query except, the is not isAlive:true.

Current Tags

  • 3.0.27                                ...           latest (2 years ago)

23 Versions

  • 3.0.27                                ...           2 years ago
  • 3.0.26                                ...           2 years ago
  • 3.0.25                                ...           2 years ago
  • 3.0.24                                ...           2 years ago
  • 3.0.23                                ...           2 years ago
  • 3.0.22                                ...           2 years ago
  • 3.0.21                                ...           2 years ago
  • 3.0.20                                ...           2 years ago
  • 3.0.19                                ...           2 years ago
  • 3.0.18                                ...           2 years ago
  • 3.0.17                                ...           2 years ago
  • 3.0.16                                ...           2 years ago
  • 3.0.15                                ...           2 years ago
  • 3.0.14                                ...           2 years ago
  • 3.0.13                                ...           2 years ago
  • 3.0.12                                ...           2 years ago
  • 3.0.10                                ...           2 years ago
  • 3.0.9                                ...           2 years ago
  • 3.0.8                                ...           2 years ago
  • 3.0.7                                ...           2 years ago
  • 3.0.6                                ...           2 years ago
  • 3.0.5                                ...           2 years ago
  • 1.0.5                                ...           3 years ago

Copyright 2014 - 2016 © taobao.org |