forked from loafle/openapi-generator-original
update objc samples
This commit is contained in:
@@ -30,8 +30,8 @@ Pod::Spec.new do |s|
|
||||
s.public_header_files = 'SwaggerClient/**/*.h'
|
||||
s.resources = 'SwaggerClient/**/*.{xcdatamodeld,xcdatamodel}'
|
||||
|
||||
s.dependency 'AFNetworking', '~> 3'
|
||||
s.dependency 'JSONModel', '~> 1.2'
|
||||
s.dependency 'AFNetworking', '~> 3.1'
|
||||
s.dependency 'JSONModel', '~> 1.4'
|
||||
s.dependency 'ISO8601', '~> 0.5'
|
||||
end
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
|
||||
NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth", @"api_key"];
|
||||
NSArray *authSettings = @[@"api_key", @"petstore_auth"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
@@ -98,7 +98,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
||||
/**
|
||||
* Sets the client reachability, this may be overridden by the reachability manager if reachability changes
|
||||
*
|
||||
* @param The client reachability.
|
||||
* @param status The client reachability status.
|
||||
*/
|
||||
+(void) setReachabilityStatus:(AFNetworkReachabilityStatus) status;
|
||||
|
||||
|
||||
@@ -483,7 +483,7 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
|
||||
|
||||
if (config.sslCaCert) {
|
||||
NSData *certData = [NSData dataWithContentsOfFile:config.sslCaCert];
|
||||
[securityPolicy setPinnedCertificates:@[certData]];
|
||||
[securityPolicy setPinnedCertificates:[NSSet setWithObject:certData]];
|
||||
}
|
||||
|
||||
if (config.verifySSL) {
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
/**
|
||||
* Sets the prefix for API key
|
||||
*
|
||||
* @param apiKeyPrefix API key prefix.
|
||||
* @param prefix API key prefix.
|
||||
* @param identifier API key identifier.
|
||||
*/
|
||||
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier;
|
||||
@@ -162,7 +162,7 @@
|
||||
/**
|
||||
* Removes header from defaultHeaders
|
||||
*
|
||||
* @param Header name.
|
||||
* @param key Header name.
|
||||
*/
|
||||
-(void) removeDefaultHeaderForKey:(NSString*)key;
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key;
|
||||
|
||||
/**
|
||||
* @param Header key name.
|
||||
* @param key Header key name.
|
||||
*/
|
||||
-(NSString*) defaultHeaderForKey:(NSString*)key;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ extern NSInteger const SWGUnknownResponseObjectErrorCode;
|
||||
* Deserializes the given data to Objective-C object.
|
||||
*
|
||||
* @param data The data will be deserialized.
|
||||
* @param class The type of objective-c object.
|
||||
* @param className The type of objective-c object.
|
||||
* @param error The error
|
||||
*/
|
||||
- (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper {
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }];
|
||||
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ Pod::Spec.new do |s|
|
||||
|
||||
|
||||
s.dependency 'AFNetworking', '~> 3.1'
|
||||
s.dependency 'JSONModel', '~> 1.2'
|
||||
s.dependency 'JSONModel', '~> 1.4'
|
||||
s.dependency 'ISO8601', '~> 0.5'
|
||||
end
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
|
||||
NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth", @"api_key"];
|
||||
NSArray *authSettings = @[@"api_key", @"petstore_auth"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
@@ -246,14 +246,14 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
|
||||
```objc
|
||||
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
|
||||
|
||||
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
|
||||
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
|
||||
|
||||
// Configure API key authorization: (authentication scheme: api_key)
|
||||
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"];
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api_key"];
|
||||
|
||||
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
|
||||
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
|
||||
|
||||
|
||||
NSNumber* petId = @789; // ID of pet that needs to be fetched
|
||||
|
||||
@@ -283,7 +283,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user