From 30cb2806fdcfcfb6eb558f435f8fe4a1f0bef909 Mon Sep 17 00:00:00 2001 From: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com> Date: Fri, 27 Feb 2026 14:59:15 -0800 Subject: [PATCH] Normalize write response shape, add blockhash, blocknumber --- api/swagger/swagger-v1.yaml | 57 +++++++++++++++++++++++++--------- api/v1_comments.go | 24 +++++++++----- api/v1_grants.go | 15 ++++++--- api/v1_playlist.go | 9 ++++-- api/v1_playlist_favorites.go | 6 ++-- api/v1_playlist_reposts.go | 6 ++-- api/v1_playlist_shares.go | 3 +- api/v1_track.go | 6 ++-- api/v1_track_downloads.go | 3 +- api/v1_track_favorites.go | 6 ++-- api/v1_track_reposts.go | 6 ++-- api/v1_track_shares.go | 3 +- api/v1_users.go | 6 ++-- api/v1_users_developer_apps.go | 8 +++-- api/v1_users_followers.go | 6 ++-- api/v1_users_muted.go | 6 ++-- api/v1_users_subscribers.go | 6 ++-- 17 files changed, 122 insertions(+), 54 deletions(-) diff --git a/api/swagger/swagger-v1.yaml b/api/swagger/swagger-v1.yaml index b727325b..9bd27163 100644 --- a/api/swagger/swagger-v1.yaml +++ b/api/swagger/swagger-v1.yaml @@ -10415,12 +10415,16 @@ components: create_user_response: type: object properties: - success: - type: boolean - description: Whether the user was created successfully transaction_hash: type: string description: The blockchain transaction hash + block_hash: + type: string + description: The blockchain block hash + block_number: + type: integer + format: int64 + description: The blockchain block number/height user_id: type: string description: The ID of the created user @@ -10595,12 +10599,16 @@ components: create_comment_response: type: object properties: - success: - type: boolean - description: Whether the comment was created successfully transaction_hash: type: string description: The blockchain transaction hash + block_hash: + type: string + description: The blockchain block hash + block_number: + type: integer + format: int64 + description: The blockchain block number/height comment_id: type: string description: The ID of the created comment @@ -10644,12 +10652,16 @@ components: write_response: type: object properties: - success: - type: boolean - description: Whether the operation was successful transaction_hash: type: string description: The blockchain transaction hash + block_hash: + type: string + description: The blockchain block hash + block_number: + type: integer + format: int64 + description: The blockchain block number/height playlist_artwork: type: object properties: @@ -11116,6 +11128,13 @@ components: transaction_hash: type: string description: Transaction hash of the creation + block_hash: + type: string + description: The blockchain block hash + block_number: + type: integer + format: int64 + description: The blockchain block number/height playlist_response: required: - latest_chain_block @@ -12203,12 +12222,16 @@ components: create_playlist_response: type: object properties: - success: - type: boolean - description: Whether the playlist was created successfully transaction_hash: type: string description: The blockchain transaction hash + block_hash: + type: string + description: The blockchain block hash + block_number: + type: integer + format: int64 + description: The blockchain block number/height playlist_id: type: string description: The ID of the created playlist @@ -13074,12 +13097,16 @@ components: create_track_response: type: object properties: - success: - type: boolean - description: Whether the track was created successfully transaction_hash: type: string description: The blockchain transaction hash + block_hash: + type: string + description: The blockchain block hash + block_number: + type: integer + format: int64 + description: The blockchain block number/height track_id: type: string description: The ID of the created track diff --git a/api/v1_comments.go b/api/v1_comments.go index 60b55acd..58e10b98 100644 --- a/api/v1_comments.go +++ b/api/v1_comments.go @@ -201,8 +201,9 @@ func (app *ApiServer) postV1Comment(c *fiber.Ctx) error { encodedCommentID, _ := trashid.EncodeHashId(commentID) return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), "comment_id": encodedCommentID, }) } @@ -267,8 +268,9 @@ func (app *ApiServer) putV1Comment(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -305,8 +307,9 @@ func (app *ApiServer) deleteV1Comment(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -361,8 +364,9 @@ func (app *ApiServer) postV1CommentReact(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -415,8 +419,9 @@ func (app *ApiServer) deleteV1CommentReact(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -471,8 +476,9 @@ func (app *ApiServer) postV1CommentPin(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -525,8 +531,9 @@ func (app *ApiServer) deleteV1CommentPin(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -563,7 +570,8 @@ func (app *ApiServer) postV1CommentReport(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_grants.go b/api/v1_grants.go index 99f46b4f..28a0c1e7 100644 --- a/api/v1_grants.go +++ b/api/v1_grants.go @@ -83,8 +83,9 @@ func (app *ApiServer) postV1UsersGrant(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -138,8 +139,9 @@ func (app *ApiServer) deleteV1UsersGrant(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -216,8 +218,9 @@ func (app *ApiServer) postV1UsersManager(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -290,8 +293,9 @@ func (app *ApiServer) deleteV1UsersManager(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -347,7 +351,8 @@ func (app *ApiServer) postV1UsersApproveGrant(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_playlist.go b/api/v1_playlist.go index a0658323..b33f1edf 100644 --- a/api/v1_playlist.go +++ b/api/v1_playlist.go @@ -182,8 +182,9 @@ func (app *ApiServer) postV1Playlists(c *fiber.Ctx) error { encodedPlaylistID, _ := trashid.EncodeHashId(playlistID) return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), "playlist_id": encodedPlaylistID, }) } @@ -270,8 +271,9 @@ func (app *ApiServer) putV1Playlist(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -308,7 +310,8 @@ func (app *ApiServer) deleteV1Playlist(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_playlist_favorites.go b/api/v1_playlist_favorites.go index a00e29f2..ddfa2462 100644 --- a/api/v1_playlist_favorites.go +++ b/api/v1_playlist_favorites.go @@ -85,8 +85,9 @@ func (app *ApiServer) postV1PlaylistFavorite(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -123,7 +124,8 @@ func (app *ApiServer) deleteV1PlaylistFavorite(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_playlist_reposts.go b/api/v1_playlist_reposts.go index 33880fed..24649f35 100644 --- a/api/v1_playlist_reposts.go +++ b/api/v1_playlist_reposts.go @@ -83,8 +83,9 @@ func (app *ApiServer) postV1PlaylistRepost(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -121,7 +122,8 @@ func (app *ApiServer) deleteV1PlaylistRepost(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_playlist_shares.go b/api/v1_playlist_shares.go index 2d64e151..21edcd0e 100644 --- a/api/v1_playlist_shares.go +++ b/api/v1_playlist_shares.go @@ -45,7 +45,8 @@ func (app *ApiServer) postV1PlaylistShare(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_track.go b/api/v1_track.go index 0de57e91..94f64b17 100644 --- a/api/v1_track.go +++ b/api/v1_track.go @@ -303,8 +303,9 @@ func (app *ApiServer) postV1Tracks(c *fiber.Ctx) error { encodedTrackID, _ := trashid.EncodeHashId(trackID) return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), "track_id": encodedTrackID, }) } @@ -391,8 +392,9 @@ func (app *ApiServer) putV1Track(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_track_downloads.go b/api/v1_track_downloads.go index c4162803..e1c4c2b0 100644 --- a/api/v1_track_downloads.go +++ b/api/v1_track_downloads.go @@ -80,7 +80,8 @@ func (app *ApiServer) postV1TrackDownload(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_track_favorites.go b/api/v1_track_favorites.go index ed73df0b..01adbc3c 100644 --- a/api/v1_track_favorites.go +++ b/api/v1_track_favorites.go @@ -83,8 +83,9 @@ func (app *ApiServer) postV1TrackFavorite(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -121,7 +122,8 @@ func (app *ApiServer) deleteV1TrackFavorite(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_track_reposts.go b/api/v1_track_reposts.go index ae147d37..bf232931 100644 --- a/api/v1_track_reposts.go +++ b/api/v1_track_reposts.go @@ -83,8 +83,9 @@ func (app *ApiServer) postV1TrackRepost(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -121,7 +122,8 @@ func (app *ApiServer) deleteV1TrackRepost(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_track_shares.go b/api/v1_track_shares.go index c1de7b41..92e460e4 100644 --- a/api/v1_track_shares.go +++ b/api/v1_track_shares.go @@ -45,7 +45,8 @@ func (app *ApiServer) postV1TrackShare(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_users.go b/api/v1_users.go index aafef1f4..f279feed 100644 --- a/api/v1_users.go +++ b/api/v1_users.go @@ -183,8 +183,9 @@ func (app *ApiServer) postV1Users(c *fiber.Ctx) error { encodedUserID, _ := trashid.EncodeHashId(userID) return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), "user_id": encodedUserID, }) } @@ -314,7 +315,8 @@ func (app *ApiServer) putV1User(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_users_developer_apps.go b/api/v1_users_developer_apps.go index 6ebd4b9f..4acf892f 100644 --- a/api/v1_users_developer_apps.go +++ b/api/v1_users_developer_apps.go @@ -216,8 +216,9 @@ func (app *ApiServer) putV1UsersDeveloperApp(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -369,6 +370,8 @@ func (app *ApiServer) postV1UsersDeveloperApp(c *fiber.Ctx) error { "api_secret": apiSecretHex, "bearer_token": apiAccessKey, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -466,8 +469,9 @@ func (app *ApiServer) deleteV1UsersDeveloperApp(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_users_followers.go b/api/v1_users_followers.go index c1fe86a7..29fc3542 100644 --- a/api/v1_users_followers.go +++ b/api/v1_users_followers.go @@ -68,8 +68,9 @@ func (app *ApiServer) postV1UserFollow(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -106,7 +107,8 @@ func (app *ApiServer) deleteV1UserFollow(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_users_muted.go b/api/v1_users_muted.go index e41ef9e6..be2c211f 100644 --- a/api/v1_users_muted.go +++ b/api/v1_users_muted.go @@ -62,8 +62,9 @@ func (app *ApiServer) postV1UserMute(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -100,7 +101,8 @@ func (app *ApiServer) deleteV1UserMute(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } diff --git a/api/v1_users_subscribers.go b/api/v1_users_subscribers.go index 8f2f32e4..27116c82 100644 --- a/api/v1_users_subscribers.go +++ b/api/v1_users_subscribers.go @@ -67,8 +67,9 @@ func (app *ApiServer) postV1UserSubscribe(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) } @@ -105,7 +106,8 @@ func (app *ApiServer) deleteV1UserSubscribe(c *fiber.Ctx) error { } return c.JSON(fiber.Map{ - "success": true, "transaction_hash": response.Msg.GetTransaction().GetHash(), + "block_hash": response.Msg.GetTransaction().GetBlockHash(), + "block_number": response.Msg.GetTransaction().GetHeight(), }) }