Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2578493
sync.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
sync.cpp
View Options
/******************************************************************************
* THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
*/
#include
<algorithm>
#include
"sync.hpp"
namespace
Kazv
::
Api
{
BaseJob
::
Query
SyncJob::buildQuery
(
std
::
optional
<
std
::
string
>
filter
,
std
::
optional
<
std
::
string
>
since
,
std
::
optional
<
bool
>
fullState
,
std
::
optional
<
std
::
string
>
setPresence
,
std
::
optional
<
int
>
timeout
)
{
BaseJob
::
Query
_q
;
addToQueryIfNeeded
(
_q
,
"filter"
s
,
filter
);
addToQueryIfNeeded
(
_q
,
"since"
s
,
since
);
addToQueryIfNeeded
(
_q
,
"full_state"
s
,
fullState
);
addToQueryIfNeeded
(
_q
,
"set_presence"
s
,
setPresence
);
addToQueryIfNeeded
(
_q
,
"timeout"
s
,
timeout
);
return
_q
;
}
BaseJob
::
Body
SyncJob::buildBody
(
std
::
optional
<
std
::
string
>
filter
,
std
::
optional
<
std
::
string
>
since
,
std
::
optional
<
bool
>
fullState
,
std
::
optional
<
std
::
string
>
setPresence
,
std
::
optional
<
int
>
timeout
)
{
// ignore unused param
(
void
)(
filter
);(
void
)(
since
);(
void
)(
fullState
);(
void
)(
setPresence
);(
void
)(
timeout
);
return
BaseJob
::
EmptyBody
{};
};
SyncJob
::
SyncJob
(
std
::
string
serverUrl
,
std
::
string
_accessToken
,
std
::
optional
<
std
::
string
>
filter
,
std
::
optional
<
std
::
string
>
since
,
std
::
optional
<
bool
>
fullState
,
std
::
optional
<
std
::
string
>
setPresence
,
std
::
optional
<
int
>
timeout
)
:
BaseJob
(
std
::
move
(
serverUrl
),
std
::
string
(
"/_matrix/client/r0"
)
+
"/sync"
,
GET
,
std
::
string
(
"Sync"
),
_accessToken
,
ReturnType
::
Json
,
buildBody
(
filter
,
since
,
fullState
,
setPresence
,
timeout
)
,
buildQuery
(
filter
,
since
,
fullState
,
setPresence
,
timeout
)
,
{}
)
{
}
SyncJob
SyncJob
::
withData
(
JsonWrap
j
)
&&
{
auto
ret
=
SyncJob
(
std
::
move
(
*
this
));
ret
.
attachData
(
j
);
return
ret
;
}
SyncJob
SyncJob
::
withData
(
JsonWrap
j
)
const
&
{
auto
ret
=
SyncJob
(
*
this
);
ret
.
attachData
(
j
);
return
ret
;
}
SyncJob
::
JobResponse
::
JobResponse
(
Response
r
)
:
Response
(
std
::
move
(
r
))
{}
bool
SyncResponse
::
success
()
const
{
return
Response
::
success
()
&&
isBodyJson
(
body
)
&&
jsonBody
().
get
().
contains
(
"next_batch"
s
)
;
}
std
::
string
SyncResponse
::
nextBatch
()
const
{
if
(
jsonBody
().
get
()
.
contains
(
"next_batch"
s
))
{
return
jsonBody
().
get
()[
"next_batch"
s
]
.
template
get
<
std
::
string
>
();}
else
{
return
std
::
string
(
);}
}
std
::
optional
<
SyncJob
::
Rooms
>
SyncResponse
::
rooms
()
const
{
if
(
jsonBody
().
get
()
.
contains
(
"rooms"
s
))
{
return
jsonBody
().
get
()[
"rooms"
s
]
.
template
get
<
Rooms
>
();}
else
{
return
std
::
optional
<
Rooms
>
(
);}
}
std
::
optional
<
EventBatch
>
SyncResponse
::
presence
()
const
{
if
(
jsonBody
().
get
()
.
contains
(
"presence"
s
))
{
return
jsonBody
().
get
()[
"presence"
s
]
.
template
get
<
EventBatch
>
();}
else
{
return
std
::
optional
<
EventBatch
>
(
);}
}
std
::
optional
<
EventBatch
>
SyncResponse
::
accountData
()
const
{
if
(
jsonBody
().
get
()
.
contains
(
"account_data"
s
))
{
return
jsonBody
().
get
()[
"account_data"
s
]
.
template
get
<
EventBatch
>
();}
else
{
return
std
::
optional
<
EventBatch
>
(
);}
}
JsonWrap
SyncResponse
::
toDevice
()
const
{
if
(
jsonBody
().
get
()
.
contains
(
"to_device"
s
))
{
return
jsonBody
().
get
()[
"to_device"
s
]
.
template
get
<
JsonWrap
>
();}
else
{
return
JsonWrap
(
);}
}
JsonWrap
SyncResponse
::
deviceLists
()
const
{
if
(
jsonBody
().
get
()
.
contains
(
"device_lists"
s
))
{
return
jsonBody
().
get
()[
"device_lists"
s
]
.
template
get
<
JsonWrap
>
();}
else
{
return
JsonWrap
(
);}
}
immer
::
map
<
std
::
string
,
int
>
SyncResponse
::
deviceOneTimeKeysCount
()
const
{
if
(
jsonBody
().
get
()
.
contains
(
"device_one_time_keys_count"
s
))
{
return
jsonBody
().
get
()[
"device_one_time_keys_count"
s
]
.
template
get
<
immer
::
map
<
std
::
string
,
int
>>
();}
else
{
return
immer
::
map
<
std
::
string
,
int
>
(
);}
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Wed, Jun 25, 6:09 AM (11 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
235173
Default Alt Text
sync.cpp (4 KB)
Attached To
Mode
rL libkazv
Attached
Detach File
Event Timeline
Log In to Comment