aboutsummaryrefslogtreecommitdiff
path: root/src/gns/plugin_rest_gns.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2016-05-04 17:18:02 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2016-05-04 17:18:02 +0000
commita44744499d8f3df64cc1d15cd6b40b4b0e4a3683 (patch)
tree27621a6ee20cbe8e344ffdc18c05754e67d67bf3 /src/gns/plugin_rest_gns.c
parentca11046195a840932edb04900669a38cd60ae682 (diff)
downloadgnunet-a44744499d8f3df64cc1d15cd6b40b4b0e4a3683.tar.gz
gnunet-a44744499d8f3df64cc1d15cd6b40b4b0e4a3683.zip
Update jsonapi to current specs, refactor
Diffstat (limited to 'src/gns/plugin_rest_gns.c')
-rw-r--r--src/gns/plugin_rest_gns.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index 718a9b29b..b2034c8ce 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -258,7 +258,7 @@ gnsrecord_to_json (const struct GNUNET_GNSRECORD_Data *rd)
258 (int) rd->record_type); 258 (int) rd->record_type);
259 return NULL; 259 return NULL;
260 } 260 }
261 record_obj = json_object(); 261 record_obj = json_object ();
262 json_object_set_new (record_obj, "type", json_string (typename)); 262 json_object_set_new (record_obj, "type", json_string (typename));
263 json_object_set_new (record_obj, "value", json_string (string_val)); 263 json_object_set_new (record_obj, "value", json_string (string_val));
264 GNUNET_free (string_val); 264 GNUNET_free (string_val);
@@ -295,7 +295,7 @@ process_lookup_result (void *cls, uint32_t rd_count,
295{ 295{
296 struct LookupHandle *handle = cls; 296 struct LookupHandle *handle = cls;
297 struct MHD_Response *resp; 297 struct MHD_Response *resp;
298 struct GNUNET_JSONAPI_Object *json_object; 298 struct GNUNET_JSONAPI_Document *json_document;
299 struct GNUNET_JSONAPI_Resource *json_resource; 299 struct GNUNET_JSONAPI_Resource *json_resource;
300 uint32_t i; 300 uint32_t i;
301 char *result; 301 char *result;
@@ -303,7 +303,7 @@ process_lookup_result (void *cls, uint32_t rd_count,
303 json_t *record_obj; 303 json_t *record_obj;
304 304
305 result_array = json_array(); 305 result_array = json_array();
306 json_object = GNUNET_JSONAPI_object_new (); 306 json_document = GNUNET_JSONAPI_document_new ();
307 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_GNS_TYPEINFO, handle->name); 307 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_GNS_TYPEINFO, handle->name);
308 handle->lookup_request = NULL; 308 handle->lookup_request = NULL;
309 for (i=0; i<rd_count; i++) 309 for (i=0; i<rd_count; i++)
@@ -318,11 +318,11 @@ process_lookup_result (void *cls, uint32_t rd_count,
318 GNUNET_JSONAPI_resource_add_attr (json_resource, 318 GNUNET_JSONAPI_resource_add_attr (json_resource,
319 GNUNET_REST_JSONAPI_GNS_RECORD, 319 GNUNET_REST_JSONAPI_GNS_RECORD,
320 result_array); 320 result_array);
321 GNUNET_JSONAPI_object_resource_add (json_object, json_resource); 321 GNUNET_JSONAPI_document_resource_add (json_document, json_resource);
322 GNUNET_JSONAPI_data_serialize (json_object, &result); 322 GNUNET_JSONAPI_document_serialize (json_document, &result);
323 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); 323 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result);
324 json_decref (result_array); 324 json_decref (result_array);
325 GNUNET_JSONAPI_object_delete (json_object); 325 GNUNET_JSONAPI_document_delete (json_document);
326 resp = GNUNET_REST_create_json_response (result); 326 resp = GNUNET_REST_create_json_response (result);
327 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 327 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
328 GNUNET_free (result); 328 GNUNET_free (result);