@@ -12,7 +12,7 @@ import PackageModel
12
12
import TSCBasic
13
13
14
14
// TODO: is there a better name? this conflicts with the module name which is okay in this case but not ideal in Swift
15
- internal struct PackageCollections : PackageCollectionsProtocol {
15
+ public struct PackageCollections : PackageCollectionsProtocol {
16
16
private let configuration : Configuration
17
17
private let storage : Storage
18
18
private let providers : [ PackageCollectionsModel . CollectionSourceType : PackageCollectionProvider ]
@@ -23,13 +23,13 @@ internal struct PackageCollections: PackageCollectionsProtocol {
23
23
self . providers = providers
24
24
}
25
25
26
- func listProfiles( callback: @escaping ( Result < [ PackageCollectionsModel . Profile ] , Error > ) -> Void ) {
26
+ public func listProfiles( callback: @escaping ( Result < [ PackageCollectionsModel . Profile ] , Error > ) -> Void ) {
27
27
self . storage. collectionsProfiles. listProfiles ( callback: callback)
28
28
}
29
29
30
- func listCollections( identifiers: Set < PackageCollectionsModel . CollectionIdentifier > ? = nil ,
31
- in profile: PackageCollectionsModel . Profile ? = nil ,
32
- callback: @escaping ( Result < [ PackageCollectionsModel . Collection ] , Error > ) -> Void ) {
30
+ public func listCollections( identifiers: Set < PackageCollectionsModel . CollectionIdentifier > ? = nil ,
31
+ in profile: PackageCollectionsModel . Profile ? = nil ,
32
+ callback: @escaping ( Result < [ PackageCollectionsModel . Collection ] , Error > ) -> Void ) {
33
33
let profile = profile ?? . default
34
34
35
35
self . storage. collectionsProfiles. listSources ( in: profile) { result in
@@ -60,7 +60,7 @@ internal struct PackageCollections: PackageCollectionsProtocol {
60
60
}
61
61
}
62
62
63
- func findPackages(
63
+ public func findPackages(
64
64
_ query: String ,
65
65
collections: Set < PackageCollectionsModel . CollectionIdentifier > ? = nil ,
66
66
profile: PackageCollectionsModel . Profile ? = nil ,
@@ -82,8 +82,8 @@ internal struct PackageCollections: PackageCollectionsProtocol {
82
82
}
83
83
}
84
84
85
- func refreshCollections( in profile: PackageCollectionsModel . Profile ? = nil ,
86
- callback: @escaping ( Result < [ PackageCollectionsModel . CollectionSource ] , Error > ) -> Void ) {
85
+ public func refreshCollections( in profile: PackageCollectionsModel . Profile ? = nil ,
86
+ callback: @escaping ( Result < [ PackageCollectionsModel . CollectionSource ] , Error > ) -> Void ) {
87
87
let profile = profile ?? . default
88
88
89
89
self . storage. collectionsProfiles. listSources ( in: profile) { result in
@@ -109,10 +109,10 @@ internal struct PackageCollections: PackageCollectionsProtocol {
109
109
}
110
110
}
111
111
112
- func addCollection( _ source: PackageCollectionsModel . CollectionSource ,
113
- order: Int ? = nil ,
114
- to profile: PackageCollectionsModel . Profile ? = nil ,
115
- callback: @escaping ( Result < PackageCollectionsModel . Collection , Error > ) -> Void ) {
112
+ public func addCollection( _ source: PackageCollectionsModel . CollectionSource ,
113
+ order: Int ? = nil ,
114
+ to profile: PackageCollectionsModel . Profile ? = nil ,
115
+ callback: @escaping ( Result < PackageCollectionsModel . Collection , Error > ) -> Void ) {
116
116
let profile = profile ?? . default
117
117
118
118
if let errors = source. validate ( ) {
@@ -131,9 +131,9 @@ internal struct PackageCollections: PackageCollectionsProtocol {
131
131
}
132
132
}
133
133
134
- func removeCollection( _ source: PackageCollectionsModel . CollectionSource ,
135
- from profile: PackageCollectionsModel . Profile ? = nil ,
136
- callback: @escaping ( Result < Void , Error > ) -> Void ) {
134
+ public func removeCollection( _ source: PackageCollectionsModel . CollectionSource ,
135
+ from profile: PackageCollectionsModel . Profile ? = nil ,
136
+ callback: @escaping ( Result < Void , Error > ) -> Void ) {
137
137
let profile = profile ?? . default
138
138
139
139
self . storage. collectionsProfiles. remove ( source: source, from: profile) { result in
@@ -159,9 +159,9 @@ internal struct PackageCollections: PackageCollectionsProtocol {
159
159
}
160
160
}
161
161
162
- func moveCollection( _ source: PackageCollectionsModel . CollectionSource ,
163
- to order: Int , in profile: PackageCollectionsModel . Profile ? = nil ,
164
- callback: @escaping ( Result < Void , Error > ) -> Void ) {
162
+ public func moveCollection( _ source: PackageCollectionsModel . CollectionSource ,
163
+ to order: Int , in profile: PackageCollectionsModel . Profile ? = nil ,
164
+ callback: @escaping ( Result < Void , Error > ) -> Void ) {
165
165
let profile = profile ?? . default
166
166
167
167
self . storage. collectionsProfiles. move ( source: source, to: order, in: profile, callback: callback)
@@ -170,8 +170,8 @@ internal struct PackageCollections: PackageCollectionsProtocol {
170
170
// Returns information about a package collection.
171
171
// The collection is not required to be in the configured list.
172
172
// If not found locally (storage), the collection will be fetched from the source.
173
- func getCollection( _ source: PackageCollectionsModel . CollectionSource ,
174
- callback: @escaping ( Result < PackageCollectionsModel . Collection , Error > ) -> Void ) {
173
+ public func getCollection( _ source: PackageCollectionsModel . CollectionSource ,
174
+ callback: @escaping ( Result < PackageCollectionsModel . Collection , Error > ) -> Void ) {
175
175
if let errors = source. validate ( ) {
176
176
return callback ( . failure( MultipleErrors ( errors) ) )
177
177
}
@@ -189,7 +189,7 @@ internal struct PackageCollections: PackageCollectionsProtocol {
189
189
}
190
190
}
191
191
192
- func listTargets(
192
+ public func listTargets(
193
193
collections: Set < PackageCollectionsModel . CollectionIdentifier > ? = nil ,
194
194
in profile: PackageCollectionsModel . Profile ? = nil ,
195
195
callback: @escaping ( Result < PackageCollectionsModel . TargetListResult , Error > ) -> Void
@@ -205,7 +205,7 @@ internal struct PackageCollections: PackageCollectionsProtocol {
205
205
}
206
206
}
207
207
208
- func findTargets(
208
+ public func findTargets(
209
209
_ query: String ,
210
210
searchType: PackageCollectionsModel . TargetSearchType ? = nil ,
211
211
collections: Set < PackageCollectionsModel . CollectionIdentifier > ? = nil ,
@@ -230,9 +230,9 @@ internal struct PackageCollections: PackageCollectionsProtocol {
230
230
}
231
231
232
232
// FIXME:
233
- func getPackageMetadata( _ reference: PackageReference ,
234
- profile: PackageCollectionsModel . Profile ? = nil ,
235
- callback: @escaping ( Result < PackageCollectionsModel . PackageMetadata , Error > ) -> Void ) {
233
+ public func getPackageMetadata( _ reference: PackageReference ,
234
+ profile: PackageCollectionsModel . Profile ? = nil ,
235
+ callback: @escaping ( Result < PackageCollectionsModel . PackageMetadata , Error > ) -> Void ) {
236
236
fatalError ( " not implemented " )
237
237
}
238
238
0 commit comments