diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2016-05-04 17:18:02 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2016-05-04 17:18:02 +0000 |
commit | a44744499d8f3df64cc1d15cd6b40b4b0e4a3683 (patch) | |
tree | 27621a6ee20cbe8e344ffdc18c05754e67d67bf3 /src/jsonapi/jsonapi_objects.h | |
parent | ca11046195a840932edb04900669a38cd60ae682 (diff) |
Update jsonapi to current specs, refactor
Diffstat (limited to 'src/jsonapi/jsonapi_objects.h')
-rw-r--r-- | src/jsonapi/jsonapi_objects.h | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/src/jsonapi/jsonapi_objects.h b/src/jsonapi/jsonapi_objects.h new file mode 100644 index 0000000000..27c64eeb70 --- /dev/null +++ b/src/jsonapi/jsonapi_objects.h @@ -0,0 +1,162 @@ +#include "platform.h" +#include "gnunet_jsonapi_lib.h" +/** + * jsonapi error object + */ +struct GNUNET_JSONAPI_Error +{ + /** + * DLL + */ + struct GNUNET_JSONAPI_Error *next; + + /** + * DLL + */ + struct GNUNET_JSONAPI_Error *prev; + + /** + * Unique error id + */ + char *id; + + /** + * Links object + */ + json_t *links; + + /** + * HTTP status code for this error + */ + char *status; + + /** + * Application error code + */ + char *code; + + /** + * Error title + */ + char *title; + + /** + * Error details + */ + char *detail; + + /** + * Error source + */ + json_t *source; + + /** + * Meta info for the error + */ + json_t *meta; +}; + +struct GNUNET_JSONAPI_Relationship +{ + /** + * Links object + */ + struct GNUNET_JSONAPI_Link *links; + + /** + * Resource linkage data + */ + struct GNUNET_JSONAPI_Resource *res_list_head; + + /** + * DLL + */ + struct GNUNET_JSONAPI_Resource *res_list_tail; + + /** + * Number of resources in data section + */ + int res_count; + + /** + * Meta information + */ + json_t *meta; +}; + +/** + * A jsonapi resource object + */ +struct GNUNET_JSONAPI_Resource +{ + /** + * DLL + */ + struct GNUNET_JSONAPI_Resource *next; + + /** + * DLL + */ + struct GNUNET_JSONAPI_Resource *prev; + + /** + * Resource type + */ + char *type; + + /** + * Resource ID + */ + char *id; + + /** + * Attributes object + */ + json_t *attr_obj; + + /** + * Relationship + */ + struct GNUNET_JSONAPI_Relationship *relationship; +}; + + +struct GNUNET_JSONAPI_Document +{ + /** + * DLL Resource + */ + struct GNUNET_JSONAPI_Resource *res_list_head; + + /** + * DLL Resource + */ + struct GNUNET_JSONAPI_Resource *res_list_tail; + + /** + * num resources + */ + int res_count; + + /** + * DLL Error + */ + struct GNUNET_JSONAPI_Error *err_list_head; + + /** + * DLL Error + */ + struct GNUNET_JSONAPI_Error *err_list_tail; + + /** + * num errors + */ + int err_count; + + /** + * Meta info + */ + json_t *meta; +}; + + |