@@ -44,28 +44,29 @@ internal enum FunctionsConstants {
44
44
45
45
/// The network client to use for http requests.
46
46
private let fetcherService : GTMSessionFetcherService
47
- // The projectID to use for all function references.
47
+ /// The projectID to use for all function references.
48
48
private let projectID : String
49
- // A serializer to encode/decode data and return values.
49
+ /// A serializer to encode/decode data and return values.
50
50
private let serializer = FUNSerializer ( )
51
- // A factory for getting the metadata to include with function calls.
51
+ /// A factory for getting the metadata to include with function calls.
52
52
private let contextProvider : FunctionsContextProvider
53
53
54
- // The custom domain to use for all functions references (optional).
54
+ /// The custom domain to use for all functions references (optional).
55
55
internal let customDomain : String ?
56
56
57
- // The region to use for all function references.
57
+ /// The region to use for all function references.
58
58
internal let region : String
59
59
60
60
// MARK: - Public APIs
61
61
62
62
/**
63
- * The current emulator origin, or nil if it is not set.
63
+ * The current emulator origin, or ` nil` if it is not set.
64
64
*/
65
65
open private( set) var emulatorOrigin : String ?
66
66
67
67
/**
68
- * Creates a Cloud Functions client or returns a pre-existing instance if it already exists.
68
+ * Creates a Cloud Functions client using the default or returns a pre-existing instance if it already exists.
69
+ * - Returns: A shared Functions instance initialized with the default `FirebaseApp`.
69
70
*/
70
71
@objc ( functions) open class func functions( ) -> Functions {
71
72
return functions (
@@ -78,15 +79,17 @@ internal enum FunctionsConstants {
78
79
/**
79
80
* Creates a Cloud Functions client with the given app, or returns a pre-existing
80
81
* instance if one already exists.
81
- * @param app The app for the Firebase project.
82
+ * - Parameter app The app for the Firebase project.
83
+ * - Returns: A shared Functions instance initialized with the specified `FirebaseApp`.
82
84
*/
83
85
@objc ( functionsForApp: ) open class func functions( app: FirebaseApp ) -> Functions {
84
86
return functions ( app: app, region: FunctionsConstants . defaultRegion, customDomain: nil )
85
87
}
86
88
87
89
/**
88
90
* Creates a Cloud Functions client with the default app and given region.
89
- * @param region The region for the http trigger, such as "us-central1".
91
+ * - Parameter region The region for the HTTP trigger, such as `us-central1`.
92
+ * - Returns: A shared Functions instance initialized with the default `FirebaseApp` and a custom region.
90
93
*/
91
94
@objc ( functionsForRegion: ) open class func functions( region: String ) -> Functions {
92
95
return functions ( app: FirebaseApp . app ( ) , region: region, customDomain: nil )
@@ -95,7 +98,8 @@ internal enum FunctionsConstants {
95
98
/**
96
99
* Creates a Cloud Functions client with the given app and region, or returns a pre-existing
97
100
* instance if one already exists.
98
- * @param customDomain A custom domain for the http trigger, such as "https://mydomain.com".
101
+ * - Parameter customDomain A custom domain for the HTTP trigger, such as "https://mydomain.com".
102
+ * - Returns: A shared Functions instance initialized with the default `FirebaseApp` and a custom HTTP trigger domain.
99
103
*/
100
104
@objc ( functionsForCustomDomain: ) open class func functions( customDomain: String ) -> Functions {
101
105
return functions ( app: FirebaseApp . app ( ) ,
@@ -105,8 +109,10 @@ internal enum FunctionsConstants {
105
109
/**
106
110
* Creates a Cloud Functions client with the given app and region, or returns a pre-existing
107
111
* instance if one already exists.
108
- * @param app The app for the Firebase project.
109
- * @param region The region for the http trigger, such as "us-central1".
112
+ * - Parameters:
113
+ * - app: The app for the Firebase project.
114
+ * - region: The region for the HTTP trigger, such as `us-central1`.
115
+ * - Returns: An instance of `Functions` with a custom app and region.
110
116
*/
111
117
@objc ( functionsForApp: region: ) open class func functions( app: FirebaseApp ,
112
118
region: String ) -> Functions {
@@ -116,8 +122,10 @@ internal enum FunctionsConstants {
116
122
/**
117
123
* Creates a Cloud Functions client with the given app and region, or returns a pre-existing
118
124
* instance if one already exists.
119
- * @param app The app for the Firebase project.
120
- * @param customDomain A custom domain for the http trigger, such as "https://mydomain.com".
125
+ * - Parameters:
126
+ * - app The app for the Firebase project.
127
+ * - customDomain A custom domain for the HTTP trigger, such as `https://mydomain.com`.
128
+ * - Returns: An instance of `Functions` with a custom app and HTTP trigger domain.
121
129
*/
122
130
@objc ( functionsForApp: customDomain: ) open class func functions( app: FirebaseApp ,
123
131
customDomain: String )
@@ -127,7 +135,7 @@ internal enum FunctionsConstants {
127
135
128
136
/**
129
137
* Creates a reference to the Callable HTTPS trigger with the given name.
130
- * @param name The name of the Callable HTTPS trigger.
138
+ * - Parameter name The name of the Callable HTTPS trigger.
131
139
*/
132
140
@objc ( HTTPSCallableWithName: ) open func httpsCallable( _ name: String ) -> HTTPSCallable {
133
141
return HTTPSCallable ( functions: self , name: name)
@@ -144,6 +152,7 @@ internal enum FunctionsConstants {
144
152
/// - Parameter responseAs: The type of the `Decodable` entity to use for responses from this `Callable`
145
153
/// - Parameter encoder: The encoder instance to use to run the encoding.
146
154
/// - Parameter decoder: The decoder instance to use to run the decoding.
155
+ /// - Returns: A reference to an HTTPS-callable Cloud Function that can be used to make Cloud Functions invocations.
147
156
open func httpsCallable< Request: Encodable ,
148
157
Response: Decodable > ( _ name: String ,
149
158
requestAs: Request . Type = Request . self,
@@ -163,6 +172,7 @@ internal enum FunctionsConstants {
163
172
/// - Parameter responseAs: The type of the `Decodable` entity to use for responses from this `Callable`
164
173
/// - Parameter encoder: The encoder instance to use to run the encoding.
165
174
/// - Parameter decoder: The decoder instance to use to run the decoding.
175
+ /// - Returns: A reference to an HTTPS-callable Cloud Function that can be used to make Cloud Functions invocations.
166
176
open func httpsCallable< Request: Encodable ,
167
177
Response: Decodable > ( _ url: URL ,
168
178
requestAs: Request . Type = Request . self,
@@ -178,8 +188,9 @@ internal enum FunctionsConstants {
178
188
/**
179
189
* Changes this instance to point to a Cloud Functions emulator running locally.
180
190
* See https://firebase.google.com/docs/functions/local-emulator
181
- * @param host The host of the local emulator, such as "localhost".
182
- * @param port The port of the local emulator, for example 5005.
191
+ * - Parameters:
192
+ * - host: The host of the local emulator, such as "localhost".
193
+ * - port: The port of the local emulator, for example 5005.
183
194
*/
184
195
@objc open func useEmulator( withHost host: String , port: Int ) {
185
196
let prefix = host. hasPrefix ( " http " ) ? " " : " http:// "
0 commit comments