33 if (! jo.is_object()) { jo = json::object(); }
36 jo[
"regexp"s] = pod.
regexp;
44 if (jo.contains(
"regexp"s)) {
45 result.
regexp = jo.at(
"regexp"s);
47 if (jo.contains(
"placeholder"s)) {
72 std::optional<std::string>
icon;
84 if (! jo.is_object()) { jo = json::object(); }
87 jo[
"desc"s] = pod.
desc;
89 jo[
"fields"s] = pod.
fields;
99 if (jo.contains(
"desc"s)) {
100 result.
desc = jo.at(
"desc"s);
102 if (jo.contains(
"fields"s)) {
103 result.
fields = jo.at(
"fields"s);
105 if (jo.contains(
"network_id"s)) {
108 if (jo.contains(
"icon"s)) {
109 result.
icon = jo.at(
"icon"s);
153 using namespace Kazv;
159 if (! jo.is_object()) { jo = json::object(); }
166 jo[
"icon"s] = pod.
icon;
176 if (jo.contains(
"user_fields"s)) {
179 if (jo.contains(
"location_fields"s)) {
182 if (jo.contains(
"icon"s)) {
183 result.
icon = jo.at(
"icon"s);
185 if (jo.contains(
"field_types"s)) {
188 if (jo.contains(
"instances"s)) {
Definition: jsonwrap.hpp:23
Definition: location.hpp:10
Definition: location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
nlohmann::json json
Definition: jsonwrap.hpp:20
Definition: location.hpp:27
Definition of valid values for a field.
Definition: protocol.hpp:13
std::string placeholder
An placeholder serving as a valid example of the field value.
Definition: protocol.hpp:21
std::string regexp
A regular expression for validation of a field's value.
Definition: protocol.hpp:18
Definition: protocol.hpp:59
std::string networkId
A unique identifier across all instances.
Definition: protocol.hpp:68
std::optional< std::string > icon
An optional content URI representing the protocol.
Definition: protocol.hpp:72
JsonWrap fields
Preset values for fields the client may use to search by.
Definition: protocol.hpp:65
std::string desc
A human-readable description for the protocol, such as the name.
Definition: protocol.hpp:62
Definition: protocol.hpp:120
std::string icon
A content URI representing an icon for the third party protocol.
Definition: protocol.hpp:135
immer::map< std::string, FieldType > fieldTypes
The type definitions for the fields defined in the user_fields and location_fields.
Definition: protocol.hpp:142
immer::array< std::string > locationFields
Fields which may be used to identify a third party location.
Definition: protocol.hpp:132
immer::array< std::string > userFields
Fields which may be used to identify a third party user.
Definition: protocol.hpp:126
immer::array< ProtocolInstance > instances
A list of objects representing independent instances of configuration.
Definition: protocol.hpp:147
static void to_json(json &jo, const FieldType &pod)
Definition: protocol.hpp:31
static void from_json(const json &jo, FieldType &result)
Definition: protocol.hpp:41
static void from_json(const json &jo, ProtocolInstance &result)
Definition: protocol.hpp:96
static void to_json(json &jo, const ProtocolInstance &pod)
Definition: protocol.hpp:82
static void to_json(json &jo, const ThirdPartyProtocol &pod)
Definition: protocol.hpp:157
static void from_json(const json &jo, ThirdPartyProtocol &result)
Definition: protocol.hpp:173