diff --git a/Sources/AppStoreConnectClient/Models/Build.swift b/Sources/AppStoreConnectClient/Models/Build.swift index 06925ba..d22abb1 100644 --- a/Sources/AppStoreConnectClient/Models/Build.swift +++ b/Sources/AppStoreConnectClient/Models/Build.swift @@ -42,6 +42,20 @@ public struct Build: Equatable { /// The minimum version of the operating system required to run this build. public let minOsVersion: String? + /// Initializes a `Build` instance with the provided parameters. + /// - Parameters: + /// - id: A unique identifier for the build. + /// - version: The version number of the build. + /// - uploadedDate: The date when the build was uploaded, if available. + /// - minOsVersion: The minimum OS version required for this build, if specified. + /// - Note: Some properties may be nil if not provided during initialization. + public init(id: String, version: String, uploadedDate: Date?, minOsVersion: String?) { + self.id = id + self.version = version + self.uploadedDate = uploadedDate + self.minOsVersion = minOsVersion + } + /// Initializes a `Build` instance with the provided App Store Connect build schema. /// - Parameters: /// - schema: The schema representing the build from the API. diff --git a/Sources/AppStoreConnectClient/Models/PreReleaseVersion.swift b/Sources/AppStoreConnectClient/Models/PreReleaseVersion.swift index 9445e0a..7baa49b 100644 --- a/Sources/AppStoreConnectClient/Models/PreReleaseVersion.swift +++ b/Sources/AppStoreConnectClient/Models/PreReleaseVersion.swift @@ -38,6 +38,18 @@ public struct PreReleaseVersion { /// The platform for which the pre-release version is intended. public let platform: String? + /// Initializes a `PreReleaseVersion` instance with the provided parameters. + /// - Parameters: + /// - id: The unique identifier for the pre-release version. + /// - version: The version string of the pre-release version. + /// - platform: The platform for which the pre-release version is intended, if specified. + /// - Note: This initializer creates a new `PreReleaseVersion` instance with the given information. + public init(id: String, version: String, platform: String?) { + self.id = id + self.version = version + self.platform = platform + } + /// Initializes a `PreReleaseVersion` instance with the provided testFlight's pre-release version schema. /// - Parameters: /// - schema: The schema representing the pre-release version from the API. diff --git a/Sources/AppStoreConnectClient/Models/Release.swift b/Sources/AppStoreConnectClient/Models/Release.swift index 81b1486..cb07365 100644 --- a/Sources/AppStoreConnectClient/Models/Release.swift +++ b/Sources/AppStoreConnectClient/Models/Release.swift @@ -35,6 +35,15 @@ public struct Release { /// The state of the release on the App Store. public let appStoreState: String + /// Initializes a `Release` instance with the provided parameters. + /// - Parameters: + /// - version: The version string of the release. + /// - appStoreState: The state of the release on the App Store. + /// - Note: This initializer creates a new `Release` instance with the given information. + public init(version: String, appStoreState: String) { + self.version = version + self.appStoreState = appStoreState + } /// Initializes a `Release` instance with the provided App Store version schema. /// - Parameters: /// - schema: The schema representing the App Store version. diff --git a/Tests/AppStoreConnectClientTests/BuildTest.swift b/Tests/AppStoreConnectClientTests/BuildTest.swift index 6704982..1f1973c 100644 --- a/Tests/AppStoreConnectClientTests/BuildTest.swift +++ b/Tests/AppStoreConnectClientTests/BuildTest.swift @@ -64,4 +64,16 @@ final class BuildTest: XCTestCase { XCTAssertNil(build.uploadedDate) XCTAssertNil(build.minOsVersion) } + + func testBuildInitializer() { + let id = "mock-123" + let version = "mock-1.0.0" + let uploadedDate = Date() + let minOsVersion = "mock-14.0" + let build = Build(id: id, version: version, uploadedDate: uploadedDate, minOsVersion: minOsVersion) + XCTAssertEqual(build.id, id) + XCTAssertEqual(build.version, version) + XCTAssertEqual(build.uploadedDate, uploadedDate) + XCTAssertEqual(build.minOsVersion, minOsVersion) + } } diff --git a/Tests/AppStoreConnectClientTests/PreReleaseVersionTest.swift b/Tests/AppStoreConnectClientTests/PreReleaseVersionTest.swift index 7ff711f..48abbf8 100644 --- a/Tests/AppStoreConnectClientTests/PreReleaseVersionTest.swift +++ b/Tests/AppStoreConnectClientTests/PreReleaseVersionTest.swift @@ -64,4 +64,14 @@ final class PreReleaseVersionTest: XCTestCase { XCTAssertNil(preReleaseVersion.version) XCTAssertNil(preReleaseVersion.platform) } + + func testPreReleaseVersionInitializer() { + let id = "mock-456" + let version = "mock-2.0.0" + let platform = "mock-iOS" + let preRelease = PreReleaseVersion(id: id, version: version, platform: platform) + XCTAssertEqual(preRelease.id, id) + XCTAssertEqual(preRelease.version, version) + XCTAssertEqual(preRelease.platform, platform) + } } diff --git a/Tests/AppStoreConnectClientTests/ReleaseTests.swift b/Tests/AppStoreConnectClientTests/ReleaseTests.swift index 8602715..11f3f40 100644 --- a/Tests/AppStoreConnectClientTests/ReleaseTests.swift +++ b/Tests/AppStoreConnectClientTests/ReleaseTests.swift @@ -54,4 +54,12 @@ final class ReleaseTests: XCTestCase { let release = Release(schema: schema) XCTAssertNil(release) } + + func testReleaseInitializer() { + let version = "mock-3.0.0" + let appStoreState = "mock-Ready for Sale" + let release = Release(version: version, appStoreState: appStoreState) + XCTAssertEqual(release.version, version) + XCTAssertEqual(release.appStoreState, appStoreState) + } }