forked from loafle/openapi-generator-original
restore sample files for objc, php and ruby
This commit is contained in:
@@ -21,10 +21,10 @@ Pod::Spec.new do |s|
|
||||
|
||||
s.framework = 'SystemConfiguration'
|
||||
|
||||
s.homepage = "https://github.com/swagger-api/swagger-codegen"
|
||||
s.license = "MIT"
|
||||
s.source = { :git => "https://github.com/swagger-api/swagger-codegen.git", :tag => "#{s.version}" }
|
||||
s.author = { "Swagger" => "apiteam@swagger.io" }
|
||||
s.homepage = ""
|
||||
s.license = ""
|
||||
s.source = { :git => ".git", :tag => "#{s.version}" }
|
||||
s.author = { "" => "" }
|
||||
|
||||
s.source_files = 'SwaggerClient/**/*'
|
||||
s.public_header_files = 'SwaggerClient/**/*.h'
|
||||
|
||||
@@ -311,10 +311,9 @@ static void (^reachabilityChangeBlock)(int);
|
||||
range:NSMakeRange(0, [class length])];
|
||||
|
||||
if (match) {
|
||||
NSArray *dataArray = data;
|
||||
innerType = [class substringWithRange:[match rangeAtIndex:1]];
|
||||
|
||||
resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]];
|
||||
resultArray = [NSMutableArray arrayWithCapacity:[data count]];
|
||||
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
[resultArray addObject:[self deserialize:obj class:innerType]];
|
||||
}
|
||||
@@ -333,10 +332,9 @@ static void (^reachabilityChangeBlock)(int);
|
||||
range:NSMakeRange(0, [class length])];
|
||||
|
||||
if (match) {
|
||||
NSArray *dataArray = data;
|
||||
innerType = [class substringWithRange:[match rangeAtIndex:1]];
|
||||
|
||||
resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]];
|
||||
resultArray = [NSMutableArray arrayWithCapacity:[data count]];
|
||||
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
[resultArray addObject:[self deserialize:obj class:innerType]];
|
||||
}];
|
||||
@@ -354,10 +352,9 @@ static void (^reachabilityChangeBlock)(int);
|
||||
range:NSMakeRange(0, [class length])];
|
||||
|
||||
if (match) {
|
||||
NSDictionary *dataDict = data;
|
||||
NSString *valueType = [class substringWithRange:[match rangeAtIndex:2]];
|
||||
|
||||
resultDict = [NSMutableDictionary dictionaryWithCapacity:[dataDict count]];
|
||||
resultDict = [NSMutableDictionary dictionaryWithCapacity:[data count]];
|
||||
[data enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||
[resultDict setValue:[self deserialize:obj class:valueType] forKey:key];
|
||||
}];
|
||||
@@ -731,8 +728,7 @@ static void (^reachabilityChangeBlock)(int);
|
||||
return [object ISO8601String];
|
||||
}
|
||||
else if ([object isKindOfClass:[NSArray class]]) {
|
||||
NSArray *objectArray = object;
|
||||
NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[objectArray count]];
|
||||
NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[object count]];
|
||||
[object enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
if (obj) {
|
||||
[sanitizedObjs addObject:[self sanitizeForSerialization:obj]];
|
||||
@@ -741,8 +737,7 @@ static void (^reachabilityChangeBlock)(int);
|
||||
return sanitizedObjs;
|
||||
}
|
||||
else if ([object isKindOfClass:[NSDictionary class]]) {
|
||||
NSDictionary *objectDict = object;
|
||||
NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[objectDict count]];
|
||||
NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[object count]];
|
||||
[object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||
if (obj) {
|
||||
[sanitizedObjs setValue:[self sanitizeForSerialization:obj] forKey:key];
|
||||
|
||||
@@ -107,6 +107,13 @@
|
||||
|
||||
- (NSDictionary *) authSettings {
|
||||
return @{
|
||||
@"api_key":
|
||||
@{
|
||||
@"type": @"api_key",
|
||||
@"in": @"header",
|
||||
@"key": @"api_key",
|
||||
@"value": [self getApiKeyWithPrefix:@"api_key"]
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
#import "SWGTag.h"
|
||||
#import "SWGCategory.h"
|
||||
#import "SWGTag.h"
|
||||
|
||||
|
||||
@protocol SWGPet
|
||||
|
||||
@@ -118,7 +118,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[@"application/json", @"application/xml"]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[];
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
|
||||
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 = @[];
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -280,7 +280,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[];
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -364,7 +364,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[];
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -450,7 +450,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[];
|
||||
NSArray *authSettings = @[@"petstore_auth", @"api_key"];
|
||||
|
||||
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 = @[];
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -646,7 +646,7 @@ static SWGPetApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[];
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
|
||||
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 = @[];
|
||||
NSArray *authSettings = @[@"petstore_auth"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
@@ -115,7 +115,7 @@ static SWGStoreApi* singletonAPI = nil;
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[];
|
||||
NSArray *authSettings = @[@"api_key"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
/// 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.
|
||||
///
|
||||
///
|
||||
/// @return SWGUser*
|
||||
|
||||
@@ -470,7 +470,7 @@ static SWGUserApi* singletonAPI = nil;
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// @returns SWGUser*
|
||||
///
|
||||
|
||||
@@ -135,6 +135,9 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
{
|
||||
@@ -197,6 +200,9 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
{
|
||||
@@ -258,6 +264,9 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
{
|
||||
@@ -331,6 +340,9 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
{
|
||||
@@ -412,6 +424,16 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
|
||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
||||
if (isset($apiKey)) {
|
||||
$headerParams['api_key'] = $apiKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
{
|
||||
@@ -501,6 +523,9 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
{
|
||||
@@ -574,6 +599,9 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
{
|
||||
@@ -651,6 +679,9 @@ class PetApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
{
|
||||
|
||||
@@ -130,6 +130,13 @@ class StoreApi
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
||||
if (isset($apiKey)) {
|
||||
$headerParams['api_key'] = $apiKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
{
|
||||
|
||||
@@ -193,7 +193,7 @@ class ObjectSerializer
|
||||
$deserialized = $values;
|
||||
} elseif ($class === '\DateTime') {
|
||||
$deserialized = new \DateTime($data);
|
||||
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) {
|
||||
} elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
} elseif ($class === '\SplFileObject') {
|
||||
|
||||
@@ -14,8 +14,8 @@ require 'petstore/models/order'
|
||||
|
||||
# APIs
|
||||
require 'petstore/api/user_api'
|
||||
require 'petstore/api/pet_api'
|
||||
require 'petstore/api/store_api'
|
||||
require 'petstore/api/pet_api'
|
||||
|
||||
module Petstore
|
||||
class << self
|
||||
|
||||
@@ -42,7 +42,7 @@ module Petstore
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
|
||||
auth_names = []
|
||||
auth_names = ['petstore_auth']
|
||||
@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 = []
|
||||
auth_names = ['petstore_auth']
|
||||
@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 = []
|
||||
auth_names = ['petstore_auth']
|
||||
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 = []
|
||||
auth_names = ['petstore_auth']
|
||||
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 = []
|
||||
auth_names = ['petstore_auth', 'api_key']
|
||||
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 = []
|
||||
auth_names = ['petstore_auth']
|
||||
@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 = []
|
||||
auth_names = ['petstore_auth']
|
||||
@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 = []
|
||||
auth_names = ['petstore_auth']
|
||||
@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 = []
|
||||
auth_names = ['api_key']
|
||||
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,6 +62,8 @@ module Petstore
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
|
||||
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
||||
|
||||
|
||||
req_opts = {
|
||||
:method => http_method,
|
||||
|
||||
@@ -160,6 +160,13 @@ 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