Skip to content

Commit aefdb40

Browse files
committed
Create service function pullBetaGroups
1 parent 4b9ad36 commit aefdb40

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

Sources/AppStoreConnectCLI/Services/AppStoreConnectService.swift

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ class AppStoreConnectService {
410410
.execute(with: requestor)
411411
.await()
412412

413-
return Model.BetaGroup(app, betaGroup)
413+
return try Model.BetaGroup(app, betaGroup)
414414
}
415415

416416
func createBetaGroup(
@@ -432,7 +432,7 @@ class AppStoreConnectService {
432432
)
433433

434434
let betaGroupResponse = createBetaGroupOperation.execute(with: requestor)
435-
return try betaGroupResponse.map(Model.BetaGroup.init).await()
435+
return try betaGroupResponse.tryMap(Model.BetaGroup.init).await()
436436
}
437437

438438
func deleteBetaGroup(appBundleId: String, betaGroupName: String) throws {
@@ -507,7 +507,29 @@ class AppStoreConnectService {
507507
let modifyBetaGroupOperation = ModifyBetaGroupOperation(options: modifyBetaGroupOptions)
508508
let modifiedBetaGroup = try modifyBetaGroupOperation.execute(with: requestor).await()
509509

510-
return Model.BetaGroup(app, modifiedBetaGroup)
510+
return try Model.BetaGroup(app, modifiedBetaGroup)
511+
}
512+
513+
func pullBetaGroups() throws -> [(betaGroup: Model.BetaGroup, testers: [Model.BetaTester])] {
514+
let groupOutputs = try ListBetaGroupsOperation(options: .init(appIds: [], names: [], sort: nil)).execute(with: requestor).await()
515+
516+
return try groupOutputs.map {
517+
let testers = try ListBetaTestersOperation(
518+
options: .init(groupIds: [$0.betaGroup.id])
519+
)
520+
.execute(with: requestor)
521+
.await()
522+
.map(BetaTester.init)
523+
524+
return (try BetaGroup($0.app, $0.betaGroup), testers)
525+
}
526+
}
527+
528+
func updateBetaGroup(betaGroup: Model.BetaGroup) throws {
529+
// TODO
530+
// _ = try UpdateBetaGroupOperation(options: .init(betaGroup: betaGroup))
531+
// .execute(with: requestor)
532+
// .await()
511533
}
512534

513535
func readBuild(bundleId: String, buildNumber: String, preReleaseVersion: String) throws -> Model.Build {

0 commit comments

Comments
 (0)