Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mtxclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
mtxclient
Commits
cfba58cc
Commit
cfba58cc
authored
4 years ago
by
kamathmanu
Browse files
Options
Downloads
Patches
Plain Diff
Client API for viewing public room directory
parent
83469b56
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/mtxclient/http/client.hpp
+8
-0
8 additions, 0 deletions
include/mtxclient/http/client.hpp
lib/http/client.cpp
+19
-0
19 additions, 0 deletions
lib/http/client.cpp
with
27 additions
and
0 deletions
include/mtxclient/http/client.hpp
+
8
−
0
View file @
cfba58cc
...
...
@@ -43,6 +43,7 @@ struct Login;
struct
QueryKeys
;
struct
ClaimKeys
;
struct
UploadKeys
;
struct
PublicRooms
;
}
namespace
responses
{
struct
AvatarUrl
;
...
...
@@ -69,6 +70,7 @@ struct TurnServer;
struct
UploadKeys
;
struct
Versions
;
struct
WellKnown
;
struct
PublicRooms
;
namespace
backup
{
struct
SessionBackup
;
struct
RoomKeysBackup
;
...
...
@@ -446,6 +448,12 @@ public:
const
std
::
map
<
mtx
::
identifiers
::
User
,
std
::
map
<
std
::
string
,
EventContent
>>
&
messages
,
ErrCallback
callback
);
//! POST a new room listing to the public rooms directory.
void
post_public_rooms
(
const
std
::
string
&
server
,
const
nhlomann
::
json
&
j
,
Callback
<
mtx
::
responses
::
PublicRooms
>
cb
);
//! GET the public rooms directory listing.
void
get_public_rooms
(
int
limit
,
const
std
::
string
&
since
,
const
std
::
string
&
server
,
Callback
<
mtx
::
responses
::
PublicRooms
>
cb
);
//
// Group related endpoints.
//
...
...
This diff is collapsed.
Click to expand it.
lib/http/client.cpp
+
19
−
0
View file @
cfba58cc
...
...
@@ -962,6 +962,25 @@ Client::send_to_device(const std::string &event_type,
put
<
nlohmann
::
json
>
(
api_path
,
body
,
callback
);
}
void
Client
::
post_public_rooms
(
const
std
::
string
&
server
,
const
nhlomann
::
json
&
j
,
Callback
<
mtx
::
responses
::
PublicRooms
>
cb
)
{
const
auto
api_path
=
"/client/r0/publicRooms"
+
" "
+
server
;
post
<
mtx
::
requests
::
PublicRooms
,
mtx
::
responses
::
PublicRooms
>
(
api_path
,
j
,
cb
);
}
void
Client
::
get_public_rooms
(
int
limit
,
const
std
::
string
&
since
,
const
std
::
string
&
server
,
Callback
<
mtx
::
responses
::
PublicRooms
>
cb
)
{
const
auto
api_path
=
"/client/r0/publicRooms"
+
" "
+
std
::
to_string
(
limit
)
+
" "
+
since
+
" "
+
server
;
get
<
mtx
::
requests
::
PublicRooms
,
mtx
::
responses
::
PublicRooms
>
(
api_path
,
cb
);
}
//
// Group related endpoints.
//
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment