No Description

AWSSerialization.h 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. //
  2. // Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  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. // A copy of the License is located at
  7. //
  8. // http://aws.amazon.com/apache2.0
  9. //
  10. // or in the "license" file accompanying this file. This file is distributed
  11. // on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  12. // express or implied. See the License for the specific language governing
  13. // permissions and limitations under the License.
  14. //
  15. #import <Foundation/Foundation.h>
  16. // defined domain for errors from AWSRuntime.
  17. FOUNDATION_EXPORT NSString *const AWSXMLBuilderErrorDomain;
  18. /* NSError codes in AWSErrorDomain. */
  19. typedef NS_ENUM(NSInteger, AWSXMLBuilderErrorType) {
  20. // AWSJSON Validation related errors
  21. AWSXMLBuilderUnknownError = 900, // Unknown Error found
  22. AWSXMLBuilderDefinitionFileIsEmpty = 901,
  23. AWSXMLBuilderUndefinedXMLNamespace = 902,
  24. AWSXMLBuilderUndefinedActionRule = 903,
  25. AWSXMLBuilderMissingRequiredXMLElements = 904,
  26. AWSXMLBuilderInvalidXMLValue = 905,
  27. AWSXMLBuilderUnCatchedRuleTypeInDifinitionFile = 906,
  28. };
  29. // defined domain for errors from AWSRuntime.
  30. FOUNDATION_EXPORT NSString *const AWSXMLParserErrorDomain;
  31. /* NSError codes in AWSErrorDomain. */
  32. typedef NS_ENUM(NSInteger, AWSXMLParserErrorType) {
  33. // AWSJSON Validation related errors
  34. AWSXMLParserUnknownError, // Unknown Error found
  35. AWSXMLParserNoTypeDefinitionInRule, // Unknown Type in JSON Definition (rules) file
  36. AWSXMLParserUnHandledType, //Unhandled Type
  37. AWSXMLParserUnExpectedType, //Unexpected type
  38. AWSXMLParserDefinitionFileIsEmpty, //the rule is empty.
  39. AWSXMLParserUnexpectedXMLElement,
  40. AWSXMLParserXMLNameNotFoundInDefinition, //can not find the 'xmlname' key in definition file for unflattened xml list
  41. AWSXMLParserMissingRequiredXMLElements,
  42. AWSXMLParserInvalidXMLValue,
  43. };
  44. //defined domain for errors from AWSRuntime.
  45. FOUNDATION_EXPORT NSString *const AWSQueryParamBuilderErrorDomain;
  46. /* NSError codes in AWSErrorDomain. */
  47. typedef NS_ENUM(NSInteger, AWSQueryParamBuilderErrorType) {
  48. AWSQueryParamBuilderUnknownError,
  49. AWSQueryParamBuilderDefinitionFileIsEmpty,
  50. AWSQueryParamBuilderUndefinedActionRule,
  51. AWSQueryParamBuilderInternalError,
  52. AWSQueryParamBuilderInvalidParameter,
  53. };
  54. //defined domain for errors from AWSRuntime.
  55. FOUNDATION_EXPORT NSString *const AWSEC2ParamBuilderErrorDomain;
  56. /* NSError codes in AWSErrorDomain. */
  57. typedef NS_ENUM(NSInteger, AWSEC2ParamBuilderErrorType) {
  58. AWSEC2ParamBuilderUnknownError,
  59. AWSEC2ParamBuilderDefinitionFileIsEmpty,
  60. AWSEC2ParamBuilderUndefinedActionRule,
  61. AWSEC2ParamBuilderInternalError,
  62. AWSEC2ParamBuilderInvalidParameter,
  63. };
  64. //defined domain for errors from AWSRuntime.
  65. FOUNDATION_EXPORT NSString *const AWSJSONBuilderErrorDomain;
  66. /* NSError codes in AWSErrorDomain. */
  67. typedef NS_ENUM(NSInteger, AWSJSONBuilderErrorType) {
  68. AWSJSONBuilderUnknownError,
  69. AWSJSONBuilderDefinitionFileIsEmpty,
  70. AWSJSONBuilderUndefinedActionRule,
  71. AWSJSONBuilderInternalError,
  72. AWSJSONBuilderInvalidParameter,
  73. };
  74. //defined domain for errors from AWSRuntime.
  75. FOUNDATION_EXPORT NSString *const AWSJSONParserErrorDomain;
  76. /* NSError codes in AWSErrorDomain. */
  77. typedef NS_ENUM(NSInteger, AWSJSONParserErrorType) {
  78. AWSJSONParserUnknownError,
  79. AWSJSONParserDefinitionFileIsEmpty,
  80. AWSJSONParserUndefinedActionRule,
  81. AWSJSONParserInternalError,
  82. AWSJSONParserInvalidParameter,
  83. };
  84. @interface AWSJSONDictionary : NSDictionary
  85. - (instancetype)initWithDictionary:(NSDictionary *)otherDictionary
  86. JSONDefinitionRule:(NSDictionary *)rule;
  87. - (NSUInteger)count;
  88. - (id)objectForKey:(id)aKey;
  89. @end
  90. @interface AWSXMLBuilder : NSObject
  91. + (NSData *)xmlDataForDictionary:(NSDictionary *)params
  92. actionName:(NSString *)actionName
  93. serviceDefinitionRule:(NSDictionary *)serviceDefinitionRule
  94. error:(NSError *__autoreleasing *)error;
  95. + (NSString *)xmlStringForDictionary:(NSDictionary *)params
  96. actionName:(NSString *)actionName
  97. serviceDefinitionRule:(NSDictionary *)serviceDefinitionRule
  98. error:(NSError *__autoreleasing *)error;
  99. @end
  100. @interface AWSXMLParser : NSObject
  101. + (AWSXMLParser *)sharedInstance;
  102. - (NSMutableDictionary *)dictionaryForXMLData:(NSData *)data
  103. actionName:(NSString *)actionName
  104. serviceDefinitionRule:(NSDictionary *)serviceDefinitionRule
  105. error:(NSError *__autoreleasing *)error;
  106. @end
  107. @interface AWSQueryParamBuilder : NSObject
  108. + (NSDictionary *)buildFormattedParams:(NSDictionary *)params
  109. actionName:(NSString *)actionName
  110. serviceDefinitionRule:(NSDictionary *)serviceDefinitionRule
  111. error:(NSError *__autoreleasing *)error;
  112. @end
  113. @interface AWSEC2ParamBuilder : NSObject
  114. + (NSDictionary *)buildFormattedParams:(NSDictionary *)params
  115. actionName:(NSString *)actionName
  116. serviceDefinitionRule:(NSDictionary *)serviceDefinitionRule
  117. error:(NSError *__autoreleasing *)error;
  118. @end
  119. @interface AWSJSONBuilder : NSObject
  120. + (NSData *)jsonDataForDictionary:(NSDictionary *)params
  121. actionName:(NSString *)actionName
  122. serviceDefinitionRule:(NSDictionary *)serviceDefinitionRule
  123. error:(NSError *__autoreleasing *)error;
  124. @end
  125. @interface AWSJSONParser : NSObject
  126. + (NSDictionary *)dictionaryForJsonData:(NSData *)data
  127. response:(NSHTTPURLResponse *)response
  128. actionName:(NSString *)actionName
  129. serviceDefinitionRule:(NSDictionary *)serviceDefinitionRule
  130. error:(NSError *__autoreleasing *)error;
  131. @end