comparison Plugins/OrthancCPlugin/OrthancCPlugin.h @ 1282:7bccdd221e2b

Plugins can do REST calls to other plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 03 Feb 2015 11:52:21 +0100
parents d6a65dc6d0ac
children 6e7e5ed91c2d
comparison
equal deleted inserted replaced
1281:8dac11c78d71 1282:7bccdd221e2b
279 _OrthancPluginService_LookupPatient = 3005, 279 _OrthancPluginService_LookupPatient = 3005,
280 _OrthancPluginService_LookupStudy = 3006, 280 _OrthancPluginService_LookupStudy = 3006,
281 _OrthancPluginService_LookupSeries = 3007, 281 _OrthancPluginService_LookupSeries = 3007,
282 _OrthancPluginService_LookupInstance = 3008, 282 _OrthancPluginService_LookupInstance = 3008,
283 _OrthancPluginService_LookupStudyWithAccessionNumber = 3009, 283 _OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
284 _OrthancPluginService_RestApiGetAfterPlugins = 3010,
285 _OrthancPluginService_RestApiPostAfterPlugins = 3011,
286 _OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
287 _OrthancPluginService_RestApiPutAfterPlugins = 3013,
284 288
285 /* Access to DICOM instances */ 289 /* Access to DICOM instances */
286 _OrthancPluginService_GetInstanceRemoteAet = 4000, 290 _OrthancPluginService_GetInstanceRemoteAet = 4000,
287 _OrthancPluginService_GetInstanceSize = 4001, 291 _OrthancPluginService_GetInstanceSize = 4001,
288 _OrthancPluginService_GetInstanceData = 4002, 292 _OrthancPluginService_GetInstanceData = 4002,
889 return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params); 893 return context->InvokeService(context, _OrthancPluginService_RestApiGet, &params);
890 } 894 }
891 895
892 896
893 897
898 /**
899 * @brief Make a GET call to the REST API, as tainted by the plugins.
900 *
901 * Make a GET call to the Orthanc REST API, after all the plugins
902 * are applied. In other words, if some plugin overrides or adds the
903 * called URI to the built-in Orthanc REST API, this call will
904 * return the result provided by this plugin. The result to the
905 * query is stored into a newly allocated memory buffer.
906 *
907 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
908 * @param target The target memory buffer.
909 * @param uri The URI in the built-in Orthanc API.
910 * @return 0 if success, other value if error.
911 **/
912 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiGetAfterPlugins(
913 OrthancPluginContext* context,
914 OrthancPluginMemoryBuffer* target,
915 const char* uri)
916 {
917 _OrthancPluginRestApiGet params;
918 params.target = target;
919 params.uri = uri;
920 return context->InvokeService(context, _OrthancPluginService_RestApiGetAfterPlugins, &params);
921 }
922
923
924
894 typedef struct 925 typedef struct
895 { 926 {
896 OrthancPluginMemoryBuffer* target; 927 OrthancPluginMemoryBuffer* target;
897 const char* uri; 928 const char* uri;
898 const char* body; 929 const char* body;
926 params.bodySize = bodySize; 957 params.bodySize = bodySize;
927 return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params); 958 return context->InvokeService(context, _OrthancPluginService_RestApiPost, &params);
928 } 959 }
929 960
930 961
962 /**
963 * @brief Make a POST call to the REST API, as tainted by the plugins.
964 *
965 * Make a POST call to the Orthanc REST API, after all the plugins
966 * are applied. In other words, if some plugin overrides or adds the
967 * called URI to the built-in Orthanc REST API, this call will
968 * return the result provided by this plugin. The result to the
969 * query is stored into a newly allocated memory buffer.
970 *
971 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
972 * @param target The target memory buffer.
973 * @param uri The URI in the built-in Orthanc API.
974 * @param body The body of the POST request.
975 * @param bodySize The size of the body.
976 * @return 0 if success, other value if error.
977 **/
978 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiPostAfterPlugins(
979 OrthancPluginContext* context,
980 OrthancPluginMemoryBuffer* target,
981 const char* uri,
982 const char* body,
983 uint32_t bodySize)
984 {
985 _OrthancPluginRestApiPostPut params;
986 params.target = target;
987 params.uri = uri;
988 params.body = body;
989 params.bodySize = bodySize;
990 return context->InvokeService(context, _OrthancPluginService_RestApiPostAfterPlugins, &params);
991 }
992
993
931 994
932 /** 995 /**
933 * @brief Make a DELETE call to the built-in Orthanc REST API. 996 * @brief Make a DELETE call to the built-in Orthanc REST API.
934 * 997 *
935 * Make a DELETE call to the built-in Orthanc REST API. 998 * Make a DELETE call to the built-in Orthanc REST API.
941 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiDelete( 1004 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiDelete(
942 OrthancPluginContext* context, 1005 OrthancPluginContext* context,
943 const char* uri) 1006 const char* uri)
944 { 1007 {
945 return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri); 1008 return context->InvokeService(context, _OrthancPluginService_RestApiDelete, uri);
1009 }
1010
1011
1012 /**
1013 * @brief Make a DELETE call to the REST API, as tainted by the plugins.
1014 *
1015 * Make a DELETE call to the Orthanc REST API, after all the plugins
1016 * are applied. In other words, if some plugin overrides or adds the
1017 * called URI to the built-in Orthanc REST API, this call will
1018 * return the result provided by this plugin.
1019 *
1020 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1021 * @param uri The URI to delete in the built-in Orthanc API.
1022 * @return 0 if success, other value if error.
1023 **/
1024 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiDeleteAfterPlugins(
1025 OrthancPluginContext* context,
1026 const char* uri)
1027 {
1028 return context->InvokeService(context, _OrthancPluginService_RestApiDeleteAfterPlugins, uri);
946 } 1029 }
947 1030
948 1031
949 1032
950 /** 1033 /**
975 return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params); 1058 return context->InvokeService(context, _OrthancPluginService_RestApiPut, &params);
976 } 1059 }
977 1060
978 1061
979 1062
1063 /**
1064 * @brief Make a PUT call to the REST API, as tainted by the plugins.
1065 *
1066 * Make a PUT call to the Orthanc REST API, after all the plugins
1067 * are applied. In other words, if some plugin overrides or adds the
1068 * called URI to the built-in Orthanc REST API, this call will
1069 * return the result provided by this plugin. The result to the
1070 * query is stored into a newly allocated memory buffer.
1071 *
1072 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1073 * @param target The target memory buffer.
1074 * @param uri The URI in the built-in Orthanc API.
1075 * @param body The body of the PUT request.
1076 * @param bodySize The size of the body.
1077 * @return 0 if success, other value if error.
1078 **/
1079 ORTHANC_PLUGIN_INLINE int OrthancPluginRestApiPutAfterPlugins(
1080 OrthancPluginContext* context,
1081 OrthancPluginMemoryBuffer* target,
1082 const char* uri,
1083 const char* body,
1084 uint32_t bodySize)
1085 {
1086 _OrthancPluginRestApiPostPut params;
1087 params.target = target;
1088 params.uri = uri;
1089 params.body = body;
1090 params.bodySize = bodySize;
1091 return context->InvokeService(context, _OrthancPluginService_RestApiPutAfterPlugins, &params);
1092 }
1093
1094
1095
980 typedef struct 1096 typedef struct
981 { 1097 {
982 OrthancPluginRestOutput* output; 1098 OrthancPluginRestOutput* output;
983 const char* argument; 1099 const char* argument;
984 } _OrthancPluginOutputPlusArgument; 1100 } _OrthancPluginOutputPlusArgument;