FBProtocolHelpers.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import <Foundation/Foundation.h>
  10. NS_ASSUME_NONNULL_BEGIN
  11. /**
  12. Prepares an element dictionary, which could be then used in hybrid W3C/JWP responses
  13. @param element Either element identifier or element object itself
  14. @returns The resulting dictionary
  15. */
  16. NSDictionary<NSString *, id> *FBToElementDict(id element);
  17. /**
  18. Extracts element uuid from dictionary
  19. @param src The source dictionary
  20. @returns The resulting element or nil if no element keys are found
  21. */
  22. id _Nullable FBExtractElement(NSDictionary *src);
  23. /**
  24. Cleanup items having element keys from the dictionary
  25. @param src The source dictionary
  26. @returns The resulting dictionary
  27. */
  28. NSDictionary *FBCleanupElements(NSDictionary *src);
  29. /**
  30. Parses key/value pairs of valid W3C capabilities
  31. @param caps The source capabilitites dictionary
  32. @param error Is set if there was an error while parsing the source capabilities
  33. @returns Parsed capabilitites mapping or nil in case of failure
  34. */
  35. NSDictionary<NSString *, id> *_Nullable FBParseCapabilities(NSDictionary<NSString *, id> *caps, NSError **error);
  36. NS_ASSUME_NONNULL_END