-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.gen.go
1305 lines (1047 loc) · 43 KB
/
api.gen.go
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
// Package webserver provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT.
package webserver
import (
"bytes"
"compress/gzip"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"path"
"strings"
"github.com/getkin/kin-openapi/openapi3"
"github.com/gin-gonic/gin"
"github.com/oapi-codegen/runtime"
strictgin "github.com/oapi-codegen/runtime/strictmiddleware/gin"
)
const (
CookieAuthScopes = "cookieAuth.Scopes"
)
// DeleteTransferRequest defines model for DeleteTransferRequest.
type DeleteTransferRequest struct {
// IngestId Ingestion id to abort the ingestion
IngestId *string `json:"ingestId,omitempty"`
}
// DeleteTransferResponse defines model for DeleteTransferResponse.
type DeleteTransferResponse struct {
// IngestId Ingestion id to abort the ingestion
IngestId *string `json:"ingestId,omitempty"`
// Status New status of the ingestion.
Status *string `json:"status,omitempty"`
}
// Error defines model for Error.
type Error struct {
Code string `json:"code"`
Message string `json:"message"`
}
// GetDatasetResponse defines model for GetDatasetResponse.
type GetDatasetResponse struct {
Datasets []string `json:"datasets"`
// Total Total number of datasets.
Total int `json:"total"`
}
// GetExtractorResponse defines model for GetExtractorResponse.
type GetExtractorResponse struct {
// Methods List of the metadata extraction method names configured in the ingestor
Methods []MethodItem `json:"methods"`
// Total Total number of methods
Total int `json:"total"`
}
// GetMetadataRequest defines model for GetMetadataRequest.
type GetMetadataRequest struct {
// FilePath The file path of the selected data record.
FilePath string `json:"filePath"`
// MethodName The selected methodName for data extraction.
MethodName string `json:"methodName"`
}
// GetTransferResponse defines model for GetTransferResponse.
type GetTransferResponse struct {
// Total Total number of transfers.
Total *int `json:"total,omitempty"`
Transfers *[]TransferItem `json:"transfers,omitempty"`
}
// MethodItem a method item describes the method's name and schema
type MethodItem struct {
Name string `json:"name"`
Schema string `json:"schema"`
}
// OtherHealthResponse defines model for OtherHealthResponse.
type OtherHealthResponse struct {
Errors *map[string]string `json:"errors,omitempty"`
// Status Status of the ingestor.
Status string `json:"status"`
}
// OtherVersionResponse defines model for OtherVersionResponse.
type OtherVersionResponse struct {
// Version Version of the ingestor.
Version *string `json:"version,omitempty"`
}
// PostDatasetRequest defines model for PostDatasetRequest.
type PostDatasetRequest struct {
// MetaData The metadata of the dataset.
MetaData string `json:"metaData"`
}
// PostDatasetResponse defines model for PostDatasetResponse.
type PostDatasetResponse struct {
// IngestId The unique ingestion id of the dataset.
IngestId *string `json:"ingestId,omitempty"`
// Status The status of the ingestion. Can be used to send a message back to the ui.
Status *string `json:"status,omitempty"`
}
// TransferItem defines model for TransferItem.
type TransferItem struct {
Status *string `json:"status,omitempty"`
TransferId *string `json:"transferId,omitempty"`
}
// GetCallbackParams defines parameters for GetCallback.
type GetCallbackParams struct {
// Code For handling the authorization code received from the OIDC provider
Code string `form:"code" json:"code"`
// State parameter for CSRF protection
State string `form:"state" json:"state"`
}
// DatasetControllerGetDatasetParams defines parameters for DatasetControllerGetDataset.
type DatasetControllerGetDatasetParams struct {
Page *uint `form:"page,omitempty" json:"page,omitempty"`
PageSize *uint `form:"pageSize,omitempty" json:"pageSize,omitempty"`
}
// ExtractorControllerGetExtractorMethodsParams defines parameters for ExtractorControllerGetExtractorMethods.
type ExtractorControllerGetExtractorMethodsParams struct {
Page *uint `form:"page,omitempty" json:"page,omitempty"`
PageSize *uint `form:"pageSize,omitempty" json:"pageSize,omitempty"`
}
// TransferControllerGetTransferParams defines parameters for TransferControllerGetTransfer.
type TransferControllerGetTransferParams struct {
TransferId *string `form:"transferId,omitempty" json:"transferId,omitempty"`
Page *int `form:"page,omitempty" json:"page,omitempty"`
PageSize *int `form:"pageSize,omitempty" json:"pageSize,omitempty"`
}
// DatasetControllerIngestDatasetJSONRequestBody defines body for DatasetControllerIngestDataset for application/json ContentType.
type DatasetControllerIngestDatasetJSONRequestBody = PostDatasetRequest
// ExtractMetadataJSONRequestBody defines body for ExtractMetadata for application/json ContentType.
type ExtractMetadataJSONRequestBody = GetMetadataRequest
// TransferControllerDeleteTransferJSONRequestBody defines body for TransferControllerDeleteTransfer for application/json ContentType.
type TransferControllerDeleteTransferJSONRequestBody = DeleteTransferRequest
// ServerInterface represents all server handlers.
type ServerInterface interface {
// OIDC callback
// (GET /callback)
GetCallback(c *gin.Context, params GetCallbackParams)
// Get the available datasets.
// (GET /dataset)
DatasetControllerGetDataset(c *gin.Context, params DatasetControllerGetDatasetParams)
// Ingest a new dataset
// (POST /dataset)
DatasetControllerIngestDataset(c *gin.Context)
// Get available extraction methods
// (GET /extractor)
ExtractorControllerGetExtractorMethods(c *gin.Context, params ExtractorControllerGetExtractorMethodsParams)
// Get the health status.
// (GET /health)
OtherControllerGetHealth(c *gin.Context)
// OIDC login
// (GET /login)
GetLogin(c *gin.Context)
// end user session
// (GET /logout)
GetLogout(c *gin.Context)
// get metadata of a dataset
// (GET /metadata)
ExtractMetadata(c *gin.Context)
// Cancel a data transfer
// (DELETE /transfer)
TransferControllerDeleteTransfer(c *gin.Context)
// Get list of transfers. Optional use the transferId parameter to only get one item.
// (GET /transfer)
TransferControllerGetTransfer(c *gin.Context, params TransferControllerGetTransferParams)
// Get the used ingestor version
// (GET /version)
OtherControllerGetVersion(c *gin.Context)
}
// ServerInterfaceWrapper converts contexts to parameters.
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandler func(*gin.Context, error, int)
}
type MiddlewareFunc func(c *gin.Context)
// GetCallback operation middleware
func (siw *ServerInterfaceWrapper) GetCallback(c *gin.Context) {
var err error
// Parameter object where we will unmarshal all parameters from the context
var params GetCallbackParams
// ------------- Required query parameter "code" -------------
if paramValue := c.Query("code"); paramValue != "" {
} else {
siw.ErrorHandler(c, fmt.Errorf("Query argument code is required, but not found"), http.StatusBadRequest)
return
}
err = runtime.BindQueryParameter("form", true, true, "code", c.Request.URL.Query(), ¶ms.Code)
if err != nil {
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter code: %w", err), http.StatusBadRequest)
return
}
// ------------- Required query parameter "state" -------------
if paramValue := c.Query("state"); paramValue != "" {
} else {
siw.ErrorHandler(c, fmt.Errorf("Query argument state is required, but not found"), http.StatusBadRequest)
return
}
err = runtime.BindQueryParameter("form", true, true, "state", c.Request.URL.Query(), ¶ms.State)
if err != nil {
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter state: %w", err), http.StatusBadRequest)
return
}
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.GetCallback(c, params)
}
// DatasetControllerGetDataset operation middleware
func (siw *ServerInterfaceWrapper) DatasetControllerGetDataset(c *gin.Context) {
var err error
c.Set(CookieAuthScopes, []string{"ingestor_read", "ingestor_write", "admin"})
// Parameter object where we will unmarshal all parameters from the context
var params DatasetControllerGetDatasetParams
// ------------- Optional query parameter "page" -------------
err = runtime.BindQueryParameter("form", true, false, "page", c.Request.URL.Query(), ¶ms.Page)
if err != nil {
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter page: %w", err), http.StatusBadRequest)
return
}
// ------------- Optional query parameter "pageSize" -------------
err = runtime.BindQueryParameter("form", true, false, "pageSize", c.Request.URL.Query(), ¶ms.PageSize)
if err != nil {
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter pageSize: %w", err), http.StatusBadRequest)
return
}
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.DatasetControllerGetDataset(c, params)
}
// DatasetControllerIngestDataset operation middleware
func (siw *ServerInterfaceWrapper) DatasetControllerIngestDataset(c *gin.Context) {
c.Set(CookieAuthScopes, []string{"ingestor_write"})
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.DatasetControllerIngestDataset(c)
}
// ExtractorControllerGetExtractorMethods operation middleware
func (siw *ServerInterfaceWrapper) ExtractorControllerGetExtractorMethods(c *gin.Context) {
var err error
c.Set(CookieAuthScopes, []string{"ingestor_read"})
// Parameter object where we will unmarshal all parameters from the context
var params ExtractorControllerGetExtractorMethodsParams
// ------------- Optional query parameter "page" -------------
err = runtime.BindQueryParameter("form", true, false, "page", c.Request.URL.Query(), ¶ms.Page)
if err != nil {
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter page: %w", err), http.StatusBadRequest)
return
}
// ------------- Optional query parameter "pageSize" -------------
err = runtime.BindQueryParameter("form", true, false, "pageSize", c.Request.URL.Query(), ¶ms.PageSize)
if err != nil {
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter pageSize: %w", err), http.StatusBadRequest)
return
}
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.ExtractorControllerGetExtractorMethods(c, params)
}
// OtherControllerGetHealth operation middleware
func (siw *ServerInterfaceWrapper) OtherControllerGetHealth(c *gin.Context) {
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.OtherControllerGetHealth(c)
}
// GetLogin operation middleware
func (siw *ServerInterfaceWrapper) GetLogin(c *gin.Context) {
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.GetLogin(c)
}
// GetLogout operation middleware
func (siw *ServerInterfaceWrapper) GetLogout(c *gin.Context) {
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.GetLogout(c)
}
// ExtractMetadata operation middleware
func (siw *ServerInterfaceWrapper) ExtractMetadata(c *gin.Context) {
c.Set(CookieAuthScopes, []string{"ingestor_read", "ingestor_write", "admin"})
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.ExtractMetadata(c)
}
// TransferControllerDeleteTransfer operation middleware
func (siw *ServerInterfaceWrapper) TransferControllerDeleteTransfer(c *gin.Context) {
c.Set(CookieAuthScopes, []string{"ingestor_write"})
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.TransferControllerDeleteTransfer(c)
}
// TransferControllerGetTransfer operation middleware
func (siw *ServerInterfaceWrapper) TransferControllerGetTransfer(c *gin.Context) {
var err error
c.Set(CookieAuthScopes, []string{"ingestor_read"})
// Parameter object where we will unmarshal all parameters from the context
var params TransferControllerGetTransferParams
// ------------- Optional query parameter "transferId" -------------
err = runtime.BindQueryParameter("form", true, false, "transferId", c.Request.URL.Query(), ¶ms.TransferId)
if err != nil {
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter transferId: %w", err), http.StatusBadRequest)
return
}
// ------------- Optional query parameter "page" -------------
err = runtime.BindQueryParameter("form", true, false, "page", c.Request.URL.Query(), ¶ms.Page)
if err != nil {
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter page: %w", err), http.StatusBadRequest)
return
}
// ------------- Optional query parameter "pageSize" -------------
err = runtime.BindQueryParameter("form", true, false, "pageSize", c.Request.URL.Query(), ¶ms.PageSize)
if err != nil {
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter pageSize: %w", err), http.StatusBadRequest)
return
}
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.TransferControllerGetTransfer(c, params)
}
// OtherControllerGetVersion operation middleware
func (siw *ServerInterfaceWrapper) OtherControllerGetVersion(c *gin.Context) {
for _, middleware := range siw.HandlerMiddlewares {
middleware(c)
if c.IsAborted() {
return
}
}
siw.Handler.OtherControllerGetVersion(c)
}
// GinServerOptions provides options for the Gin server.
type GinServerOptions struct {
BaseURL string
Middlewares []MiddlewareFunc
ErrorHandler func(*gin.Context, error, int)
}
// RegisterHandlers creates http.Handler with routing matching OpenAPI spec.
func RegisterHandlers(router gin.IRouter, si ServerInterface) {
RegisterHandlersWithOptions(router, si, GinServerOptions{})
}
// RegisterHandlersWithOptions creates http.Handler with additional options
func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions) {
errorHandler := options.ErrorHandler
if errorHandler == nil {
errorHandler = func(c *gin.Context, err error, statusCode int) {
c.JSON(statusCode, gin.H{"msg": err.Error()})
}
}
wrapper := ServerInterfaceWrapper{
Handler: si,
HandlerMiddlewares: options.Middlewares,
ErrorHandler: errorHandler,
}
router.GET(options.BaseURL+"/callback", wrapper.GetCallback)
router.GET(options.BaseURL+"/dataset", wrapper.DatasetControllerGetDataset)
router.POST(options.BaseURL+"/dataset", wrapper.DatasetControllerIngestDataset)
router.GET(options.BaseURL+"/extractor", wrapper.ExtractorControllerGetExtractorMethods)
router.GET(options.BaseURL+"/health", wrapper.OtherControllerGetHealth)
router.GET(options.BaseURL+"/login", wrapper.GetLogin)
router.GET(options.BaseURL+"/logout", wrapper.GetLogout)
router.GET(options.BaseURL+"/metadata", wrapper.ExtractMetadata)
router.DELETE(options.BaseURL+"/transfer", wrapper.TransferControllerDeleteTransfer)
router.GET(options.BaseURL+"/transfer", wrapper.TransferControllerGetTransfer)
router.GET(options.BaseURL+"/version", wrapper.OtherControllerGetVersion)
}
type GetCallbackRequestObject struct {
Params GetCallbackParams
}
type GetCallbackResponseObject interface {
VisitGetCallbackResponse(w http.ResponseWriter) error
}
type GetCallback302ResponseHeaders struct {
Location string
}
type GetCallback302Response struct {
Headers GetCallback302ResponseHeaders
}
func (response GetCallback302Response) VisitGetCallbackResponse(w http.ResponseWriter) error {
w.Header().Set("location", fmt.Sprint(response.Headers.Location))
w.WriteHeader(302)
return nil
}
type GetCallback400TextResponse string
func (response GetCallback400TextResponse) VisitGetCallbackResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(400)
_, err := w.Write([]byte(response))
return err
}
type GetCallback500TextResponse string
func (response GetCallback500TextResponse) VisitGetCallbackResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(500)
_, err := w.Write([]byte(response))
return err
}
type DatasetControllerGetDatasetRequestObject struct {
Params DatasetControllerGetDatasetParams
}
type DatasetControllerGetDatasetResponseObject interface {
VisitDatasetControllerGetDatasetResponse(w http.ResponseWriter) error
}
type DatasetControllerGetDataset200JSONResponse GetDatasetResponse
func (response DatasetControllerGetDataset200JSONResponse) VisitDatasetControllerGetDatasetResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
return json.NewEncoder(w).Encode(response)
}
type DatasetControllerGetDataset400TextResponse string
func (response DatasetControllerGetDataset400TextResponse) VisitDatasetControllerGetDatasetResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(400)
_, err := w.Write([]byte(response))
return err
}
type DatasetControllerIngestDatasetRequestObject struct {
Body *DatasetControllerIngestDatasetJSONRequestBody
}
type DatasetControllerIngestDatasetResponseObject interface {
VisitDatasetControllerIngestDatasetResponse(w http.ResponseWriter) error
}
type DatasetControllerIngestDataset200JSONResponse PostDatasetResponse
func (response DatasetControllerIngestDataset200JSONResponse) VisitDatasetControllerIngestDatasetResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
return json.NewEncoder(w).Encode(response)
}
type DatasetControllerIngestDataset400TextResponse string
func (response DatasetControllerIngestDataset400TextResponse) VisitDatasetControllerIngestDatasetResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(400)
_, err := w.Write([]byte(response))
return err
}
type ExtractorControllerGetExtractorMethodsRequestObject struct {
Params ExtractorControllerGetExtractorMethodsParams
}
type ExtractorControllerGetExtractorMethodsResponseObject interface {
VisitExtractorControllerGetExtractorMethodsResponse(w http.ResponseWriter) error
}
type ExtractorControllerGetExtractorMethods200JSONResponse GetExtractorResponse
func (response ExtractorControllerGetExtractorMethods200JSONResponse) VisitExtractorControllerGetExtractorMethodsResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
return json.NewEncoder(w).Encode(response)
}
type OtherControllerGetHealthRequestObject struct {
}
type OtherControllerGetHealthResponseObject interface {
VisitOtherControllerGetHealthResponse(w http.ResponseWriter) error
}
type OtherControllerGetHealth200JSONResponse OtherHealthResponse
func (response OtherControllerGetHealth200JSONResponse) VisitOtherControllerGetHealthResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
return json.NewEncoder(w).Encode(response)
}
type OtherControllerGetHealth400TextResponse string
func (response OtherControllerGetHealth400TextResponse) VisitOtherControllerGetHealthResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(400)
_, err := w.Write([]byte(response))
return err
}
type GetLoginRequestObject struct {
}
type GetLoginResponseObject interface {
VisitGetLoginResponse(w http.ResponseWriter) error
}
type GetLogin302ResponseHeaders struct {
Location string
}
type GetLogin302Response struct {
Headers GetLogin302ResponseHeaders
}
func (response GetLogin302Response) VisitGetLoginResponse(w http.ResponseWriter) error {
w.Header().Set("location", fmt.Sprint(response.Headers.Location))
w.WriteHeader(302)
return nil
}
type GetLogoutRequestObject struct {
}
type GetLogoutResponseObject interface {
VisitGetLogoutResponse(w http.ResponseWriter) error
}
type GetLogout302ResponseHeaders struct {
Location string
}
type GetLogout302Response struct {
Headers GetLogout302ResponseHeaders
}
func (response GetLogout302Response) VisitGetLogoutResponse(w http.ResponseWriter) error {
w.Header().Set("location", fmt.Sprint(response.Headers.Location))
w.WriteHeader(302)
return nil
}
type GetLogout500TextResponse string
func (response GetLogout500TextResponse) VisitGetLogoutResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(500)
_, err := w.Write([]byte(response))
return err
}
type ExtractMetadataRequestObject struct {
Body *ExtractMetadataJSONRequestBody
}
type ExtractMetadataResponseObject interface {
VisitExtractMetadataResponse(w http.ResponseWriter) error
}
type ExtractMetadata200ResponseHeaders struct {
CacheControl string
Connection string
ContentType string
}
type ExtractMetadata200TexteventStreamResponse struct {
Body io.Reader
Headers ExtractMetadata200ResponseHeaders
ContentLength int64
}
func (response ExtractMetadata200TexteventStreamResponse) VisitExtractMetadataResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/event-stream")
if response.ContentLength != 0 {
w.Header().Set("Content-Length", fmt.Sprint(response.ContentLength))
}
w.Header().Set("Cache-Control", fmt.Sprint(response.Headers.CacheControl))
w.Header().Set("Connection", fmt.Sprint(response.Headers.Connection))
w.Header().Set("Content-Type", fmt.Sprint(response.Headers.ContentType))
w.WriteHeader(200)
if closer, ok := response.Body.(io.ReadCloser); ok {
defer closer.Close()
}
_, err := io.Copy(w, response.Body)
return err
}
type ExtractMetadatadefaultJSONResponse struct {
Body Error
StatusCode int
}
func (response ExtractMetadatadefaultJSONResponse) VisitExtractMetadataResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(response.StatusCode)
return json.NewEncoder(w).Encode(response.Body)
}
type TransferControllerDeleteTransferRequestObject struct {
Body *TransferControllerDeleteTransferJSONRequestBody
}
type TransferControllerDeleteTransferResponseObject interface {
VisitTransferControllerDeleteTransferResponse(w http.ResponseWriter) error
}
type TransferControllerDeleteTransfer200JSONResponse DeleteTransferResponse
func (response TransferControllerDeleteTransfer200JSONResponse) VisitTransferControllerDeleteTransferResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
return json.NewEncoder(w).Encode(response)
}
type TransferControllerDeleteTransfer400TextResponse string
func (response TransferControllerDeleteTransfer400TextResponse) VisitTransferControllerDeleteTransferResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(400)
_, err := w.Write([]byte(response))
return err
}
type TransferControllerGetTransferRequestObject struct {
Params TransferControllerGetTransferParams
}
type TransferControllerGetTransferResponseObject interface {
VisitTransferControllerGetTransferResponse(w http.ResponseWriter) error
}
type TransferControllerGetTransfer200JSONResponse GetTransferResponse
func (response TransferControllerGetTransfer200JSONResponse) VisitTransferControllerGetTransferResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
return json.NewEncoder(w).Encode(response)
}
type TransferControllerGetTransfer400TextResponse string
func (response TransferControllerGetTransfer400TextResponse) VisitTransferControllerGetTransferResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(400)
_, err := w.Write([]byte(response))
return err
}
type OtherControllerGetVersionRequestObject struct {
}
type OtherControllerGetVersionResponseObject interface {
VisitOtherControllerGetVersionResponse(w http.ResponseWriter) error
}
type OtherControllerGetVersion200JSONResponse OtherVersionResponse
func (response OtherControllerGetVersion200JSONResponse) VisitOtherControllerGetVersionResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
return json.NewEncoder(w).Encode(response)
}
type OtherControllerGetVersion400TextResponse string
func (response OtherControllerGetVersion400TextResponse) VisitOtherControllerGetVersionResponse(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(400)
_, err := w.Write([]byte(response))
return err
}
// StrictServerInterface represents all server handlers.
type StrictServerInterface interface {
// OIDC callback
// (GET /callback)
GetCallback(ctx context.Context, request GetCallbackRequestObject) (GetCallbackResponseObject, error)
// Get the available datasets.
// (GET /dataset)
DatasetControllerGetDataset(ctx context.Context, request DatasetControllerGetDatasetRequestObject) (DatasetControllerGetDatasetResponseObject, error)
// Ingest a new dataset
// (POST /dataset)
DatasetControllerIngestDataset(ctx context.Context, request DatasetControllerIngestDatasetRequestObject) (DatasetControllerIngestDatasetResponseObject, error)
// Get available extraction methods
// (GET /extractor)
ExtractorControllerGetExtractorMethods(ctx context.Context, request ExtractorControllerGetExtractorMethodsRequestObject) (ExtractorControllerGetExtractorMethodsResponseObject, error)
// Get the health status.
// (GET /health)
OtherControllerGetHealth(ctx context.Context, request OtherControllerGetHealthRequestObject) (OtherControllerGetHealthResponseObject, error)
// OIDC login
// (GET /login)
GetLogin(ctx context.Context, request GetLoginRequestObject) (GetLoginResponseObject, error)
// end user session
// (GET /logout)
GetLogout(ctx context.Context, request GetLogoutRequestObject) (GetLogoutResponseObject, error)
// get metadata of a dataset
// (GET /metadata)
ExtractMetadata(ctx context.Context, request ExtractMetadataRequestObject) (ExtractMetadataResponseObject, error)
// Cancel a data transfer
// (DELETE /transfer)
TransferControllerDeleteTransfer(ctx context.Context, request TransferControllerDeleteTransferRequestObject) (TransferControllerDeleteTransferResponseObject, error)
// Get list of transfers. Optional use the transferId parameter to only get one item.
// (GET /transfer)
TransferControllerGetTransfer(ctx context.Context, request TransferControllerGetTransferRequestObject) (TransferControllerGetTransferResponseObject, error)
// Get the used ingestor version
// (GET /version)
OtherControllerGetVersion(ctx context.Context, request OtherControllerGetVersionRequestObject) (OtherControllerGetVersionResponseObject, error)
}
type StrictHandlerFunc = strictgin.StrictGinHandlerFunc
type StrictMiddlewareFunc = strictgin.StrictGinMiddlewareFunc
func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface {
return &strictHandler{ssi: ssi, middlewares: middlewares}
}
type strictHandler struct {
ssi StrictServerInterface
middlewares []StrictMiddlewareFunc
}
// GetCallback operation middleware
func (sh *strictHandler) GetCallback(ctx *gin.Context, params GetCallbackParams) {
var request GetCallbackRequestObject
request.Params = params
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
return sh.ssi.GetCallback(ctx, request.(GetCallbackRequestObject))
}
for _, middleware := range sh.middlewares {
handler = middleware(handler, "GetCallback")
}
response, err := handler(ctx, request)
if err != nil {
ctx.Error(err)
ctx.Status(http.StatusInternalServerError)
} else if validResponse, ok := response.(GetCallbackResponseObject); ok {
if err := validResponse.VisitGetCallbackResponse(ctx.Writer); err != nil {
ctx.Error(err)
}
} else if response != nil {
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
}
}
// DatasetControllerGetDataset operation middleware
func (sh *strictHandler) DatasetControllerGetDataset(ctx *gin.Context, params DatasetControllerGetDatasetParams) {
var request DatasetControllerGetDatasetRequestObject
request.Params = params
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
return sh.ssi.DatasetControllerGetDataset(ctx, request.(DatasetControllerGetDatasetRequestObject))
}
for _, middleware := range sh.middlewares {
handler = middleware(handler, "DatasetControllerGetDataset")
}
response, err := handler(ctx, request)
if err != nil {
ctx.Error(err)
ctx.Status(http.StatusInternalServerError)
} else if validResponse, ok := response.(DatasetControllerGetDatasetResponseObject); ok {
if err := validResponse.VisitDatasetControllerGetDatasetResponse(ctx.Writer); err != nil {
ctx.Error(err)
}
} else if response != nil {
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
}
}
// DatasetControllerIngestDataset operation middleware
func (sh *strictHandler) DatasetControllerIngestDataset(ctx *gin.Context) {
var request DatasetControllerIngestDatasetRequestObject
var body DatasetControllerIngestDatasetJSONRequestBody
if err := ctx.ShouldBindJSON(&body); err != nil {
ctx.Status(http.StatusBadRequest)
ctx.Error(err)
return
}
request.Body = &body
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
return sh.ssi.DatasetControllerIngestDataset(ctx, request.(DatasetControllerIngestDatasetRequestObject))
}
for _, middleware := range sh.middlewares {
handler = middleware(handler, "DatasetControllerIngestDataset")
}
response, err := handler(ctx, request)
if err != nil {
ctx.Error(err)
ctx.Status(http.StatusInternalServerError)
} else if validResponse, ok := response.(DatasetControllerIngestDatasetResponseObject); ok {
if err := validResponse.VisitDatasetControllerIngestDatasetResponse(ctx.Writer); err != nil {
ctx.Error(err)
}
} else if response != nil {
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
}
}
// ExtractorControllerGetExtractorMethods operation middleware
func (sh *strictHandler) ExtractorControllerGetExtractorMethods(ctx *gin.Context, params ExtractorControllerGetExtractorMethodsParams) {
var request ExtractorControllerGetExtractorMethodsRequestObject
request.Params = params
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
return sh.ssi.ExtractorControllerGetExtractorMethods(ctx, request.(ExtractorControllerGetExtractorMethodsRequestObject))
}
for _, middleware := range sh.middlewares {
handler = middleware(handler, "ExtractorControllerGetExtractorMethods")
}
response, err := handler(ctx, request)
if err != nil {
ctx.Error(err)
ctx.Status(http.StatusInternalServerError)
} else if validResponse, ok := response.(ExtractorControllerGetExtractorMethodsResponseObject); ok {
if err := validResponse.VisitExtractorControllerGetExtractorMethodsResponse(ctx.Writer); err != nil {
ctx.Error(err)
}
} else if response != nil {
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
}
}
// OtherControllerGetHealth operation middleware
func (sh *strictHandler) OtherControllerGetHealth(ctx *gin.Context) {
var request OtherControllerGetHealthRequestObject
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
return sh.ssi.OtherControllerGetHealth(ctx, request.(OtherControllerGetHealthRequestObject))
}
for _, middleware := range sh.middlewares {
handler = middleware(handler, "OtherControllerGetHealth")
}