Skip to content

Commit 6b0cc02

Browse files
authored
Several minor doc fixes for Functions (#12323)
1 parent 4914cc2 commit 6b0cc02

File tree

4 files changed

+89
-108
lines changed

4 files changed

+89
-108
lines changed

FirebaseFunctions/Sources/Callable+Codable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import FirebaseSharedSwift
1616
import Foundation
1717

18-
// A `Callable` is reference to a particular Callable HTTPS trigger in Cloud Functions.
18+
/// A `Callable` is reference to a particular Callable HTTPS trigger in Cloud Functions.
1919
public struct Callable<Request: Encodable, Response: Decodable> {
2020
/// The timeout to use when calling the function. Defaults to 60 seconds.
2121
public var timeoutInterval: TimeInterval {

FirebaseFunctions/Sources/Functions.swift

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ enum FunctionsConstants {
3838
static let defaultRegion = "us-central1"
3939
}
4040

41-
/**
42-
* `Functions` is the client for Cloud Functions for a Firebase project.
43-
*/
41+
/// `Functions` is the client for Cloud Functions for a Firebase project.
4442
@objc(FIRFunctions) open class Functions: NSObject {
4543
// MARK: - Private Variables
4644

@@ -61,15 +59,12 @@ enum FunctionsConstants {
6159

6260
// MARK: - Public APIs
6361

64-
/**
65-
* The current emulator origin, or `nil` if it is not set.
66-
*/
62+
/// The current emulator origin, or `nil` if it is not set.
6763
open private(set) var emulatorOrigin: String?
6864

69-
/**
70-
* Creates a Cloud Functions client using the default or returns a pre-existing instance if it already exists.
71-
* - Returns: A shared Functions instance initialized with the default `FirebaseApp`.
72-
*/
65+
/// Creates a Cloud Functions client using the default or returns a pre-existing instance if it
66+
/// already exists.
67+
/// - Returns: A shared Functions instance initialized with the default `FirebaseApp`.
7368
@objc(functions) open class func functions() -> Functions {
7469
return functions(
7570
app: FirebaseApp.app(),
@@ -78,57 +73,51 @@ enum FunctionsConstants {
7873
)
7974
}
8075

81-
/**
82-
* Creates a Cloud Functions client with the given app, or returns a pre-existing
83-
* instance if one already exists.
84-
* - Parameter app The app for the Firebase project.
85-
* - Returns: A shared Functions instance initialized with the specified `FirebaseApp`.
86-
*/
76+
/// Creates a Cloud Functions client with the given app, or returns a pre-existing
77+
/// instance if one already exists.
78+
/// - Parameter app: The app for the Firebase project.
79+
/// - Returns: A shared Functions instance initialized with the specified `FirebaseApp`.
8780
@objc(functionsForApp:) open class func functions(app: FirebaseApp) -> Functions {
8881
return functions(app: app, region: FunctionsConstants.defaultRegion, customDomain: nil)
8982
}
9083

91-
/**
92-
* Creates a Cloud Functions client with the default app and given region.
93-
* - Parameter region The region for the HTTP trigger, such as `us-central1`.
94-
* - Returns: A shared Functions instance initialized with the default `FirebaseApp` and a custom region.
95-
*/
84+
/// Creates a Cloud Functions client with the default app and given region.
85+
/// - Parameter region: The region for the HTTP trigger, such as `us-central1`.
86+
/// - Returns: A shared Functions instance initialized with the default `FirebaseApp` and a
87+
/// custom region.
9688
@objc(functionsForRegion:) open class func functions(region: String) -> Functions {
9789
return functions(app: FirebaseApp.app(), region: region, customDomain: nil)
9890
}
9991

100-
/**
101-
* Creates a Cloud Functions client with the given app and region, or returns a pre-existing
102-
* instance if one already exists.
103-
* - Parameter customDomain A custom domain for the HTTP trigger, such as "https://mydomain.com".
104-
* - Returns: A shared Functions instance initialized with the default `FirebaseApp` and a custom HTTP trigger domain.
105-
*/
92+
/// Creates a Cloud Functions client with the given custom domain or returns a pre-existing
93+
/// instance if one already exists.
94+
/// - Parameter customDomain: A custom domain for the HTTP trigger, such as
95+
/// "https://mydomain.com".
96+
/// - Returns: A shared Functions instance initialized with the default `FirebaseApp` and a
97+
/// custom HTTP trigger domain.
10698
@objc(functionsForCustomDomain:) open class func functions(customDomain: String) -> Functions {
10799
return functions(app: FirebaseApp.app(),
108100
region: FunctionsConstants.defaultRegion, customDomain: customDomain)
109101
}
110102

111-
/**
112-
* Creates a Cloud Functions client with the given app and region, or returns a pre-existing
113-
* instance if one already exists.
114-
* - Parameters:
115-
* - app: The app for the Firebase project.
116-
* - region: The region for the HTTP trigger, such as `us-central1`.
117-
* - Returns: An instance of `Functions` with a custom app and region.
118-
*/
103+
/// Creates a Cloud Functions client with the given app and region, or returns a pre-existing
104+
/// instance if one already exists.
105+
/// - Parameters:
106+
/// - app: The app for the Firebase project.
107+
/// - region: The region for the HTTP trigger, such as `us-central1`.
108+
/// - Returns: An instance of `Functions` with a custom app and region.
119109
@objc(functionsForApp:region:) open class func functions(app: FirebaseApp,
120110
region: String) -> Functions {
121111
return functions(app: app, region: region, customDomain: nil)
122112
}
123113

124-
/**
125-
* Creates a Cloud Functions client with the given app and region, or returns a pre-existing
126-
* instance if one already exists.
127-
* - Parameters:
128-
* - app The app for the Firebase project.
129-
* - customDomain A custom domain for the HTTP trigger, such as `https://mydomain.com`.
130-
* - Returns: An instance of `Functions` with a custom app and HTTP trigger domain.
131-
*/
114+
/// Creates a Cloud Functions client with the given app and custom domain, or returns a
115+
/// pre-existing
116+
/// instance if one already exists.
117+
/// - Parameters:
118+
/// - app: The app for the Firebase project.
119+
/// - customDomain: A custom domain for the HTTP trigger, such as `https://mydomain.com`.
120+
/// - Returns: An instance of `Functions` with a custom app and HTTP trigger domain.
132121
@objc(functionsForApp:customDomain:) open class func functions(app: FirebaseApp,
133122
customDomain: String)
134123
-> Functions {

FirebaseFunctions/Sources/FunctionsError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import Foundation
1616

17-
/// The error domain for codes in the `FunctionsErrorCode` enum.
17+
/// The error domain for codes in the ``FunctionsErrorCode`` enum.
1818
public let FunctionsErrorDomain: String = "com.firebase.functions"
1919

2020
/// The key for finding error details in the `NSError` userInfo.

FirebaseFunctions/Sources/HTTPSCallable.swift

Lines changed: 55 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,14 @@
1414

1515
import Foundation
1616

17-
/**
18-
* A `HTTPSCallableResult` contains the result of calling a `HTTPSCallable`.
19-
*/
17+
/// A `HTTPSCallableResult` contains the result of calling a `HTTPSCallable`.
2018
@objc(FIRHTTPSCallableResult)
2119
open class HTTPSCallableResult: NSObject {
22-
/**
23-
* The data that was returned from the Callable HTTPS trigger.
24-
*
25-
* The data is in the form of native objects. For example, if your trigger returned an
26-
* array, this object would be an `Array<Any>`. If your trigger returned a JavaScript object with
27-
* keys and values, this object would be an instance of `[String: Any]`.
28-
*/
20+
/// The data that was returned from the Callable HTTPS trigger.
21+
///
22+
/// The data is in the form of native objects. For example, if your trigger returned an
23+
/// array, this object would be an `Array<Any>`. If your trigger returned a JavaScript object with
24+
/// keys and values, this object would be an instance of `[String: Any]`.
2925
@objc public let data: Any
3026

3127
init(data: Any) {
@@ -54,9 +50,7 @@ open class HTTPSCallable: NSObject {
5450

5551
// MARK: - Public Properties
5652

57-
/**
58-
* The timeout to use when calling the function. Defaults to 70 seconds.
59-
*/
53+
/// The timeout to use when calling the function. Defaults to 70 seconds.
6054
@objc open var timeoutInterval: TimeInterval = 70
6155

6256
init(functions: Functions, name: String, options: HTTPSCallableOptions? = nil) {
@@ -71,28 +65,27 @@ open class HTTPSCallable: NSObject {
7165
endpoint = .url(url)
7266
}
7367

74-
/**
75-
* Executes this Callable HTTPS trigger asynchronously.
76-
*
77-
* The data passed into the trigger can be any of the following types:
78-
* - `nil` or `NSNull`
79-
* - `String`
80-
* - `NSNumber`, or any Swift numeric type bridgeable to `NSNumber`
81-
* - `[Any]`, where the contained objects are also one of these types.
82-
* - `[String: Any]` where the values are also one of these types.
83-
*
84-
* The request to the Cloud Functions backend made by this method automatically includes a
85-
* Firebase Installations ID token to identify the app instance. If a user is logged in with
86-
* Firebase Auth, an auth ID token for the user is also automatically included.
87-
*
88-
* Firebase Cloud Messaging sends data to the Firebase backend periodically to collect information
89-
* regarding the app instance. To stop this, see `Messaging.deleteData()`. It
90-
* resumes with a new FCM Token the next time you call this method.
91-
*
92-
* - Parameters:
93-
* - data: Parameters to pass to the trigger.
94-
* - completion: The block to call when the HTTPS request has completed.
95-
*/
68+
/// Executes this Callable HTTPS trigger asynchronously.
69+
///
70+
/// The data passed into the trigger can be any of the following types:
71+
/// - `nil` or `NSNull`
72+
/// - `String`
73+
/// - `NSNumber`, or any Swift numeric type bridgeable to `NSNumber`
74+
/// - `[Any]`, where the contained objects are also one of these types.
75+
/// - `[String: Any]` where the values are also one of these types.
76+
///
77+
/// The request to the Cloud Functions backend made by this method automatically includes a
78+
/// Firebase Installations ID token to identify the app instance. If a user is logged in with
79+
/// Firebase Auth, an auth ID token for the user is also automatically included.
80+
///
81+
/// Firebase Cloud Messaging sends data to the Firebase backend periodically to collect
82+
/// information
83+
/// regarding the app instance. To stop this, see `Messaging.deleteData()`. It
84+
/// resumes with a new FCM Token the next time you call this method.
85+
///
86+
/// - Parameters:
87+
/// - data: Parameters to pass to the trigger.
88+
/// - completion: The block to call when the HTTPS request has completed.
9689
@objc(callWithObject:completion:) open func call(_ data: Any? = nil,
9790
completion: @escaping (HTTPSCallableResult?,
9891
Error?) -> Void) {
@@ -121,39 +114,38 @@ open class HTTPSCallable: NSObject {
121114
}
122115
}
123116

124-
/**
125-
* Executes this Callable HTTPS trigger asynchronously. This API should only be used from Objective-C.
126-
*
127-
* The request to the Cloud Functions backend made by this method automatically includes a
128-
* Firebase Installations ID token to identify the app instance. If a user is logged in with
129-
* Firebase Auth, an auth ID token for the user is also automatically included.
130-
*
131-
* Firebase Cloud Messaging sends data to the Firebase backend periodically to collect information
132-
* regarding the app instance. To stop this, see `Messaging.deleteData()`. It
133-
* resumes with a new FCM Token the next time you call this method.
134-
*
135-
* - Parameter completion The block to call when the HTTPS request has completed.
136-
*/
117+
/// Executes this Callable HTTPS trigger asynchronously. This API should only be used from
118+
/// Objective-C.
119+
///
120+
/// The request to the Cloud Functions backend made by this method automatically includes a
121+
/// Firebase Installations ID token to identify the app instance. If a user is logged in with
122+
/// Firebase Auth, an auth ID token for the user is also automatically included.
123+
///
124+
/// Firebase Cloud Messaging sends data to the Firebase backend periodically to collect
125+
/// information
126+
/// regarding the app instance. To stop this, see `Messaging.deleteData()`. It
127+
/// resumes with a new FCM Token the next time you call this method.
128+
///
129+
/// - Parameter completion: The block to call when the HTTPS request has completed.
137130
@objc(callWithCompletion:) public func __call(completion: @escaping (HTTPSCallableResult?,
138131
Error?) -> Void) {
139132
call(nil, completion: completion)
140133
}
141134

142-
/**
143-
* Executes this Callable HTTPS trigger asynchronously.
144-
*
145-
* The request to the Cloud Functions backend made by this method automatically includes a
146-
* FCM token to identify the app instance. If a user is logged in with Firebase
147-
* Auth, an auth ID token for the user is also automatically included.
148-
*
149-
* Firebase Cloud Messaging sends data to the Firebase backend periodically to collect information
150-
* regarding the app instance. To stop this, see `Messaging.deleteData()`. It
151-
* resumes with a new FCM Token the next time you call this method.
152-
*
153-
* - Parameter data Parameters to pass to the trigger.
154-
* - Throws: An error if the Cloud Functions invocation failed.
155-
* - Returns: The result of the call.
156-
*/
135+
/// Executes this Callable HTTPS trigger asynchronously.
136+
///
137+
/// The request to the Cloud Functions backend made by this method automatically includes a
138+
/// FCM token to identify the app instance. If a user is logged in with Firebase
139+
/// Auth, an auth ID token for the user is also automatically included.
140+
///
141+
/// Firebase Cloud Messaging sends data to the Firebase backend periodically to collect
142+
/// information
143+
/// regarding the app instance. To stop this, see `Messaging.deleteData()`. It
144+
/// resumes with a new FCM Token the next time you call this method.
145+
///
146+
/// - Parameter data: Parameters to pass to the trigger.
147+
/// - Throws: An error if the Cloud Functions invocation failed.
148+
/// - Returns: The result of the call.
157149
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
158150
open func call(_ data: Any? = nil) async throws -> HTTPSCallableResult {
159151
return try await withCheckedThrowingContinuation { continuation in

0 commit comments

Comments
 (0)