forked from loafle/openapi-generator-original
update objc sample
This commit is contained in:
@@ -311,9 +311,10 @@ static void (^reachabilityChangeBlock)(int);
|
||||
range:NSMakeRange(0, [class length])];
|
||||
|
||||
if (match) {
|
||||
NSArray *dataArray = data;
|
||||
innerType = [class substringWithRange:[match rangeAtIndex:1]];
|
||||
|
||||
resultArray = [NSMutableArray arrayWithCapacity:[data count]];
|
||||
resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]];
|
||||
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
[resultArray addObject:[self deserialize:obj class:innerType]];
|
||||
}
|
||||
@@ -332,9 +333,10 @@ static void (^reachabilityChangeBlock)(int);
|
||||
range:NSMakeRange(0, [class length])];
|
||||
|
||||
if (match) {
|
||||
NSArray *dataArray = data;
|
||||
innerType = [class substringWithRange:[match rangeAtIndex:1]];
|
||||
|
||||
resultArray = [NSMutableArray arrayWithCapacity:[data count]];
|
||||
resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]];
|
||||
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
[resultArray addObject:[self deserialize:obj class:innerType]];
|
||||
}];
|
||||
@@ -352,9 +354,10 @@ static void (^reachabilityChangeBlock)(int);
|
||||
range:NSMakeRange(0, [class length])];
|
||||
|
||||
if (match) {
|
||||
NSDictionary *dataDict = data;
|
||||
NSString *valueType = [class substringWithRange:[match rangeAtIndex:2]];
|
||||
|
||||
resultDict = [NSMutableDictionary dictionaryWithCapacity:[data count]];
|
||||
resultDict = [NSMutableDictionary dictionaryWithCapacity:[dataDict count]];
|
||||
[data enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||
[resultDict setValue:[self deserialize:obj class:valueType] forKey:key];
|
||||
}];
|
||||
@@ -728,7 +731,8 @@ static void (^reachabilityChangeBlock)(int);
|
||||
return [object ISO8601String];
|
||||
}
|
||||
else if ([object isKindOfClass:[NSArray class]]) {
|
||||
NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[object count]];
|
||||
NSArray *objectArray = object;
|
||||
NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[objectArray count]];
|
||||
[object enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
if (obj) {
|
||||
[sanitizedObjs addObject:[self sanitizeForSerialization:obj]];
|
||||
@@ -737,7 +741,8 @@ static void (^reachabilityChangeBlock)(int);
|
||||
return sanitizedObjs;
|
||||
}
|
||||
else if ([object isKindOfClass:[NSDictionary class]]) {
|
||||
NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[object count]];
|
||||
NSDictionary *objectDict = object;
|
||||
NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[objectDict count]];
|
||||
[object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||
if (obj) {
|
||||
[sanitizedObjs setValue:[self sanitizeForSerialization:obj] forKey:key];
|
||||
|
||||
@@ -107,13 +107,6 @@
|
||||
|
||||
- (NSDictionary *) authSettings {
|
||||
return @{
|
||||
@"api_key":
|
||||
@{
|
||||
@"type": @"api_key",
|
||||
@"in": @"header",
|
||||
@"key": @"api_key",
|
||||
@"value": [self getApiKeyWithPrefix:@"api_key"]
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
*/
|
||||
@property(nonatomic) NSString* status;
|
||||
|
||||
@property(nonatomic) NSString* count;
|
||||
@property(nonatomic) NSNumber* complete;
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"count": @"count" }];
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||
{
|
||||
NSArray *optionalProperties = @[@"_id", @"petId", @"quantity", @"shipDate", @"status", @"count"];
|
||||
NSArray *optionalProperties = @[@"_id", @"petId", @"quantity", @"shipDate", @"status", @"complete"];
|
||||
|
||||
if ([optionalProperties containsObject:propertyName]) {
|
||||
return YES;
|
||||
|
||||
@@ -118,7 +118,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[@"application/json", @"application/xml"]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
NSArray *authSettings = @[];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -196,7 +196,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[@"application/json", @"application/xml"]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
NSArray *authSettings = @[];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -280,7 +280,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
NSArray *authSettings = @[];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -364,7 +364,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
NSArray *authSettings = @[];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -450,7 +450,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"api_key", @"petstore_auth"];
|
||||
NSArray *authSettings = @[];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -542,7 +542,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[@"application/x-www-form-urlencoded"]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
NSArray *authSettings = @[];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -646,7 +646,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
NSArray *authSettings = @[];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -738,7 +738,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[@"multipart/form-data"]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
NSArray *authSettings = @[];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
@@ -115,7 +115,7 @@ static SWGStoreApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"api_key"];
|
||||
NSArray *authSettings = @[];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
@@ -14,8 +14,8 @@ require 'petstore/models/order'
|
||||
|
||||
# APIs
|
||||
require 'petstore/api/user_api'
|
||||
require 'petstore/api/store_api'
|
||||
require 'petstore/api/pet_api'
|
||||
require 'petstore/api/store_api'
|
||||
|
||||
module Petstore
|
||||
class << self
|
||||
|
||||
@@ -42,7 +42,7 @@ module Petstore
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
auth_names = []
|
||||
@api_client.call_api(:PUT, path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
@@ -89,7 +89,7 @@ module Petstore
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
auth_names = []
|
||||
@api_client.call_api(:POST, path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
@@ -137,7 +137,7 @@ module Petstore
|
||||
post_body = nil
|
||||
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
auth_names = []
|
||||
result = @api_client.call_api(:GET, path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
@@ -186,7 +186,7 @@ module Petstore
|
||||
post_body = nil
|
||||
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
auth_names = []
|
||||
result = @api_client.call_api(:GET, path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
@@ -237,7 +237,7 @@ module Petstore
|
||||
post_body = nil
|
||||
|
||||
|
||||
auth_names = ['petstore_auth', 'api_key']
|
||||
auth_names = []
|
||||
result = @api_client.call_api(:GET, path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
@@ -292,7 +292,7 @@ module Petstore
|
||||
post_body = nil
|
||||
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
auth_names = []
|
||||
@api_client.call_api(:POST, path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
@@ -344,7 +344,7 @@ module Petstore
|
||||
post_body = nil
|
||||
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
auth_names = []
|
||||
@api_client.call_api(:DELETE, path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
@@ -398,7 +398,7 @@ module Petstore
|
||||
post_body = nil
|
||||
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
auth_names = []
|
||||
@api_client.call_api(:POST, path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
|
||||
@@ -41,7 +41,7 @@ module Petstore
|
||||
post_body = nil
|
||||
|
||||
|
||||
auth_names = ['api_key']
|
||||
auth_names = []
|
||||
result = @api_client.call_api(:GET, path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
|
||||
@@ -248,7 +248,7 @@ module Petstore
|
||||
|
||||
# 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.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [User]
|
||||
def get_user_by_name(username, opts = {})
|
||||
|
||||
@@ -62,8 +62,6 @@ module Petstore
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
|
||||
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
||||
|
||||
|
||||
req_opts = {
|
||||
:method => http_method,
|
||||
|
||||
@@ -160,13 +160,6 @@ module Petstore
|
||||
# Returns Auth Settings hash for api client.
|
||||
def auth_settings
|
||||
{
|
||||
'api_key' =>
|
||||
{
|
||||
type: 'api_key',
|
||||
in: 'header',
|
||||
key: 'api_key',
|
||||
value: api_key_with_prefix('api_key')
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user