forked from loafle/openapi-generator-original
Supoort customize classPrefix in objc client.
This commit is contained in:
parent
e244d20152
commit
9a15ced211
@ -138,6 +138,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
additionalProperties.put("podName", podName);
|
||||
additionalProperties.put("podVersion", podVersion);
|
||||
additionalProperties.put("classPrefix", classPrefix);
|
||||
|
||||
String swaggerFolder = podName;
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
#import "SWGApiClient.h"
|
||||
#import "SWGFile.h"
|
||||
#import "SWGQueryParamCollection.h"
|
||||
#import "SWGConfiguration.h"
|
||||
#import "{{classPrefix}}ApiClient.h"
|
||||
|
||||
@implementation SWGApiClient
|
||||
@implementation {{classPrefix}}ApiClient
|
||||
|
||||
NSString *const SWGResponseObjectErrorKey = @"SWGResponseObject";
|
||||
NSString *const {{classPrefix}}ResponseObjectErrorKey = @"{{classPrefix}}ResponseObject";
|
||||
|
||||
static long requestId = 0;
|
||||
static bool offlineState = false;
|
||||
@ -58,7 +55,7 @@ static bool loggingEnabled = true;
|
||||
return sharedQueue;
|
||||
}
|
||||
|
||||
+(SWGApiClient *)sharedClientFromPool:(NSString *)baseUrl {
|
||||
+({{classPrefix}}ApiClient *)sharedClientFromPool:(NSString *)baseUrl {
|
||||
static NSMutableDictionary *_pool = nil;
|
||||
if (queuedRequests == nil) {
|
||||
queuedRequests = [[NSMutableSet alloc]init];
|
||||
@ -72,16 +69,16 @@ static bool loggingEnabled = true;
|
||||
_pool = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// initialize URL cache
|
||||
[SWGApiClient configureCacheWithMemoryAndDiskCapacity:4*1024*1024 diskSize:32*1024*1024];
|
||||
[{{classPrefix}}ApiClient configureCacheWithMemoryAndDiskCapacity:4*1024*1024 diskSize:32*1024*1024];
|
||||
|
||||
// configure reachability
|
||||
[SWGApiClient configureCacheReachibilityForHost:baseUrl];
|
||||
[{{classPrefix}}ApiClient configureCacheReachibilityForHost:baseUrl];
|
||||
}
|
||||
|
||||
@synchronized(self) {
|
||||
SWGApiClient * client = [_pool objectForKey:baseUrl];
|
||||
{{classPrefix}}ApiClient * client = [_pool objectForKey:baseUrl];
|
||||
if (client == nil) {
|
||||
client = [[SWGApiClient alloc] initWithBaseURL:[NSURL URLWithString:baseUrl]];
|
||||
client = [[{{classPrefix}}ApiClient alloc] initWithBaseURL:[NSURL URLWithString:baseUrl]];
|
||||
[_pool setValue:client forKey:baseUrl ];
|
||||
if(loggingEnabled)
|
||||
NSLog(@"new client for path %@", baseUrl);
|
||||
@ -156,7 +153,7 @@ static bool loggingEnabled = true;
|
||||
}
|
||||
|
||||
+(NSNumber*) queueRequest {
|
||||
NSNumber* requestId = [SWGApiClient nextRequestId];
|
||||
NSNumber* requestId = [{{classPrefix}}ApiClient nextRequestId];
|
||||
if(loggingEnabled)
|
||||
NSLog(@"added %@ to request queue", requestId);
|
||||
[queuedRequests addObject:requestId];
|
||||
@ -221,31 +218,31 @@ static bool loggingEnabled = true;
|
||||
}
|
||||
|
||||
+(void) configureCacheReachibilityForHost:(NSString*)host {
|
||||
[[SWGApiClient sharedClientFromPool:host].reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
|
||||
[[{{classPrefix}}ApiClient sharedClientFromPool:host].reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
|
||||
reachabilityStatus = status;
|
||||
switch (status) {
|
||||
case AFNetworkReachabilityStatusUnknown:
|
||||
if(loggingEnabled)
|
||||
NSLog(@"reachability changed to AFNetworkReachabilityStatusUnknown");
|
||||
[SWGApiClient setOfflineState:true];
|
||||
[{{classPrefix}}ApiClient setOfflineState:true];
|
||||
break;
|
||||
|
||||
case AFNetworkReachabilityStatusNotReachable:
|
||||
if(loggingEnabled)
|
||||
NSLog(@"reachability changed to AFNetworkReachabilityStatusNotReachable");
|
||||
[SWGApiClient setOfflineState:true];
|
||||
[{{classPrefix}}ApiClient setOfflineState:true];
|
||||
break;
|
||||
|
||||
case AFNetworkReachabilityStatusReachableViaWWAN:
|
||||
if(loggingEnabled)
|
||||
NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWWAN");
|
||||
[SWGApiClient setOfflineState:false];
|
||||
[{{classPrefix}}ApiClient setOfflineState:false];
|
||||
break;
|
||||
|
||||
case AFNetworkReachabilityStatusReachableViaWiFi:
|
||||
if(loggingEnabled)
|
||||
NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWiFi");
|
||||
[SWGApiClient setOfflineState:false];
|
||||
[{{classPrefix}}ApiClient setOfflineState:false];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -255,7 +252,7 @@ static bool loggingEnabled = true;
|
||||
reachabilityChangeBlock(status);
|
||||
}
|
||||
}];
|
||||
[[SWGApiClient sharedClientFromPool:host].reachabilityManager startMonitoring];
|
||||
[[{{classPrefix}}ApiClient sharedClientFromPool:host].reachabilityManager startMonitoring];
|
||||
}
|
||||
|
||||
-(NSString*) pathWithQueryParamsToString:(NSString*) path
|
||||
@ -272,32 +269,32 @@ static bool loggingEnabled = true;
|
||||
id queryParam = [queryParams valueForKey:key];
|
||||
if([queryParam isKindOfClass:[NSString class]]){
|
||||
[requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator,
|
||||
[SWGApiClient escape:key], [SWGApiClient escape:[queryParams valueForKey:key]]]];
|
||||
[{{classPrefix}}ApiClient escape:key], [{{classPrefix}}ApiClient escape:[queryParams valueForKey:key]]]];
|
||||
}
|
||||
else if([queryParam isKindOfClass:[SWGQueryParamCollection class]]){
|
||||
SWGQueryParamCollection * coll = (SWGQueryParamCollection*) queryParam;
|
||||
else if([queryParam isKindOfClass:[{{classPrefix}}QueryParamCollection class]]){
|
||||
{{classPrefix}}QueryParamCollection * coll = ({{classPrefix}}QueryParamCollection*) queryParam;
|
||||
NSArray* values = [coll values];
|
||||
NSString* format = [coll format];
|
||||
|
||||
if([format isEqualToString:@"csv"]) {
|
||||
[requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator,
|
||||
[SWGApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@","]]]];
|
||||
[{{classPrefix}}ApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@","]]]];
|
||||
|
||||
}
|
||||
else if([format isEqualToString:@"tsv"]) {
|
||||
[requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator,
|
||||
[SWGApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@"\t"]]]];
|
||||
[{{classPrefix}}ApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@"\t"]]]];
|
||||
|
||||
}
|
||||
else if([format isEqualToString:@"pipes"]) {
|
||||
[requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator,
|
||||
[SWGApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@"|"]]]];
|
||||
[{{classPrefix}}ApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@"|"]]]];
|
||||
|
||||
}
|
||||
else if([format isEqualToString:@"multi"]) {
|
||||
for(id obj in values) {
|
||||
[requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator,
|
||||
[SWGApiClient escape:key], [NSString stringWithFormat:@"%@", obj]]];
|
||||
[{{classPrefix}}ApiClient escape:key], [NSString stringWithFormat:@"%@", obj]]];
|
||||
counter += 1;
|
||||
}
|
||||
|
||||
@ -305,7 +302,7 @@ static bool loggingEnabled = true;
|
||||
}
|
||||
else {
|
||||
[requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator,
|
||||
[SWGApiClient escape:key], [NSString stringWithFormat:@"%@", [queryParams valueForKey:key]]]];
|
||||
[{{classPrefix}}ApiClient escape:key], [NSString stringWithFormat:@"%@", [queryParams valueForKey:key]]]];
|
||||
}
|
||||
|
||||
counter += 1;
|
||||
@ -333,7 +330,7 @@ static bool loggingEnabled = true;
|
||||
NSMutableDictionary *headersWithAuth = [NSMutableDictionary dictionaryWithDictionary:*headers];
|
||||
NSMutableDictionary *querysWithAuth = [NSMutableDictionary dictionaryWithDictionary:*querys];
|
||||
|
||||
SWGConfiguration *config = [SWGConfiguration sharedConfig];
|
||||
{{classPrefix}}Configuration *config = [{{classPrefix}}Configuration sharedConfig];
|
||||
for (NSString *auth in authSettings) {
|
||||
NSDictionary *authSetting = [[config authSettings] objectForKey:auth];
|
||||
|
||||
@ -486,7 +483,7 @@ static bool loggingEnabled = true;
|
||||
completionBlock: (void (^)(id, NSError *))completionBlock {
|
||||
// setting request serializer
|
||||
if ([requestContentType isEqualToString:@"application/json"]) {
|
||||
self.requestSerializer = [SWGJSONRequestSerializer serializer];
|
||||
self.requestSerializer = [{{classPrefix}}JSONRequestSerializer serializer];
|
||||
}
|
||||
else if ([requestContentType isEqualToString:@"application/x-www-form-urlencoded"]) {
|
||||
self.requestSerializer = [AFHTTPRequestSerializer serializer];
|
||||
@ -500,7 +497,7 @@ static bool loggingEnabled = true;
|
||||
|
||||
// setting response serializer
|
||||
if ([responseContentType isEqualToString:@"application/json"]) {
|
||||
self.responseSerializer = [SWGJSONResponseSerializer serializer];
|
||||
self.responseSerializer = [{{classPrefix}}JSONResponseSerializer serializer];
|
||||
}
|
||||
else {
|
||||
self.responseSerializer = [AFHTTPResponseSerializer serializer];
|
||||
@ -511,11 +508,11 @@ static bool loggingEnabled = true;
|
||||
|
||||
NSMutableURLRequest * request = nil;
|
||||
if (body != nil && [body isKindOfClass:[NSArray class]]){
|
||||
SWGFile * file;
|
||||
{{classPrefix}}File * file;
|
||||
NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
|
||||
for(id obj in body) {
|
||||
if([obj isKindOfClass:[SWGFile class]]) {
|
||||
file = (SWGFile*) obj;
|
||||
if([obj isKindOfClass:[{{classPrefix}}File class]]) {
|
||||
file = ({{classPrefix}}File*) obj;
|
||||
requestContentType = @"multipart/form-data";
|
||||
}
|
||||
else if([obj isKindOfClass:[NSDictionary class]]) {
|
||||
@ -598,7 +595,7 @@ static bool loggingEnabled = true;
|
||||
// Always disable cookies!
|
||||
[request setHTTPShouldHandleCookies:NO];
|
||||
|
||||
NSNumber* requestId = [SWGApiClient queueRequest];
|
||||
NSNumber* requestId = [{{classPrefix}}ApiClient queueRequest];
|
||||
AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request
|
||||
success:^(AFHTTPRequestOperation *operation, id response) {
|
||||
if([self executeRequestWithId:requestId]) {
|
||||
@ -612,7 +609,7 @@ static bool loggingEnabled = true;
|
||||
NSMutableDictionary *userInfo = [error.userInfo mutableCopy];
|
||||
if(operation.responseObject) {
|
||||
// Add in the (parsed) response body.
|
||||
userInfo[SWGResponseObjectErrorKey] = operation.responseObject;
|
||||
userInfo[{{classPrefix}}ResponseObjectErrorKey] = operation.responseObject;
|
||||
}
|
||||
NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo];
|
||||
|
||||
|
@ -1,8 +1,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <ISO8601/ISO8601.h>
|
||||
#import "AFHTTPRequestOperationManager.h"
|
||||
#import "SWGJSONResponseSerializer.h"
|
||||
#import "SWGJSONRequestSerializer.h"
|
||||
#import <AFNetworking/AFHTTPRequestOperationManager.h>
|
||||
#import "{{classPrefix}}JSONResponseSerializer.h"
|
||||
#import "{{classPrefix}}JSONRequestSerializer.h"
|
||||
#import "{{classPrefix}}File.h"
|
||||
#import "{{classPrefix}}QueryParamCollection.h"
|
||||
#import "{{classPrefix}}Configuration.h"
|
||||
|
||||
|
||||
{{#models}}{{#model}}#import "{{classname}}.h"
|
||||
{{/model}}{{/models}}
|
||||
@ -12,10 +16,10 @@
|
||||
*
|
||||
* The corresponding value is the parsed response body for an HTTP error.
|
||||
*/
|
||||
extern NSString *const SWGResponseObjectErrorKey;
|
||||
extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
||||
|
||||
|
||||
@interface SWGApiClient : AFHTTPRequestOperationManager
|
||||
@interface {{classPrefix}}ApiClient : AFHTTPRequestOperationManager
|
||||
|
||||
@property(nonatomic, assign) NSURLRequestCachePolicy cachePolicy;
|
||||
@property(nonatomic, assign) NSTimeInterval timeoutInterval;
|
||||
@ -31,9 +35,9 @@ extern NSString *const SWGResponseObjectErrorKey;
|
||||
*
|
||||
* @param baseUrl The base url of api client.
|
||||
*
|
||||
* @return The SWGApiClient instance.
|
||||
* @return The {{classPrefix}}ApiClient instance.
|
||||
*/
|
||||
+(SWGApiClient *)sharedClientFromPool:(NSString *)baseUrl;
|
||||
+({{classPrefix}}ApiClient *)sharedClientFromPool:(NSString *)baseUrl;
|
||||
|
||||
/**
|
||||
* Get the operations queue
|
||||
@ -122,7 +126,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
||||
/**
|
||||
* Set the client reachability strategy
|
||||
*
|
||||
* @param host The host of SWGApiClient.
|
||||
* @param host The host of {{classPrefix}}ApiClient.
|
||||
*/
|
||||
+(void) configureCacheReachibilityForHost:(NSString*)host;
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
#import "SWGConfiguration.h"
|
||||
#import "{{classPrefix}}Configuration.h"
|
||||
|
||||
@interface SWGConfiguration ()
|
||||
@interface {{classPrefix}}Configuration ()
|
||||
|
||||
@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableApiKey;
|
||||
@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableApiKeyPrefix;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SWGConfiguration
|
||||
@implementation {{classPrefix}}Configuration
|
||||
|
||||
#pragma mark - Singletion Methods
|
||||
|
||||
+ (instancetype) sharedConfig {
|
||||
static SWGConfiguration *shardConfig = nil;
|
||||
static {{classPrefix}}Configuration *shardConfig = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
shardConfig = [[self alloc] init];
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SWGConfiguration : NSObject
|
||||
@interface {{classPrefix}}Configuration : NSObject
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import "SWGFile.h"
|
||||
#import "{{classPrefix}}File.h"
|
||||
|
||||
@implementation SWGFile
|
||||
@implementation {{classPrefix}}File
|
||||
|
||||
@synthesize name = _name;
|
||||
@synthesize mimeType = _mimeType;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SWGFile : NSObject
|
||||
@interface {{classPrefix}}File : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSString* name;
|
||||
@property(nonatomic, readonly) NSString* mimeType;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import "SWGJSONRequestSerializer.h"
|
||||
#import "{{classPrefix}}JSONRequestSerializer.h"
|
||||
|
||||
@implementation SWGJSONRequestSerializer
|
||||
@implementation {{classPrefix}}JSONRequestSerializer
|
||||
|
||||
///
|
||||
/// When customize a request serializer,
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AFNetworking/AFURLRequestSerialization.h>
|
||||
|
||||
@interface SWGJSONRequestSerializer : AFJSONRequestSerializer
|
||||
@interface {{classPrefix}}JSONRequestSerializer : AFJSONRequestSerializer
|
||||
@end
|
||||
|
@ -1,4 +1,4 @@
|
||||
#import "SWGJSONResponseSerializer.h"
|
||||
#import "{{classPrefix}}JSONResponseSerializer.h"
|
||||
|
||||
static BOOL JSONParseError(NSError *error) {
|
||||
if ([error.domain isEqualToString:NSCocoaErrorDomain] && error.code == 3840) {
|
||||
@ -8,7 +8,7 @@ static BOOL JSONParseError(NSError *error) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
@implementation SWGJSONResponseSerializer
|
||||
@implementation {{classPrefix}}JSONResponseSerializer
|
||||
|
||||
///
|
||||
/// When customize a response serializer,
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AFNetworking/AFURLResponseSerialization.h>
|
||||
|
||||
@interface SWGJSONResponseSerializer : AFJSONResponseSerializer
|
||||
@interface {{classPrefix}}JSONResponseSerializer : AFJSONResponseSerializer
|
||||
|
||||
@end
|
||||
|
@ -1,4 +1,4 @@
|
||||
#import "SWGObject.h"
|
||||
#import "{{classPrefix}}Object.h"
|
||||
|
||||
@implementation SWGObject
|
||||
@implementation {{classPrefix}}Object
|
||||
@end
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "JSONModel.h"
|
||||
|
||||
@interface SWGObject : JSONModel
|
||||
@interface {{classPrefix}}Object : JSONModel
|
||||
@end
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import "SWGQueryParamCollection.h"
|
||||
#import "{{classPrefix}}QueryParamCollection.h"
|
||||
|
||||
@implementation SWGQueryParamCollection
|
||||
@implementation {{classPrefix}}QueryParamCollection
|
||||
|
||||
@synthesize values = _values;
|
||||
@synthesize format = _format;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SWGQueryParamCollection : NSObject
|
||||
@interface {{classPrefix}}QueryParamCollection : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSArray* values;
|
||||
@property(nonatomic, readonly) NSString* format;
|
||||
|
@ -69,7 +69,7 @@ static NSString * basePath = @"{{basePath}}";
|
||||
}
|
||||
|
||||
-(unsigned long) requestQueueSize {
|
||||
return [SWGApiClient requestQueueSize];
|
||||
return [{{classPrefix}}ApiClient requestQueueSize];
|
||||
}
|
||||
|
||||
#pragma mark - Api Methods
|
||||
@ -106,7 +106,7 @@ static NSString * basePath = @"{{basePath}}";
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
{{#queryParams}}if({{paramName}} != nil) {
|
||||
{{#collectionFormat}}
|
||||
queryParams[@"{{baseName}}"] = [[SWGQueryParamCollection alloc] initWithValuesAndFormat: {{baseName}} format: @"{{collectionFormat}}"];
|
||||
queryParams[@"{{baseName}}"] = [[{{classPrefix}}QueryParamCollection alloc] initWithValuesAndFormat: {{baseName}} format: @"{{collectionFormat}}"];
|
||||
{{/collectionFormat}}
|
||||
{{^collectionFormat}}queryParams[@"{{baseName}}"] = {{paramName}};{{/collectionFormat}}
|
||||
}
|
||||
@ -118,7 +118,7 @@ static NSString * basePath = @"{{basePath}}";
|
||||
{{/headerParams}}
|
||||
|
||||
// HTTP header `Accept`
|
||||
headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[{{#produces}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}}]];
|
||||
headerParams[@"Accept"] = [{{classPrefix}}ApiClient selectHeaderAccept:@[{{#produces}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}}]];
|
||||
if ([headerParams[@"Accept"] length] == 0) {
|
||||
[headerParams removeObjectForKey:@"Accept"];
|
||||
}
|
||||
@ -133,7 +133,7 @@ static NSString * basePath = @"{{basePath}}";
|
||||
}
|
||||
|
||||
// request content type
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[{{#consumes}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}]];
|
||||
NSString *requestContentType = [{{classPrefix}}ApiClient selectHeaderContentType:@[{{#consumes}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[{{#authMethods}}@"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}}];
|
||||
@ -146,7 +146,7 @@ static NSString * basePath = @"{{basePath}}";
|
||||
NSMutableArray *objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)bodyParam) {
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
[objs addObject:[({{classPrefix}}Object*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
@ -155,7 +155,7 @@ static NSString * basePath = @"{{basePath}}";
|
||||
bodyParam = objs;
|
||||
}
|
||||
else if([bodyParam respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyParam = [(SWGObject*)bodyParam toDictionary];
|
||||
bodyParam = [({{classPrefix}}Object*)bodyParam toDictionary];
|
||||
}
|
||||
{{/bodyParam}}
|
||||
{{^bodyParam}}
|
||||
|
@ -1,16 +1,16 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
{{#imports}}#import "{{import}}.h"
|
||||
{{/imports}}
|
||||
#import "SWGObject.h"
|
||||
#import "SWGApiClient.h"
|
||||
#import "{{classPrefix}}Object.h"
|
||||
#import "{{classPrefix}}ApiClient.h"
|
||||
{{newline}}
|
||||
|
||||
{{#operations}}
|
||||
@interface {{classname}}: NSObject
|
||||
|
||||
@property(nonatomic, assign)SWGApiClient *apiClient;
|
||||
@property(nonatomic, assign){{classPrefix}}ApiClient *apiClient;
|
||||
|
||||
-(instancetype) initWithApiClient:(SWGApiClient *)apiClient;
|
||||
-(instancetype) initWithApiClient:({{classPrefix}}ApiClient *)apiClient;
|
||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||
-(unsigned long) requestQueueSize;
|
||||
+({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SWGObject.h"
|
||||
#import "{{classPrefix}}Object.h"
|
||||
{{#imports}}#import "{{import}}.h"
|
||||
{{/imports}}
|
||||
{{newline}}
|
||||
@ -9,7 +9,7 @@
|
||||
@protocol {{classname}}
|
||||
@end
|
||||
|
||||
@interface {{classname}} : SWGObject
|
||||
@interface {{classname}} : {{classPrefix}}Object
|
||||
|
||||
{{#vars}}
|
||||
{{#description}}/* {{{description}}} {{^required}}[optional]{{/required}}
|
||||
|
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2015 geekerzp <geekerzp@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
@ -1,8 +1,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <ISO8601/ISO8601.h>
|
||||
#import "AFHTTPRequestOperationManager.h"
|
||||
#import <AFNetworking/AFHTTPRequestOperationManager.h>
|
||||
#import "SWGJSONResponseSerializer.h"
|
||||
#import "SWGJSONRequestSerializer.h"
|
||||
#import "SWGFile.h"
|
||||
#import "SWGQueryParamCollection.h"
|
||||
#import "SWGConfiguration.h"
|
||||
|
||||
|
||||
#import "SWGUser.h"
|
||||
#import "SWGCategory.h"
|
||||
|
@ -1,7 +1,4 @@
|
||||
#import "SWGApiClient.h"
|
||||
#import "SWGFile.h"
|
||||
#import "SWGQueryParamCollection.h"
|
||||
#import "SWGConfiguration.h"
|
||||
|
||||
@implementation SWGApiClient
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SWGObject.h"
|
||||
#import "SwaggerClient.SWGTag.h"
|
||||
#import "SwaggerClient.SWGCategory.h"
|
||||
#import "SWGTag.h"
|
||||
#import "SWGCategory.h"
|
||||
|
||||
|
||||
@protocol SWGPet
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SwaggerClient.SWGPet.h"
|
||||
#import "SwaggerClient.SWGFile.h"
|
||||
#import "SWGPet.h"
|
||||
#import "SWGFile.h"
|
||||
#import "SWGObject.h"
|
||||
#import "SWGApiClient.h"
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#import "SWGPetApi.h"
|
||||
#import "SWGFile.h"
|
||||
#import "SWGQueryParamCollection.h"
|
||||
#import "SwaggerClient.SWGPet.h"
|
||||
#import "SwaggerClient.SWGFile.h"
|
||||
#import "SWGPet.h"
|
||||
#import "SWGFile.h"
|
||||
|
||||
|
||||
@interface SWGPetApi ()
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SwaggerClient.SWGOrder.h"
|
||||
#import "SWGOrder.h"
|
||||
#import "SWGObject.h"
|
||||
#import "SWGApiClient.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#import "SWGStoreApi.h"
|
||||
#import "SWGFile.h"
|
||||
#import "SWGQueryParamCollection.h"
|
||||
#import "SwaggerClient.SWGOrder.h"
|
||||
#import "SWGOrder.h"
|
||||
|
||||
|
||||
@interface SWGStoreApi ()
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SwaggerClient.SWGUser.h"
|
||||
#import "SWGUser.h"
|
||||
#import "SWGObject.h"
|
||||
#import "SWGApiClient.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#import "SWGUserApi.h"
|
||||
#import "SWGFile.h"
|
||||
#import "SWGQueryParamCollection.h"
|
||||
#import "SwaggerClient.SWGUser.h"
|
||||
#import "SWGUser.h"
|
||||
|
||||
|
||||
@interface SWGUserApi ()
|
||||
|
@ -40,7 +40,6 @@
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
06B47F8BDBE73A9C03BFBEA2 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
|
||||
1A81C3BE3E54961CD827EAE3 /* Pods-SwaggerClient_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
4CCE21315897B7D544C83242 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
|
||||
56767C6E86DE2B2855ABF7B2 /* Pods_SwaggerClient_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwaggerClient_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@ -189,7 +188,6 @@
|
||||
children = (
|
||||
E9675D953C6DCDE71A1BDFD4 /* SwaggerClient.podspec */,
|
||||
4CCE21315897B7D544C83242 /* README.md */,
|
||||
06B47F8BDBE73A9C03BFBEA2 /* LICENSE */,
|
||||
);
|
||||
name = "Podspec Metadata";
|
||||
sourceTree = "<group>";
|
||||
|
@ -51,7 +51,7 @@
|
||||
<argument>-workspace</argument>
|
||||
<argument>SwaggerClient.xcworkspace</argument>
|
||||
<argument>-scheme</argument>
|
||||
<argument>SwaggerClient</argument>
|
||||
<argument>SwaggerClient-Example</argument>
|
||||
<argument>test</argument>
|
||||
<argument>-destination</argument>
|
||||
<argument>platform=iOS Simulator,name=iPhone 6,OS=8.3</argument>
|
Loading…
x
Reference in New Issue
Block a user