Merge remote-tracking branch 'origin' into sync_master_230

This commit is contained in:
wing328
2017-02-10 23:31:36 +08:00
1480 changed files with 60531 additions and 12438 deletions

View File

@@ -30,8 +30,8 @@ Pod::Spec.new do |s|
s.public_header_files = 'SwaggerClient/**/*.h'
s.resources = 'SwaggerClient/**/*.{xcdatamodeld,xcdatamodel}'
s.dependency 'AFNetworking', '~> 3.1'
s.dependency 'JSONModel', '~> 1.4'
s.dependency 'AFNetworking', '~> 3'
s.dependency 'JSONModel', '~> 1.2'
s.dependency 'ISO8601', '~> 0.6'
end

View File

@@ -27,84 +27,113 @@ extern NSInteger kSWGPetApiMissingParamErrorCode;
///
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) addPetWithBody: (SWGPet*) body
///
/// @return
-(NSURLSessionTask*) addPetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Deletes a pet
///
///
/// @param petId Pet id to delete
/// @param apiKey (optional)
///
/// code:400 message:"Invalid pet value"
-(NSNumber*) deletePetWithPetId: (NSNumber*) petId
///
/// @return
-(NSURLSessionTask*) deletePetWithPetId: (NSNumber*) petId
apiKey: (NSString*) apiKey
completionHandler: (void (^)(NSError* error)) handler;
/// Finds Pets by status
/// Multiple status values can be provided with comma separated strings
///
/// @param status Status values that need to be considered for filter (optional) (default to available)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid status value"
///
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
-(NSURLSessionTask*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
/// Finds Pets by tags
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
///
/// @param tags Tags to filter by (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid tag value"
///
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
-(NSURLSessionTask*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
/// Find pet by ID
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
///
/// @param petId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found"
///
/// @return SWGPet*
-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId
-(NSURLSessionTask*) getPetByIdWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler;
/// Update an existing pet
///
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found",
/// code:405 message:"Validation exception"
-(NSNumber*) updatePetWithBody: (SWGPet*) body
///
/// @return
-(NSURLSessionTask*) updatePetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Updates a pet in the store with form data
///
///
/// @param petId ID of pet that needs to be updated
/// @param name Updated name of the pet (optional)
/// @param status Updated status of the pet (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId
///
/// @return
-(NSURLSessionTask*) updatePetWithFormWithPetId: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
completionHandler: (void (^)(NSError* error)) handler;
/// uploads an image
///
///
/// @param petId ID of pet to update
/// @param additionalMetadata Additional data to pass to server (optional)
/// @param file file to upload (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId
///
/// @return
-(NSURLSessionTask*) uploadFileWithPetId: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (NSURL*) file
completionHandler: (void (^)(NSError* error)) handler;
@end

View File

@@ -52,10 +52,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Add a new pet to the store
///
/// @param body Pet object that needs to be added to the store (optional)
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) addPetWithBody: (SWGPet*) body
/// @returns void
///
-(NSURLSessionTask*) addPetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
@@ -109,12 +110,13 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Deletes a pet
///
/// @param petId Pet id to delete
/// @param petId Pet id to delete
///
/// @param apiKey (optional)
/// @param apiKey (optional)
///
/// code:400 message:"Invalid pet value"
-(NSNumber*) deletePetWithPetId: (NSNumber*) petId
/// @returns void
///
-(NSURLSessionTask*) deletePetWithPetId: (NSNumber*) petId
apiKey: (NSString*) apiKey
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'petId' is set
@@ -185,12 +187,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Finds Pets by status
/// Multiple status values can be provided with comma separated strings
/// @param status Status values that need to be considered for filter (optional, default to available)
/// @param status Status values that need to be considered for filter (optional, default to available)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid status value"
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
/// @returns NSArray<SWGPet>*
///
-(NSURLSessionTask*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByStatus"];
@@ -247,12 +248,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Finds Pets by tags
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
/// @param tags Tags to filter by (optional)
/// @param tags Tags to filter by (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid tag value"
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
/// @returns NSArray<SWGPet>*
///
-(NSURLSessionTask*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByTags"];
@@ -309,13 +309,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Find pet by ID
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
/// @param petId ID of pet that needs to be fetched
/// @param petId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found"
/// @return SWGPet*
-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId
/// @returns SWGPet*
///
-(NSURLSessionTask*) getPetByIdWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler {
// verify the required parameter 'petId' is set
if (petId == nil) {
@@ -382,12 +380,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Update an existing pet
///
/// @param body Pet object that needs to be added to the store (optional)
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found",
/// code:405 message:"Validation exception"
-(NSNumber*) updatePetWithBody: (SWGPet*) body
/// @returns void
///
-(NSURLSessionTask*) updatePetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
@@ -441,14 +438,15 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Updates a pet in the store with form data
///
/// @param petId ID of pet that needs to be updated
/// @param petId ID of pet that needs to be updated
///
/// @param name Updated name of the pet (optional)
/// @param name Updated name of the pet (optional)
///
/// @param status Updated status of the pet (optional)
/// @param status Updated status of the pet (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId
/// @returns void
///
-(NSURLSessionTask*) updatePetWithFormWithPetId: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
completionHandler: (void (^)(NSError* error)) handler {
@@ -523,14 +521,15 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// uploads an image
///
/// @param petId ID of pet to update
/// @param petId ID of pet to update
///
/// @param additionalMetadata Additional data to pass to server (optional)
/// @param additionalMetadata Additional data to pass to server (optional)
///
/// @param file file to upload (optional)
/// @param file file to upload (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId
/// @returns void
///
-(NSURLSessionTask*) uploadFileWithPetId: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (NSURL*) file
completionHandler: (void (^)(NSError* error)) handler {
@@ -601,4 +600,5 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
}
@end

View File

@@ -27,39 +27,52 @@ extern NSInteger kSWGStoreApiMissingParamErrorCode;
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
///
/// @param orderId ID of the order that needs to be deleted
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId
///
/// @return
-(NSURLSessionTask*) deleteOrderWithOrderId: (NSString*) orderId
completionHandler: (void (^)(NSError* error)) handler;
/// Returns pet inventories by status
/// Returns a map of status codes to quantities
///
///
/// code:200 message:"successful operation"
///
/// @return NSDictionary<NSString*, NSNumber*>*
-(NSNumber*) getInventoryWithCompletionHandler:
-(NSURLSessionTask*) getInventoryWithCompletionHandler:
(void (^)(NSDictionary<NSString*, NSNumber*>* output, NSError* error)) handler;
/// Find purchase order by ID
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
///
/// @param orderId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
///
/// @return SWGOrder*
-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId
-(NSURLSessionTask*) getOrderByIdWithOrderId: (NSString*) orderId
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;
/// Place an order for a pet
///
///
/// @param body order placed for purchasing the pet (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid Order"
///
/// @return SWGOrder*
-(NSNumber*) placeOrderWithBody: (SWGOrder*) body
-(NSURLSessionTask*) placeOrderWithBody: (SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;
@end

View File

@@ -52,11 +52,11 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Delete purchase order by ID
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// @param orderId ID of the order that needs to be deleted
/// @param orderId ID of the order that needs to be deleted
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId
/// @returns void
///
-(NSURLSessionTask*) deleteOrderWithOrderId: (NSString*) orderId
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'orderId' is set
if (orderId == nil) {
@@ -123,9 +123,9 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Returns pet inventories by status
/// Returns a map of status codes to quantities
/// code:200 message:"successful operation"
/// @return NSDictionary<NSString*, NSNumber*>*
-(NSNumber*) getInventoryWithCompletionHandler:
/// @returns NSDictionary<NSString*, NSNumber*>*
///
-(NSURLSessionTask*) getInventoryWithCompletionHandler:
(void (^)(NSDictionary<NSString*, NSNumber*>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory"];
@@ -178,13 +178,11 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Find purchase order by ID
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// @param orderId ID of pet that needs to be fetched
/// @param orderId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
/// @return SWGOrder*
-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId
/// @returns SWGOrder*
///
-(NSURLSessionTask*) getOrderByIdWithOrderId: (NSString*) orderId
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler {
// verify the required parameter 'orderId' is set
if (orderId == nil) {
@@ -251,12 +249,11 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Place an order for a pet
///
/// @param body order placed for purchasing the pet (optional)
/// @param body order placed for purchasing the pet (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid Order"
/// @return SWGOrder*
-(NSNumber*) placeOrderWithBody: (SWGOrder*) body
/// @returns SWGOrder*
///
-(NSURLSessionTask*) placeOrderWithBody: (SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order"];
@@ -308,4 +305,5 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
}
@end

View File

@@ -27,75 +27,105 @@ extern NSInteger kSWGUserApiMissingParamErrorCode;
/// This can only be done by the logged in user.
///
/// @param body Created user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUserWithBody: (SWGUser*) body
///
/// @return
-(NSURLSessionTask*) createUserWithBody: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Creates list of users with given input array
///
///
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
///
/// @return
-(NSURLSessionTask*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Creates list of users with given input array
///
///
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
///
/// @return
-(NSURLSessionTask*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Delete user
/// This can only be done by the logged in user.
///
/// @param username The name that needs to be deleted
///
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
-(NSNumber*) deleteUserWithUsername: (NSString*) username
///
/// @return
-(NSURLSessionTask*) deleteUserWithUsername: (NSString*) username
completionHandler: (void (^)(NSError* error)) handler;
/// Get user by user name
///
///
/// @param username The name that needs to be fetched. Use user1 for testing.
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
///
/// @return SWGUser*
-(NSNumber*) getUserByNameWithUsername: (NSString*) username
-(NSURLSessionTask*) getUserByNameWithUsername: (NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error)) handler;
/// Logs user into the system
///
///
/// @param username The user name for login (optional)
/// @param password The password for login in clear text (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username/password supplied"
///
/// @return NSString*
-(NSNumber*) loginUserWithUsername: (NSString*) username
-(NSURLSessionTask*) loginUserWithUsername: (NSString*) username
password: (NSString*) password
completionHandler: (void (^)(NSString* output, NSError* error)) handler;
/// Logs out current logged in user session
///
///
///
/// code:0 message:"successful operation"
-(NSNumber*) logoutUserWithCompletionHandler:
///
/// @return
-(NSURLSessionTask*) logoutUserWithCompletionHandler:
(void (^)(NSError* error)) handler;
/// Updated user
/// This can only be done by the logged in user.
///
/// @param username name that need to be deleted
/// @param body Updated user object (optional)
///
/// code:400 message:"Invalid user supplied",
/// code:404 message:"User not found"
-(NSNumber*) updateUserWithUsername: (NSString*) username
///
/// @return
-(NSURLSessionTask*) updateUserWithUsername: (NSString*) username
body: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler;
@end

View File

@@ -52,10 +52,11 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Create user
/// This can only be done by the logged in user.
/// @param body Created user object (optional)
/// @param body Created user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUserWithBody: (SWGUser*) body
/// @returns void
///
-(NSURLSessionTask*) createUserWithBody: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user"];
@@ -109,10 +110,11 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Creates list of users with given input array
///
/// @param body List of user object (optional)
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
/// @returns void
///
-(NSURLSessionTask*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithArray"];
@@ -166,10 +168,11 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Creates list of users with given input array
///
/// @param body List of user object (optional)
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
/// @returns void
///
-(NSURLSessionTask*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithList"];
@@ -223,11 +226,11 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Delete user
/// This can only be done by the logged in user.
/// @param username The name that needs to be deleted
/// @param username The name that needs to be deleted
///
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
-(NSNumber*) deleteUserWithUsername: (NSString*) username
/// @returns void
///
-(NSURLSessionTask*) deleteUserWithUsername: (NSString*) username
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'username' is set
if (username == nil) {
@@ -294,13 +297,11 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Get user by user name
///
/// @param username The name that needs to be fetched. Use user1 for testing.
/// @param username The name that needs to be fetched. Use user1 for testing.
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
/// @return SWGUser*
-(NSNumber*) getUserByNameWithUsername: (NSString*) username
/// @returns SWGUser*
///
-(NSURLSessionTask*) getUserByNameWithUsername: (NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error)) handler {
// verify the required parameter 'username' is set
if (username == nil) {
@@ -367,14 +368,13 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Logs user into the system
///
/// @param username The user name for login (optional)
/// @param username The user name for login (optional)
///
/// @param password The password for login in clear text (optional)
/// @param password The password for login in clear text (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username/password supplied"
/// @return NSString*
-(NSNumber*) loginUserWithUsername: (NSString*) username
/// @returns NSString*
///
-(NSURLSessionTask*) loginUserWithUsername: (NSString*) username
password: (NSString*) password
completionHandler: (void (^)(NSString* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/login"];
@@ -434,8 +434,9 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Logs out current logged in user session
///
/// code:0 message:"successful operation"
-(NSNumber*) logoutUserWithCompletionHandler:
/// @returns void
///
-(NSURLSessionTask*) logoutUserWithCompletionHandler:
(void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/logout"];
@@ -488,13 +489,13 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Updated user
/// This can only be done by the logged in user.
/// @param username name that need to be deleted
/// @param username name that need to be deleted
///
/// @param body Updated user object (optional)
/// @param body Updated user object (optional)
///
/// code:400 message:"Invalid user supplied",
/// code:404 message:"User not found"
-(NSNumber*) updateUserWithUsername: (NSString*) username
/// @returns void
///
-(NSURLSessionTask*) updateUserWithUsername: (NSString*) username
body: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'username' is set
@@ -561,4 +562,5 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
}
@end

View File

@@ -34,14 +34,6 @@ extern NSString *const SWGResponseObjectErrorKey;
@property(nonatomic, strong) id<SWGSanitizer> sanitizer;
@property (nonatomic, strong) NSDictionary< NSString *, AFHTTPRequestSerializer <AFURLRequestSerialization> *>* requestSerializerForContentType;
/**
* Gets client singleton instance
*/
+ (instancetype) sharedClient;
/**
* Gets if the client is unreachable
*
@@ -63,29 +55,16 @@ extern NSString *const SWGResponseObjectErrorKey;
*/
+(AFNetworkReachabilityStatus) getReachabilityStatus;
/**
* Gets the next request id
*
* @return The next executed request id.
*/
+(NSNumber*) nextRequestId;
@property (nonatomic, strong) NSDictionary< NSString *, AFHTTPRequestSerializer <AFURLRequestSerialization> *>* requestSerializerForContentType;
/**
* Generates request id and add it to the queue
*
* @return The next executed request id.
* Gets client singleton instance
*/
+(NSNumber*) queueRequest;
+ (instancetype) sharedClient;
/**
* Removes request id from the queue
*
* @param requestId The request which will be removed.
*/
+(void) cancelRequest:(NSNumber*)requestId;
/**
* Customizes the behavior when the reachability changed
* Updates header parameters and query parameters for authentication
*
* @param headers The header parameter will be udpated, passed by pointer to pointer.
* @param querys The query parameters will be updated, passed by pointer to pointer.
@@ -100,7 +79,15 @@ extern NSString *const SWGResponseObjectErrorKey;
* @param configuration The configuration implementation
*/
- (instancetype)initWithConfiguration:(id<SWGConfiguration>)configuration;
/**
* Initializes the session manager with a configuration and url
*
* @param url The base url
* @param configuration The configuration implementation
*/
- (instancetype)initWithBaseURL:(NSURL *)url configuration:(id<SWGConfiguration>)configuration;
/**
* Performs request
*

View File

@@ -80,6 +80,7 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
@"application/x-www-form-urlencoded": afhttpRequestSerializer,
@"multipart/form-data": afhttpRequestSerializer
};
self.securityPolicy = [self createSecurityPolicy];
self.responseSerializer = [AFHTTPResponseSerializer serializer];
}
return self;
@@ -351,4 +352,25 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
}
- (AFSecurityPolicy *) createSecurityPolicy {
AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
id<SWGConfiguration> config = self.configuration;
if (config.sslCaCert) {
NSData *certData = [NSData dataWithContentsOfFile:config.sslCaCert];
[securityPolicy setPinnedCertificates:[NSSet setWithObject:certData]];
}
if (config.verifySSL) {
[securityPolicy setAllowInvalidCertificates:NO];
}
else {
[securityPolicy setAllowInvalidCertificates:YES];
[securityPolicy setValidatesDomainName:NO];
}
return securityPolicy;
}
@end

View File

@@ -64,6 +64,18 @@ static NSString * const kSWGAPIVersion = @"1.0.0";
*/
@property (readonly, nonatomic) BOOL debug;
/**
* SSL/TLS verification
* Set this to NO to skip verifying SSL certificate when calling API from https server
*/
@property (readonly, nonatomic) BOOL verifySSL;
/**
* SSL/TLS verification
* Set this to customize the certificate file to verify the peer
*/
@property (readonly, nonatomic) NSString *sslCaCert;
/**
* Authentication Settings
*/
@@ -74,4 +86,4 @@ static NSString * const kSWGAPIVersion = @"1.0.0";
*/
@property (readonly, nonatomic, strong) NSDictionary *defaultHeaders;
@end
@end

View File

@@ -32,6 +32,7 @@
_username = @"";
_password = @"";
_accessToken= @"";
_verifySSL = YES;
_mutableApiKey = [NSMutableDictionary dictionary];
_mutableApiKeyPrefix = [NSMutableDictionary dictionary];
_mutableDefaultHeaders = [NSMutableDictionary dictionary];

View File

@@ -391,7 +391,7 @@
);
inputPaths = (
);
name = "📦 Check Pods Manifest.lock";
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -436,7 +436,7 @@
);
inputPaths = (
);
name = "📦 Check Pods Manifest.lock";
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -466,7 +466,22 @@
);
inputPaths = (
);
name = "📦 Copy Pods Resources";
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E337D7E459CCFFDF27046FFC /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;

View File

@@ -30,8 +30,8 @@ Pod::Spec.new do |s|
s.public_header_files = 'SwaggerClient/**/*.h'
s.dependency 'AFNetworking', '~> 3.1'
s.dependency 'JSONModel', '~> 1.4'
s.dependency 'AFNetworking', '~> 3'
s.dependency 'JSONModel', '~> 1.2'
s.dependency 'ISO8601', '~> 0.6'
end

View File

@@ -27,84 +27,113 @@ extern NSInteger kSWGPetApiMissingParamErrorCode;
///
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) addPetWithBody: (SWGPet*) body
///
/// @return
-(NSURLSessionTask*) addPetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Deletes a pet
///
///
/// @param petId Pet id to delete
/// @param apiKey (optional)
///
/// code:400 message:"Invalid pet value"
-(NSNumber*) deletePetWithPetId: (NSNumber*) petId
///
/// @return
-(NSURLSessionTask*) deletePetWithPetId: (NSNumber*) petId
apiKey: (NSString*) apiKey
completionHandler: (void (^)(NSError* error)) handler;
/// Finds Pets by status
/// Multiple status values can be provided with comma separated strings
///
/// @param status Status values that need to be considered for filter (optional) (default to available)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid status value"
///
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
-(NSURLSessionTask*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
/// Finds Pets by tags
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
///
/// @param tags Tags to filter by (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid tag value"
///
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
-(NSURLSessionTask*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
/// Find pet by ID
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
///
/// @param petId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found"
///
/// @return SWGPet*
-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId
-(NSURLSessionTask*) getPetByIdWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler;
/// Update an existing pet
///
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found",
/// code:405 message:"Validation exception"
-(NSNumber*) updatePetWithBody: (SWGPet*) body
///
/// @return
-(NSURLSessionTask*) updatePetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Updates a pet in the store with form data
///
///
/// @param petId ID of pet that needs to be updated
/// @param name Updated name of the pet (optional)
/// @param status Updated status of the pet (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId
///
/// @return
-(NSURLSessionTask*) updatePetWithFormWithPetId: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
completionHandler: (void (^)(NSError* error)) handler;
/// uploads an image
///
///
/// @param petId ID of pet to update
/// @param additionalMetadata Additional data to pass to server (optional)
/// @param file file to upload (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId
///
/// @return
-(NSURLSessionTask*) uploadFileWithPetId: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (NSURL*) file
completionHandler: (void (^)(NSError* error)) handler;
@end

View File

@@ -52,10 +52,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Add a new pet to the store
///
/// @param body Pet object that needs to be added to the store (optional)
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) addPetWithBody: (SWGPet*) body
/// @returns void
///
-(NSURLSessionTask*) addPetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
@@ -109,12 +110,13 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Deletes a pet
///
/// @param petId Pet id to delete
/// @param petId Pet id to delete
///
/// @param apiKey (optional)
/// @param apiKey (optional)
///
/// code:400 message:"Invalid pet value"
-(NSNumber*) deletePetWithPetId: (NSNumber*) petId
/// @returns void
///
-(NSURLSessionTask*) deletePetWithPetId: (NSNumber*) petId
apiKey: (NSString*) apiKey
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'petId' is set
@@ -185,12 +187,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Finds Pets by status
/// Multiple status values can be provided with comma separated strings
/// @param status Status values that need to be considered for filter (optional, default to available)
/// @param status Status values that need to be considered for filter (optional, default to available)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid status value"
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
/// @returns NSArray<SWGPet>*
///
-(NSURLSessionTask*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByStatus"];
@@ -247,12 +248,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Finds Pets by tags
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
/// @param tags Tags to filter by (optional)
/// @param tags Tags to filter by (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid tag value"
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
/// @returns NSArray<SWGPet>*
///
-(NSURLSessionTask*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByTags"];
@@ -309,13 +309,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Find pet by ID
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
/// @param petId ID of pet that needs to be fetched
/// @param petId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found"
/// @return SWGPet*
-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId
/// @returns SWGPet*
///
-(NSURLSessionTask*) getPetByIdWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler {
// verify the required parameter 'petId' is set
if (petId == nil) {
@@ -382,12 +380,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Update an existing pet
///
/// @param body Pet object that needs to be added to the store (optional)
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found",
/// code:405 message:"Validation exception"
-(NSNumber*) updatePetWithBody: (SWGPet*) body
/// @returns void
///
-(NSURLSessionTask*) updatePetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
@@ -441,14 +438,15 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Updates a pet in the store with form data
///
/// @param petId ID of pet that needs to be updated
/// @param petId ID of pet that needs to be updated
///
/// @param name Updated name of the pet (optional)
/// @param name Updated name of the pet (optional)
///
/// @param status Updated status of the pet (optional)
/// @param status Updated status of the pet (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId
/// @returns void
///
-(NSURLSessionTask*) updatePetWithFormWithPetId: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
completionHandler: (void (^)(NSError* error)) handler {
@@ -523,14 +521,15 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// uploads an image
///
/// @param petId ID of pet to update
/// @param petId ID of pet to update
///
/// @param additionalMetadata Additional data to pass to server (optional)
/// @param additionalMetadata Additional data to pass to server (optional)
///
/// @param file file to upload (optional)
/// @param file file to upload (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId
/// @returns void
///
-(NSURLSessionTask*) uploadFileWithPetId: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (NSURL*) file
completionHandler: (void (^)(NSError* error)) handler {
@@ -601,4 +600,5 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
}
@end

View File

@@ -27,39 +27,52 @@ extern NSInteger kSWGStoreApiMissingParamErrorCode;
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
///
/// @param orderId ID of the order that needs to be deleted
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId
///
/// @return
-(NSURLSessionTask*) deleteOrderWithOrderId: (NSString*) orderId
completionHandler: (void (^)(NSError* error)) handler;
/// Returns pet inventories by status
/// Returns a map of status codes to quantities
///
///
/// code:200 message:"successful operation"
///
/// @return NSDictionary<NSString*, NSNumber*>*
-(NSNumber*) getInventoryWithCompletionHandler:
-(NSURLSessionTask*) getInventoryWithCompletionHandler:
(void (^)(NSDictionary<NSString*, NSNumber*>* output, NSError* error)) handler;
/// Find purchase order by ID
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
///
/// @param orderId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
///
/// @return SWGOrder*
-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId
-(NSURLSessionTask*) getOrderByIdWithOrderId: (NSString*) orderId
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;
/// Place an order for a pet
///
///
/// @param body order placed for purchasing the pet (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid Order"
///
/// @return SWGOrder*
-(NSNumber*) placeOrderWithBody: (SWGOrder*) body
-(NSURLSessionTask*) placeOrderWithBody: (SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;
@end

View File

@@ -52,11 +52,11 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Delete purchase order by ID
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// @param orderId ID of the order that needs to be deleted
/// @param orderId ID of the order that needs to be deleted
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId
/// @returns void
///
-(NSURLSessionTask*) deleteOrderWithOrderId: (NSString*) orderId
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'orderId' is set
if (orderId == nil) {
@@ -123,9 +123,9 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Returns pet inventories by status
/// Returns a map of status codes to quantities
/// code:200 message:"successful operation"
/// @return NSDictionary<NSString*, NSNumber*>*
-(NSNumber*) getInventoryWithCompletionHandler:
/// @returns NSDictionary<NSString*, NSNumber*>*
///
-(NSURLSessionTask*) getInventoryWithCompletionHandler:
(void (^)(NSDictionary<NSString*, NSNumber*>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory"];
@@ -178,13 +178,11 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Find purchase order by ID
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// @param orderId ID of pet that needs to be fetched
/// @param orderId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
/// @return SWGOrder*
-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId
/// @returns SWGOrder*
///
-(NSURLSessionTask*) getOrderByIdWithOrderId: (NSString*) orderId
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler {
// verify the required parameter 'orderId' is set
if (orderId == nil) {
@@ -251,12 +249,11 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Place an order for a pet
///
/// @param body order placed for purchasing the pet (optional)
/// @param body order placed for purchasing the pet (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid Order"
/// @return SWGOrder*
-(NSNumber*) placeOrderWithBody: (SWGOrder*) body
/// @returns SWGOrder*
///
-(NSURLSessionTask*) placeOrderWithBody: (SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order"];
@@ -308,4 +305,5 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
}
@end

View File

@@ -27,75 +27,105 @@ extern NSInteger kSWGUserApiMissingParamErrorCode;
/// This can only be done by the logged in user.
///
/// @param body Created user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUserWithBody: (SWGUser*) body
///
/// @return
-(NSURLSessionTask*) createUserWithBody: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Creates list of users with given input array
///
///
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
///
/// @return
-(NSURLSessionTask*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Creates list of users with given input array
///
///
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
///
/// @return
-(NSURLSessionTask*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Delete user
/// This can only be done by the logged in user.
///
/// @param username The name that needs to be deleted
///
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
-(NSNumber*) deleteUserWithUsername: (NSString*) username
///
/// @return
-(NSURLSessionTask*) deleteUserWithUsername: (NSString*) username
completionHandler: (void (^)(NSError* error)) handler;
/// Get user by user name
///
///
/// @param username The name that needs to be fetched. Use user1 for testing.
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
///
/// @return SWGUser*
-(NSNumber*) getUserByNameWithUsername: (NSString*) username
-(NSURLSessionTask*) getUserByNameWithUsername: (NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error)) handler;
/// Logs user into the system
///
///
/// @param username The user name for login (optional)
/// @param password The password for login in clear text (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username/password supplied"
///
/// @return NSString*
-(NSNumber*) loginUserWithUsername: (NSString*) username
-(NSURLSessionTask*) loginUserWithUsername: (NSString*) username
password: (NSString*) password
completionHandler: (void (^)(NSString* output, NSError* error)) handler;
/// Logs out current logged in user session
///
///
///
/// code:0 message:"successful operation"
-(NSNumber*) logoutUserWithCompletionHandler:
///
/// @return
-(NSURLSessionTask*) logoutUserWithCompletionHandler:
(void (^)(NSError* error)) handler;
/// Updated user
/// This can only be done by the logged in user.
///
/// @param username name that need to be deleted
/// @param body Updated user object (optional)
///
/// code:400 message:"Invalid user supplied",
/// code:404 message:"User not found"
-(NSNumber*) updateUserWithUsername: (NSString*) username
///
/// @return
-(NSURLSessionTask*) updateUserWithUsername: (NSString*) username
body: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler;
@end

View File

@@ -52,10 +52,11 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Create user
/// This can only be done by the logged in user.
/// @param body Created user object (optional)
/// @param body Created user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUserWithBody: (SWGUser*) body
/// @returns void
///
-(NSURLSessionTask*) createUserWithBody: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user"];
@@ -109,10 +110,11 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Creates list of users with given input array
///
/// @param body List of user object (optional)
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
/// @returns void
///
-(NSURLSessionTask*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithArray"];
@@ -166,10 +168,11 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Creates list of users with given input array
///
/// @param body List of user object (optional)
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
/// @returns void
///
-(NSURLSessionTask*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithList"];
@@ -223,11 +226,11 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Delete user
/// This can only be done by the logged in user.
/// @param username The name that needs to be deleted
/// @param username The name that needs to be deleted
///
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
-(NSNumber*) deleteUserWithUsername: (NSString*) username
/// @returns void
///
-(NSURLSessionTask*) deleteUserWithUsername: (NSString*) username
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'username' is set
if (username == nil) {
@@ -294,13 +297,11 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Get user by user name
///
/// @param username The name that needs to be fetched. Use user1 for testing.
/// @param username The name that needs to be fetched. Use user1 for testing.
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
/// @return SWGUser*
-(NSNumber*) getUserByNameWithUsername: (NSString*) username
/// @returns SWGUser*
///
-(NSURLSessionTask*) getUserByNameWithUsername: (NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error)) handler {
// verify the required parameter 'username' is set
if (username == nil) {
@@ -367,14 +368,13 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Logs user into the system
///
/// @param username The user name for login (optional)
/// @param username The user name for login (optional)
///
/// @param password The password for login in clear text (optional)
/// @param password The password for login in clear text (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username/password supplied"
/// @return NSString*
-(NSNumber*) loginUserWithUsername: (NSString*) username
/// @returns NSString*
///
-(NSURLSessionTask*) loginUserWithUsername: (NSString*) username
password: (NSString*) password
completionHandler: (void (^)(NSString* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/login"];
@@ -434,8 +434,9 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Logs out current logged in user session
///
/// code:0 message:"successful operation"
-(NSNumber*) logoutUserWithCompletionHandler:
/// @returns void
///
-(NSURLSessionTask*) logoutUserWithCompletionHandler:
(void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/logout"];
@@ -488,13 +489,13 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Updated user
/// This can only be done by the logged in user.
/// @param username name that need to be deleted
/// @param username name that need to be deleted
///
/// @param body Updated user object (optional)
/// @param body Updated user object (optional)
///
/// code:400 message:"Invalid user supplied",
/// code:404 message:"User not found"
-(NSNumber*) updateUserWithUsername: (NSString*) username
/// @returns void
///
-(NSURLSessionTask*) updateUserWithUsername: (NSString*) username
body: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'username' is set
@@ -561,4 +562,5 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
}
@end

View File

@@ -34,14 +34,6 @@ extern NSString *const SWGResponseObjectErrorKey;
@property(nonatomic, strong) id<SWGSanitizer> sanitizer;
@property (nonatomic, strong) NSDictionary< NSString *, AFHTTPRequestSerializer <AFURLRequestSerialization> *>* requestSerializerForContentType;
/**
* Gets client singleton instance
*/
+ (instancetype) sharedClient;
/**
* Gets if the client is unreachable
*
@@ -63,29 +55,16 @@ extern NSString *const SWGResponseObjectErrorKey;
*/
+(AFNetworkReachabilityStatus) getReachabilityStatus;
/**
* Gets the next request id
*
* @return The next executed request id.
*/
+(NSNumber*) nextRequestId;
@property (nonatomic, strong) NSDictionary< NSString *, AFHTTPRequestSerializer <AFURLRequestSerialization> *>* requestSerializerForContentType;
/**
* Generates request id and add it to the queue
*
* @return The next executed request id.
* Gets client singleton instance
*/
+(NSNumber*) queueRequest;
+ (instancetype) sharedClient;
/**
* Removes request id from the queue
*
* @param requestId The request which will be removed.
*/
+(void) cancelRequest:(NSNumber*)requestId;
/**
* Customizes the behavior when the reachability changed
* Updates header parameters and query parameters for authentication
*
* @param headers The header parameter will be udpated, passed by pointer to pointer.
* @param querys The query parameters will be updated, passed by pointer to pointer.
@@ -100,7 +79,15 @@ extern NSString *const SWGResponseObjectErrorKey;
* @param configuration The configuration implementation
*/
- (instancetype)initWithConfiguration:(id<SWGConfiguration>)configuration;
/**
* Initializes the session manager with a configuration and url
*
* @param url The base url
* @param configuration The configuration implementation
*/
- (instancetype)initWithBaseURL:(NSURL *)url configuration:(id<SWGConfiguration>)configuration;
/**
* Performs request
*

View File

@@ -80,6 +80,7 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
@"application/x-www-form-urlencoded": afhttpRequestSerializer,
@"multipart/form-data": afhttpRequestSerializer
};
self.securityPolicy = [self createSecurityPolicy];
self.responseSerializer = [AFHTTPResponseSerializer serializer];
}
return self;
@@ -351,4 +352,25 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
}
- (AFSecurityPolicy *) createSecurityPolicy {
AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
id<SWGConfiguration> config = self.configuration;
if (config.sslCaCert) {
NSData *certData = [NSData dataWithContentsOfFile:config.sslCaCert];
[securityPolicy setPinnedCertificates:[NSSet setWithObject:certData]];
}
if (config.verifySSL) {
[securityPolicy setAllowInvalidCertificates:NO];
}
else {
[securityPolicy setAllowInvalidCertificates:YES];
[securityPolicy setValidatesDomainName:NO];
}
return securityPolicy;
}
@end

View File

@@ -64,6 +64,18 @@ static NSString * const kSWGAPIVersion = @"1.0.0";
*/
@property (readonly, nonatomic) BOOL debug;
/**
* SSL/TLS verification
* Set this to NO to skip verifying SSL certificate when calling API from https server
*/
@property (readonly, nonatomic) BOOL verifySSL;
/**
* SSL/TLS verification
* Set this to customize the certificate file to verify the peer
*/
@property (readonly, nonatomic) NSString *sslCaCert;
/**
* Authentication Settings
*/
@@ -74,4 +86,4 @@ static NSString * const kSWGAPIVersion = @"1.0.0";
*/
@property (readonly, nonatomic, strong) NSDictionary *defaultHeaders;
@end
@end

View File

@@ -32,6 +32,7 @@
_username = @"";
_password = @"";
_accessToken= @"";
_verifySSL = YES;
_mutableApiKey = [NSMutableDictionary dictionary];
_mutableApiKeyPrefix = [NSMutableDictionary dictionary];
_mutableDefaultHeaders = [NSMutableDictionary dictionary];