Top
@Kitty4D on the B-Chain
just my adventures with the blockchain, web3, cryptocurrencies, and NFTs
Developer, Content Creator, Former Camgirl
aka @kitty4Do, $kitty4d
kitty4d Profile Photo

Post by kitty4d

2022-02-08
• 2 months ago
@100 @Dylanjaggerlee @TyFischer @AlexValaitis @TeamDeSo help me to know how to do this via github and i can probably just knock out a bunch since i'm doing this in parallel with updating my javascript to call the method in question. no idea how this will end up looking once posted, if the indentation is gone i can send it another way. https://github.com/deso-protocol/docs/blob/e6cb98ac40f35401b8fc54fb6b809fc8752f007f/devs/backend-api.md#get-posts-for-public-key ### Get Posts For Public Key ```text POST /api/v0/get-posts-for-public-key ``` Get posts for a public key or username. Can be used to retrieve all posts by a user when viewing their profile page. Example use in [frontend](https://github.com/deso-protocol/frontend/blob/afcc2c14edcee62bcdded4738b225c9349cf44e3/src/app/creator-profile-page/creator-profile-posts/creator-profile-posts.component.ts#L51) and endpoint implementation in [backend](https://github.com/deso-protocol/backend/blob/ecb04939469a61ae1dd3510dbd140d31fc9f5d5d/routes/post.go#L1463). **Parameters** Retrieves posts by a user. Either PublicKeyBase58Check or Username can be set to locate the user. | Name | Type | Description | | :--- | :--- | :--- | | PublicKeyBase58Check | string | Poster's public key | | Username | string | Poster's username | | ReaderPublicKeyBase58Check | string | Reader's public key (optional) | | LastPostHashHex | string | Hash of last post for paging (optional) | | NumToFetch | uint64 | Number of posts to fetch | | MediaRequired | bool | If true, only include posts with photos and/or videos (optional) | **Response** Example response only represents one type of post configuration. You will want to test each post configuration out in order to understand how best to parse the response. The following response is a post having no comments and it is not a quote repost. If a Reader's public key was passed, the response contains information regarding the reader. For example, PostEntryReaderState ([backend class definition](https://github.com/deso-protocol/frontend/blob/afcc2c14edcee62bcdded4738b225c9349cf44e3/src/app/backend-api.service.ts#L316)), which contains information about if the reader liked, bestowed diamonds upon, and/or reposted the post. ```text { Posts: [ { "PostHashHex": "...", "PosterPublicKeyBase58Check": "...", "ParentStakeID": "", "Body": "...", "ImageURLs": [ "..." ], "VideoURLs": null, "RepostedPostEntryResponse": null, "CreatorBasisPoints": 1000, "StakeMultipleBasisPoints": 12500, "TimestampNanos": 0, "IsHidden": false, "ConfirmationBlockHeight": 0, "InMempool": false, "ProfileEntryResponse": null, "Comments": null, "LikeCount": 0, "DiamondCount": 0, "PostEntryReaderState": null, "InGlobalFeed": false, "InHotFeed": false, "IsPinned": false, "PostExtraData": { "Language": "en", "Node": "0" }, "CommentCount": 0, "RepostCount": 0, "QuoteRepostCount": 0, "ParentPosts": null, "IsNFT": false, "NumNFTCopies": 0, "NumNFTCopiesForSale": 0, "NumNFTCopiesBurned": 0, "HasUnlockable": false, "NFTRoyaltyToCreatorBasisPoints": 0, "NFTRoyaltyToCoinBasisPoints": 0, "AdditionalDESORoyaltiesMap": {}, "AdditionalCoinRoyaltiesMap": {}, "DiamondsFromSender": 0, "HotnessScore": 0, "PostMultiplier": 0, "RecloutCount": 0, "QuoteRecloutCount": 0, "RecloutedPostEntryResponse": null } ], "LastPostHashHex": "..." } ```
mcmarsh Profile Photo kitty4D Profile Photo
Likes:
4
Diamonds:
3
Reposts:
0
Quote Reposts:
0

comments

