FIRInstallationsAPIService.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright 2019 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. @class FBLPromise<ValueType>;
  18. @class FIRInstallationsItem;
  19. NS_ASSUME_NONNULL_BEGIN
  20. /**
  21. * The class is responsible for interacting with HTTP REST API for Installations.
  22. */
  23. @interface FIRInstallationsAPIService : NSObject
  24. @property(nonatomic, readonly) NSString *APIKey;
  25. @property(nonatomic, readonly) NSString *projectID;
  26. /**
  27. * The default initializer.
  28. * @param APIKey The Firebase project API key (see `FIROptions.APIKey`).
  29. * @param projectID The Firebase project ID (see `FIROptions.projectID`).
  30. */
  31. - (instancetype)initWithAPIKey:(NSString *)APIKey projectID:(NSString *)projectID;
  32. /**
  33. * Sends a request to register a new FID to get auth and refresh tokens.
  34. * @param installation The `FIRInstallationsItem` instance with the FID to register.
  35. * @return A promise that is resolved with a new `FIRInstallationsItem` instance with valid tokens.
  36. * It is rejected with an error in case of a failure.
  37. */
  38. - (FBLPromise<FIRInstallationsItem *> *)registerInstallation:(FIRInstallationsItem *)installation;
  39. - (FBLPromise<FIRInstallationsItem *> *)refreshAuthTokenForInstallation:
  40. (FIRInstallationsItem *)installation;
  41. /**
  42. * Sends a request to delete the installation, related auth tokens and all related data from the
  43. * server.
  44. * @param installation The installation to delete.
  45. * @return Returns a promise that is resolved with the passed installation on successful deletion or
  46. * is rejected with an error otherwise.
  47. */
  48. - (FBLPromise<FIRInstallationsItem *> *)deleteInstallation:(FIRInstallationsItem *)installation;
  49. @end
  50. NS_ASSUME_NONNULL_END