-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for submitting an App Version for Review and CRUD for App…
… Store Versions (#145) * Create models and endpoint for Create an App Store Version Submission * Models and endpoint for Modify an App Store Version * Create models and endpoint for Create an App Store Version * Add support for Delete an App Store Version * Add some high level documentation
- Loading branch information
1 parent
e909081
commit a3aab80
Showing
14 changed files
with
629 additions
and
18 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...s/Endpoints/TestFlight/App Store Review Submissions/CreateAppStoreVersionSubmission.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Foundation | ||
|
||
public extension APIEndpoint where T == AppStoreVersionSubmissionResponse { | ||
|
||
/// Submit an App Store version to App Review. | ||
/// | ||
/// # Reference | ||
/// [Apple Documentation](https://developer.apple.com/documentation/appstoreconnectapi/create_an_app_store_version_submission) | ||
static func create( | ||
appStoreVersionSubmissionForVersionWithId versionId: String | ||
) -> APIEndpoint { | ||
let request = AppStoreVersionSubmissionCreateRequest( | ||
appStoreVersionId: versionId | ||
) | ||
return APIEndpoint( | ||
path: "appStoreVersionSubmissions", | ||
method: .post, | ||
parameters: nil, | ||
body: try? JSONEncoder().encode(request) | ||
) | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Sources/Endpoints/TestFlight/App Store Versions/CreateAppStoreVersion.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Foundation | ||
|
||
public extension APIEndpoint where T == AppStoreVersionResponse { | ||
|
||
/// Add a new App Store version or platform to an app. | ||
/// | ||
/// # Reference | ||
/// [Apple Documentation](https://developer.apple.com/documentation/appstoreconnectapi/create_an_app_store_version) | ||
static func create( | ||
appStoreVersionForAppId id: String, | ||
versionString: String, | ||
platform: AppStoreVersionCreateRequest.Data.Attributes.Platform, | ||
copyright: String? = nil, | ||
earliestReleaseDate: Date? = nil, | ||
releaseType: AppStoreVersionCreateRequest.Data.Attributes.ReleaseType? = nil, | ||
usesIdfa: Bool? = nil, | ||
buildId: String? = nil | ||
) -> APIEndpoint { | ||
let request = AppStoreVersionCreateRequest( | ||
appStoreVersionForAppId: id, | ||
versionString: versionString, | ||
platform: platform, | ||
copyright: copyright, | ||
earliestReleaseDate: earliestReleaseDate, | ||
releaseType: releaseType, | ||
usesIdfa: usesIdfa, | ||
buildId: buildId | ||
) | ||
return APIEndpoint( | ||
path: "appStoreVersions", | ||
method: .post, | ||
parameters: nil, | ||
body: try? JSONEncoder().encode(request) | ||
) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Sources/Endpoints/TestFlight/App Store Versions/DeleteAppStoreVersion.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
extension APIEndpoint where T == Void { | ||
|
||
/// Delete an app store version that is associated with an app. | ||
/// | ||
/// # Reference | ||
/// [Apple Documentation](https://developer.apple.com/documentation/appstoreconnectapi/delete_an_app_store_version) | ||
public static func delete(appStoreVersionWithId id: String) -> APIEndpoint { | ||
return APIEndpoint(path: "appStoreVersions/\(id)", method: .delete, parameters: nil) | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Sources/Endpoints/TestFlight/App Store Versions/ModifyAppStoreVersion.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Foundation | ||
|
||
public extension APIEndpoint where T == AppStoreVersionResponse { | ||
|
||
/// Update the app store version for a specific app. | ||
/// | ||
/// # Reference | ||
/// [Apple Documentation](https://developer.apple.com/documentation/appstoreconnectapi/modify_an_app_store_version) | ||
static func modify( | ||
appStoreVersionWithId id: String, | ||
buildId: String? = nil, | ||
copyright: String? = nil, | ||
earliestReleaseDate: Date? = nil, | ||
releaseType: AppStoreVersionUpdateRequest.Data.Attributes.ReleaseType? = nil, | ||
usesIdfa: Bool? = nil, | ||
versionString: String? = nil, | ||
downloadable: Bool? = nil | ||
) -> APIEndpoint { | ||
let request = AppStoreVersionUpdateRequest( | ||
id: id, | ||
buildId: buildId, | ||
copyright: copyright, | ||
earliestReleaseDate: earliestReleaseDate, | ||
releaseType: releaseType, | ||
usesIdfa: usesIdfa, | ||
versionString: versionString, | ||
downloadable: downloadable | ||
) | ||
return APIEndpoint( | ||
path: "appStoreVersions/\(id)", | ||
method: .patch, | ||
parameters: nil, | ||
body: try? JSONEncoder().encode(request) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import Foundation | ||
|
||
public struct AppStoreVersionCreateRequest: Codable { | ||
|
||
public let data: AppStoreVersionCreateRequest.Data | ||
|
||
public init( | ||
appStoreVersionForAppId id: String, | ||
versionString: String, | ||
platform: AppStoreVersionCreateRequest.Data.Attributes.Platform, | ||
copyright: String? = nil, | ||
earliestReleaseDate: Date? = nil, | ||
releaseType: AppStoreVersionCreateRequest.Data.Attributes.ReleaseType? = nil, | ||
usesIdfa: Bool? = nil, | ||
buildId: String? = nil | ||
) { | ||
var build: AppStoreVersionCreateRequest.Data.Relationships.Build? | ||
if let buildId = buildId { | ||
build = .init(data: .init(id: buildId)) | ||
} | ||
|
||
data = .init(attributes: .init(copyright: copyright, | ||
earliestReleaseDate: earliestReleaseDate, | ||
platform: platform, | ||
releaseType: releaseType, | ||
usesIdfa: usesIdfa, | ||
versionString: versionString), | ||
relationships: .init(app: .init(data: .init(id: id)), | ||
build: build)) | ||
} | ||
} | ||
|
||
// MARK: AppStoreVersionCreateRequest | ||
extension AppStoreVersionCreateRequest { | ||
|
||
public struct Data: Codable { | ||
|
||
public let attributes: AppStoreVersionCreateRequest.Data.Attributes | ||
|
||
public let relationships: AppStoreVersionCreateRequest.Data.Relationships | ||
|
||
public let type: String = "appStoreVersions" | ||
} | ||
} | ||
|
||
// MARK: AppStoreVersionCreateRequest.Data | ||
extension AppStoreVersionCreateRequest.Data { | ||
|
||
public struct Attributes: Codable { | ||
|
||
public let copyright: String? | ||
|
||
public let earliestReleaseDate: Date? | ||
|
||
public let platform: AppStoreVersionCreateRequest.Data.Attributes.Platform | ||
|
||
public let releaseType: AppStoreVersionCreateRequest.Data.Attributes.ReleaseType? | ||
|
||
public let usesIdfa: Bool? | ||
|
||
public let versionString: String | ||
} | ||
|
||
public struct Relationships: Codable { | ||
|
||
public let app: AppStoreVersionCreateRequest.Data.Relationships.App | ||
|
||
public let build: AppStoreVersionCreateRequest.Data.Relationships.Build? | ||
} | ||
} | ||
|
||
// MARK: AppStoreVersionCreateRequest.Data.Attributes | ||
extension AppStoreVersionCreateRequest.Data.Attributes { | ||
|
||
public enum Platform: String, CaseIterable, Codable { | ||
case iOS = "IOS" | ||
case macOS = "MAC_OS" | ||
case tvOS = "TV_OS" | ||
} | ||
|
||
public enum ReleaseType: String, CaseIterable, Codable { | ||
case manual = "MANUAL" | ||
case afterApproval = "AFTER_APPROVAL" | ||
case scheduled = "SCHEDULED" | ||
} | ||
} | ||
|
||
// MARK: AppStoreVersionCreateRequest.Data.Relationships | ||
extension AppStoreVersionCreateRequest.Data.Relationships { | ||
|
||
public struct App: Codable { | ||
|
||
public let data: AppStoreVersionCreateRequest.Data.Relationships.App.Data | ||
} | ||
|
||
public struct Build: Codable { | ||
|
||
public let data: AppStoreVersionCreateRequest.Data.Relationships.Build.Data? | ||
} | ||
} | ||
|
||
// MARK: AppStoreVersionCreateRequest.Data.Relationships.App | ||
extension AppStoreVersionCreateRequest.Data.Relationships.App { | ||
|
||
public struct Data: Codable { | ||
|
||
public let id: String | ||
|
||
public let type: String = "apps" | ||
} | ||
} | ||
|
||
// MARK: AppStoreVersionCreateRequest.Data.Relationships.Build | ||
extension AppStoreVersionCreateRequest.Data.Relationships.Build { | ||
|
||
public struct Data: Codable { | ||
|
||
public let id: String | ||
|
||
public let type: String = "builds" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import Foundation | ||
|
||
public struct AppStoreVersionSubmission: Codable { | ||
public let id: String | ||
|
||
public let links: ResourceLinks<AppStoreVersionSubmissionResponse> | ||
|
||
public let relationships: AppStoreVersionSubmission.Relationships? | ||
|
||
public let type: String = "appStoreVersionSubmissions" | ||
} | ||
|
||
// MARK: AppStoreVersionSubmission | ||
extension AppStoreVersionSubmission { | ||
|
||
public struct Relationships: Codable { | ||
|
||
public let appStoreVersion: AppStoreVersionSubmission.Relationships.AppStoreVersion? | ||
|
||
} | ||
} | ||
|
||
// MARK: AppStoreVersionSubmission.Relationships | ||
extension AppStoreVersionSubmission.Relationships { | ||
|
||
public struct AppStoreVersion: Codable { | ||
|
||
public let data: AppStoreVersionSubmission.Relationships.AppStoreVersion.Data? | ||
|
||
public let links: AppStoreVersionSubmission.Relationships.AppStoreVersion.Links? | ||
} | ||
} | ||
|
||
// MARK: AppStoreVersionSubmission.Relationships.AppStoreVersion | ||
extension AppStoreVersionSubmission.Relationships.AppStoreVersion { | ||
|
||
public struct Data: Codable { | ||
public let id: String | ||
|
||
public let type: String = "appStoreVersions" | ||
} | ||
|
||
public struct Links: Codable { | ||
public let related: URL? | ||
|
||
public let `self`: URL? | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
Sources/Models/AppStoreVersionSubmissionCreateRequest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import Foundation | ||
|
||
public struct AppStoreVersionSubmissionCreateRequest: Codable { | ||
|
||
public struct Data: Codable { | ||
|
||
public let relationships: AppStoreVersionSubmissionCreateRequest.Data.Relationships | ||
|
||
public let type: String = "appStoreVersionSubmissions" | ||
} | ||
|
||
public let data: AppStoreVersionSubmissionCreateRequest.Data | ||
|
||
init(appStoreVersionId: String) { | ||
self.data = .init(relationships: .init(appStoreVersion: .init(data: .init(id: appStoreVersionId)))) | ||
} | ||
} | ||
|
||
// MARK: AppStoreVersionSubmissionCreateRequest.Data | ||
extension AppStoreVersionSubmissionCreateRequest.Data { | ||
|
||
public struct Relationships: Codable { | ||
|
||
public let appStoreVersion: AppStoreVersionSubmissionCreateRequest.Data.Relationships.AppStoreVersion | ||
|
||
} | ||
} | ||
|
||
// MARK: - AppStoreVersionSubmissionCreateRequest.Data.Relationships | ||
extension AppStoreVersionSubmissionCreateRequest.Data.Relationships { | ||
|
||
public struct AppStoreVersion: Codable { | ||
|
||
public let data: AppStoreVersionSubmissionCreateRequest.Data.Relationships.AppStoreVersion.Data | ||
|
||
} | ||
} | ||
|
||
// MARK: AppStoreVersionSubmissionCreateRequest.Data.Relationships.AppStoreVersion | ||
extension AppStoreVersionSubmissionCreateRequest.Data.Relationships.AppStoreVersion { | ||
|
||
public struct Data: Codable { | ||
|
||
public let id: String | ||
|
||
public let type: String = "appStoreVersions" | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Foundation | ||
|
||
public struct AppStoreVersionSubmissionResponse: Codable { | ||
|
||
public let data: AppStoreVersionSubmission | ||
|
||
public let links: DocumentLinks | ||
|
||
} |
Oops, something went wrong.