queryPost

Get a single Post

Since postId are only available after the Post smart contract is deployed, we provide 2 queries to fetch Post, using PostId or Id. Both queries yield the same output,

Interface

GraphQL Schema
type Query {
  post(postId: String!): Post
  postById(id: String!): Post
}

Operation

query Post {
  post(postId: "0x6-0x2") {
    __typename
    id
    postId
    contractPublicationId
    profileId
    profile {
      handle
      metadataS3Url
    }
    contentS3Uri
    content
    comments {
      id
      commentId
      contractPublicationId
      profileId
      content
      profile {
        handle
        metadataS3Url
      }
    }
    mirrors {
      id
      mirrorId
      contractPublicationId
      profileId
      content
      profile {
        handle
        metadataS3Url
      }
    }
    stats {
      totalCollects
      totalComments
      totalMirrors
    }
  }
}

Response

JSON Response
{
  "data": {
    "post": {
      "__typename": "Post",
      "id": "58",
      "postId": "0x6-0x2",
      "contractPublicationId": "0x2",
      "profileId": "0x6",
      "profile": {
        "handle": "LunarLily",
        "metadataS3Url": "https://nabi-protocol-profile-nft-meta.s3.amazonaws.com/5162af7f-5aa8-475c-91a1-d4b5690a268b.json"
      },
      "contentS3Uri": "https://nabi-protocol-profile-nft-meta.s3.amazonaws.com/8e95914a-b751-4e0a-95ea-5554a85366ff.json",
      "content": "Sometimes one can have the best date with oneself and I'm feeling empowered! \nRemember to love yourself first and the rest will fall into place 💕👩‍❤️‍👩 \n#SelfLove #SingleLife #web3",
      "comments": [],
      "mirrors": [],
      "stats": {
        "totalCollects": 0,
        "totalComments": 0,
        "totalMirrors": 0
      }
    }
  }
}

Last updated