mcmarsh Profile Photo
mcmarsh
2022-02-08
• 2 months ago
is this a example of not just posts but also reply fetching ?
Likes:
0
Diamonds:
1
Reposts:
0
Quote Reposts:
0
kitty4D Profile Photo
kitty4D
2022-02-08
• 2 months ago
it's literally just what should go here: https://docs.deso.org/devs/backend-api#get-posts-for-public-key it's basic documentation for the backend API method get-posts-for-public-key, used for instance on a user's profile page to get only posts by that one particular user. i assumed it would return comments in the "Comments" field, i was getting a null value for that for a post with 0 comments, but it looks like for this post it's also returning null there though it shows 1 for the number of comments (yours). i don't know for sure, haven't tried yet!
Likes:
1
Diamonds:
1
Reposts:
0
Quote Reposts:
0
{
   PostHashHex: "88fcb4ca73bb980cd64f70b53cc9e5642bce36e9d933aaf93ca8ae682e126320",
   PosterPublicKeyBase58Check: "BC1YLgbCAxYSSn97DArZtbwwhVUtHtjUfGZzKojLBKfxP8wbRHvb2Gz",
   ParentStakeID: "",
   Body: "@100 @Dylanjaggerlee @TyFischer @AlexValaitis @TeamDeSo \n\nhelp me to know how to do this via github and i can probably just knock out a bunch since i'm doing this in parallel with updating my javascript to call the method in question.\n\nno idea how this will end up looking once posted, if the indentation is gone i can send it another way.\n\nhttps://github.com/deso-protocol/docs/blob/e6cb98ac40f35401b8fc54fb6b809fc8752f007f/devs/backend-api.md#get-posts-for-public-key\n\n### Get Posts For Public Key\n\n```text\nPOST /api/v0/get-posts-for-public-key\n```\n\nGet posts for a public key or username. Can be used to retrieve all posts by a user when viewing their profile page. Example use in [frontend](https://github.com/deso-protocol/frontend/blob/afcc2c14edcee62bcdded4738b225c9349cf44e3/src/app/creator-profile-page/creator-profile-posts/creator-profile-posts.component.ts#L51) and endpoint implementation in [backend](https://github.com/deso-protocol/backend/blob/ecb04939469a61ae1dd3510dbd140d31fc9f5d5d/routes/post.go#L1463).\n\n**Parameters**\n\nRetrieves posts by a user. Either PublicKeyBase58Check or Username can be set to locate the user. \n\n| Name | Type | Description |\n| :--- | :--- | :--- |\n| PublicKeyBase58Check | string | Poster's public key |\n| Username | string | Poster's username |\n| ReaderPublicKeyBase58Check | string | Reader's public key (optional) |\n| LastPostHashHex | string | Hash of last post for paging (optional) |\n| NumToFetch | uint64 | Number of posts to fetch |\n| MediaRequired | bool | If true, only include posts with photos and/or videos (optional) |\n\n**Response**\n\nExample response only represents one type of post configuration. \nYou will want to test each post configuration out in order to understand how best to parse the response. The following response is a post having no comments and it is not a quote repost.\n\nIf a Reader's public key was passed, the response contains information regarding the reader. For example, PostEntryReaderState ([backend class definition](https://github.com/deso-protocol/frontend/blob/afcc2c14edcee62bcdded4738b225c9349cf44e3/src/app/backend-api.service.ts#L316)), which contains information about if the reader liked, bestowed diamonds upon, and/or reposted the post.\n\n```text\n{\n    Posts: [\n        {\n            \"PostHashHex\": \"...\",\n            \"PosterPublicKeyBase58Check\": \"...\",\n            \"ParentStakeID\": \"\",\n            \"Body\": \"...\",\n            \"ImageURLs\": [\n                \"...\"\n            ],\n            \"VideoURLs\": null,\n            \"RepostedPostEntryResponse\": null,\n            \"CreatorBasisPoints\": 1000,\n            \"StakeMultipleBasisPoints\": 12500,\n            \"TimestampNanos\": 0,\n            \"IsHidden\": false,\n            \"ConfirmationBlockHeight\": 0,\n            \"InMempool\": false,\n            \"ProfileEntryResponse\": null,\n            \"Comments\": null,\n            \"LikeCount\": 0,\n            \"DiamondCount\": 0,\n            \"PostEntryReaderState\": null,\n            \"InGlobalFeed\": false,\n            \"InHotFeed\": false,\n            \"IsPinned\": false,\n            \"PostExtraData\": {\n                \"Language\": \"en\",\n                \"Node\": \"0\"\n            },\n            \"CommentCount\": 0,\n            \"RepostCount\": 0,\n            \"QuoteRepostCount\": 0,\n            \"ParentPosts\": null,\n            \"IsNFT\": false,\n            \"NumNFTCopies\": 0,\n            \"NumNFTCopiesForSale\": 0,\n            \"NumNFTCopiesBurned\": 0,\n            \"HasUnlockable\": false,\n            \"NFTRoyaltyToCreatorBasisPoints\": 0,\n            \"NFTRoyaltyToCoinBasisPoints\": 0,\n            \"AdditionalDESORoyaltiesMap\": {},\n            \"AdditionalCoinRoyaltiesMap\": {},\n            \"DiamondsFromSender\": 0,\n            \"HotnessScore\": 0,\n            \"PostMultiplier\": 0,\n            \"RecloutCount\": 0,\n            \"QuoteRecloutCount\": 0,\n            \"RecloutedPostEntryResponse\": null\n        }\n    ],\n    \"LastPostHashHex\": \"...\"\n}\n```",
   ImageURLs: null,
   VideoURLs: null,
   RepostedPostEntryResponse: null,
   CreatorBasisPoints: 1000,
   StakeMultipleBasisPoints: 12500,
   TimestampNanos: 1644284411969028900,
   IsHidden: false,
   ConfirmationBlockHeight: 102236,
   InMempool: false,
   ProfileEntryResponse: {
      Username: "kitty4d"
   },
   Comments: null,
   LikeCount: 4,
   DiamondCount: 3,
   PostEntryReaderState: null,
   InGlobalFeed: false,
   InHotFeed: false,
   IsPinned: false,
   PostExtraData: {
      Language: "en-US",
      Node: "11"
   },
   CommentCount: 2,
   RepostCount: 0,
   QuoteRepostCount: 0,
   ParentPosts: null,
   IsNFT: false,
   NumNFTCopies: 0,
   NumNFTCopiesForSale: 0,
   NumNFTCopiesBurned: 0,
   HasUnlockable: false,
   NFTRoyaltyToCreatorBasisPoints: 0,
   NFTRoyaltyToCoinBasisPoints: 0,
   AdditionalDESORoyaltiesMap: {},
   AdditionalCoinRoyaltiesMap: {},
   DiamondsFromSender: 0,
   HotnessScore: 0,
   PostMultiplier: 0,
   RecloutCount: 0,
   QuoteRecloutCount: 0,
   RecloutedPostEntryResponse: null
}
[
   {
      PostHashHex: "8e45f42900963f3aacc998c63b93d26209a82b7c8b2386d6c5d380796434f427",
      PosterPublicKeyBase58Check: "BC1YLiaMnyaKdaE48TemmcYnizr5FA99iR8ThXLuYJb9ExZnpxizs5g",
      ParentStakeID: "88fcb4ca73bb980cd64f70b53cc9e5642bce36e9d933aaf93ca8ae682e126320",
      Body: "is this a example of not just posts but also reply fetching ?",
      ImageURLs: null,
      VideoURLs: null,
      RepostedPostEntryResponse: null,
      CreatorBasisPoints: 1000,
      StakeMultipleBasisPoints: 12500,
      TimestampNanos: 1644284919522918700,
      IsHidden: false,
      ConfirmationBlockHeight: 102236,
      InMempool: false,
      ProfileEntryResponse: {
         PublicKeyBase58Check: "BC1YLiaMnyaKdaE48TemmcYnizr5FA99iR8ThXLuYJb9ExZnpxizs5g",
         Username: "mcmarsh",
         Description: "Matt\nOct > Recovering from (3rd) Heart Attack \nFrom UK desogeo.com/map?account=mcmarsh\n\nsince Mar 2021\n @_science @_music @_tech #Film \n\nhttps://twitter.com/mcmarsh\n\npeople who will tell you I'm real:\[email protected] and @jemarsh (my brothers)\[email protected] and @NirvanaHTX from @NachoAverageCall video call\n\n",
         IsHidden: false,
         IsReserved: false,
         IsVerified: false,
         Comments: null,
         Posts: null,
         CoinEntry: {
            CreatorBasisPoints: 3000,
            DeSoLockedNanos: 11344689717,
            NumberOfHolders: 434,
            CoinsInCirculationNanos: 22469706941,
            CoinWatermarkNanos: 25779063229,
            BitCloutLockedNanos: 11344689717
         },
         DAOCoinEntry: {
            NumberOfHolders: 0,
            CoinsInCirculationNanos: "0x0",
            MintingDisabled: false,
            TransferRestrictionStatus: "unrestricted"
         },
         CoinPriceDeSoNanos: 1514664728,
         CoinPriceBitCloutNanos: 1514664728,
         UsersThatHODL: null,
         IsFeaturedTutorialWellKnownCreator: false,
         IsFeaturedTutorialUpAndComingCreator: false,
         ExtraData: null
      },
      Comments: null,
      LikeCount: 0,
      DiamondCount: 1,
      PostEntryReaderState: {
         LikedByReader: false,
         DiamondLevelBestowed: 1,
         RepostedByReader: false,
         RepostPostHashHex: ""
      },
      IsPinned: false,
      PostExtraData: {
         Language: "en-US",
         Node: "11"
      },
      CommentCount: 1,
      RepostCount: 0,
      QuoteRepostCount: 0,
      ParentPosts: null,
      IsNFT: false,
      NumNFTCopies: 0,
      NumNFTCopiesForSale: 0,
      NumNFTCopiesBurned: 0,
      HasUnlockable: false,
      NFTRoyaltyToCreatorBasisPoints: 0,
      NFTRoyaltyToCoinBasisPoints: 0,
      AdditionalDESORoyaltiesMap: {},
      AdditionalCoinRoyaltiesMap: {},
      DiamondsFromSender: 0,
      HotnessScore: 0,
      PostMultiplier: 0,
      RecloutCount: 0,
      QuoteRecloutCount: 0,
      RecloutedPostEntryResponse: null,
      Depth: 0
   },
   {
      PostHashHex: "af957744ea443570bda64842ff57a2ee5fc6c13005db41bd0fb42e79274f4bd7",
      PosterPublicKeyBase58Check: "BC1YLgbCAxYSSn97DArZtbwwhVUtHtjUfGZzKojLBKfxP8wbRHvb2Gz",
      ParentStakeID: "8e45f42900963f3aacc998c63b93d26209a82b7c8b2386d6c5d380796434f427",
      Body: "it's literally just what should go here:\n\nhttps://docs.deso.org/devs/backend-api#get-posts-for-public-key\n\nit's basic documentation for the backend API method get-posts-for-public-key, used for instance on a user's profile page to get only posts by that one particular user.\n\ni assumed it would return comments in the \"Comments\" field, i was getting a null value for that for a post with 0 comments, but it looks like for this post it's also returning null there though it shows 1 for the number of comments (yours). i don't know for sure, haven't tried yet!",
      ImageURLs: null,
      VideoURLs: null,
      RepostedPostEntryResponse: null,
      CreatorBasisPoints: 1000,
      StakeMultipleBasisPoints: 12500,
      TimestampNanos: 1644285864645733000,
      IsHidden: false,
      ConfirmationBlockHeight: 102240,
      InMempool: false,
      ProfileEntryResponse: {
         PublicKeyBase58Check: "BC1YLgbCAxYSSn97DArZtbwwhVUtHtjUfGZzKojLBKfxP8wbRHvb2Gz",
         Username: "kitty4D",
         Description: "I make fun images, \nwrite strange stories about my cats, \ngive funky comments. ^^ \n\nfounded 2021-11-13\n\n~i am verified~ at many sites but don't worry about it. just check out my own website, https://kitty.fourdown.org\n\ni am a developer, i have two websites that i created with @4down - https://www.fourdown.org [for developers primarily, has information about API endpoints not covered in the docs + more] and the aforementioned https://kitty.fourdown.org - but at the moment they're kinda on hold since there's little dev support here, so i'm working on DeFi projects now on Ethereum~",
         IsHidden: false,
         IsReserved: false,
         IsVerified: false,
         Comments: null,
         Posts: null,
         CoinEntry: {
            CreatorBasisPoints: 2169,
            DeSoLockedNanos: 17076138394,
            NumberOfHolders: 46,
            CoinsInCirculationNanos: 25042454952,
            CoinWatermarkNanos: 28101520468,
            BitCloutLockedNanos: 17076138394
         },
         DAOCoinEntry: {
            NumberOfHolders: 0,
            CoinsInCirculationNanos: "0x0",
            MintingDisabled: false,
            TransferRestrictionStatus: "unrestricted"
         },
         CoinPriceDeSoNanos: 2045662871,
         CoinPriceBitCloutNanos: 2045662871,
         UsersThatHODL: null,
         IsFeaturedTutorialWellKnownCreator: false,
         IsFeaturedTutorialUpAndComingCreator: false,
         ExtraData: null
      },
      Comments: null,
      LikeCount: 1,
      DiamondCount: 1,
      PostEntryReaderState: {
         LikedByReader: false,
         DiamondLevelBestowed: 0,
         RepostedByReader: false,
         RepostPostHashHex: ""
      },
      IsPinned: false,
      PostExtraData: {
         Language: "en",
         Node: "3"
      },
      CommentCount: 0,
      RepostCount: 0,
      QuoteRepostCount: 0,
      ParentPosts: null,
      IsNFT: false,
      NumNFTCopies: 0,
      NumNFTCopiesForSale: 0,
      NumNFTCopiesBurned: 0,
      HasUnlockable: false,
      NFTRoyaltyToCreatorBasisPoints: 0,
      NFTRoyaltyToCoinBasisPoints: 0,
      AdditionalDESORoyaltiesMap: {},
      AdditionalCoinRoyaltiesMap: {},
      DiamondsFromSender: 0,
      HotnessScore: 0,
      PostMultiplier: 0,
      RecloutCount: 0,
      QuoteRecloutCount: 0,
      RecloutedPostEntryResponse: null,
      Depth: 1
   }
]