-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More App Store Version Localization APIs/models. (#139)
* More App Store Version Localization APIs/models. * Fix typo. * Use URL for consistency with existing APIs. Lint. * Add missing ID parameter. * Enums. * App Preview Sets models and API. * Add unit tests. Co-authored-by: Antoine van der Lee <[email protected]>
- Loading branch information
Showing
30 changed files
with
1,236 additions
and
10 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
Sources/Endpoints/TestFlight/App Store Versions/CreateAppStoreVersionLocalization.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,31 @@ | ||
import Foundation | ||
|
||
public extension APIEndpoint where T == AppStoreVersionLocalizationResponse { | ||
static func create( | ||
appStoreVersionLocalizationForVersionWithId versionId: String, | ||
locale: String, | ||
description: String? = nil, | ||
keywords: String? = nil, | ||
marketingUrl: URL? = nil, | ||
promotionalText: String? = nil, | ||
supportUrl: URL? = nil, | ||
whatsNew: String? = nil | ||
) -> APIEndpoint { | ||
let request = AppStoreVersionLocalizationCreateRequest( | ||
appStoreVersionId: versionId, | ||
locale: locale, | ||
description: description, | ||
keywords: keywords, | ||
marketingUrl: marketingUrl, | ||
promotionalText: promotionalText, | ||
supportUrl: supportUrl, | ||
whatsNew: whatsNew | ||
) | ||
return APIEndpoint( | ||
path: "appStoreVersionLocalizations", | ||
method: .post, | ||
parameters: nil, | ||
body: try? JSONEncoder().encode(request) | ||
) | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Sources/Endpoints/TestFlight/App Store Versions/DeleteAppStoreVersionLocalizations.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,7 @@ | ||
import Foundation | ||
|
||
public extension APIEndpoint where T == Void { | ||
static func delete(appStoreVersionLocalizationWithId id: String) -> APIEndpoint { | ||
return APIEndpoint(path: "appStoreVersionLocalizations/\(id)", method: .delete, parameters: nil) | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
Sources/Endpoints/TestFlight/App Store Versions/ListAppPreviewSets.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,99 @@ | ||
import Foundation | ||
|
||
public extension APIEndpoint where T == AppPreviewSetsResponse { | ||
static func appPreviewSets( | ||
forAppStoreVersionLocalization id: String, | ||
fields: [ListAppPreviewSetsForAppStoreVersionLocalization.Field]? = nil, | ||
includes: [ListAppPreviewSetsForAppStoreVersionLocalization.Include]? = nil, | ||
limit: Int? = nil | ||
) -> APIEndpoint { | ||
var parameters = [String: Any]() | ||
if let fields = fields { parameters.add(fields) } | ||
if let includes = includes { parameters.add(includes) } | ||
if let limit = limit { parameters["limit"] = limit } | ||
return APIEndpoint( | ||
path: "appStoreVersions/\(id)/appPreviewSets", | ||
method: .get, | ||
parameters: parameters | ||
) | ||
} | ||
} | ||
|
||
public enum ListAppPreviewSetsForAppStoreVersionLocalization { | ||
public enum Field: NestableQueryParameter { | ||
case appPreviewSets([AppPreviewSets]) | ||
case appPreviews([AppPreviews]) | ||
case appStoreVersionLocalizations([AppStoreVersionLocalizations]) | ||
case previewType([PreviewType]) | ||
|
||
static var key: String = "fields" | ||
var pair: Pair { | ||
switch self { | ||
case let .appPreviewSets(value): | ||
return (AppPreviewSets.key, value.map { $0.pair.value }.joinedByCommas()) | ||
|
||
case let .appPreviews(value): | ||
return (AppPreviews.key, value.map { $0.pair.value }.joinedByCommas()) | ||
|
||
case let .appStoreVersionLocalizations(value): | ||
return (AppStoreVersionLocalizations.key, value.map { $0.pair.value }.joinedByCommas()) | ||
|
||
case let .previewType(value): | ||
return (PreviewType.key, value.map { $0.pair.value }.joinedByCommas()) | ||
} | ||
} | ||
} | ||
|
||
public enum Include: String, CaseIterable, NestableQueryParameter { | ||
case appPreviews, appStoreVersionLocalization | ||
|
||
static var key: String = "include" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
} | ||
|
||
public extension ListAppPreviewSetsForAppStoreVersionLocalization.Field { | ||
enum AppPreviewSets: String, CaseIterable, NestableQueryParameter { | ||
case appPreviews, appStoreVersionLocalization, previewType | ||
|
||
static var key: String = "appPreviewSets" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
|
||
enum AppPreviews: String, CaseIterable, NestableQueryParameter { | ||
case appPreviewSet, assetDeliveryState, fileName, fileSize, mimeType, previewFrameTimeCode, previewImage, | ||
sourceFileChecksum, uploadOperations, uploaded, videoUrl | ||
|
||
static var key: String = "appPreviews" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
|
||
enum AppStoreVersionLocalizations: String, CaseIterable, NestableQueryParameter { | ||
case appPreviewSets, appScreenshotSets, appStoreVersion, description, keywords, locale, marketingUrl, | ||
promotionalText, supportUrl, whatsNew | ||
|
||
static var key: String = "appStoreVersionLocalizations" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
|
||
enum PreviewType: String, CaseIterable, NestableQueryParameter { | ||
case iPhone6Point5Inch = "IPHONE_65" | ||
case iPhone5Point8Inch = "IPHONE_58" | ||
case iPhone5Point5Inch = "IPHONE_55" | ||
case iPhone4Point7Inch = "IPHONE_47" | ||
case iPhone4Inch = "IPHONE_40" | ||
case iPhone3Point5Inch = "IPHONE_35" | ||
case iPadPro3rdGen12Point9Inch = "IPAD_PRO_3GEN_129" | ||
case iPadPro3rdGen11Inch = "IPAD_PRO_3GEN_11" | ||
case iPadPro12Point9Inch = "IPAD_PRO_129" | ||
case iPadPro10Point5Inch = "IPAD_105" | ||
case iPadPro9Point7Inch = "IPAD_97" | ||
case mac = "DESKTOP" | ||
case appleWatchSeries4 = "WATCH_SERIES_4" | ||
case appleWatchSeries3 = "WATCH_SERIES_3" | ||
case appleTV = "APPLE_TV" | ||
|
||
static var key: String = "previewType" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
} |
109 changes: 109 additions & 0 deletions
109
Sources/Endpoints/TestFlight/App Store Versions/ListAppScreenshotSets.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,109 @@ | ||
import Foundation | ||
|
||
public extension APIEndpoint where T == AppScreenshotSetsResponse { | ||
static func appScreenshotSets( | ||
forAppStoreVersionLocalization id: String, | ||
fields: [ListAppScreenshotSetsForAppStoreVersionLocalization.Field]? = nil, | ||
includes: [ListAppScreenshotSetsForAppStoreVersionLocalization.Include]? = nil, | ||
limit: Int? = nil | ||
) -> APIEndpoint { | ||
var parameters = [String: Any]() | ||
if let fields = fields { parameters.add(fields) } | ||
if let includes = includes { parameters.add(includes) } | ||
if let limit = limit { parameters["limit"] = limit } | ||
return APIEndpoint( | ||
path: "appStoreVersions/\(id)/appScreenshotSets", | ||
method: .get, | ||
parameters: parameters | ||
) | ||
} | ||
} | ||
|
||
public enum ListAppScreenshotSetsForAppStoreVersionLocalization { | ||
public enum Field: NestableQueryParameter { | ||
case appScreenshotSets([AppScreenshotSets]) | ||
case appScreenshots([AppScreenshots]) | ||
case appStoreVersionLocalizations([AppStoreVersionLocalizations]) | ||
case screenshotDisplayType([ScreenshotDisplayType]) | ||
|
||
static var key: String = "fields" | ||
var pair: Pair { | ||
switch self { | ||
case let .appScreenshotSets(value): | ||
return (AppScreenshotSets.key, value.map { $0.pair.value }.joinedByCommas()) | ||
|
||
case let .appScreenshots(value): | ||
return (AppScreenshots.key, value.map { $0.pair.value }.joinedByCommas()) | ||
|
||
case let .appStoreVersionLocalizations(value): | ||
return (AppStoreVersionLocalizations.key, value.map { $0.pair.value }.joinedByCommas()) | ||
|
||
case let .screenshotDisplayType(value): | ||
return (ScreenshotDisplayType.key, value.map { $0.pair.value }.joinedByCommas()) | ||
} | ||
} | ||
} | ||
|
||
public enum Include: String, CaseIterable, NestableQueryParameter { | ||
case appScreenshots, appStoreVersionLocalization | ||
|
||
static var key: String = "include" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
} | ||
|
||
public extension ListAppScreenshotSetsForAppStoreVersionLocalization.Field { | ||
enum AppScreenshotSets: String, CaseIterable, NestableQueryParameter { | ||
case appScreenshots, appStoreVersionLocalization, screenshotDisplayType | ||
|
||
static var key: String = "appScreenshotSets" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
|
||
enum AppScreenshots: String, CaseIterable, NestableQueryParameter { | ||
case appScreenshotSet, assetDeliveryState, assetToken, assetType, fileName, fileSize, imageAsset, | ||
sourceFileChecksum, uploadOperations, uploaded | ||
|
||
static var key: String = "appScreenshots" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
|
||
enum AppStoreVersionLocalizations: String, CaseIterable, NestableQueryParameter { | ||
case appPreviewSets, appScreenshotSets, appStoreVersion, description, keywords, locale, marketingUrl, | ||
promotionalText, supportUrl, whatsNew | ||
|
||
static var key: String = "appStoreVersionLocalizations" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
|
||
enum ScreenshotDisplayType: String, CaseIterable, NestableQueryParameter { | ||
case iPhone6Point5Inch = "APP_IPHONE_65" | ||
case iPhone5Point8Inch = "APP_IPHONE_58" | ||
case iPhone5Point5Inch = "APP_IPHONE_55" | ||
case iPhone4Point7Inch = "APP_IPHONE_47" | ||
case iPhone4Inch = "APP_IPHONE_40" | ||
case iPhone3Point5Inch = "APP_IPHONE_35" | ||
case iPadPro3rdGen12Point9Inch = "APP_IPAD_PRO_3GEN_129" | ||
case iPadPro3rdGen11Inch = "APP_IPAD_PRO_3GEN_11" | ||
case iPadPro12Point9Inch = "APP_IPAD_PRO_129" | ||
case iPadPro10Point5Inch = "APP_IPAD_105" | ||
case iPadPro9Point7Inch = "APP_IPAD_97" | ||
case mac = "APP_DESKTOP" | ||
case appleWatchSeries4 = "APP_WATCH_SERIES_4" | ||
case appleWatchSeries3 = "APP_WATCH_SERIES_3" | ||
case appleTV = "APP_APPLE_TV" | ||
case iPhone6Point5InchMessaging = "IMESSAGE_APP_IPHONE_65" | ||
case iPhone5Point8InchMessaging = "IMESSAGE_APP_IPHONE_58" | ||
case iPhone5Point5InchMessaging = "IMESSAGE_APP_IPHONE_55" | ||
case iPhone4Point7InchMessaging = "IMESSAGE_APP_IPHONE_47" | ||
case iPhone4InchMessaging = "IMESSAGE_APP_IPHONE_40" | ||
case iPadPro3rdGen12Point9InchMessaging = "IMESSAGE_APP_IPAD_PRO_3GEN_129" | ||
case iPadPro3rdGen11InchMessaging = "IMESSAGE_APP_IPAD_PRO_3GEN_11" | ||
case iPadPro12Point9InchMessaging = "IMESSAGE_APP_IPAD_PRO_129" | ||
case iPadPro10Point5InchMessaging = "IMESSAGE_APP_IPAD_105" | ||
case iPadPro9Point7InchMessaging = "IMESSAGE_APP_IPAD_97" | ||
|
||
static var key: String = "screenshotDisplayType" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Sources/Endpoints/TestFlight/App Store Versions/ModifyAppStoreVersionLocalization.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,29 @@ | ||
import Foundation | ||
|
||
public extension APIEndpoint where T == AppStoreVersionLocalizationResponse { | ||
static func modify( | ||
appStoreVersionLocalizationWithId id: String, | ||
description: String? = nil, | ||
keywords: String? = nil, | ||
marketingUrl: URL? = nil, | ||
promotionalText: String? = nil, | ||
supportUrl: URL? = nil, | ||
whatsNew: String? = nil | ||
) -> APIEndpoint { | ||
let request = AppStoreVersionLocalizationUpdateRequest( | ||
id: id, | ||
description: description, | ||
keywords: keywords, | ||
marketingUrl: marketingUrl, | ||
promotionalText: promotionalText, | ||
supportUrl: supportUrl, | ||
whatsNew: whatsNew | ||
) | ||
return APIEndpoint( | ||
path: "appStoreVersionLocalizations/\(id)", | ||
method: .patch, | ||
parameters: nil, | ||
body: try? JSONEncoder().encode(request) | ||
) | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
Sources/Endpoints/TestFlight/App Store Versions/ReadAppStoreVersionLocalization.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,91 @@ | ||
import Foundation | ||
|
||
public extension APIEndpoint where T == AppStoreVersionLocalization { | ||
static func appStoreVersionLocalization( | ||
withId id: String, | ||
fields: [ReadAppStoreVersionLocalizationInformation.Field]? = nil, | ||
include: [ReadAppStoreVersionLocalizationInformation.Include]? = nil, | ||
limits: [ReadAppStoreVersionLocalizationInformation.Limit]? = nil | ||
) -> APIEndpoint { | ||
var parameters = [String: Any]() | ||
if let fields = fields { parameters.add(fields) } | ||
if let include = include { parameters.add(include) } | ||
if let limits = limits { parameters.add(limits) } | ||
return APIEndpoint( | ||
path: "appStoreVersionLocalizations/\(id)", | ||
method: .get, | ||
parameters: parameters | ||
) | ||
} | ||
} | ||
|
||
public enum ReadAppStoreVersionLocalizationInformation { | ||
public enum Field: NestableQueryParameter { | ||
case appPreviewSets([Field.AppPreviewSet]) | ||
case appScreenshotSets([Field.AppScreenshotSet]) | ||
case appStoreVersionLocalizations([Field.AppStoreVersionLocalization]) | ||
|
||
static var key: String = "fields" | ||
var pair: Pair { | ||
switch self { | ||
case let .appPreviewSets(value): | ||
return (Field.AppPreviewSet.key, value.map { $0.pair.value }.joinedByCommas()) | ||
case let .appScreenshotSets(value): | ||
return (Field.AppScreenshotSet.key, value.map { $0.pair.value }.joinedByCommas()) | ||
case let .appStoreVersionLocalizations(value): | ||
return (Field.AppStoreVersionLocalization.key, value.map { $0.pair.value }.joinedByCommas()) | ||
} | ||
} | ||
} | ||
|
||
public enum Include: String, CaseIterable, NestableQueryParameter { | ||
case appPreviewSets | ||
case appScreenshotSets | ||
case appStoreVersion | ||
|
||
static var key: String = "include" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
|
||
public enum Limit: NestableQueryParameter { | ||
/// Maximum: 50 | ||
case appPreviewSets(Int) | ||
|
||
/// Maximum: 50 | ||
case appScreenshotSets(Int) | ||
|
||
static var key: String = "limit" | ||
var pair: Pair { | ||
switch self { | ||
case let .appPreviewSets(value): | ||
return ("appPreviewSets", "\(value)") | ||
case let .appScreenshotSets(value): | ||
return ("appScreenshotSets", "\(value)") | ||
} | ||
} | ||
} | ||
} | ||
|
||
public extension ReadAppStoreVersionLocalizationInformation.Field { | ||
enum AppPreviewSet: String, CaseIterable, NestableQueryParameter { | ||
case appPreviews, appStoreVersionLocalization, previewType | ||
|
||
static var key: String = "appPreviewSets" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
|
||
enum AppScreenshotSet: String, CaseIterable, NestableQueryParameter { | ||
case appScreenshots, appStoreVersionLocalization, screenshotDisplayType | ||
|
||
static var key: String = "appScreenshotSets" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
|
||
enum AppStoreVersionLocalization: String, CaseIterable, NestableQueryParameter { | ||
case appPreviewSets, appScreenshotSets, appStoreVersion, description, keywords, locale, marketingUrl, | ||
promotionalText, supportUrl, whatsNew | ||
|
||
static var key: String = "appStoreVersionLocalizations" | ||
var pair: NestableQueryParameter.Pair { return (nil, rawValue) } | ||
} | ||
} |
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,7 @@ | ||
import Foundation | ||
|
||
public struct AppMediaAssetState: Codable { | ||
public let errors: [AppMediaStateError]? | ||
public let state: String? | ||
public let warnings: [AppMediaStateError]? | ||
} |
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,6 @@ | ||
import Foundation | ||
|
||
public struct AppMediaStateError: Codable { | ||
public let code: String? | ||
public let description: String? | ||
} |
Oops, something went wrong.