FIRIAMMsgFetcherUsingRestful.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import "FirebaseInAppMessaging/Sources/Private/Analytics/FIRIAMClientInfoFetcher.h"
  18. #import "FirebaseInAppMessaging/Sources/Private/Data/FIRIAMFetchResponseParser.h"
  19. #import "FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMServerMsgFetchStorage.h"
  20. #import "FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMFetchFlow.h"
  21. #import "FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMSDKSettings.h"
  22. NS_ASSUME_NONNULL_BEGIN
  23. // implementation of FIRIAMMessageFetcher by making Restful API requests to firebase
  24. // in-app messaging services
  25. @interface FIRIAMMsgFetcherUsingRestful : NSObject <FIRIAMMessageFetcher>
  26. /**
  27. * Create an instance which uses NSURLSession to make the restful api call.
  28. *
  29. * @param serverHost API server host.
  30. * @param fbProjectNumber project number used for the API call. It's the GCM_SENDER_ID
  31. * field in GoogleService-Info.plist.
  32. * @param fbAppId It's the GOOGLE_APP_ID field in GoogleService-Info.plist.
  33. * @param apiKey API key.
  34. * @param fetchStorage used to persist the fetched response.
  35. * @param clientInfoFetcher used to fetch iid info for the current app.
  36. * @param URLSession can be nil in which case the class would create NSURLSession
  37. * internally to perform the network request. Having it here so that
  38. * it's easier for doing mocking with unit testing.
  39. */
  40. - (instancetype)initWithHost:(NSString *)serverHost
  41. HTTPProtocol:(NSString *)HTTPProtocol
  42. project:(NSString *)fbProjectNumber
  43. firebaseApp:(NSString *)fbAppId
  44. APIKey:(NSString *)apiKey
  45. fetchStorage:(FIRIAMServerMsgFetchStorage *)fetchStorage
  46. instanceIDFetcher:(FIRIAMClientInfoFetcher *)clientInfoFetcher
  47. usingURLSession:(nullable NSURLSession *)URLSession
  48. responseParser:(FIRIAMFetchResponseParser *)responseParser;
  49. @end
  50. NS_ASSUME_NONNULL_END