Skip to content

Commit f235a53

Browse files
committed
Implement UpdateBetaGroupOperation, add update and delete service func
1 parent d7b7148 commit f235a53

2 files changed

Lines changed: 43 additions & 4 deletions

File tree

Sources/AppStoreConnectCLI/Services/AppStoreConnectService.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,15 @@ class AppStoreConnectService {
526526
}
527527

528528
func updateBetaGroup(betaGroup: Model.BetaGroup) throws {
529-
// TODO
530-
// _ = try UpdateBetaGroupOperation(options: .init(betaGroup: betaGroup))
531-
// .execute(with: requestor)
532-
// .await()
529+
_ = try UpdateBetaGroupOperation(options: .init(betaGroup: betaGroup))
530+
.execute(with: requestor)
531+
.await()
532+
}
533+
534+
func deleteBetaGroup(with id: String) throws {
535+
try DeleteBetaGroupOperation(options: .init(betaGroupId: id))
536+
.execute(with: requestor)
537+
.await()
533538
}
534539

535540
func readBuild(bundleId: String, buildNumber: String, preReleaseVersion: String) throws -> Model.Build {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2020 Itty Bitty Apps Pty Ltd
2+
3+
import AppStoreConnect_Swift_SDK
4+
import Combine
5+
import Foundation
6+
import struct Model.BetaGroup
7+
8+
struct UpdateBetaGroupOperation: APIOperation {
9+
10+
struct Options {
11+
let betaGroup: BetaGroup
12+
}
13+
14+
private let options: Options
15+
16+
init(options: Options) {
17+
self.options = options
18+
}
19+
20+
func execute(with requestor: EndpointRequestor) throws -> AnyPublisher<BetaGroupResponse, Error> {
21+
let betaGroup = options.betaGroup
22+
23+
let endpoint = APIEndpoint.modify(
24+
betaGroupWithId: betaGroup.id!,
25+
name: betaGroup.groupName,
26+
publicLinkEnabled: betaGroup.publicLinkEnabled,
27+
publicLinkLimit: betaGroup.publicLinkLimit,
28+
publicLinkLimitEnabled: betaGroup.publicLinkLimitEnabled
29+
)
30+
31+
return requestor.request(endpoint).eraseToAnyPublisher()
32+
}
33+
34+
}

0 commit comments

Comments
 (0)