TalentLayer Documentation
  • 👋Introduction
    • Value Proposition
    • Options for Integration
      • On-Demand Integration
      • Native Integration
    • TalentLayer's Functions
      • PlatformID
        • Fees & Economics
      • TalentLayerID
      • Reviews
      • Services
      • Escrow and Dispute
        • Dispute Workflow
        • Arbitration
          • Kleros Arbitration
          • Platform Managed Arbitration
    • Current Network Liquidity
    • Decentralization
  • ⚙️Technical Guides
    • Web 3 SDK & API
    • StarterKit Template
    • Technical Schemas
    • Network Support
    • Lower-Level Guides
      • Smart Contracts
        • Deployments
        • TalentLayerPlatformID.sol
        • TalentLayerID.sol
        • TalentLayerService.sol
        • TalentLayerReview.sol
        • Escrow & Dispute Contracts
      • The Graph
        • Introduction
        • Querying from an application
        • Queries examples
        • Implementing the pagination
      • Metadata
      • Third-Party Modules
        • Lens Protocol - Social
        • XMTP - Messaging
        • Sismo - Privacy
        • Iexec - Web3Mail
      • Messaging
        • Integrating XMTP
      • Standards
        • ERC-792: Arbitration standard
        • ERC-1497: Evidence Standard
      • How-To Guides
        • How to implement minting TalentLayer IDs?
        • How to implement the service creation?
        • How to implement the proposal creation?
        • How to implement the proposal validation?
    • Delegation
      • Meta Transaction
      • Delegate System
        • Setting
        • User workflow
        • Service creation example
        • How mintForAddress works
  • ⭐Get a Platform ID
  • 🧠Inspiration for Builders
  • 💬Contact The Team
  • 🦝Core Developer Guides
    • Subgraph Local Setup
    • Smart Contracts Local Setup
    • Advanced Documentation
    • Contract & Graph Deployment Guide
    • TalentLayer Improvement Proposals
    • Audit Report
Powered by GitBook
On this page
  1. ⚙️Technical Guides
  2. Lower-Level Guides
  3. The Graph

Queries examples

PreviousQuerying from an applicationNextImplementing the pagination

Last updated 2 years ago

Was this helpful?

CtrlK
  • Get user information by Talent Layer Id
  • Get the service reviews by service id
  • Get the first 5 services informations after the 18 March with the open status
  • Get the total gain and the platform name of the first 3 users with a rating greater than 4

Was this helpful?

Here, we will explore the various queries that you can create.

Get user information by Talent Layer Id

{
  user(id: "59") {
    cid
    handle
    id
    numReviews
    description {
      about
      id
    }
    address
    updatedAt
  }
}
{
  "data": {
    "user": {
      "cid": "QmawFHVwFggkFC5FgY2i2dDPfqDiVGvzJJAM7NyxvCAU6W",
      "handle": "martin",
      "id": "59",
      "numReviews": "1",
      "description": {
        "about": "I'm a fan of robots, time rifts and giant bionic shark movies. And all things about #Web3, #Blockchain, #NFT, #Metaverse, #DEFI etc...",
        "id": "QmawFHVwFggkFC5FgY2i2dDPfqDiVGvzJJAM7NyxvCAU6W-1681747217",
      },
      "address": "0x1caab8ded4535bf42728fea90afa7da1ac637e1e",
      "updatedAt": "1681747217"
    }
  }
}

Get the service reviews by service id

{
  reviews {
    description {
      content
      id
    }
    rating
    to {
      id
      handle
    }
    service {
      id
      status
    }
  }
}
{
  "data": {
    "review": {
      "description": {
        "content": "Perfect!",
        "id": "QmW612hUxvg1SigPA5Y3msuBEuXfLaH3axp22dr1kwCXp8-1680027235"
      },
      "rating": "5",
      "to": {
        "id": "2",
        "handle": "migmig"
      },
      "service": {
        "id": "1",
        "status": "Finished"
      }
    }
  }
}

Get the first 5 services informations after the 18 March with the open status

{
  services(first: 3, where: {createdAt_gt: "1679149214", status: Opened}) {
    id
    createdAt
    updatedAt
    status
    description {
      about
      rateAmount
      rateToken
      startDate
      title
    }
  }
}
{
  "data": {
    "services": [
      {
        "id": "100",
        "createdAt": "1681996135",
        "updatedAt": "1681996135",
        "status": "Opened",
        "description": {
          "about": "We looking for a Solidity developer",
          "rateAmount": "1000000000000000000",
          "rateToken": "0x0000000000000000000000000000000000000000",
          "startDate": null,
          "title": "Solidity developer"
        }
      },
      {
        "id": "101",
        "createdAt": "1681997279",
        "updatedAt": "1681997279",
        "status": "Opened",
        "description": {
          "about": "We looking for a Rust developer",
          "rateAmount": "1000000000000000000",
          "rateToken": "0x0000000000000000000000000000000000000000",
          "startDate": null,
          "title": "Rust developer"
        }
      },
      {
        "id": "102",
        "createdAt": "1682017181",
        "updatedAt": "1682017181",
        "status": "Opened",
        "description": {
          "about": "We looking for a C++ developer",
          "rateAmount": "1000000000000000000",
          "rateToken": "0x0000000000000000000000000000000000000000",
          "startDate": null,
          "title": "C++ developer"
        }
      }
    ]
  }

Get the total gain and the platform name of the first 3 users with a rating greater than 4

{
  users(first: 3,where: {rating_gt: "4"}) {
    handle
    id
    numReviews
    platform {
      id
      name
    }
    totalGains {
      totalGain
    }
  }
}
{
  "data": {
    "users": [
      {
        "handle": "thomas",
        "id": "1",
        "numReviews": "1",
        "platform": {
          "id": "4",
          "name": "WorkX"
        },
        "totalGains": [
        {
            "totalGain": "14000000000"
          }
        ]
      },
      {
        "handle": "mattia",
        "id": "11",
        "numReviews": "1",
        "platform": "6clover",
        "totalGains": [
          {
            "totalGain": "100000000"
          }
        ]
      },
      {
        "handle": "migmig",
        "id": "2",
        "numReviews": "1",
        "platform": {
          "id": "4",
          "name": "indie"
        },
        "totalGains": [
          {
            "totalGain": "1000000000000000000"
          }
        ]
      }
    ]
  }
}

As you can see, you are not limited in your query building. Please feel free to contact us if you cannot find or build exactly what you need.