File: REST_API.h

package info (click to toggle)
mediaconch 25.04-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,828 kB
  • sloc: ansic: 126,293; cpp: 39,636; javascript: 34,300; xml: 2,950; sh: 2,121; makefile: 200; python: 183
file content (1319 lines) | stat: -rw-r--r-- 56,233 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
/*  Copyright (c) MediaArea.net SARL. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license that can
 *  be found in the License.html file in the root of the source tree.
 */

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// RESTAPI functions
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//---------------------------------------------------------------------------
#ifndef RESTAPIH
#define RESTAPIH
//---------------------------------------------------------------------------

#include <string>
#include <vector>
#include <utility>
#include "Container.h"
#include "MediaConchLib.h"
//---------------------------------------------------------------------------

namespace MediaConch {

//---------------------------------------------------------------------------

//***************************************************************************
// Class RESTAPI
//***************************************************************************

class RESTAPI
{
public:

    static const std::string API_VERSION;

    enum Reason
    {
        NO_REASON = 0,
        FILE_NOT_EXISTING,
        ID_NOT_EXISTING,
        NOT_READY,
    };

    enum Report
    {
        NO_REPORT = 0,
        POLICY,
        IMPLEMENTATION,
        MEDIAINFO,
        MEDIATRACE,
        VERAPDF,
        DPFMANAGER,
        IMSC1VALIDATION,
    };

    std::string get_Report_string(Report r)
    {
#define ReportString(report) \
        case report:         \
            return #report;

        switch (r)
        {
            ReportString(POLICY);
            ReportString(IMPLEMENTATION);
            ReportString(MEDIAINFO);
            ReportString(MEDIATRACE);
            ReportString(VERAPDF);
            ReportString(DPFMANAGER);
            ReportString(IMSC1VALIDATION);
            default:
                break;
        }
#undef ReportString
        return std::string();
    }

