diff options
Diffstat (limited to 'src/jsonapi')
-rw-r--r-- | src/jsonapi/jsonapi.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/jsonapi/jsonapi.c b/src/jsonapi/jsonapi.c index 7bc4c05e5..6bd03e0ec 100644 --- a/src/jsonapi/jsonapi.c +++ b/src/jsonapi/jsonapi.c | |||
@@ -21,11 +21,11 @@ | |||
21 | #include "platform.h" | 21 | #include "platform.h" |
22 | #include "gnunet_json_lib.h" | 22 | #include "gnunet_json_lib.h" |
23 | 23 | ||
24 | #define GNUNET_JSONAPI_JSONAPI_KEY_DATA "data" | 24 | #define GNUNET_JSONAPI_KEY_DATA "data" |
25 | 25 | ||
26 | #define GNUNET_JSONAPI_JSONAPI_KEY_ID "id" | 26 | #define GNUNET_JSONAPI_KEY_ID "id" |
27 | 27 | ||
28 | #define GNUNET_JSONAPI_JSONAPI_KEY_TYPE "type" | 28 | #define GNUNET_JSONAPI_KEY_TYPE "type" |
29 | 29 | ||
30 | struct GNUNET_JSONAPI_Resource | 30 | struct GNUNET_JSONAPI_Resource |
31 | { | 31 | { |
@@ -93,8 +93,8 @@ GNUNET_JSONAPI_resource_new (const char *type, const char *id) | |||
93 | 93 | ||
94 | res->res_obj = json_object (); | 94 | res->res_obj = json_object (); |
95 | 95 | ||
96 | json_object_set_new (res->res_obj, GNUNET_JSONAPI_JSONAPI_KEY_ID, json_string (id)); | 96 | json_object_set_new (res->res_obj, GNUNET_JSONAPI_KEY_ID, json_string (id)); |
97 | json_object_set_new (res->res_obj, GNUNET_JSONAPI_JSONAPI_KEY_TYPE, json_string (type)); | 97 | json_object_set_new (res->res_obj, GNUNET_JSONAPI_KEY_TYPE, json_string (type)); |
98 | 98 | ||
99 | return res; | 99 | return res; |
100 | } | 100 | } |
@@ -172,7 +172,7 @@ int | |||
172 | GNUNET_JSONAPI_resource_check_id (const struct GNUNET_JSONAPI_Resource *resource, | 172 | GNUNET_JSONAPI_resource_check_id (const struct GNUNET_JSONAPI_Resource *resource, |
173 | const char* id) | 173 | const char* id) |
174 | { | 174 | { |
175 | return check_resource_attr_str (resource, GNUNET_JSONAPI_JSONAPI_KEY_ID, id); | 175 | return check_resource_attr_str (resource, GNUNET_JSONAPI_KEY_ID, id); |
176 | } | 176 | } |
177 | 177 | ||
178 | /** | 178 | /** |
@@ -184,7 +184,7 @@ GNUNET_JSONAPI_resource_check_id (const struct GNUNET_JSONAPI_Resource *resource | |||
184 | json_t* | 184 | json_t* |
185 | GNUNET_JSONAPI_resource_get_id (const struct GNUNET_JSONAPI_Resource *resource) | 185 | GNUNET_JSONAPI_resource_get_id (const struct GNUNET_JSONAPI_Resource *resource) |
186 | { | 186 | { |
187 | return GNUNET_JSONAPI_resource_read_attr (resource, GNUNET_JSONAPI_JSONAPI_KEY_ID); | 187 | return GNUNET_JSONAPI_resource_read_attr (resource, GNUNET_JSONAPI_KEY_ID); |
188 | } | 188 | } |
189 | 189 | ||
190 | /** | 190 | /** |
@@ -198,7 +198,7 @@ int | |||
198 | GNUNET_JSONAPI_resource_check_type (const struct GNUNET_JSONAPI_Resource *resource, | 198 | GNUNET_JSONAPI_resource_check_type (const struct GNUNET_JSONAPI_Resource *resource, |
199 | const char* type) | 199 | const char* type) |
200 | { | 200 | { |
201 | return check_resource_attr_str (resource, GNUNET_JSONAPI_JSONAPI_KEY_TYPE, type); | 201 | return check_resource_attr_str (resource, GNUNET_JSONAPI_KEY_TYPE, type); |
202 | } | 202 | } |
203 | 203 | ||
204 | /** | 204 | /** |
@@ -285,7 +285,7 @@ GNUNET_JSONAPI_object_delete (struct GNUNET_JSONAPI_Object *resp) | |||
285 | * @return a new JSON API resource or NULL on error. | 285 | * @return a new JSON API resource or NULL on error. |
286 | */ | 286 | */ |
287 | struct GNUNET_JSONAPI_Object* | 287 | struct GNUNET_JSONAPI_Object* |
288 | GNUNET_JSONAPI_jsonapi_object_new () | 288 | GNUNET_JSONAPI_object_new () |
289 | { | 289 | { |
290 | struct GNUNET_JSONAPI_Object *result; | 290 | struct GNUNET_JSONAPI_Object *result; |
291 | 291 | ||
@@ -320,7 +320,7 @@ add_json_resource (struct GNUNET_JSONAPI_Object *obj, | |||
320 | const char *type_json; | 320 | const char *type_json; |
321 | 321 | ||
322 | struct GNUNET_JSON_Specification dspec[] = { | 322 | struct GNUNET_JSON_Specification dspec[] = { |
323 | GNUNET_JSON_spec_string (GNUNET_JSONAPI_JSONAPI_KEY_TYPE, &type_json), | 323 | GNUNET_JSON_spec_string (GNUNET_JSONAPI_KEY_TYPE, &type_json), |
324 | GNUNET_JSON_spec_end() | 324 | GNUNET_JSON_spec_end() |
325 | }; | 325 | }; |
326 | 326 | ||
@@ -354,7 +354,7 @@ parse_jsonapiobject (void *cls, | |||
354 | int i; | 354 | int i; |
355 | 355 | ||
356 | struct GNUNET_JSON_Specification jsonapispec[] = { | 356 | struct GNUNET_JSON_Specification jsonapispec[] = { |
357 | GNUNET_JSON_spec_json (GNUNET_JSONAPI_JSONAPI_KEY_DATA, &data_json), | 357 | GNUNET_JSON_spec_json (GNUNET_JSONAPI_KEY_DATA, &data_json), |
358 | GNUNET_JSON_spec_end() | 358 | GNUNET_JSON_spec_end() |
359 | }; | 359 | }; |
360 | if (GNUNET_OK != | 360 | if (GNUNET_OK != |
@@ -448,7 +448,7 @@ GNUNET_JSONAPI_data_serialize (const struct GNUNET_JSONAPI_Object *resp, | |||
448 | { | 448 | { |
449 | json_array_append (res_arr, res->res_obj); | 449 | json_array_append (res_arr, res->res_obj); |
450 | } | 450 | } |
451 | json_object_set (root_json, GNUNET_JSONAPI_JSONAPI_KEY_DATA, res_arr); | 451 | json_object_set (root_json, GNUNET_JSONAPI_KEY_DATA, res_arr); |
452 | *result = json_dumps (root_json, JSON_INDENT(2)); | 452 | *result = json_dumps (root_json, JSON_INDENT(2)); |
453 | json_decref (root_json); | 453 | json_decref (root_json); |
454 | json_decref (res_arr); | 454 | json_decref (res_arr); |