From eff31c97bdac8cf5d151fa39c6e0159e6322c5b5 Mon Sep 17 00:00:00 2001
From: kamathmanu <manuriddle@gmail.com>
Date: Thu, 7 Jan 2021 20:43:33 -0500
Subject: [PATCH] Fixing PUT endpoint API

---
 include/mtxclient/http/client.hpp | 2 +-
 lib/http/client.cpp               | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/mtxclient/http/client.hpp b/include/mtxclient/http/client.hpp
index 6ee19bdc1..0ada81f15 100644
--- a/include/mtxclient/http/client.hpp
+++ b/include/mtxclient/http/client.hpp
@@ -460,7 +460,7 @@ public:
 
         //! Sets the visibility of a given room in the server's public room directory.
         void put_room_visibility(const std::string &room_id,
-                                 const nlohmann::json &body,
+                                 const mtx::requests::RoomVisibility &req,
                                  ErrCallback cb);
 
         //! Lists the public rooms on the server. This API returns paginated responses.
diff --git a/lib/http/client.cpp b/lib/http/client.cpp
index 16b854625..237c5ed32 100644
--- a/lib/http/client.cpp
+++ b/lib/http/client.cpp
@@ -979,13 +979,13 @@ Client::get_room_visibility(const std::string &room_id,
 
 void 
 Client::put_room_visibility(const std::string &room_id,
-                                 const nlohmann::json &body,
+                                 const mtx::requests::RoomVisibility &req,
                                  ErrCallback cb)
 {
         const auto api_path = "/client/r0/directory/list/room/"
                                 + mtx::client::utils::url_encode(room_id);
-        
-        put<nlohmann::json>(api_path, body, cb);
+        std::cout << api_path << "\n"; 
+        put<mtx::requests::RoomVisibility>(api_path, req, cb);
 }
 
 void
-- 
GitLab