Skip to content

Commit c30f740

Browse files
paulb777granluo
authored andcommitted
Revert parameterless API version
1 parent 9ef016e commit c30f740

File tree

2 files changed

+4
-41
lines changed

2 files changed

+4
-41
lines changed

FirebaseFunctionsSwift/Sources/Codable/Callable+Codable.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public struct Callable<Request: Encodable, Response: Decodable> {
7373
///
7474
/// - Parameter data: Parameters to pass to the trigger.
7575
/// - Parameter completion: The block to call when the HTTPS request has completed.
76-
public func call(_ data: Request? = nil,
76+
public func call(_ data: Request,
7777
completion: @escaping (Result<Response, Error>)
7878
-> Void) {
7979
do {
@@ -119,7 +119,7 @@ public struct Callable<Request: Encodable, Response: Decodable> {
119119
/// - Parameters:
120120
/// - data: Parameters to pass to the trigger.
121121
/// - completion: The block to call when the HTTPS request has completed.
122-
public func callAsFunction(_ data: Request? = nil,
122+
public func callAsFunction(_ data: Request,
123123
completion: @escaping (Result<Response, Error>)
124124
-> Void) {
125125
call(data, completion: completion)
@@ -146,7 +146,7 @@ public struct Callable<Request: Encodable, Response: Decodable> {
146146
///
147147
/// - Returns: The decoded `Response` value
148148
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
149-
public func call(_ data: Request? = nil,
149+
public func call(_ data: Request,
150150
encoder: FirebaseDataEncoder = FirebaseDataEncoder(),
151151
decoder: FirebaseDataDecoder =
152152
FirebaseDataDecoder()) async throws -> Response {
@@ -175,7 +175,7 @@ public struct Callable<Request: Encodable, Response: Decodable> {
175175
/// - data: Parameters to pass to the trigger.
176176
/// - Returns: The decoded `Response` value
177177
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
178-
public func callAsFunction(_ data: Request? = nil) async throws -> Response {
178+
public func callAsFunction(_ data: Request) async throws -> Response {
179179
return try await call(data)
180180
}
181181
#endif

FirebaseFunctionsSwift/Tests/IntegrationTests.swift

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -290,43 +290,6 @@ class IntegrationTests: XCTestCase {
290290
}
291291
#endif
292292

293-
// No parameters to call should be the same as passing nil.
294-
// If no parameters are required, then the non-typed API
295-
// is more appropriate since it specifically avoids defining
296-
// type.
297-
func testParameterless() {
298-
let expectation = expectation(description: #function)
299-
let function = functions.httpsCallable(
300-
"nullTest",
301-
requestAs: Int?.self,
302-
responseAs: Int?.self
303-
)
304-
function.call { result in
305-
do {
306-
let data = try result.get()
307-
XCTAssertEqual(data, nil)
308-
} catch {
309-
XCTAssert(false, "Failed to unwrap the function result: \(error)")
310-
}
311-
expectation.fulfill()
312-
}
313-
waitForExpectations(timeout: 5)
314-
}
315-
316-
#if compiler(>=5.5) && canImport(_Concurrency)
317-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
318-
func testParameterlessAsync() async throws {
319-
let function = functions.httpsCallable(
320-
"nullTest",
321-
requestAs: Int?.self,
322-
responseAs: Int?.self
323-
)
324-
325-
let data = try await function.call()
326-
XCTAssertEqual(data, nil)
327-
}
328-
#endif
329-
330293
func testMissingResult() {
331294
let expectation = expectation(description: #function)
332295
let function = functions.httpsCallable(

0 commit comments

Comments
 (0)