    Report string_to_Report(const std::string& str)
    {
#define ReportString(report)       \
        if (!str.compare(#report)) \
            return report;

        ReportString(POLICY);
        ReportString(IMPLEMENTATION);
        ReportString(MEDIAINFO);
        ReportString(MEDIATRACE);
        ReportString(VERAPDF);
        ReportString(DPFMANAGER);
        ReportString(IMSC1VALIDATION);

#undef ReportString

        return NO_REPORT;
    }

    std::string get_Reason_string(Reason r)
    {
#define ReasonString(reason) \
        case reason:         \
            return #reason;

        switch (r)
        {
            ReasonString(NO_REASON);
            ReasonString(FILE_NOT_EXISTING);
            ReasonString(ID_NOT_EXISTING);
            ReasonString(NOT_READY);
            default:
                break;
        }
#undef ReasonString
        return std::string();
    }

    Reason string_to_Reason(const std::string& str)
    {
#define ReasonString(reason)       \
        if (!str.compare(#reason)) \
            return reason;

        ReasonString(NO_REASON);
        ReasonString(FILE_NOT_EXISTING);
        ReasonString(ID_NOT_EXISTING);
        ReasonString(NOT_READY);

#undef ReasonString

        return NO_REASON;
    }

//***************************************************************************
// MediaConch General
//***************************************************************************

    // Generic error
    struct MediaConch_Nok
    {
        MediaConch_Nok() : id(NULL) {}
        ~MediaConch_Nok();

        long        *id;
        std::string  error;
        std::string  to_str() const;
    };

    // Get Plugins
    struct MediaConch_Get_Plugins_Req
    {
        std::string  to_str() const;
    };

    struct MediaConch_Get_Plugins_Res
    {
        MediaConch_Get_Plugins_Res() : nok(NULL) {}
        ~MediaConch_Get_Plugins_Res();

        std::vector<std::string>         plugins;
        MediaConch_Nok                  *nok;
        std::string                      to_str() const;
    };

    // List Watch Folder
    struct MediaConch_List_Watch_Folders_Req
    {
        std::string  to_str() const;
    };

    struct MediaConch_List_Watch_Folders_Res
    {
        MediaConch_List_Watch_Folders_Res() : nok(NULL) {}
        ~MediaConch_List_Watch_Folders_Res();

        std::vector<std::string>         folders;
        MediaConch_Nok                  *nok;
        std::string                      to_str() const;
    };

    // Watch Folder
    struct MediaConch_Watch_Folder_Req
    {
        MediaConch_Watch_Folder_Req() : user(NULL), recursive(true) {}
        ~MediaConch_Watch_Folder_Req();

        std::string                                       to_str() const;

        std::string                                       folder;
        std::string                                       folder_reports;
        std::vector<std::string>                          plugins;
        std::vector<std::string>                          policies;
        std::vector<std::pair<std::string,std::string> >  options;
        long                                             *user;
        bool                                              recursive;
    };

    struct MediaConch_Watch_Folder_Res
    {
        MediaConch_Watch_Folder_Res() : nok(NULL) {}
        ~MediaConch_Watch_Folder_Res();

        long                             user;
        MediaConch_Nok                  *nok;
        std::string                      to_str() const;
    };

    // Edit Watch Folder
    struct MediaConch_Edit_Watch_Folder_Req
    {
        std::string  to_str() const;

        std::string  folder;
        std::string  folder_reports;
    };

    struct MediaConch_Edit_Watch_Folder_Res
    {
        MediaConch_Edit_Watch_Folder_Res() : nok(NULL) {}
        ~MediaConch_Edit_Watch_Folder_Res();

        MediaConch_Nok                  *nok;
        std::string                      to_str() const;
    };

    // Remove Watch Folder
    struct MediaConch_Remove_Watch_Folder_Req
    {
        std::string  to_str() const;

        std::string  folder;
    };

    struct MediaConch_Remove_Watch_Folder_Res
    {
        MediaConch_Remove_Watch_Folder_Res() : nok(NULL) {}
        ~MediaConch_Remove_Watch_Folder_Res();

        MediaConch_Nok                  *nok;
        std::string                      to_str() const;
    };

//***************************************************************************
// Checker
//***************************************************************************

    // Analyze
    struct Checker_Analyze_Arg
    {
        Checker_Analyze_Arg() : user(-1), has_force_analyze(false), mil_analyze(true) {}

        std::string              to_str() const;
        std::string              file;
        int                      user;
        int                      id;
        std::vector<std::string> plugins;
        std::vector<std::pair<std::string,std::string> > options;
        bool                     has_force_analyze;
        bool                     force_analyze;
        bool                     mil_analyze;
    };

    struct Checker_Analyze_Req
    {
        std::vector<Checker_Analyze_Arg> args;
        std::string                      to_str() const;
    };

    struct Checker_Analyze_Ok
    {
        long                   inId;
        long                   outId;
        bool                   create;
        std::string            to_str() const;
    };

    struct Checker_Analyze_Res
    {
        ~Checker_Analyze_Res();
        std::vector<Checker_Analyze_Ok*>  ok;
        std::vector<MediaConch_Nok*>      nok;
        std::string                       to_str() const;
    };

    // Status
    struct Checker_Status_Req
    {
        Checker_Status_Req() :  user(-1) {}

        int                     user;
        std::vector<long>       ids;
        std::string             to_str() const;
    };

    struct Checker_Status_Ok
    {
        Checker_Status_Ok() : finished(false), has_error(false), percent(NULL), tool(NULL), source_id(-1) {}
        ~Checker_Status_Ok();

        long                     id;
        bool                     finished;
        bool                     has_error;
        std::string              error_log;
        double                  *percent;
        Report                  *tool;
        std::vector<long>        generated_id;
        long                     source_id;
        std::string              to_str() const;
    };

    struct Checker_Status_Res
    {
        ~Checker_Status_Res();
        std::vector<Checker_Status_Ok*>  ok;
        std::vector<MediaConch_Nok*>     nok;
        std::string                      to_str() const;
    };

    // Report
    struct Checker_Report_Req
    {
        Checker_Report_Req() :             user(-1) {}

        int                                user;
        std::vector<long>                  ids;
        std::vector<Report>                reports;
        std::vector<size_t>                policies_ids;
        std::vector<std::string>           policies_contents;
        std::string                        display_name;
        std::string                        display_content;
        std::string                        mi_inform;
        std::map<std::string, std::string> options;
        std::string                        to_str() const;
    };

    struct Checker_Report_Ok
    {
        Checker_Report_Ok() :   has_valid(false), has_info(false), has_warning(false) {}
        std::string             report;
        bool                    has_valid;
        bool                    has_info;
        bool                    has_warning;
        bool                    valid;
        std::string             to_str() const;
    };

    struct Checker_Report_Res
    {
        Checker_Report_Res() : ok(NULL), nok(NULL) {}
        ~Checker_Report_Res();

        Checker_Report_Ok               *ok;
        MediaConch_Nok                  *nok;
        std::string                      to_str() const;
    };

    // Clear
    struct Checker_Clear_Req
    {
        Checker_Clear_Req() :   user(-1) {}

        int                     user;
        std::vector<long>       ids;
        std::string             to_str() const;
    };

    struct Checker_Clear_Res
    {
        ~Checker_Clear_Res();

        std::vector<long>               ok;
        std::vector<MediaConch_Nok*>    nok;
        std::string                     to_str() const;
    };

    // Stop
    struct Checker_Stop_Req
    {
        Checker_Stop_Req() :   user(-1) {}

        int                     user;
        std::vector<long>       ids;
        std::string             to_str() const;
    };

    struct Checker_Stop_Res
    {
        ~Checker_Stop_Res();

        std::vector<long>               ok;
        std::vector<MediaConch_Nok*>    nok;
        std::string                     to_str() const;
    };

    // List
    struct Checker_List_Req
    {
        Checker_List_Req() :   user(-1) {}

        int                    user;
        std::string            to_str() const;
    };

    struct Checker_List_File
    {
        std::string            file;
        long                   id;
    };

    struct Checker_List_Res
    {
        Checker_List_Res() : nok(NULL) {}
        ~Checker_List_Res();

        std::vector<Checker_List_File*>  files;
        MediaConch_Nok                  *nok;
        std::string                      to_str() const;
    };

    // Validate
    struct Checker_Validate_Req
    {
        Checker_Validate_Req() :           user(-1) {}

        int                                user;
        std::vector<long>                  ids;
        Report                             report;
        std::vector<size_t>                policies_ids;
        std::vector<std::string>           policies_contents;
        std::map<std::string, std::string> options;
        std::string                        to_str() const;
    };

    struct Checker_Validate_Ok
    {
        Checker_Validate_Ok() :    valid(false), has_info(false), has_warning(false) {}

        long                       id;
        bool                       valid;
        bool                       has_info;
        bool                       has_warning;
        std::string                to_str() const;
    };

    struct Checker_Validate_Res
    {
        Checker_Validate_Res() : nok(NULL) {}
        ~Checker_Validate_Res();

        std::vector<Checker_Validate_Ok*>  ok;
        MediaConch_Nok                    *nok;
        std::string                        to_str() const;
    };

    struct Checker_File_From_Id_Req
    {
        Checker_File_From_Id_Req() : user(-1), id(-1) {}

        int          user;
        long         id;
        std::string  to_str() const;
    };

    struct Checker_File_From_Id_Res
    {
        Checker_File_From_Id_Res() : nok(NULL) {}
        ~Checker_File_From_Id_Res();

        std::string     file;
        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Checker_Id_From_Filename_Req
    {
        Checker_Id_From_Filename_Req() : user(-1) {}

        int                                               user;
        std::string                                       filename;
        std::vector<std::pair<std::string,std::string> >  options;
        std::string                                       to_str() const;
    };

    struct Checker_Id_From_Filename_Res
    {
        Checker_Id_From_Filename_Res() : id(-1), nok(NULL) {}
        ~Checker_Id_From_Filename_Res();

        long            id;
        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Checker_File_Information_Req
    {
        Checker_File_Information_Req() : user(-1), id(-1) {}

        int          user;
        long         id;
        std::string  to_str() const;
    };

    struct Checker_File_Information_Res
    {
        Checker_File_Information_Res() : source_id(-1), generated_time((size_t)-1),
                                         analyzed(false), existing(false), has_error(false), nok(NULL) {}
        ~Checker_File_Information_Res();

        std::string                                       filename;
        std::string                                       file_last_modification;
        std::string                                       generated_log;
        std::string                                       generated_error_log;
        std::vector<std::pair<std::string,std::string> >  options;
        std::string                                       error_log;
        std::vector<long>                                 generated_id;
        long                                              source_id;
        size_t                                            generated_time;
        bool                                              analyzed;
        bool                                              existing;
        bool                                              has_error;
        MediaConch_Nok                                   *nok;
        std::string                                       to_str() const;
    };

    struct Checker_List_MediaInfo_Outputs_Req
    {
        std::string  to_str() const;
    };

    struct Checker_List_MediaInfo_Outputs_Res
    {
        Checker_List_MediaInfo_Outputs_Res() : nok(NULL) {}
        ~Checker_List_MediaInfo_Outputs_Res();

        std::string     outputs;
        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Default_Values_For_Type_Req
    {
        std::string  type;
        std::string  field;
        std::string  to_str() const;
    };

    struct Default_Values_For_Type_Res
    {
        Default_Values_For_Type_Res() : nok(NULL) {}
        ~Default_Values_For_Type_Res();

        std::vector<std::string>  values;
        MediaConch_Nok           *nok;
        std::string               to_str() const;
    };

//***************************************************************************
// Policy
//***************************************************************************
    struct XSLT_Policy_Create_Req
    {
        XSLT_Policy_Create_Req() : user(-1), parent_id(-1) {}
        int         user;
        int         parent_id;
        std::string type;
        std::string to_str() const;
    };

    struct XSLT_Policy_Create_Res
    {
        XSLT_Policy_Create_Res() : id(-1), nok(NULL) {}
        ~XSLT_Policy_Create_Res();

        int             id;
        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Import_Req
    {
        Policy_Import_Req() : user(-1) {}

        int         user;
        std::string xml;
        std::string to_str() const;
    };

    struct Policy_Import_Res
    {
        Policy_Import_Res() : id(-1), nok(NULL) {}
        ~Policy_Import_Res();

        int             id;
        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Remove_Req
    {
        Policy_Remove_Req() : user(-1), id(-1) {}

        int         user;
        int         id;
        std::string to_str() const;
    };

    struct Policy_Remove_Res
    {
        Policy_Remove_Res() : nok(NULL) {}
        ~Policy_Remove_Res();

        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Dump_Req
    {
        Policy_Dump_Req() : user(-1), id(-1), must_be_public(false) {}

        int         user;
        int         id;
        bool        must_be_public;
        std::string to_str() const;
    };

    struct Policy_Dump_Res
    {
        Policy_Dump_Res() : nok(NULL) {}
        ~Policy_Dump_Res();

        std::string     xml;
        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Save_Req
    {
        Policy_Save_Req() : user(-1), id(-1) {}

        int         user;
        int         id;
        std::string to_str() const;
    };

    struct Policy_Save_Res
    {
        Policy_Save_Res() : nok(NULL) {}
        ~Policy_Save_Res();

        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Duplicate_Req
    {
        Policy_Duplicate_Req() : user(-1), dst_user(NULL), id(-1), dst_policy_id(-1), must_be_public(false) {}
        ~Policy_Duplicate_Req();

        int         user;
        int        *dst_user;
        int         id;
        int         dst_policy_id;
        int         must_be_public;
        std::string to_str() const;
    };

    struct Policy_Duplicate_Res
    {
        Policy_Duplicate_Res() : id(-1), nok(NULL) {}
        ~Policy_Duplicate_Res();

        int             id;
        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Move_Req
    {
        Policy_Move_Req() : user(-1), id(-1), dst_policy_id(-1) {}

        int         user;
        int         id;
        int         dst_policy_id;
        std::string to_str() const;
    };

    struct Policy_Move_Res
    {
        Policy_Move_Res() : id(-1), nok(NULL) {}
        ~Policy_Move_Res();

        int             id;
        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Change_Info_Req
    {
        Policy_Change_Info_Req() : user(-1), id(-1) {}

        std::string              name;
        std::string              description;
        std::vector<std::string> tags;
        std::string              level;
        std::string              license;
        int                      user;
        int                      id;
        std::string              to_str() const;
    };

    struct Policy_Change_Info_Res
    {
        Policy_Change_Info_Res() : nok(NULL) {}
        ~Policy_Change_Info_Res();

        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Change_Type_Req
    {
        Policy_Change_Type_Req() : user(-1), id(-1) {}

        int          user;
        int          id;
        std::string  type;
        std::string  to_str() const;
    };

    struct Policy_Change_Type_Res
    {
        Policy_Change_Type_Res() : nok(NULL) {}
        ~Policy_Change_Type_Res();

        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Change_Is_Public_Req
    {
        Policy_Change_Is_Public_Req() : user(-1), id(-1), is_public(false) {}
        int          user;
        int          id;
        bool         is_public;
        std::string  to_str() const;
    };

    struct Policy_Change_Is_Public_Res
    {
        Policy_Change_Is_Public_Res() : nok(NULL) {}
        ~Policy_Change_Is_Public_Res();

        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Get_Req
    {
        Policy_Get_Req() : user(-1), id(-1), must_be_public(false), format("JSON") {}

        int         user;
        int         id;
        bool        must_be_public;
        std::string format;
        std::string to_str() const;
    };

    struct Policy_Get_Res
    {
        Policy_Get_Res() : policy(NULL), nok(NULL) {}
        ~Policy_Get_Res();

        MediaConchLib::Policy_Policy *policy;
        std::string                   policyTree;
        MediaConch_Nok               *nok;
        std::string                   to_str() const;
    };

    struct Policy_Get_Name_Req
    {
        Policy_Get_Name_Req() : user(-1), id(-1) {}

        int          user;
        int          id;
        std::string  to_str() const;
    };

    struct Policy_Get_Name_Res
    {
        Policy_Get_Name_Res() : nok(NULL) {}
        ~Policy_Get_Name_Res();

        std::string     name;
        MediaConch_Nok *nok;
        std::string     to_str() const;
    };

    struct Policy_Get_Policies_Count_Req
    {
        Policy_Get_Policies_Count_Req() : user(-1) {}

        int         user;
        std::string to_str() const;
    };

    struct Policy_Get_Policies_Count_Res
    {
        Policy_Get_Policies_Count_Res() : size(0), nok(NULL) {}
        ~Policy_Get_Policies_Count_Res();

        int              size;
        MediaConch_Nok  *nok;
        std::string      to_str() const;
    };

    struct Policy_Clear_Policies_Req
    {
        Policy_Clear_Policies_Req() : user(-1) {}

        int         user;
        std::string to_str() const;
    };

    struct Policy_Clear_Policies_Res
    {
        Policy_Clear_Policies_Res() : nok(NULL) {}
        ~Policy_Clear_Policies_Res();

        MediaConch_Nok  *nok;
        std::string      to_str() const;
    };

    struct Policy_Get_Policies_Req
    {
        Policy_Get_Policies_Req() : user(-1), format("JSON") {}

        int              user;
        std::vector<int> ids;
        std::string      format;
        std::string      to_str() const;
    };

    struct Policy_Get_Policies_Res
    {
        Policy_Get_Policies_Res() : nok(NULL) {}
        ~Policy_Get_Policies_Res();

        std::vector<MediaConchLib::Policy_Policy*>  policies;
        std::string                                 policiesTree;
        MediaConch_Nok                             *nok;
        std::string                                 to_str() const;
    };

    struct Policy_Public_Policy
    {
        Policy_Public_Policy() : id(-1), user(-1) {}

        long             id;
        long             user;
        std::string      name;
        std::string      description;
        std::string      license;
        std::string      to_str() const;
    };

    struct Policy_Get_Public_Policies_Req
    {
        std::string      to_str() const;
    };

    struct Policy_Get_Public_Policies_Res
    {
        Policy_Get_Public_Policies_Res() :  nok(NULL) {}
        ~Policy_Get_Public_Policies_Res();

        std::vector<Policy_Public_Policy*>  policies;
        MediaConch_Nok                     *nok;
        std::string                         to_str() const;
    };

    struct Policy_Get_Policies_Names_List_Req
    {
        Policy_Get_Policies_Names_List_Req() : user(-1) {}

        int              user;
        std::string      to_str() const;
    };

    struct Policy_Get_Policies_Names_List_Res
    {
        Policy_Get_Policies_Names_List_Res() : nok(NULL) {}
        ~Policy_Get_Policies_Names_List_Res();

        std::vector<std::pair<int, std::string> >   policies;
        MediaConch_Nok                             *nok;
        std::string                                 to_str() const;
    };

    struct XSLT_Policy_Create_From_File_Req
    {
        XSLT_Policy_Create_From_File_Req() : user(-1), id(-1) {}

        int         user;
        int         id;
        std::string to_str() const;
    };

    struct XSLT_Policy_Create_From_File_Res
    {
        XSLT_Policy_Create_From_File_Res() : policy_id(-1), nok(NULL) {}
        ~XSLT_Policy_Create_From_File_Res();

        int               policy_id;
        MediaConch_Nok   *nok;
        std::string       to_str() const;
    };

    // XSLT Rule
    struct XSLT_Policy_Rule_Create_Req
    {
        XSLT_Policy_Rule_Create_Req() : user(-1), policy_id(-1) {}

        int         user;
        int         policy_id;
        std::string to_str() const;
    };

    struct XSLT_Policy_Rule_Create_Res
    {
        XSLT_Policy_Rule_Create_Res() : id(-1), nok(NULL) {}
        ~XSLT_Policy_Rule_Create_Res();

        int              id;
        MediaConch_Nok  *nok;
        std::string      to_str() const;
    };

    struct XSLT_Policy_Rule_Get_Req
    {
        XSLT_Policy_Rule_Get_Req() : user(-1), policy_id(-1), id(-1) {}

        int         user;
        int         policy_id;
        int         id;
        std::string to_str() const;
    };

    struct XSLT_Policy_Rule_Get_Res
    {
        XSLT_Policy_Rule_Get_Res() : nok(NULL) {}
        ~XSLT_Policy_Rule_Get_Res();

        MediaConch_Nok                  *nok;
        MediaConchLib::XSLT_Policy_Rule  rule;
        std::string                      to_str() const;
    };

    struct XSLT_Policy_Rule_Edit_Req
    {
        XSLT_Policy_Rule_Edit_Req() : user(-1), policy_id(-1) {}

        int                             user;
        int                             policy_id;
        MediaConchLib::XSLT_Policy_Rule rule;
        std::string                     to_str() const;
    };

    struct XSLT_Policy_Rule_Edit_Res
    {
        XSLT_Policy_Rule_Edit_Res() : nok(NULL) {}
        ~XSLT_Policy_Rule_Edit_Res();

        MediaConch_Nok  *nok;
        std::string      to_str() const;
    };

    struct XSLT_Policy_Rule_Duplicate_Req
    {
        XSLT_Policy_Rule_Duplicate_Req() : user(-1), policy_id(-1), id(-1), dst_policy_id(-1) {}

        int         user;
        int         policy_id;
        int         id;
        int         dst_policy_id;
        std::string to_str() const;
    };

    struct XSLT_Policy_Rule_Duplicate_Res
    {
        XSLT_Policy_Rule_Duplicate_Res() : id(-1), nok(NULL) {}
        ~XSLT_Policy_Rule_Duplicate_Res();

        int              id;
        MediaConch_Nok  *nok;
        std::string      to_str() const;
    };

    struct XSLT_Policy_Rule_Move_Req
    {
        XSLT_Policy_Rule_Move_Req() : user(-1), policy_id(-1), id(-1), dst_policy_id(-1) {}

        int         user;
        int         policy_id;
        int         id;
        int         dst_policy_id;
        std::string to_str() const;
    };

    struct XSLT_Policy_Rule_Move_Res
    {
        XSLT_Policy_Rule_Move_Res() : id(-1), nok(NULL) {}
        ~XSLT_Policy_Rule_Move_Res();

        int              id;
        MediaConch_Nok  *nok;
        std::string      to_str() const;
    };

    struct XSLT_Policy_Rule_Delete_Req
    {
        XSLT_Policy_Rule_Delete_Req() : user(-1), policy_id(-1), id(-1) {}

        int         user;
        int         policy_id;
        int         id;
        std::string to_str() const;
    };

    struct XSLT_Policy_Rule_Delete_Res
    {
        XSLT_Policy_Rule_Delete_Res() : nok(NULL) {}
        ~XSLT_Policy_Rule_Delete_Res();

        MediaConch_Nok  *nok;
        std::string      to_str() const;
    };

public:
    //Constructor/Destructor
    RESTAPI();
    virtual ~RESTAPI();

    // Serialize: Request
    int serialize_mediaconch_get_plugins_req(MediaConch_Get_Plugins_Req& req, std::string&, std::string& err);
    int serialize_mediaconch_watch_folder_req(MediaConch_Watch_Folder_Req& req, std::string&, std::string& err);
    int serialize_mediaconch_list_watch_folders_req(MediaConch_List_Watch_Folders_Req& req, std::string&, std::string& err);
    int serialize_mediaconch_edit_watch_folder_req(MediaConch_Edit_Watch_Folder_Req& req, std::string&, std::string& err);
    int serialize_mediaconch_remove_watch_folder_req(MediaConch_Remove_Watch_Folder_Req& req, std::string&, std::string& err);

    int serialize_checker_analyze_req(Checker_Analyze_Req& req, std::string&, std::string& err);
    int serialize_checker_status_req(Checker_Status_Req& req, std::string&, std::string& err);
    int serialize_checker_report_req(Checker_Report_Req& req, std::string&, std::string& err);
    int serialize_checker_clear_req(Checker_Clear_Req& req, std::string&, std::string& err);
    int serialize_checker_stop_req(Checker_Stop_Req& req, std::string&, std::string& err);
    int serialize_checker_list_req(Checker_List_Req& req, std::string&, std::string& err);
    int serialize_checker_validate_req(Checker_Validate_Req& req, std::string&, std::string& err);
    int serialize_checker_file_from_id_req(Checker_File_From_Id_Req& req, std::string&, std::string& err);
    int serialize_checker_id_from_filename_req(Checker_Id_From_Filename_Req& req, std::string&, std::string& err);
    int serialize_checker_file_information_req(Checker_File_Information_Req& req, std::string&, std::string& err);
    int serialize_checker_list_mediainfo_outputs_req(Checker_List_MediaInfo_Outputs_Req& req, std::string&, std::string& err);
    int serialize_default_values_for_type_req(Default_Values_For_Type_Req& req, std::string&, std::string& err);

    int serialize_xslt_policy_create_req(XSLT_Policy_Create_Req& req, std::string&, std::string& err);
    int serialize_policy_import_req(Policy_Import_Req& req, std::string&, std::string& err);
    int serialize_policy_remove_req(Policy_Remove_Req& req, std::string&, std::string& err);
    int serialize_policy_dump_req(Policy_Dump_Req& req, std::string&, std::string& err);
    int serialize_policy_save_req(Policy_Save_Req& req, std::string&, std::string& err);
    int serialize_policy_duplicate_req(Policy_Duplicate_Req& req, std::string&, std::string& err);
    int serialize_policy_move_req(Policy_Move_Req& req, std::string&, std::string& err);
    int serialize_policy_change_info_req(Policy_Change_Info_Req& req, std::string&, std::string& err);
    int serialize_policy_change_type_req(Policy_Change_Type_Req& req, std::string&, std::string& err);
    int serialize_policy_change_is_public_req(Policy_Change_Is_Public_Req& req, std::string&, std::string& err);
    int serialize_policy_get_req(Policy_Get_Req& req, std::string&, std::string& err);
    int serialize_policy_get_name_req(Policy_Get_Name_Req& req, std::string&, std::string& err);
    int serialize_policy_get_policies_count_req(Policy_Get_Policies_Count_Req& req, std::string&, std::string& err);
    int serialize_policy_clear_policies_req(Policy_Clear_Policies_Req& req, std::string&, std::string& err);
    int serialize_policy_get_policies_req(Policy_Get_Policies_Req& req, std::string&, std::string& err);
    int serialize_policy_get_public_policies_req(Policy_Get_Public_Policies_Req& req, std::string&, std::string& err);
    int serialize_policy_get_policies_names_list_req(Policy_Get_Policies_Names_List_Req& req, std::string&, std::string& err);
    int serialize_xslt_policy_create_from_file_req(XSLT_Policy_Create_From_File_Req& req, std::string&, std::string& err);
    int serialize_xslt_policy_rule_create_req(XSLT_Policy_Rule_Create_Req& req, std::string&, std::string& err);
    int serialize_xslt_policy_rule_get_req(XSLT_Policy_Rule_Get_Req& req, std::string&, std::string& err);
    int serialize_xslt_policy_rule(MediaConchLib::XSLT_Policy_Rule& rule, Container::Value&, std::string& err);
    int serialize_xslt_policy_rule_edit_req(XSLT_Policy_Rule_Edit_Req& req, std::string&, std::string& err);
    int serialize_xslt_policy_rule_duplicate_req(XSLT_Policy_Rule_Duplicate_Req& req, std::string&, std::string& err);
    int serialize_xslt_policy_rule_move_req(XSLT_Policy_Rule_Move_Req& req, std::string&, std::string& err);
    int serialize_xslt_policy_rule_delete_req(XSLT_Policy_Rule_Delete_Req& req, std::string&, std::string& err);

    // Serialize: Result
    int serialize_mediaconch_get_plugins_res(MediaConch_Get_Plugins_Res& res, std::string&, std::string& err);
    int serialize_mediaconch_watch_folder_res(MediaConch_Watch_Folder_Res& res, std::string&, std::string& err);
    int serialize_mediaconch_list_watch_folders_res(MediaConch_List_Watch_Folders_Res& res, std::string&, std::string& err);
    int serialize_mediaconch_edit_watch_folder_res(MediaConch_Edit_Watch_Folder_Res& res, std::string&, std::string& err);
    int serialize_mediaconch_remove_watch_folder_res(MediaConch_Remove_Watch_Folder_Res& res, std::string&, std::string& err);

    int serialize_checker_analyze_res(Checker_Analyze_Res& res, std::string&, std::string& err);
    int serialize_checker_status_res(Checker_Status_Res& res, std::string&, std::string& err);
    int serialize_checker_report_res(Checker_Report_Res& res, std::string&, std::string& err);
    int serialize_checker_clear_res(Checker_Clear_Res& res, std::string&, std::string& err);
    int serialize_checker_stop_res(Checker_Stop_Res& res, std::string&, std::string& err);
    int serialize_checker_list_res(Checker_List_Res& res, std::string&, std::string& err);
    int serialize_checker_validate_res(Checker_Validate_Res& res, std::string&, std::string& err);
    int serialize_checker_file_from_id_res(Checker_File_From_Id_Res& res, std::string&, std::string& err);
    int serialize_checker_id_from_filename_res(Checker_Id_From_Filename_Res& res, std::string&, std::string& err);
    int serialize_checker_file_information_res(Checker_File_Information_Res& res, std::string&, std::string& err);
    int serialize_checker_list_mediainfo_outputs_res(Checker_List_MediaInfo_Outputs_Res& res, std::string&, std::string& err);
    int serialize_default_values_for_type_res(Default_Values_For_Type_Res& res, std::string&, std::string& err);

    int serialize_xslt_policy_create_res(XSLT_Policy_Create_Res& res, std::string&, std::string& err);
    int serialize_policy_import_res(Policy_Import_Res& res, std::string&, std::string& err);
    int serialize_policy_remove_res(Policy_Remove_Res& res, std::string&, std::string& err);
    int serialize_policy_dump_res(Policy_Dump_Res& res, std::string&, std::string& err);
    int serialize_policy_save_res(Policy_Save_Res& res, std::string&, std::string& err);
    int serialize_policy_duplicate_res(Policy_Duplicate_Res& res, std::string&, std::string& err);
    int serialize_policy_move_res(Policy_Move_Res& res, std::string&, std::string& err);
    int serialize_policy_change_info_res(Policy_Change_Info_Res& res, std::string&, std::string& err);
    int serialize_policy_change_type_res(Policy_Change_Type_Res& res, std::string&, std::string& err);
    int serialize_policy_change_is_public_res(Policy_Change_Is_Public_Res& res, std::string&, std::string& err);
    int serialize_policy_get_res(Policy_Get_Res& res, std::string&, std::string& err);
    int serialize_policy_get_name_res(Policy_Get_Name_Res& res, std::string&, std::string& err);
    int serialize_policy_get_policies_count_res(Policy_Get_Policies_Count_Res& res, std::string&, std::string& err);
    int serialize_policy_clear_policies_res(Policy_Clear_Policies_Res& res, std::string&, std::string& err);
    int serialize_policy_get_policies_res(Policy_Get_Policies_Res& res, std::string&, std::string& err);
    int serialize_policy_get_public_policies_res(Policy_Get_Public_Policies_Res& res, std::string&, std::string& err);
    int serialize_policy_get_policies_names_list_res(Policy_Get_Policies_Names_List_Res& res, std::string&, std::string& err);
    int serialize_xslt_policy_create_from_file_res(XSLT_Policy_Create_From_File_Res& res, std::string&, std::string& err);
    int serialize_xslt_policy_rule_create_res(XSLT_Policy_Rule_Create_Res& res, std::string&, std::string& err);
    int serialize_xslt_policy_rule_get_res(XSLT_Policy_Rule_Get_Res& res, std::string&, std::string& err);
    int serialize_xslt_policy_rule_edit_res(XSLT_Policy_Rule_Edit_Res& res, std::string&, std::string& err);
    int serialize_xslt_policy_rule_duplicate_res(XSLT_Policy_Rule_Duplicate_Res& res, std::string&, std::string& err);
    int serialize_xslt_policy_rule_move_res(XSLT_Policy_Rule_Move_Res& res, std::string&, std::string& err);
    int serialize_xslt_policy_rule_delete_res(XSLT_Policy_Rule_Delete_Res& res, std::string&, std::string& err);

    // Parse: Request
    MediaConch_Get_Plugins_Req          *parse_mediaconch_get_plugins_req(const std::string& data, std::string& err);
    MediaConch_Watch_Folder_Req         *parse_mediaconch_watch_folder_req(const std::string& data, std::string& err);
    MediaConch_List_Watch_Folders_Req   *parse_mediaconch_list_watch_folders_req(const std::string& data, std::string& err);
    MediaConch_Edit_Watch_Folder_Req    *parse_mediaconch_edit_watch_folder_req(const std::string& data, std::string& err);
    MediaConch_Remove_Watch_Folder_Req  *parse_mediaconch_remove_watch_folder_req(const std::string& data, std::string& err);

    Checker_Analyze_Req                 *parse_checker_analyze_req(const std::string& data, std::string& err);
    Checker_Status_Req                  *parse_checker_status_req(const std::string& data, std::string& err);
    Checker_Report_Req                  *parse_checker_report_req(const std::string& data, std::string& err);
    Checker_Clear_Req                   *parse_checker_clear_req(const std::string& data, std::string& err);
    Checker_Stop_Req                    *parse_checker_stop_req(const std::string& data, std::string& err);
    Checker_List_Req                    *parse_checker_list_req(const std::string& data, std::string& err);
    Checker_Validate_Req                *parse_checker_validate_req(const std::string& data, std::string& err);
    Checker_File_From_Id_Req            *parse_checker_file_from_id_req(const std::string& data, std::string& err);
    Checker_Id_From_Filename_Req        *parse_checker_id_from_filename_req(const std::string& data, std::string& err);
    Checker_File_Information_Req        *parse_checker_file_information_req(const std::string& data, std::string& err);
    Checker_List_MediaInfo_Outputs_Req  *parse_checker_list_mediainfo_outputs_req(const std::string& uri, std::string& err);
    Default_Values_For_Type_Req         *parse_default_values_for_type_req(const std::string& data, std::string& err);

    XSLT_Policy_Create_Req              *parse_xslt_policy_create_req(const std::string&, std::string& err);
    Policy_Import_Req                   *parse_policy_import_req(const std::string&, std::string& err);
    Policy_Remove_Req                   *parse_policy_remove_req(const std::string&, std::string& err);
    Policy_Dump_Req                     *parse_policy_dump_req(const std::string&, std::string& err);
    Policy_Save_Req                     *parse_policy_save_req(const std::string&, std::string& err);
    Policy_Duplicate_Req                *parse_policy_duplicate_req(const std::string&, std::string& err);
    Policy_Move_Req                     *parse_policy_move_req(const std::string&, std::string& err);
    Policy_Change_Info_Req              *parse_policy_change_info_req(const std::string&, std::string& err);
    Policy_Change_Type_Req              *parse_policy_change_type_req(const std::string&, std::string& err);
    Policy_Change_Is_Public_Req         *parse_policy_change_is_public_req(const std::string&, std::string& err);
    Policy_Get_Req                      *parse_policy_get_req(const std::string&, std::string& err);
    Policy_Get_Name_Req                 *parse_policy_get_name_req(const std::string&, std::string& err);
    Policy_Get_Policies_Count_Req       *parse_policy_get_policies_count_req(const std::string&, std::string& err);
    Policy_Clear_Policies_Req           *parse_policy_clear_policies_req(const std::string&, std::string& err);
    Policy_Get_Policies_Req             *parse_policy_get_policies_req(const std::string&, std::string& err);
    Policy_Get_Public_Policies_Req      *parse_policy_get_public_policies_req(const std::string&, std::string& err);
    Policy_Get_Policies_Names_List_Req  *parse_policy_get_policies_names_list_req(const std::string&, std::string& err);
    XSLT_Policy_Create_From_File_Req    *parse_xslt_policy_create_from_file_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Create_Req         *parse_xslt_policy_rule_create_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Get_Req            *parse_xslt_policy_rule_get_req(const std::string&, std::string& err);
    int                                  parse_xslt_policy_rule(Container::Value *val, MediaConchLib::XSLT_Policy_Rule *,
                                                                std::string& err);
    XSLT_Policy_Rule_Edit_Req           *parse_xslt_policy_rule_edit_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Duplicate_Req      *parse_xslt_policy_rule_duplicate_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Move_Req           *parse_xslt_policy_rule_move_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Delete_Req         *parse_xslt_policy_rule_delete_req(const std::string&, std::string& err);

    // Parse: URI Request
    MediaConch_Get_Plugins_Req          *parse_uri_mediaconch_get_plugins_req(const std::string& uri, std::string& err);
    MediaConch_Watch_Folder_Req         *parse_uri_mediaconch_watch_folder_req(const std::string& uri, std::string& err);
    MediaConch_List_Watch_Folders_Req   *parse_uri_mediaconch_list_watch_folders_req(const std::string& uri, std::string& err);
    MediaConch_Edit_Watch_Folder_Req    *parse_uri_mediaconch_edit_watch_folder_req(const std::string& uri, std::string& err);
    MediaConch_Remove_Watch_Folder_Req  *parse_uri_mediaconch_remove_watch_folder_req(const std::string& uri, std::string& err);

    Checker_Analyze_Req                 *parse_uri_checker_analyze_req(const std::string& uri, std::string& err);
    Checker_Status_Req                  *parse_uri_checker_status_req(const std::string& uri, std::string& err);
    Checker_Report_Req                  *parse_uri_checker_report_req(const std::string& uri, std::string& err);
    Checker_Clear_Req                   *parse_uri_checker_clear_req(const std::string& uri, std::string& err);
    Checker_Stop_Req                    *parse_uri_checker_stop_req(const std::string& uri, std::string& err);
    Checker_List_Req                    *parse_uri_checker_list_req(const std::string& uri, std::string& err);
    Checker_Validate_Req                *parse_uri_checker_validate_req(const std::string& uri, std::string& err);
    Checker_File_From_Id_Req            *parse_uri_checker_file_from_id_req(const std::string& uri, std::string& err);
    Checker_Id_From_Filename_Req        *parse_uri_checker_id_from_filename_req(const std::string& uri, std::string& err);
    Checker_File_Information_Req        *parse_uri_checker_file_information_req(const std::string& uri, std::string& err);
    Checker_List_MediaInfo_Outputs_Req  *parse_uri_checker_list_mediainfo_outputs_req(const std::string& uri, std::string& err);
    Default_Values_For_Type_Req         *parse_uri_default_values_for_type_req(const std::string& uri, std::string& err);

    XSLT_Policy_Create_Req              *parse_uri_xslt_policy_create_req(const std::string&, std::string& err);
    Policy_Import_Req                   *parse_uri_policy_import_req(const std::string&, std::string& err);
    Policy_Remove_Req                   *parse_uri_policy_remove_req(const std::string&, std::string& err);
    Policy_Dump_Req                     *parse_uri_policy_dump_req(const std::string&, std::string& err);
    Policy_Save_Req                     *parse_uri_policy_save_req(const std::string&, std::string& err);
    Policy_Duplicate_Req                *parse_uri_policy_duplicate_req(const std::string&, std::string& err);
    Policy_Move_Req                     *parse_uri_policy_move_req(const std::string&, std::string& err);
    Policy_Change_Info_Req              *parse_uri_policy_change_info_req(const std::string&, std::string& err);
    Policy_Change_Type_Req              *parse_uri_policy_change_type_req(const std::string&, std::string& err);
    Policy_Change_Is_Public_Req         *parse_uri_policy_change_is_public_req(const std::string&, std::string& err);
    Policy_Get_Req                      *parse_uri_policy_get_req(const std::string&, std::string& err);
    Policy_Get_Name_Req                 *parse_uri_policy_get_name_req(const std::string&, std::string& err);
    Policy_Get_Policies_Count_Req       *parse_uri_policy_get_policies_count_req(const std::string&, std::string& err);
    Policy_Clear_Policies_Req           *parse_uri_policy_clear_policies_req(const std::string&, std::string& err);
    Policy_Get_Policies_Req             *parse_uri_policy_get_policies_req(const std::string&, std::string& err);
    Policy_Get_Public_Policies_Req      *parse_uri_policy_get_public_policies_req(const std::string&, std::string& err);
    Policy_Get_Policies_Names_List_Req  *parse_uri_policy_get_policies_names_list_req(const std::string&, std::string& err);
    XSLT_Policy_Create_From_File_Req    *parse_uri_xslt_policy_create_from_file_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Create_Req         *parse_uri_xslt_policy_rule_create_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Get_Req            *parse_uri_xslt_policy_rule_get_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Edit_Req           *parse_uri_xslt_policy_rule_edit_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Duplicate_Req      *parse_uri_xslt_policy_rule_duplicate_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Move_Req           *parse_uri_xslt_policy_rule_move_req(const std::string&, std::string& err);
    XSLT_Policy_Rule_Delete_Req         *parse_uri_xslt_policy_rule_delete_req(const std::string&, std::string& err);

    // Parse: Result
    MediaConch_Get_Plugins_Res         *parse_mediaconch_get_plugins_res(const std::string& data, std::string& err);
    MediaConch_Watch_Folder_Res        *parse_mediaconch_watch_folder_res(const std::string& data, std::string& err);
    MediaConch_List_Watch_Folders_Res  *parse_mediaconch_list_watch_folders_res(const std::string& data, std::string& err);
    MediaConch_Edit_Watch_Folder_Res   *parse_mediaconch_edit_watch_folder_res(const std::string& data, std::string& err);
    MediaConch_Remove_Watch_Folder_Res *parse_mediaconch_remove_watch_folder_res(const std::string& data, std::string& err);

    Checker_Analyze_Res                *parse_checker_analyze_res(const std::string& data, std::string& err);
    Checker_Status_Res                 *parse_checker_status_res(const std::string& data, std::string& err);
    Checker_Report_Res                 *parse_checker_report_res(const std::string& data, std::string& err);
    Checker_Clear_Res                  *parse_checker_clear_res(const std::string& data, std::string& err);
    Checker_Stop_Res                   *parse_checker_stop_res(const std::string& data, std::string& err);
    Checker_List_Res                   *parse_checker_list_res(const std::string& data, std::string& err);
    Checker_Validate_Res               *parse_checker_validate_res(const std::string& data, std::string& err);
    Checker_File_From_Id_Res           *parse_checker_file_from_id_res(const std::string& data, std::string& err);
    Checker_Id_From_Filename_Res       *parse_checker_id_from_filename_res(const std::string& data, std::string& err);
    Checker_File_Information_Res       *parse_checker_file_information_res(const std::string& data, std::string& err);
    Checker_List_MediaInfo_Outputs_Res *parse_checker_list_mediainfo_outputs_res(const std::string& data, std::string& err);
    Default_Values_For_Type_Res        *parse_default_values_for_type_res(const std::string& data, std::string& err);

    XSLT_Policy_Create_Res             *parse_xslt_policy_create_res(const std::string&, std::string& err);
    Policy_Import_Res                  *parse_policy_import_res(const std::string&, std::string& err);
    Policy_Remove_Res                  *parse_policy_remove_res(const std::string&, std::string& err);
    Policy_Dump_Res                    *parse_policy_dump_res(const std::string&, std::string& err);
    Policy_Save_Res                    *parse_policy_save_res(const std::string&, std::string& err);
    Policy_Duplicate_Res               *parse_policy_duplicate_res(const std::string&, std::string& err);
    Policy_Move_Res                    *parse_policy_move_res(const std::string&, std::string& err);
    Policy_Change_Info_Res             *parse_policy_change_info_res(const std::string&, std::string& err);
    Policy_Change_Type_Res             *parse_policy_change_type_res(const std::string&, std::string& err);
    Policy_Change_Is_Public_Res        *parse_policy_change_is_public_res(const std::string&, std::string& err);
    Policy_Get_Res                     *parse_policy_get_res(const std::string&, std::string& err);
    Policy_Get_Name_Res                *parse_policy_get_name_res(const std::string&, std::string& err);
    Policy_Get_Policies_Count_Res      *parse_policy_get_policies_count_res(const std::string&, std::string& err);
    Policy_Clear_Policies_Res          *parse_policy_clear_policies_res(const std::string&, std::string& err);
    Policy_Get_Policies_Res            *parse_policy_get_policies_res(const std::string&, std::string& err);
    Policy_Get_Public_Policies_Res     *parse_policy_get_public_policies_res(const std::string&, std::string& err);
    Policy_Get_Policies_Names_List_Res *parse_policy_get_policies_names_list_res(const std::string&, std::string& err);
    XSLT_Policy_Create_From_File_Res   *parse_xslt_policy_create_from_file_res(const std::string&, std::string& err);
    XSLT_Policy_Rule_Create_Res        *parse_xslt_policy_rule_create_res(const std::string&, std::string& err);
    XSLT_Policy_Rule_Get_Res           *parse_xslt_policy_rule_get_res(const std::string&, std::string& err);
    XSLT_Policy_Rule_Edit_Res          *parse_xslt_policy_rule_edit_res(const std::string&, std::string& err);
    XSLT_Policy_Rule_Duplicate_Res     *parse_xslt_policy_rule_duplicate_res(const std::string&, std::string& err);
    XSLT_Policy_Rule_Move_Res          *parse_xslt_policy_rule_move_res(const std::string&, std::string& err);
    XSLT_Policy_Rule_Delete_Res        *parse_xslt_policy_rule_delete_res(const std::string&, std::string& err);

    std::string                         get_error() const { return error; }

private:
    Container *model;

    std::string error;

    //Helper
    Container::Value serialize_mediaconch_nok(MediaConch_Nok* nok, std::string& err);
    Container::Value serialize_checker_analyze_args(std::vector<Checker_Analyze_Arg>& args, std::string& err);
    Container::Value serialize_ids(std::vector<long>& ids, std::string& err);
    Container::Value serialize_checker_report_reports(std::vector<Report>& args, std::string& err);
    Container::Value serialize_checker_report_string(const std::string& args, std::string& err);
    Container::Value serialize_checker_report_int(int val, std::string& err);
    Container::Value serialize_checker_report_arr_str(const std::vector<std::string>& reports, std::string& err);
    Container::Value serialize_checker_report_arr_long_u(const std::vector<size_t>& reports, std::string& err);
    Container::Value serialize_checker_analyze_oks(std::vector<Checker_Analyze_Ok*>& array, std::string& err);
    Container::Value serialize_checker_status_oks(std::vector<Checker_Status_Ok*>& array, std::string& err);
    int serialize_checker_report_ok(Checker_Report_Ok* ok, Container::Value&, std::string& err);
    Container::Value serialize_checker_list_file(const std::string& file, int id, std::string& err);
    Container::Value serialize_checker_validate_ok(Checker_Validate_Ok* ok, std::string& err);
    void serialize_policies_get_policies(const std::vector<MediaConchLib::Policy_Policy*>&, Container::Value& policies, std::string& err);
    void serialize_policy_public_policy(const std::vector<Policy_Public_Policy*>&, Container::Value& policies, std::string& err);
    void serialize_policies_get_policies_names(const std::vector<std::pair<int, std::string> >& policies, Container::Value &p, std::string& err);
    void serialize_a_policy(MediaConchLib::Policy_Policy* policy, Container::Value &ok_v, std::string& err);
    void serialize_a_xslt_policy_rule(MediaConchLib::XSLT_Policy_Rule* rule, Container::Value &ok_v, std::string& err);

    int parse_mediaconch_nok(Container::Value *v, MediaConch_Nok** n, std::string& err);
    int parse_checker_analyze_arg(Container::Value *v, std::vector<Checker_Analyze_Arg>& args, std::string& err);
    int parse_checker_report_reports(Container::Value *v, std::vector<Report>& reports, std::string& err);
    int parse_checker_analyze_ok(Container::Value *v, std::vector<Checker_Analyze_Ok*>& ok, std::string& err);
    int parse_checker_status_ok(Container::Value *v, std::vector<Checker_Status_Ok*>& ok, std::string& err);
    int parse_checker_report_ok(Container::Value *v, Checker_Report_Ok** ok, std::string& err);
    int parse_checker_list_file(Container::Value *v, std::string& file, long& id, std::string& err);
    int parse_checker_validate_ok(Container::Value *v, std::vector<Checker_Validate_Ok*>& oks, std::string& err);
    int parse_policies_get_policies(Container::Value* policies, std::vector<MediaConchLib::Policy_Policy*>&, std::string& err);
    int parse_policy_public_policy(Container::Value* policies, std::vector<Policy_Public_Policy*>&, std::string& err);
    int parse_policies_get_policies_names(Container::Value* policies, std::vector<std::pair<int, std::string> >&, std::string& err);
    MediaConchLib::Policy_Policy* parse_a_policy(Container::Value* policy, std::string& err);
    MediaConchLib::XSLT_Policy_Rule* parse_a_xslt_policy_rule(Container::Value* rule, std::string& err);

    RESTAPI (const RESTAPI&);
    RESTAPI& operator=(const RESTAPI&);
};

}

#endif