forked from loafle/openapi-generator-original
Merge remote-tracking branch 'upstream/master' into cli-enhancements-2
This commit is contained in:
commit
6c079e95d9
@ -137,11 +137,12 @@ public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String apiFileFolder() {
|
public String apiFileFolder() {
|
||||||
return (outputFolder + File.separator + sourceFolder + File.separator + apiPackage()).replace('.', File.separatorChar);
|
|
||||||
|
return outputFolder + File.separator + (sourceFolder + File.separator + apiPackage()).replace('.', File.separatorChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String modelFileFolder() {
|
public String modelFileFolder() {
|
||||||
return (outputFolder + File.separator + sourceFolder + File.separator + modelPackage()).replace('.', File.separatorChar);
|
return outputFolder + File.separator + (sourceFolder + File.separator + modelPackage()).replace('.', File.separatorChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,6 +23,10 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
protected String podName = "SwaggerClient";
|
protected String podName = "SwaggerClient";
|
||||||
protected String podVersion = "1.0.0";
|
protected String podVersion = "1.0.0";
|
||||||
protected String classPrefix = "SWG";
|
protected String classPrefix = "SWG";
|
||||||
|
protected String authorName = "Swagger";
|
||||||
|
protected String authorEmail = "apiteam@swagger.io";
|
||||||
|
protected String license = "MIT";
|
||||||
|
protected String gitRepoURL = "https://github.com/swagger-api/swagger-codegen";
|
||||||
|
|
||||||
public ObjcClientCodegen() {
|
public ObjcClientCodegen() {
|
||||||
super();
|
super();
|
||||||
@ -112,6 +116,10 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
cliOptions.add(new CliOption("classPrefix", "prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`), default: `SWG`"));
|
cliOptions.add(new CliOption("classPrefix", "prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`), default: `SWG`"));
|
||||||
cliOptions.add(new CliOption("podName", "cocoapods package name (convention: CameCase), default: `SwaggerClient`"));
|
cliOptions.add(new CliOption("podName", "cocoapods package name (convention: CameCase), default: `SwaggerClient`"));
|
||||||
cliOptions.add(new CliOption("podVersion", "cocoapods package version, default: `1.0.0`"));
|
cliOptions.add(new CliOption("podVersion", "cocoapods package version, default: `1.0.0`"));
|
||||||
|
cliOptions.add(new CliOption("authorName", "Name to use in the podspec file, default: `Swagger`"));
|
||||||
|
cliOptions.add(new CliOption("authorEmail", "Email to use in the podspec file, default: `apiteam@swagger.io`"));
|
||||||
|
cliOptions.add(new CliOption("gitRepoURL", "URL for the git repo where this podspec should point to, default: `https://github.com/swagger-api/swagger-codegen`"));
|
||||||
|
cliOptions.add(new CliOption("license", "License to use in the podspec file, default: `MIT`"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CodegenType getTag() {
|
public CodegenType getTag() {
|
||||||
@ -142,9 +150,29 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
setClassPrefix((String) additionalProperties.get("classPrefix"));
|
setClassPrefix((String) additionalProperties.get("classPrefix"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("authorName")) {
|
||||||
|
setAuthorName((String) additionalProperties.get("authorName"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("authorEmail")) {
|
||||||
|
setAuthorEmail((String) additionalProperties.get("authorEmail"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("gitRepoURL")) {
|
||||||
|
setGitRepoURL((String) additionalProperties.get("gitRepoURL"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("license")) {
|
||||||
|
setLicense((String) additionalProperties.get("license"));
|
||||||
|
}
|
||||||
|
|
||||||
additionalProperties.put("podName", podName);
|
additionalProperties.put("podName", podName);
|
||||||
additionalProperties.put("podVersion", podVersion);
|
additionalProperties.put("podVersion", podVersion);
|
||||||
additionalProperties.put("classPrefix", classPrefix);
|
additionalProperties.put("classPrefix", classPrefix);
|
||||||
|
additionalProperties.put("authorName", authorName);
|
||||||
|
additionalProperties.put("authorEmail", authorEmail);
|
||||||
|
additionalProperties.put("gitRepoURL", gitRepoURL);
|
||||||
|
additionalProperties.put("license", license);
|
||||||
|
|
||||||
String swaggerFolder = podName;
|
String swaggerFolder = podName;
|
||||||
|
|
||||||
@ -384,4 +412,20 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
public void setPodVersion(String podVersion) {
|
public void setPodVersion(String podVersion) {
|
||||||
this.podVersion = podVersion;
|
this.podVersion = podVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAuthorEmail(String authorEmail) {
|
||||||
|
this.authorEmail = authorEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthorName(String authorName) {
|
||||||
|
this.authorName = authorName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGitRepoURL(String gitRepoURL) {
|
||||||
|
this.gitRepoURL = gitRepoURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicense(String license) {
|
||||||
|
this.license = license;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,13 @@ static bool cacheEnabled = false;
|
|||||||
static AFNetworkReachabilityStatus reachabilityStatus = AFNetworkReachabilityStatusNotReachable;
|
static AFNetworkReachabilityStatus reachabilityStatus = AFNetworkReachabilityStatusNotReachable;
|
||||||
static void (^reachabilityChangeBlock)(int);
|
static void (^reachabilityChangeBlock)(int);
|
||||||
|
|
||||||
|
|
||||||
|
@interface {{classPrefix}}ApiClient ()
|
||||||
|
|
||||||
|
@property (readwrite, nonatomic) NSDictionary *HTTPResponseHeaders;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation {{classPrefix}}ApiClient
|
@implementation {{classPrefix}}ApiClient
|
||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
@ -385,6 +392,8 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
if([[{{classPrefix}}Configuration sharedConfig] debug]) {
|
if([[{{classPrefix}}Configuration sharedConfig] debug]) {
|
||||||
[self logResponse:operation forRequest:request error:nil];
|
[self logResponse:operation forRequest:request error:nil];
|
||||||
}
|
}
|
||||||
|
NSDictionary *responseHeaders = [[operation response] allHeaderFields];
|
||||||
|
self.HTTPResponseHeaders = responseHeaders;
|
||||||
completionBlock(response, nil);
|
completionBlock(response, nil);
|
||||||
}
|
}
|
||||||
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
||||||
@ -398,6 +407,10 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
|
|
||||||
if([[{{classPrefix}}Configuration sharedConfig] debug])
|
if([[{{classPrefix}}Configuration sharedConfig] debug])
|
||||||
[self logResponse:nil forRequest:request error:augmentedError];
|
[self logResponse:nil forRequest:request error:augmentedError];
|
||||||
|
|
||||||
|
NSDictionary *responseHeaders = [[operation response] allHeaderFields];
|
||||||
|
self.HTTPResponseHeaders = responseHeaders;
|
||||||
|
|
||||||
completionBlock(nil, augmentedError);
|
completionBlock(nil, augmentedError);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
@ -441,6 +454,7 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
NSURL *file = [NSURL fileURLWithPath:filepath];
|
NSURL *file = [NSURL fileURLWithPath:filepath];
|
||||||
|
|
||||||
[operation.responseData writeToURL:file atomically:YES];
|
[operation.responseData writeToURL:file atomically:YES];
|
||||||
|
self.HTTPResponseHeaders = headers;
|
||||||
completionBlock(file, nil);
|
completionBlock(file, nil);
|
||||||
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
||||||
|
|
||||||
@ -455,7 +469,8 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
if ([[{{classPrefix}}Configuration sharedConfig] debug]) {
|
if ([[{{classPrefix}}Configuration sharedConfig] debug]) {
|
||||||
[self logResponse:nil forRequest:request error:augmentedError];
|
[self logResponse:nil forRequest:request error:augmentedError];
|
||||||
}
|
}
|
||||||
|
NSDictionary *responseHeaders = [[operation response] allHeaderFields];
|
||||||
|
self.HTTPResponseHeaders = responseHeaders;
|
||||||
completionBlock(nil, augmentedError);
|
completionBlock(nil, augmentedError);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
@ -31,6 +31,9 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
@property(nonatomic, assign) NSTimeInterval timeoutInterval;
|
@property(nonatomic, assign) NSTimeInterval timeoutInterval;
|
||||||
@property(nonatomic, readonly) NSOperationQueue* queue;
|
@property(nonatomic, readonly) NSOperationQueue* queue;
|
||||||
|
|
||||||
|
/// In order to ensure the HTTPResponseHeaders are correct, it is recommended to initialize one {{classPrefix}}ApiClient instance per thread.
|
||||||
|
@property(nonatomic, readonly) NSDictionary* HTTPResponseHeaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears Cache
|
* Clears Cache
|
||||||
*/
|
*/
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
@implementation {{classname}}
|
@implementation {{classname}}
|
||||||
|
|
||||||
|
static {{classname}}* singletonAPI = nil;
|
||||||
|
|
||||||
#pragma mark - Initialize methods
|
#pragma mark - Initialize methods
|
||||||
|
|
||||||
- (id) init {
|
- (id) init {
|
||||||
@ -38,7 +40,6 @@
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
+({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
|
+({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
|
||||||
static {{classname}}* singletonAPI = nil;
|
|
||||||
|
|
||||||
if (singletonAPI == nil) {
|
if (singletonAPI == nil) {
|
||||||
singletonAPI = [[{{classname}} alloc] init];
|
singletonAPI = [[{{classname}} alloc] init];
|
||||||
@ -47,6 +48,14 @@
|
|||||||
return singletonAPI;
|
return singletonAPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+({{classname}}*) sharedAPI {
|
||||||
|
|
||||||
|
if (singletonAPI == nil) {
|
||||||
|
singletonAPI = [[{{classname}} alloc] init];
|
||||||
|
}
|
||||||
|
return singletonAPI;
|
||||||
|
}
|
||||||
|
|
||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key {
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key {
|
||||||
[self.defaultHeaders setValue:value forKey:key];
|
[self.defaultHeaders setValue:value forKey:key];
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||||
-(unsigned long) requestQueueSize;
|
-(unsigned long) requestQueueSize;
|
||||||
+({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
+({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
||||||
|
+({{classname}}*) sharedAPI;
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
@ -21,6 +21,11 @@ Pod::Spec.new do |s|
|
|||||||
|
|
||||||
s.framework = 'SystemConfiguration'
|
s.framework = 'SystemConfiguration'
|
||||||
|
|
||||||
|
s.homepage = "{{gitRepoURL}}"
|
||||||
|
s.license = "{{license}}"
|
||||||
|
s.source = { :git => "{{gitRepoURL}}.git", :tag => "#{s.version}" }
|
||||||
|
s.author = { "{{authorName}}" => "{{authorEmail}}" }
|
||||||
|
|
||||||
s.source_files = '{{podName}}/**/*'
|
s.source_files = '{{podName}}/**/*'
|
||||||
s.public_header_files = '{{podName}}/**/*.h'
|
s.public_header_files = '{{podName}}/**/*.h'
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ class ApiClient(object):
|
|||||||
if klass in [int, float, str, bool]:
|
if klass in [int, float, str, bool]:
|
||||||
return self.__deserialize_primitive(data, klass)
|
return self.__deserialize_primitive(data, klass)
|
||||||
elif klass == object:
|
elif klass == object:
|
||||||
return self.__deserialize_object()
|
return self.__deserialize_object(data)
|
||||||
elif klass == date:
|
elif klass == date:
|
||||||
return self.__deserialize_date(data)
|
return self.__deserialize_date(data)
|
||||||
elif klass == datetime:
|
elif klass == datetime:
|
||||||
@ -495,13 +495,13 @@ class ApiClient(object):
|
|||||||
value = data
|
value = data
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def __deserialize_object(self):
|
def __deserialize_object(self, value):
|
||||||
"""
|
"""
|
||||||
Deserializes empty object.
|
Return a original value.
|
||||||
|
|
||||||
:return: object.
|
:return: object.
|
||||||
"""
|
"""
|
||||||
return object()
|
return value
|
||||||
|
|
||||||
def __deserialize_date(self, string):
|
def __deserialize_date(self, string):
|
||||||
"""
|
"""
|
||||||
|
@ -12,6 +12,10 @@ To install it, put the API client library in your project and then simply add th
|
|||||||
pod "SwaggerClient", :path => "/path/to/lib"
|
pod "SwaggerClient", :path => "/path/to/lib"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
|
||||||
|
It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issue.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
apiteam@swagger.io
|
apiteam@swagger.io
|
||||||
|
@ -35,6 +35,9 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
@property(nonatomic, assign) NSTimeInterval timeoutInterval;
|
@property(nonatomic, assign) NSTimeInterval timeoutInterval;
|
||||||
@property(nonatomic, readonly) NSOperationQueue* queue;
|
@property(nonatomic, readonly) NSOperationQueue* queue;
|
||||||
|
|
||||||
|
/// In order to ensure the HTTPResponseHeaders are correct, it is recommended to initialize one SWGApiClient instance per thread.
|
||||||
|
@property(nonatomic, readonly) NSDictionary* HTTPResponseHeaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears Cache
|
* Clears Cache
|
||||||
*/
|
*/
|
||||||
|
@ -9,6 +9,13 @@ static bool cacheEnabled = false;
|
|||||||
static AFNetworkReachabilityStatus reachabilityStatus = AFNetworkReachabilityStatusNotReachable;
|
static AFNetworkReachabilityStatus reachabilityStatus = AFNetworkReachabilityStatusNotReachable;
|
||||||
static void (^reachabilityChangeBlock)(int);
|
static void (^reachabilityChangeBlock)(int);
|
||||||
|
|
||||||
|
|
||||||
|
@interface SWGApiClient ()
|
||||||
|
|
||||||
|
@property (readwrite, nonatomic) NSDictionary *HTTPResponseHeaders;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation SWGApiClient
|
@implementation SWGApiClient
|
||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
@ -385,6 +392,8 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
if([[SWGConfiguration sharedConfig] debug]) {
|
if([[SWGConfiguration sharedConfig] debug]) {
|
||||||
[self logResponse:operation forRequest:request error:nil];
|
[self logResponse:operation forRequest:request error:nil];
|
||||||
}
|
}
|
||||||
|
NSDictionary *responseHeaders = [[operation response] allHeaderFields];
|
||||||
|
self.HTTPResponseHeaders = responseHeaders;
|
||||||
completionBlock(response, nil);
|
completionBlock(response, nil);
|
||||||
}
|
}
|
||||||
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
||||||
@ -398,6 +407,10 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
|
|
||||||
if([[SWGConfiguration sharedConfig] debug])
|
if([[SWGConfiguration sharedConfig] debug])
|
||||||
[self logResponse:nil forRequest:request error:augmentedError];
|
[self logResponse:nil forRequest:request error:augmentedError];
|
||||||
|
|
||||||
|
NSDictionary *responseHeaders = [[operation response] allHeaderFields];
|
||||||
|
self.HTTPResponseHeaders = responseHeaders;
|
||||||
|
|
||||||
completionBlock(nil, augmentedError);
|
completionBlock(nil, augmentedError);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
@ -441,6 +454,7 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
NSURL *file = [NSURL fileURLWithPath:filepath];
|
NSURL *file = [NSURL fileURLWithPath:filepath];
|
||||||
|
|
||||||
[operation.responseData writeToURL:file atomically:YES];
|
[operation.responseData writeToURL:file atomically:YES];
|
||||||
|
self.HTTPResponseHeaders = headers;
|
||||||
completionBlock(file, nil);
|
completionBlock(file, nil);
|
||||||
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
||||||
|
|
||||||
@ -455,7 +469,8 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
if ([[SWGConfiguration sharedConfig] debug]) {
|
if ([[SWGConfiguration sharedConfig] debug]) {
|
||||||
[self logResponse:nil forRequest:request error:augmentedError];
|
[self logResponse:nil forRequest:request error:augmentedError];
|
||||||
}
|
}
|
||||||
|
NSDictionary *responseHeaders = [[operation response] allHeaderFields];
|
||||||
|
self.HTTPResponseHeaders = responseHeaders;
|
||||||
completionBlock(nil, augmentedError);
|
completionBlock(nil, augmentedError);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||||
-(unsigned long) requestQueueSize;
|
-(unsigned long) requestQueueSize;
|
||||||
+(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
+(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
||||||
|
+(SWGPetApi*) sharedAPI;
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// Update an existing pet
|
/// Update an existing pet
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
@implementation SWGPetApi
|
@implementation SWGPetApi
|
||||||
|
|
||||||
|
static SWGPetApi* singletonAPI = nil;
|
||||||
|
|
||||||
#pragma mark - Initialize methods
|
#pragma mark - Initialize methods
|
||||||
|
|
||||||
- (id) init {
|
- (id) init {
|
||||||
@ -36,7 +38,6 @@
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
+(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
|
+(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
|
||||||
static SWGPetApi* singletonAPI = nil;
|
|
||||||
|
|
||||||
if (singletonAPI == nil) {
|
if (singletonAPI == nil) {
|
||||||
singletonAPI = [[SWGPetApi alloc] init];
|
singletonAPI = [[SWGPetApi alloc] init];
|
||||||
@ -45,6 +46,14 @@
|
|||||||
return singletonAPI;
|
return singletonAPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+(SWGPetApi*) sharedAPI {
|
||||||
|
|
||||||
|
if (singletonAPI == nil) {
|
||||||
|
singletonAPI = [[SWGPetApi alloc] init];
|
||||||
|
}
|
||||||
|
return singletonAPI;
|
||||||
|
}
|
||||||
|
|
||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key {
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key {
|
||||||
[self.defaultHeaders setValue:value forKey:key];
|
[self.defaultHeaders setValue:value forKey:key];
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||||
-(unsigned long) requestQueueSize;
|
-(unsigned long) requestQueueSize;
|
||||||
+(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
+(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
||||||
|
+(SWGStoreApi*) sharedAPI;
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// Returns pet inventories by status
|
/// Returns pet inventories by status
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
@implementation SWGStoreApi
|
@implementation SWGStoreApi
|
||||||
|
|
||||||
|
static SWGStoreApi* singletonAPI = nil;
|
||||||
|
|
||||||
#pragma mark - Initialize methods
|
#pragma mark - Initialize methods
|
||||||
|
|
||||||
- (id) init {
|
- (id) init {
|
||||||
@ -36,7 +38,6 @@
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
+(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
|
+(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
|
||||||
static SWGStoreApi* singletonAPI = nil;
|
|
||||||
|
|
||||||
if (singletonAPI == nil) {
|
if (singletonAPI == nil) {
|
||||||
singletonAPI = [[SWGStoreApi alloc] init];
|
singletonAPI = [[SWGStoreApi alloc] init];
|
||||||
@ -45,6 +46,14 @@
|
|||||||
return singletonAPI;
|
return singletonAPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+(SWGStoreApi*) sharedAPI {
|
||||||
|
|
||||||
|
if (singletonAPI == nil) {
|
||||||
|
singletonAPI = [[SWGStoreApi alloc] init];
|
||||||
|
}
|
||||||
|
return singletonAPI;
|
||||||
|
}
|
||||||
|
|
||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key {
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key {
|
||||||
[self.defaultHeaders setValue:value forKey:key];
|
[self.defaultHeaders setValue:value forKey:key];
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||||
-(unsigned long) requestQueueSize;
|
-(unsigned long) requestQueueSize;
|
||||||
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
||||||
|
+(SWGUserApi*) sharedAPI;
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// Create user
|
/// Create user
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
@implementation SWGUserApi
|
@implementation SWGUserApi
|
||||||
|
|
||||||
|
static SWGUserApi* singletonAPI = nil;
|
||||||
|
|
||||||
#pragma mark - Initialize methods
|
#pragma mark - Initialize methods
|
||||||
|
|
||||||
- (id) init {
|
- (id) init {
|
||||||
@ -36,7 +38,6 @@
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
|
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
|
||||||
static SWGUserApi* singletonAPI = nil;
|
|
||||||
|
|
||||||
if (singletonAPI == nil) {
|
if (singletonAPI == nil) {
|
||||||
singletonAPI = [[SWGUserApi alloc] init];
|
singletonAPI = [[SWGUserApi alloc] init];
|
||||||
@ -45,6 +46,14 @@
|
|||||||
return singletonAPI;
|
return singletonAPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+(SWGUserApi*) sharedAPI {
|
||||||
|
|
||||||
|
if (singletonAPI == nil) {
|
||||||
|
singletonAPI = [[SWGUserApi alloc] init];
|
||||||
|
}
|
||||||
|
return singletonAPI;
|
||||||
|
}
|
||||||
|
|
||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key {
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key {
|
||||||
[self.defaultHeaders setValue:value forKey:key];
|
[self.defaultHeaders setValue:value forKey:key];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user