FIRInstallationsAPIService.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. /**
  25. * The default initializer.
  26. * @param APIKey The Firebase project API key (see `FIROptions.APIKey`).
  27. * @param projectID The Firebase project ID (see `FIROptions.projectID`).
  28. */
  29. - (instancetype)initWithAPIKey:(NSString *)APIKey projectID:(NSString *)projectID;
  30. /**
  31. * Sends a request to register a new FID to get auth and refresh tokens.
  32. * @param installation The `FIRInstallationsItem` instance with the FID to register.
  33. * @return A promise that is resolved with a new `FIRInstallationsItem` instance with valid tokens.
  34. * It is rejected with an error in case of a failure.
  35. */
  36. - (FBLPromise<FIRInstallationsItem *> *)registerInstallation:(FIRInstallationsItem *)installation;
  37. - (FBLPromise<FIRInstallationsItem *> *)refreshAuthTokenForInstallation:
  38. (FIRInstallationsItem *)installation;
  39. /**
  40. * Sends a request to delete the installation, related auth tokens and all related data from the
  41. * server.
  42. * @param installation The installation to delete.
  43. * @return Returns a promise that is resolved with the passed installation on successful deletion or
  44. * is rejected with an error otherwise.
  45. */
  46. - (FBLPromise<FIRInstallationsItem *> *)deleteInstallation:(FIRInstallationsItem *)installation;
  47. @end
  48. NS_ASSUME_NONNULL_END