File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ enum Constants {
2626
2727 static let packageListUri = URI ( string: " https://raw.githubusercontent.com/SwiftPackageIndex/PackageList/main/packages.json " )
2828 static let packageDenyListUri = URI ( string: " https://raw.githubusercontent.com/SwiftPackageIndex/PackageList/main/denylist.json " )
29+ static let customCollectionsUri = URI ( string: " https://raw.githubusercontent.com/SwiftPackageIndex/PackageList/main/custom-package-collections.json.json " )
2930
3031 // NB: the underlying materialised views also have a limit, this is just an additional
3132 // limit to ensure we don't spill too many rows onto the home page
Original file line number Diff line number Diff line change @@ -25,6 +25,26 @@ struct PackageListRepositoryClient {
2525}
2626
2727
28+ extension PackageListRepositoryClient : DependencyKey {
29+ static var liveValue : PackageListRepositoryClient {
30+ . init(
31+ fetchCustomCollection: { client, url in
32+ try await client
33+ . get ( URI ( string: url. absoluteString) )
34+ . content
35+ . decode ( [ URL ] . self, using: JSONDecoder ( ) )
36+ } ,
37+ fetchCustomCollections: { client in
38+ try await client
39+ . get ( Constants . customCollectionsUri)
40+ . content
41+ . decode ( [ CustomCollection . DTO ] . self, using: JSONDecoder ( ) )
42+ }
43+ )
44+ }
45+ }
46+
47+
2848extension PackageListRepositoryClient : Sendable , TestDependencyKey {
2949 static var testValue : Self { Self ( ) }
3050}
You can’t perform that action at this time.
0 commit comments