FIRIAMFetchResponseParser.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. @class FIRIAMMessageDefinition;
  18. @protocol FIRIAMTimeFetcher;
  19. NS_ASSUME_NONNULL_BEGIN
  20. // Class responsible for parsing the json response data from the restful API endpoint
  21. // for serving eligible messages for the current SDK clients.
  22. @interface FIRIAMFetchResponseParser : NSObject
  23. // Turn the API response into a number of FIRIAMMessageDefinition objects. If any of them is invalid
  24. // it would be ignored and not represented in the response array.
  25. // @param discardCount if not nil, it would contain, on return, the number of invalid messages
  26. // detected uring parsing.
  27. // @param fetchWaitTime would be non nil if fetch wait time data is found in the api response.
  28. - (NSArray<FIRIAMMessageDefinition *> *)parseAPIResponseDictionary:(NSDictionary *)responseDict
  29. discardedMsgCount:(NSInteger *)discardCount
  30. fetchWaitTimeInSeconds:
  31. (NSNumber *_Nullable *_Nonnull)fetchWaitTime;
  32. - (instancetype)init NS_UNAVAILABLE;
  33. - (instancetype)initWithTimeFetcher:(id<FIRIAMTimeFetcher>)timeFetcher;
  34. @end
  35. NS_ASSUME_NONNULL_END