Skip to content

Commit

Permalink
Merge branch 'master' into feature/app-store-versions
Browse files Browse the repository at this point in the history
  • Loading branch information
AvdLee authored May 6, 2021
2 parents 7bab2fd + cb831e2 commit 1359414
Show file tree
Hide file tree
Showing 2 changed files with 706 additions and 82 deletions.
161 changes: 108 additions & 53 deletions Sources/Endpoints/TestFlight/Builds/ListBuilds.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,96 +46,118 @@ public enum ListBuilds {
/// Fields to return for included related types.
public enum Field: NestableQueryParameter {
case appEncryptionDeclarations([AppEncryptionDeclaration])
case appStoreVersions([AppStoreVersion])
case apps([App])
case betaAppReviewSubmissions([BetaAppReviewSubmission])
case betaBuildLocalizations([BetaBuildLocalization])
case betaTesters([BetaTester])
case buildBetaDetails([BuildBetaDetail])
case buildIcons([BuildIcon])
case builds([Build])
case diagnosticSignatures([DiagnosticSignature])
case perfPowerMetrics([PerfPowerMetric])
case preReleaseVersions([PreReleaseVersion])
case buildBetaDetails([BuildBetaDetail])
case betaAppReviewSubmissions([BetaAppReviewSubmission])
case betaBuildLocalizations([BetaBuildLocalization])


static var key: String = "fields"
var pair: Pair {
switch self {
case .appEncryptionDeclarations(let value):
return (AppEncryptionDeclaration.key, value.map({ $0.pair.value }).joinedByCommas())
case .appStoreVersions(let value):
return (AppStoreVersion.key, value.map({ $0.pair.value }).joinedByCommas())
case .apps(let value):
return (App.key, value.map({ $0.pair.value }).joinedByCommas())
case .betaAppReviewSubmissions(let value):
return (BetaAppReviewSubmission.key, value.map({ $0.pair.value }).joinedByCommas())
case .betaBuildLocalizations(let value):
return (BetaBuildLocalization.key, value.map({ $0.pair.value }).joinedByCommas())
case .betaTesters(let value):
return (BetaTester.key, value.map({ $0.pair.value }).joinedByCommas())
case .buildBetaDetails(let value):
return (BuildBetaDetail.key, value.map({ $0.pair.value }).joinedByCommas())
case .buildIcons(let value):
return (BuildIcon.key, value.map({ $0.pair.value }).joinedByCommas())
case .builds(let value):
return (Build.key, value.map({ $0.pair.value }).joinedByCommas())
case .diagnosticSignatures(let value):
return (DiagnosticSignature.key, value.map({ $0.pair.value }).joinedByCommas())
case .perfPowerMetrics(let value):
return (PerfPowerMetric.key, value.map({ $0.pair.value }).joinedByCommas())
case .preReleaseVersions(let value):
return (PreReleaseVersion.key, value.map({ $0.pair.value }).joinedByCommas())
case .buildBetaDetails(let value):
return (BuildBetaDetail.key, value.map({ $0.pair.value }).joinedByCommas())
case .betaAppReviewSubmissions(let value):
return (BetaAppReviewSubmission.key, value.map({ $0.pair.value }).joinedByCommas())
case .betaBuildLocalizations(let value):
return (BetaBuildLocalization.key, value.map({ $0.pair.value }).joinedByCommas())
}
}
}

/// Attributes, relationships, and IDs by which to filter.
public enum Filter: NestableQueryParameter {
case app([String])
case appStoreVersion([String])
case betaAppReviewSubmissionBetaReviewState([String])
case betaGroups([String])
case expired([String])
case id([String])
case preReleaseVersion([String])
case preReleaseVersionVersion([String])
case preReleaseVersionPlatform([PreReleaseVersionPlatform])
case processingState([ProcessingState])
case version([String])
case usesNonExemptEncryption([String])
case preReleaseVersionVersion([String])
case betaGroups([String])
case betaAppReviewSubmissionBetaReviewState([String])
case version([String])

static var key: String = "filter"
var pair: Pair {
switch self {
case .app(let value):
return ("app", value.joinedByCommas())
case .appStoreVersion(let value):
return ("appStoreVersion", value.joinedByCommas())
case .betaAppReviewSubmissionBetaReviewState(let value):
return ("betaAppReviewSubmission.betaReviewState", value.joinedByCommas())
case .betaGroups(let value):
return ("betagroup", value.joinedByCommas())
case .expired(let value):
return ("expired", value.joinedByCommas())
case .id(let value):
return ("id", value.joinedByCommas())
case .preReleaseVersion(let value):
return ("preReleaseVersion", value.joinedByCommas())
case .preReleaseVersionPlatform(let value):
return (PreReleaseVersionPlatform.key, value.map({ $0.pair.value }).joinedByCommas())
case .preReleaseVersionVersion(let value):
return ("preReleaseVersion.version", value.joinedByCommas())
case .processingState(let value):
return (ProcessingState.key, value.map({ $0.pair.value }).joinedByCommas())
case .version(let value):
return ("version", value.joinedByCommas())
case .usesNonExemptEncryption(let value):
return ("usesNonExemptEncryption", value.joinedByCommas())
case .preReleaseVersionVersion(let value):
return ("preReleaseVersion.version", value.joinedByCommas())
case .betaGroups(let value):
return ("betagroup", value.joinedByCommas())
case .betaAppReviewSubmissionBetaReviewState(let value):
return ("betaAppReviewSubmission.betaReviewState", value.joinedByCommas())
case .version(let value):
return ("version", value.joinedByCommas())
}
}
}

/// Relationship data to include in the response.
public enum Include: String, CaseIterable, NestableQueryParameter {
case app, appEncryptionDeclaration, betaAppReviewSubmission, betaBuildLocalizations, buildBetaDetail, individualTesters, preReleaseVersion
case app, appEncryptionDeclaration, appStoreVersion, betaAppReviewSubmission, betaBuildLocalizations, buildBetaDetail, icons, individualTesters, preReleaseVersion

static var key: String = "include"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

/// Number of resources to return.
public enum Limit: NestableQueryParameter {
case individualTesters(Int), betaBuildLocalizations(Int)
case betaBuildLocalizations(Int)
case icons(Int)
case individualTesters(Int)

static var key: String = "limit"
var pair: Pair {
switch self {
case .individualTesters(let value):
return ("individualTesters", "\(value)")
case .betaBuildLocalizations(let value):
return ("betaBuildLocalizations", "\(value)")
case .icons(let value):
return ("icons", "\(value)")
case .individualTesters(let value):
return ("individualTesters", "\(value)")
}
}
}
Expand All @@ -156,67 +178,100 @@ public enum ListBuilds {

// MARK: - Field
extension ListBuilds.Field {

public enum App: String, CaseIterable, NestableQueryParameter {
case appInfos, appStoreVersions, availableInNewTerritories, availableTerritories, betaAppLocalizations, betaAppReviewDetail, betaGroups, betaLicenseAgreement, betaTesters, builds, bundleId, contentRightsDeclaration, endUserLicenseAgreement, gameCenterEnabledVersions, inAppPurchases, isOrEverWasMadeForKids, name, perfPowerMetrics, preOrder, preReleaseVersions, prices, primaryLocale, sku

static var key: String = "apps"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum AppEncryptionDeclaration: String, CaseIterable, NestableQueryParameter {
case app, appEncryptionDeclarationState, availableOnFrenchStore, builds, codeValue, containsProprietaryCryptography, containsThirdPartyCryptography, documentName, documentType, documentUrl, exempt, platform, uploadedDate, usesEncryption

static var key: String = "AppEncryptionDeclaration"
static var key: String = "appEncryptionDeclarations"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum App: String, CaseIterable, NestableQueryParameter {
case betaAppLocalizations, betaAppReviewDetail, betaGroups, betaLicenseAgreement, betaTesters, builds, bundleId, name, preReleaseVersions, primaryLocale, sku

static var key: String = "App"
public enum AppStoreVersion: String, CaseIterable, NestableQueryParameter {
case ageRatingDeclaration, app, appStoreReviewDetail, appStoreState, appStoreVersionLocalizations, appStoreVersionPhasedRelease, appStoreVersionSubmission, build, copyright, createdDate, downloadable, earliestReleaseDate, idfaDeclaration, platform, releaseType, routingAppCoverage, usesIdfa, versionString

static var key: String = "appStoreVersions"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}


public enum BetaAppReviewSubmission: String, CaseIterable, NestableQueryParameter {
case betaReviewState, build

static var key: String = "betaAppReviewSubmissions"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum BetaBuildLocalization: String, CaseIterable, NestableQueryParameter {
case build, locale, whatsNew

static var key: String = "betaBuildLocalizations"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum BetaTester: String, CaseIterable, NestableQueryParameter {
case apps, betaGroups, builds, email, firstName, inviteType, lastName

static var key: String = "betaTester"
static var key: String = "betaTesters"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum Build: String, CaseIterable, NestableQueryParameter {
case app, appEncryptionDeclaration, betaAppReviewSubmission, betaBuildLocalizations, betaGroups, buildBetaDetail, expirationDate, expired, iconAssetToken, individualTesters, minOsVersion, preReleaseVersion, processingState, uploadedDate, usesNonExemptEncryption, version
case app, appEncryptionDeclaration, appStoreVersion, betaAppReviewSubmission, betaBuildLocalizations, betaGroups, buildBetaDetail, diagnosticSignatures, expirationDate, expired, iconAssetToken, icons, individualTesters, minOsVersion, perfPowerMetrics, preReleaseVersion, processingState, uploadedDate, usesNonExemptEncryption, version

static var key: String = "build"
static var key: String = "builds"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum PreReleaseVersion: String, CaseIterable, NestableQueryParameter {
case app, builds, platform, version

static var key: String = "preReleaseVersion"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum BuildBetaDetail: String, CaseIterable, NestableQueryParameter {
case autoNotifyEnabled, build, externalBuildState, internalBuildState

static var key: String = "buildBetaDetail"
static var key: String = "buildBetaDetails"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum BetaAppReviewSubmission: String, CaseIterable, NestableQueryParameter {
case betaReviewState, build

static var key: String = "betaAppReviewSubmission"
public enum BuildIcon: String, CaseIterable, NestableQueryParameter {
case iconAsset, iconType

static var key: String = "buildIcons"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum DiagnosticSignature: String, CaseIterable, NestableQueryParameter {
case diagnosticType, logs, signature, weight

static var key: String = "diagnosticSignatures"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum BetaBuildLocalization: String, CaseIterable, NestableQueryParameter {
case build, locale, whatsNew

static var key: String = "betaBuildLocalization"
public enum PerfPowerMetric: String, CaseIterable, NestableQueryParameter {
case deviceType, metricType, platform

static var key: String = "perfPowerMetrics"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum PreReleaseVersion: String, CaseIterable, NestableQueryParameter {
case app, builds, platform, version

static var key: String = "preReleaseVersions"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}
}

// MARK: - Filter
extension ListBuilds.Filter {

public enum PreReleaseVersionPlatform: String, CaseIterable, NestableQueryParameter {
case IOS, MAC_OS, TV_OS

static var key: String = "preReleaseVersion.platform"
var pair: NestableQueryParameter.Pair { return (nil, rawValue) }
}

public enum ProcessingState: String, CaseIterable, NestableQueryParameter {
case PROCESSING, FAILED, INVALID, VALID

Expand Down
Loading

0 comments on commit 1359414

Please sign in to comment.