@@ -15,10 +15,11 @@ public RepositoriesController(RepositoryService repositoryService)
15
15
}
16
16
17
17
[ HttpPost ]
18
- [ Route ( "/api/v1/repositories/{type}/download" ) ]
18
+ [ Route ( "/api/v1/repositories/{type}/{uid}/ download" ) ]
19
19
[ ApiExplorerSettings ( GroupName = "v1" ) ]
20
20
public async Task DownloadEntity ( string type , string uid )
21
21
{
22
+ if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
22
23
if ( uid == null ) throw new ArgumentNullException ( nameof ( uid ) ) ;
23
24
24
25
var typeBuffer = ( RepositoryType ) Enum . Parse ( typeof ( RepositoryType ) , type , true ) ;
@@ -30,8 +31,61 @@ public async Task DownloadEntity(string type, string uid)
30
31
[ ApiExplorerSettings ( GroupName = "v1" ) ]
31
32
public void DeleteEntity ( string type , string uid )
32
33
{
34
+ if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
35
+ if ( uid == null ) throw new ArgumentNullException ( nameof ( uid ) ) ;
36
+
33
37
var typeBuffer = ( RepositoryType ) Enum . Parse ( typeof ( RepositoryType ) , type , true ) ;
34
38
_repositoryService . DeleteEntity ( typeBuffer , RepositoryEntityUid . Parse ( uid ) ) ;
35
39
}
40
+
41
+ [ HttpPost ]
42
+ [ Route ( "/api/v1/repositories/component_logics/{uid}/download" ) ]
43
+ [ ApiExplorerSettings ( GroupName = "v1" ) ]
44
+ public async Task DownloadComponentLogicEntity ( string uid )
45
+ {
46
+ if ( uid == null ) throw new ArgumentNullException ( nameof ( uid ) ) ;
47
+
48
+ await _repositoryService . DownloadEntityAsync ( RepositoryType . ComponentLogics , RepositoryEntityUid . Parse ( uid ) ) ;
49
+ }
50
+
51
+ [ HttpPost ]
52
+ [ Route ( "/api/v1/repositories/component_adapters/{uid}/download" ) ]
53
+ [ ApiExplorerSettings ( GroupName = "v1" ) ]
54
+ public async Task DownloadComponentAdapterEntity ( string uid )
55
+ {
56
+ if ( uid == null ) throw new ArgumentNullException ( nameof ( uid ) ) ;
57
+
58
+ await _repositoryService . DownloadEntityAsync ( RepositoryType . ComponentAdapters , RepositoryEntityUid . Parse ( uid ) ) ;
59
+ }
60
+
61
+ [ HttpPost ]
62
+ [ Route ( "/api/v1/repositories/services/{uid}/download" ) ]
63
+ [ ApiExplorerSettings ( GroupName = "v1" ) ]
64
+ public async Task DownloadServiceEntity ( string uid )
65
+ {
66
+ if ( uid == null ) throw new ArgumentNullException ( nameof ( uid ) ) ;
67
+
68
+ await _repositoryService . DownloadEntityAsync ( RepositoryType . Services , RepositoryEntityUid . Parse ( uid ) ) ;
69
+ }
70
+
71
+ [ HttpPost ]
72
+ [ Route ( "/api/v1/repositories/tools/{uid}/download" ) ]
73
+ [ ApiExplorerSettings ( GroupName = "v1" ) ]
74
+ public async Task DownloadToolEntity ( string uid )
75
+ {
76
+ if ( uid == null ) throw new ArgumentNullException ( nameof ( uid ) ) ;
77
+
78
+ await _repositoryService . DownloadEntityAsync ( RepositoryType . Tools , RepositoryEntityUid . Parse ( uid ) ) ;
79
+ }
80
+
81
+ [ HttpPost ]
82
+ [ Route ( "/api/v1/repositories/automations/{uid}/download" ) ]
83
+ [ ApiExplorerSettings ( GroupName = "v1" ) ]
84
+ public async Task DownloadAutomationEntity ( string uid )
85
+ {
86
+ if ( uid == null ) throw new ArgumentNullException ( nameof ( uid ) ) ;
87
+
88
+ await _repositoryService . DownloadEntityAsync ( RepositoryType . Automations , RepositoryEntityUid . Parse ( uid ) ) ;
89
+ }
36
90
}
37
91
}
0 commit comments