@@ -49,7 +49,13 @@ public class DomainClient: ResendClient {
49
49
}
50
50
51
51
/// Update a domain
52
- public func update( domainId: String , clickTracking: Bool , openTracking: Bool , tls: String = " opportunistic " ) async throws -> Domain {
52
+ /// - Parameters:
53
+ /// - domainId: The ID of the domain to update
54
+ /// - clickTracking: Track clicks within the body of each HTML email
55
+ /// - openTracking: Track the open rate of each email
56
+ /// - tls: TLS policy (.opportunistic or .enforced)
57
+ /// - Returns: The updated Domain object
58
+ public func update( domainId: String , clickTracking: Bool , openTracking: Bool , tls: DomainTLSMode = . opportunistic) async throws -> Domain {
53
59
let body = DomainUpdate ( clickTracking: clickTracking, openTracking: openTracking, tls: tls)
54
60
let response = try await httpClient. execute (
55
61
request: . init(
@@ -77,7 +83,9 @@ public class DomainClient: ResendClient {
77
83
}
78
84
79
85
/// Delete a domain
80
- public func delete( domainId: String ) async throws {
86
+ /// - Parameter domainId: The ID of the domain to delete
87
+ /// - Returns: DomainDeleteResponse containing the result of the deletion
88
+ public func delete( domainId: String ) async throws -> DomainDeleteResponse {
81
89
let response = try await httpClient. execute (
82
90
request: . init(
83
91
url: APIPath . getPath ( for: . domainDelete( domainId: domainId) ) ,
@@ -86,8 +94,6 @@ public class DomainClient: ResendClient {
86
94
)
87
95
) . get ( )
88
96
89
- guard response. status == . ok else {
90
- throw ResendError . unknownError
91
- }
97
+ return try parseResponse ( response, to: DomainDeleteResponse . self)
92
98
}
93
99
}
0 commit comments