aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-21 03:14:41 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-21 03:14:41 -0400
commitfecfa277279c4f93a844de7cad1e75749d2c4f9f (patch)
tree2905dc77ae8a1286e3e4daa0d7220a5a5b418ec9 /src/include
parent78cc094d475c57914f36d5dfbf29c77c7c1fbb3f (diff)
add parser for json path
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_json_lib.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index cfab56fd6..08b72b5b7 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -184,6 +184,38 @@ TALER_JSON_contract_part_forget (json_t *json,
/**
+ * Called for each path found after expanding a path.
+ *
+ * @param cls the closure.
+ * @param object_id the name of the object that is pointed to.
+ * @param parent the parent of the object at @e object_id.
+ */
+typedef void
+(*TALER_JSON_ExpandPathCallback) (
+ void *cls,
+ const char *object_id,
+ json_t *parent);
+
+
+/**
+ * Expands a path for a json object. May call the callback several times
+ * if the path contains a wildcard.
+ *
+ * @param json the json object the path references.
+ * @param path the path to expand. Must begin with "$." and follow dot notation,
+ * and may include array indices and wildcards.
+ * @param cb the callback.
+ * @param cb_cls closure for the callback.
+ * @return GNUNET_OK on success, GNUNET_SYSERR if @e path is invalid.
+ */
+int
+TALER_JSON_expand_path (json_t *json,
+ const char *path,
+ TALER_JSON_ExpandPathCallback cb,
+ void *cb_cls);
+
+
+/**
* Extract the Taler error code from the given @a json object.
* Note that #TALER_EC_NONE is returned if no "code" is present.
*