Guides

App profile stats total

As you attach an appId to the publications you post the number of publications you did on profile Y on app Z can be different from app H numbers, this allows you to query by sources to get the correct stats if you're building an app that only cares about the content of the app.

API design

query Profile {
  profile(request: { profileId: "0x18" }) {
    stats {
      publicationsTotal(forSources: ["your_app_id"])
      postsTotal(forSources: ["your_app_id"])
      mirrorsTotal(forSources: ["your_app_id"])
      commentsTotal(forSources: ["your_app_id"])
      totalPublications
      totalPosts
      totalMirrors
      totalComments
    }
  }
}
{
  "data": {
    "profile": {
      "stats": {
        "publicationsTotal": 0,
        "postsTotal": 0,
        "mirrorsTotal": 0,
        "commentsTotal": 0,
        "totalPublications": 91,
        "totalPosts": 52,
        "totalMirrors": 11,
        "totalComments": 28
      }
    }
  }
}

Using LensClient SDK

const profileById = await lensClient.profile.stats(
  {
    handle: "pukkynext.test",
  },
  ["your_app_id"] // array of sources -> appIds you want the stats to be calculated for
);