@@ -54,7 +54,7 @@ public protocol HTTPRequestExecutor {
5454 func execute( _ request: HTTPClientRequest , timeout: TimeAmount ) async throws -> HTTPClientResponse
5555 func getCurrentSwiftlyRelease( ) async throws -> Components . Schemas . SwiftlyRelease
5656 func getReleaseToolchains( ) async throws -> [ Components . Schemas . Release ]
57- func getSnapshotToolchains( branch: Components . Schemas . KnownSourceBranch , platform: Components . Schemas . KnownPlatformIdentifier ) async throws -> Components . Schemas . DevToolchains
57+ func getSnapshotToolchains( branch: Components . Schemas . SourceBranch , platform: Components . Schemas . PlatformIdentifier ) async throws -> Components . Schemas . DevToolchains
5858}
5959
6060internal struct SwiftlyUserAgentMiddleware : ClientMiddleware {
@@ -146,7 +146,7 @@ internal class HTTPRequestExecutorImpl: HTTPRequestExecutor {
146146 return try response. ok. body. json
147147 }
148148
149- public func getSnapshotToolchains( branch: Components . Schemas . KnownSourceBranch , platform: Components . Schemas . KnownPlatformIdentifier ) async throws -> Components . Schemas . DevToolchains {
149+ public func getSnapshotToolchains( branch: Components . Schemas . SourceBranch , platform: Components . Schemas . PlatformIdentifier ) async throws -> Components . Schemas . DevToolchains {
150150 let config = AsyncHTTPClientTransport . Configuration ( client: self . httpClient, timeout: . seconds( 30 ) )
151151 let swiftlyUserAgent = SwiftlyUserAgentMiddleware ( )
152152
@@ -371,34 +371,30 @@ public struct SwiftlyHTTPClient {
371371 limit: Int ? = nil ,
372372 filter: ( ( ToolchainVersion . Snapshot ) -> Bool ) ? = nil
373373 ) async throws -> [ ToolchainVersion . Snapshot ] {
374- let platformId : Components . Schemas . KnownPlatformIdentifier = switch platform. name {
375- // case PlatformDefinition.ubuntu2404.name:
376- // .ubuntu2404
377- // case PlatformDefinition.debian12.name:
378- // .debian12
379- // case PlatformDefinition.fedora39.name:
380- // .fedora39
374+ let platformId : Components . Schemas . PlatformIdentifier = switch platform. name {
375+ // These are new platforms that aren't yet in the list of known platforms in the OpenAPI schema
376+ case PlatformDefinition . ubuntu2404. name, PlatformDefinition . debian12. name, PlatformDefinition . fedora39. name:
377+ . init( value2: platform. name)
378+
381379 case PlatformDefinition . ubuntu2204. name:
382- . ubuntu2204
380+ . init ( value1 : . ubuntu2204)
383381 case PlatformDefinition . ubuntu2004. name:
384- . ubuntu2004
382+ . init ( value1 : . ubuntu2004)
385383 case PlatformDefinition . rhel9. name:
386- . ubi9
384+ . init ( value1 : . ubi9)
387385 case PlatformDefinition . amazonlinux2. name:
388- . amazonlinux2
386+ . init ( value1 : . amazonlinux2)
389387 case PlatformDefinition . macOS. name:
390- . macos
388+ . init ( value1 : . macos)
391389 default :
392390 throw SwiftlyError ( message: " No snapshot toolchains available for platform \( platform. name) " )
393391 }
394392
395- let sourceBranch : Components . Schemas . KnownSourceBranch = switch branch {
393+ let sourceBranch : Components . Schemas . SourceBranch = switch branch {
396394 case . main:
397- . main
398- case . release( major: 6 , minor: 0 ) :
399- . _6_0
400- default :
401- throw SwiftlyError ( message: " Unknown snapshot branch: \( branch) " )
395+ . init( value1: . main)
396+ case let . release( major, minor) :
397+ . init( value2: " \( major) . \( minor) " )
402398 }
403399
404400 let devToolchains = try await SwiftlyCore . httpRequestExecutor. getSnapshotToolchains ( branch: sourceBranch, platform: platformId)
0 commit comments