No Description

FIRAuthRPCResponse.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. NS_ASSUME_NONNULL_BEGIN
  18. /** @protocol FIRAuthRPCResponse
  19. @brief The generic interface for an RPC response needed by @c FIRAuthBackend.
  20. */
  21. @protocol FIRAuthRPCResponse <NSObject>
  22. /** @fn setFieldsWithDictionary:error:
  23. @brief Sets the response instance from the decoded JSON response.
  24. @param dictionary The dictionary decoded from HTTP JSON response.
  25. @param error An out field for an error which occurred constructing the request.
  26. @return Whether the operation was successful or not.
  27. */
  28. - (BOOL)setWithDictionary:(NSDictionary *)dictionary
  29. error:(NSError *_Nullable *_Nullable)error;
  30. @optional
  31. /** @fn clientErrorWithshortErrorMessage:detailErrorMessage
  32. @brief This optional method allows response classes to create client errors given a short error
  33. message and a detail error message from the server.
  34. @param shortErrorMessage The short error message from the server.
  35. @param detailErrorMessage The detailed error message from the server.
  36. @return A client error, if any.
  37. */
  38. - (nullable NSError *)clientErrorWithShortErrorMessage:(NSString *)shortErrorMessage
  39. detailErrorMessage:(nullable NSString *)detailErrorMessage;
  40. @end
  41. NS_ASSUME_NONNULL_END