mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 22:20:56 +00:00
Merge pull request #998 from geekerzp/objc-date
[Objc] Enhancements of objective-c client
This commit is contained in:
commit
31200acc1a
@ -57,7 +57,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
typeMapping.clear();
|
typeMapping.clear();
|
||||||
typeMapping.put("enum", "NSString");
|
typeMapping.put("enum", "NSString");
|
||||||
typeMapping.put("Date", "NSDate");
|
typeMapping.put("date", "NSDate");
|
||||||
typeMapping.put("DateTime", "NSDate");
|
typeMapping.put("DateTime", "NSDate");
|
||||||
typeMapping.put("boolean", "NSNumber");
|
typeMapping.put("boolean", "NSNumber");
|
||||||
typeMapping.put("string", "NSString");
|
typeMapping.put("string", "NSString");
|
||||||
|
@ -5,9 +5,14 @@
|
|||||||
#import "{{classPrefix}}JSONRequestSerializer.h"
|
#import "{{classPrefix}}JSONRequestSerializer.h"
|
||||||
#import "{{classPrefix}}QueryParamCollection.h"
|
#import "{{classPrefix}}QueryParamCollection.h"
|
||||||
#import "{{classPrefix}}Configuration.h"
|
#import "{{classPrefix}}Configuration.h"
|
||||||
|
|
||||||
|
|
||||||
{{#models}}{{#model}}#import "{{classname}}.h"
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
{{#models}}{{#model}}#import "{{classname}}.h"
|
||||||
{{/model}}{{/models}}
|
{{/model}}{{/models}}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +30,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
@property(nonatomic, readonly) NSOperationQueue* queue;
|
@property(nonatomic, readonly) NSOperationQueue* queue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Api Client instance from pool
|
* Gets the Api Client instance from pool
|
||||||
*
|
*
|
||||||
* @param baseUrl The base url of api client.
|
* @param baseUrl The base url of api client.
|
||||||
*
|
*
|
||||||
@ -34,68 +39,68 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
+({{classPrefix}}ApiClient *)sharedClientFromPool:(NSString *)baseUrl;
|
+({{classPrefix}}ApiClient *)sharedClientFromPool:(NSString *)baseUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the operations queue
|
* Gets the operations queue
|
||||||
*
|
*
|
||||||
* @return The `shardQueue` static variable.
|
* @return The `shardQueue` static variable.
|
||||||
*/
|
*/
|
||||||
+(NSOperationQueue*) sharedQueue;
|
+(NSOperationQueue*) sharedQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear Cache
|
* Clears Cache
|
||||||
*/
|
*/
|
||||||
+(void)clearCache;
|
+(void)clearCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn on cache
|
* Turns on cache
|
||||||
*
|
*
|
||||||
* @param enabled If the cached is enable, must be `YES` or `NO`
|
* @param enabled If the cached is enable, must be `YES` or `NO`
|
||||||
*/
|
*/
|
||||||
+(void)setCacheEnabled:(BOOL) enabled;
|
+(void)setCacheEnabled:(BOOL) enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the request queue size
|
* Gets the request queue size
|
||||||
*
|
*
|
||||||
* @return The size of `queuedRequests` static variable.
|
* @return The size of `queuedRequests` static variable.
|
||||||
*/
|
*/
|
||||||
+(unsigned long)requestQueueSize;
|
+(unsigned long)requestQueueSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the client unreachable
|
* Sets the client unreachable
|
||||||
*
|
*
|
||||||
* @param state off line state, must be `YES` or `NO`
|
* @param state off line state, must be `YES` or `NO`
|
||||||
*/
|
*/
|
||||||
+(void) setOfflineState:(BOOL) state;
|
+(void) setOfflineState:(BOOL) state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the client reachability
|
* Gets the client reachability
|
||||||
*
|
*
|
||||||
* @return The client reachability.
|
* @return The client reachability.
|
||||||
*/
|
*/
|
||||||
+(AFNetworkReachabilityStatus) getReachabilityStatus;
|
+(AFNetworkReachabilityStatus) getReachabilityStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next request id
|
* Gets the next request id
|
||||||
*
|
*
|
||||||
* @return The next executed request id.
|
* @return The next executed request id.
|
||||||
*/
|
*/
|
||||||
+(NSNumber*) nextRequestId;
|
+(NSNumber*) nextRequestId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate request id and add it to the queue
|
* Generates request id and add it to the queue
|
||||||
*
|
*
|
||||||
* @return The next executed request id.
|
* @return The next executed request id.
|
||||||
*/
|
*/
|
||||||
+(NSNumber*) queueRequest;
|
+(NSNumber*) queueRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove request id from the queue
|
* Removes request id from the queue
|
||||||
*
|
*
|
||||||
* @param requestId The request which will be removed.
|
* @param requestId The request which will be removed.
|
||||||
*/
|
*/
|
||||||
+(void) cancelRequest:(NSNumber*)requestId;
|
+(void) cancelRequest:(NSNumber*)requestId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL encode NSString
|
* Gets URL encoded NSString
|
||||||
*
|
*
|
||||||
* @param unescaped The string which will be escaped.
|
* @param unescaped The string which will be escaped.
|
||||||
*
|
*
|
||||||
@ -104,21 +109,21 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
+(NSString*) escape:(id)unescaped;
|
+(NSString*) escape:(id)unescaped;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customize the behavior when the reachability changed
|
* Customizes the behavior when the reachability changed
|
||||||
*
|
*
|
||||||
* @param changeBlock The block will be executed when the reachability changed.
|
* @param changeBlock The block will be executed when the reachability changed.
|
||||||
*/
|
*/
|
||||||
+(void) setReachabilityChangeBlock:(void(^)(int))changeBlock;
|
+(void) setReachabilityChangeBlock:(void(^)(int))changeBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the client reachability strategy
|
* Sets the client reachability strategy
|
||||||
*
|
*
|
||||||
* @param host The host of {{classPrefix}}ApiClient.
|
* @param host The host of {{classPrefix}}ApiClient.
|
||||||
*/
|
*/
|
||||||
+(void) configureCacheReachibilityForHost:(NSString*)host;
|
+(void) configureCacheReachibilityForHost:(NSString*)host;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect Accept header from accepts NSArray
|
* Detects Accept header from accepts NSArray
|
||||||
*
|
*
|
||||||
* @param accepts NSArray of header
|
* @param accepts NSArray of header
|
||||||
*
|
*
|
||||||
@ -127,7 +132,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
+(NSString *) selectHeaderAccept:(NSArray *)accepts;
|
+(NSString *) selectHeaderAccept:(NSArray *)accepts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect Content-Type header from contentTypes NSArray
|
* Detects Content-Type header from contentTypes NSArray
|
||||||
*
|
*
|
||||||
* @param contentTypes NSArray of header
|
* @param contentTypes NSArray of header
|
||||||
*
|
*
|
||||||
@ -136,7 +141,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
+(NSString *) selectHeaderContentType:(NSArray *)contentTypes;
|
+(NSString *) selectHeaderContentType:(NSArray *)contentTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set header for request
|
* Sets header for request
|
||||||
*
|
*
|
||||||
* @param value The header value
|
* @param value The header value
|
||||||
* @param forKey The header key
|
* @param forKey The header key
|
||||||
@ -145,7 +150,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
forKey:(NSString*) forKey;
|
forKey:(NSString*) forKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update header parameters and query parameters for authentication
|
* Updates header parameters and query parameters for authentication
|
||||||
*
|
*
|
||||||
* @param headers The header parameter will be udpated, passed by pointer to pointer.
|
* @param headers The header parameter will be udpated, passed by pointer to pointer.
|
||||||
* @param querys The query parameters will be updated, passed by pointer to pointer.
|
* @param querys The query parameters will be updated, passed by pointer to pointer.
|
||||||
@ -156,7 +161,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
WithAuthSettings:(NSArray *)authSettings;
|
WithAuthSettings:(NSArray *)authSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize the given data to Objective-C object.
|
* Deserializes the given data to Objective-C object.
|
||||||
*
|
*
|
||||||
* @param data The data will be deserialized.
|
* @param data The data will be deserialized.
|
||||||
* @param class The type of objective-c object.
|
* @param class The type of objective-c object.
|
||||||
@ -164,7 +169,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
- (id) deserialize:(id) data class:(NSString *) class;
|
- (id) deserialize:(id) data class:(NSString *) class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logging request and response
|
* Logs request and response
|
||||||
*
|
*
|
||||||
* @param operation AFHTTPRequestOperation for the HTTP request.
|
* @param operation AFHTTPRequestOperation for the HTTP request.
|
||||||
* @param request The HTTP request.
|
* @param request The HTTP request.
|
||||||
@ -175,7 +180,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
error:(NSError *)error;
|
error:(NSError *)error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform request
|
* Performs request
|
||||||
*
|
*
|
||||||
* @param path Request url.
|
* @param path Request url.
|
||||||
* @param method Request method.
|
* @param method Request method.
|
||||||
@ -185,7 +190,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
* @param authSettings Request authentication names.
|
* @param authSettings Request authentication names.
|
||||||
* @param requestContentType Request content-type.
|
* @param requestContentType Request content-type.
|
||||||
* @param responseContentType Response content-type.
|
* @param responseContentType Response content-type.
|
||||||
* @param completionBlock The block will be executed when the request completed.
|
* @param completionBlock The block will be executed when the request completed.
|
||||||
*
|
*
|
||||||
* @return The request id.
|
* @return The request id.
|
||||||
*/
|
*/
|
||||||
|
@ -60,12 +60,20 @@
|
|||||||
|
|
||||||
#pragma mark - Setter Methods
|
#pragma mark - Setter Methods
|
||||||
|
|
||||||
- (void) setValue:(NSString *)value forApiKeyField:(NSString *)field {
|
- (void) setApiKey:(NSString *)apiKey forApiKeyIdentifier:(NSString *)identifier {
|
||||||
[self.mutableApiKey setValue:value forKey:field];
|
[self.mutableApiKey setValue:apiKey forKey:identifier];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setValue:(NSString *)value forApiKeyPrefixField:(NSString *)field {
|
- (void) removeApiKey:(NSString *)identifier {
|
||||||
[self.mutableApiKeyPrefix setValue:value forKey:field];
|
[self.mutableApiKey removeObjectForKey:identifier];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier {
|
||||||
|
[self.mutableApiKeyPrefix setValue:prefix forKey:identifier];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) removeApiKeyPrefix:(NSString *)identifier {
|
||||||
|
[self.mutableApiKeyPrefix removeObjectForKey:identifier];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setLoggingFile:(NSString *)loggingFile {
|
- (void) setLoggingFile:(NSString *)loggingFile {
|
||||||
@ -75,10 +83,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
_loggingFile = loggingFile;
|
_loggingFile = loggingFile;
|
||||||
self.loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile];
|
_loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile];
|
||||||
if (self.loggingFileHanlder == nil) {
|
if (_loggingFileHanlder == nil) {
|
||||||
[[NSFileManager defaultManager] createFileAtPath:_loggingFile contents:nil attributes:nil];
|
[[NSFileManager defaultManager] createFileAtPath:_loggingFile contents:nil attributes:nil];
|
||||||
self.loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile];
|
_loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,26 +1,36 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
/** The `{{classPrefix}}Configuration` class manages the configurations for the sdk.
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
@interface {{classPrefix}}Configuration : NSObject
|
@interface {{classPrefix}}Configuration : NSObject
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Api key values for Api Key type Authentication
|
* Api key values for Api Key type Authentication
|
||||||
*
|
*
|
||||||
* To add or remove api key, use `setValue:forApiKeyField:`.
|
* To add or remove api key, use `setApiKey:forApiKeyIdentifier:`.
|
||||||
*/
|
*/
|
||||||
@property (readonly, nonatomic, strong) NSDictionary *apiKey;
|
@property (readonly, nonatomic, strong) NSDictionary *apiKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Api key prefix values to be prepend to the respective api key
|
* Api key prefix values to be prepend to the respective api key
|
||||||
*
|
*
|
||||||
* To add or remove prefix, use `setValue:forApiKeyPrefixField:`.
|
* To add or remove prefix, use `setApiKeyPrefix:forApiKeyPrefixIdentifier:`.
|
||||||
*/
|
*/
|
||||||
@property (readonly, nonatomic, strong) NSDictionary *apiKeyPrefix;
|
@property (readonly, nonatomic, strong) NSDictionary *apiKeyPrefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usename and Password for Basic type Authentication
|
* Usename for HTTP Basic Authentication
|
||||||
|
*/
|
||||||
|
@property (nonatomic) NSString *username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Password for HTTP Basic Authentication
|
||||||
*/
|
*/
|
||||||
@property (nonatomic) NSString *username;
|
|
||||||
@property (nonatomic) NSString *password;
|
@property (nonatomic) NSString *password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,37 +41,74 @@
|
|||||||
/**
|
/**
|
||||||
* Logging Settings
|
* Logging Settings
|
||||||
*/
|
*/
|
||||||
@property (nonatomic) BOOL debug;
|
|
||||||
@property (nonatomic) NSString *loggingFile;
|
|
||||||
@property (nonatomic) NSFileHandle *loggingFileHanlder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get configuration singleton instance
|
* Debug switch, default false
|
||||||
|
*/
|
||||||
|
@property (nonatomic) BOOL debug;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debug file location, default log in console
|
||||||
|
*/
|
||||||
|
@property (nonatomic) NSString *loggingFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log file handler, this property is used by sdk internally.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, readonly) NSFileHandle *loggingFileHanlder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets configuration singleton instance
|
||||||
*/
|
*/
|
||||||
+ (instancetype) sharedConfig;
|
+ (instancetype) sharedConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets field in `apiKey`
|
* Sets API key
|
||||||
|
*
|
||||||
|
* To remove a apiKey for an identifier, just set the apiKey to nil.
|
||||||
|
*
|
||||||
|
* @param apiKey API key or token.
|
||||||
|
* @param identifier API key identifier (authentication schema).
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
- (void) setValue:(NSString *)value forApiKeyField:(NSString*)field;
|
- (void) setApiKey:(NSString *)apiKey forApiKeyIdentifier:(NSString*)identifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets field in `apiKeyPrefix`
|
* Removes api key
|
||||||
|
*
|
||||||
|
* @param identifier API key identifier.
|
||||||
*/
|
*/
|
||||||
- (void) setValue:(NSString *)value forApiKeyPrefixField:(NSString *)field;
|
- (void) removeApiKey:(NSString *)identifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get API key (with prefix if set)
|
* Sets the prefix for API key
|
||||||
|
*
|
||||||
|
* To remove a apiKeyPrefix for an identifier, just set the apiKeyPrefix to nil.
|
||||||
|
*
|
||||||
|
* @param apiKeyPrefix API key prefix.
|
||||||
|
* @param identifier API key identifier.
|
||||||
|
*/
|
||||||
|
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes api key prefix
|
||||||
|
*
|
||||||
|
* @param identifier API key identifier.
|
||||||
|
*/
|
||||||
|
- (void) removeApiKeyPrefix:(NSString *)identifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets API key (with prefix if set)
|
||||||
*/
|
*/
|
||||||
- (NSString *) getApiKeyWithPrefix:(NSString *) key;
|
- (NSString *) getApiKeyWithPrefix:(NSString *) key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Basic Auth token
|
* Gets Basic Auth token
|
||||||
*/
|
*/
|
||||||
- (NSString *) getBasicAuthToken;
|
- (NSString *) getBasicAuthToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Authentication Setings
|
* Gets Authentication Setings
|
||||||
*/
|
*/
|
||||||
- (NSDictionary *) authSettings;
|
- (NSDictionary *) authSettings;
|
||||||
|
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
#import "{{classPrefix}}ApiClient.h"
|
#import "{{classPrefix}}ApiClient.h"
|
||||||
{{newline}}
|
{{newline}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
@interface {{classname}}: NSObject
|
@interface {{classname}}: NSObject
|
||||||
|
|
||||||
|
@ -3,12 +3,21 @@
|
|||||||
#import "{{classname}}.h"
|
#import "{{classname}}.h"
|
||||||
|
|
||||||
@implementation {{classname}}
|
@implementation {{classname}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maps json key to property name.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (JSONKeyMapper *)keyMapper
|
+ (JSONKeyMapper *)keyMapper
|
||||||
{
|
{
|
||||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ {{#vars}}@"{{baseName}}": @"{{name}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }];
|
return [[JSONKeyMapper alloc] initWithDictionary:@{ {{#vars}}@"{{baseName}}": @"{{name}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the property with the given name is optional.
|
||||||
|
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||||
{
|
{
|
||||||
NSArray *optionalProperties = @[{{#vars}}{{^required}}@"{{name}}"{{#hasMore}}, {{/hasMore}}{{/required}}{{/vars}}];
|
NSArray *optionalProperties = @[{{#vars}}{{^required}}@"{{name}}"{{#hasMore}}, {{/hasMore}}{{/required}}{{/vars}}];
|
||||||
@ -21,6 +30,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string presentation of the object.
|
||||||
|
* This method will be called when logging model object using `NSLog`.
|
||||||
|
*/
|
||||||
|
- (NSString *)description {
|
||||||
|
return [[self toDictionary] description];
|
||||||
|
}
|
||||||
|
|
||||||
{{/model}}
|
{{/model}}
|
||||||
@end
|
@end
|
||||||
{{/models}}
|
{{/models}}
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "{{classPrefix}}Object.h"
|
#import "{{classPrefix}}Object.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
{{#imports}}#import "{{import}}.h"
|
{{#imports}}#import "{{import}}.h"
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
{{newline}}
|
{{newline}}
|
||||||
@ -8,7 +15,7 @@
|
|||||||
|
|
||||||
@protocol {{classname}}
|
@protocol {{classname}}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface {{classname}} : {{classPrefix}}Object
|
@interface {{classname}} : {{classPrefix}}Object
|
||||||
|
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
|
@ -5,13 +5,18 @@
|
|||||||
#import "SWGJSONRequestSerializer.h"
|
#import "SWGJSONRequestSerializer.h"
|
||||||
#import "SWGQueryParamCollection.h"
|
#import "SWGQueryParamCollection.h"
|
||||||
#import "SWGConfiguration.h"
|
#import "SWGConfiguration.h"
|
||||||
|
|
||||||
|
|
||||||
#import "SWGUser.h"
|
/**
|
||||||
#import "SWGCategory.h"
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
#import "SWGPet.h"
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
#import "SWGTag.h"
|
* Do not edit the class manually.
|
||||||
#import "SWGOrder.h"
|
*/
|
||||||
|
|
||||||
|
#import "SWGUser.h"
|
||||||
|
#import "SWGCategory.h"
|
||||||
|
#import "SWGPet.h"
|
||||||
|
#import "SWGTag.h"
|
||||||
|
#import "SWGOrder.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,7 +34,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
@property(nonatomic, readonly) NSOperationQueue* queue;
|
@property(nonatomic, readonly) NSOperationQueue* queue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Api Client instance from pool
|
* Gets the Api Client instance from pool
|
||||||
*
|
*
|
||||||
* @param baseUrl The base url of api client.
|
* @param baseUrl The base url of api client.
|
||||||
*
|
*
|
||||||
@ -38,68 +43,68 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
+(SWGApiClient *)sharedClientFromPool:(NSString *)baseUrl;
|
+(SWGApiClient *)sharedClientFromPool:(NSString *)baseUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the operations queue
|
* Gets the operations queue
|
||||||
*
|
*
|
||||||
* @return The `shardQueue` static variable.
|
* @return The `shardQueue` static variable.
|
||||||
*/
|
*/
|
||||||
+(NSOperationQueue*) sharedQueue;
|
+(NSOperationQueue*) sharedQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear Cache
|
* Clears Cache
|
||||||
*/
|
*/
|
||||||
+(void)clearCache;
|
+(void)clearCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn on cache
|
* Turns on cache
|
||||||
*
|
*
|
||||||
* @param enabled If the cached is enable, must be `YES` or `NO`
|
* @param enabled If the cached is enable, must be `YES` or `NO`
|
||||||
*/
|
*/
|
||||||
+(void)setCacheEnabled:(BOOL) enabled;
|
+(void)setCacheEnabled:(BOOL) enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the request queue size
|
* Gets the request queue size
|
||||||
*
|
*
|
||||||
* @return The size of `queuedRequests` static variable.
|
* @return The size of `queuedRequests` static variable.
|
||||||
*/
|
*/
|
||||||
+(unsigned long)requestQueueSize;
|
+(unsigned long)requestQueueSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the client unreachable
|
* Sets the client unreachable
|
||||||
*
|
*
|
||||||
* @param state off line state, must be `YES` or `NO`
|
* @param state off line state, must be `YES` or `NO`
|
||||||
*/
|
*/
|
||||||
+(void) setOfflineState:(BOOL) state;
|
+(void) setOfflineState:(BOOL) state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the client reachability
|
* Gets the client reachability
|
||||||
*
|
*
|
||||||
* @return The client reachability.
|
* @return The client reachability.
|
||||||
*/
|
*/
|
||||||
+(AFNetworkReachabilityStatus) getReachabilityStatus;
|
+(AFNetworkReachabilityStatus) getReachabilityStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next request id
|
* Gets the next request id
|
||||||
*
|
*
|
||||||
* @return The next executed request id.
|
* @return The next executed request id.
|
||||||
*/
|
*/
|
||||||
+(NSNumber*) nextRequestId;
|
+(NSNumber*) nextRequestId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate request id and add it to the queue
|
* Generates request id and add it to the queue
|
||||||
*
|
*
|
||||||
* @return The next executed request id.
|
* @return The next executed request id.
|
||||||
*/
|
*/
|
||||||
+(NSNumber*) queueRequest;
|
+(NSNumber*) queueRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove request id from the queue
|
* Removes request id from the queue
|
||||||
*
|
*
|
||||||
* @param requestId The request which will be removed.
|
* @param requestId The request which will be removed.
|
||||||
*/
|
*/
|
||||||
+(void) cancelRequest:(NSNumber*)requestId;
|
+(void) cancelRequest:(NSNumber*)requestId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL encode NSString
|
* Gets URL encoded NSString
|
||||||
*
|
*
|
||||||
* @param unescaped The string which will be escaped.
|
* @param unescaped The string which will be escaped.
|
||||||
*
|
*
|
||||||
@ -108,21 +113,21 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
+(NSString*) escape:(id)unescaped;
|
+(NSString*) escape:(id)unescaped;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customize the behavior when the reachability changed
|
* Customizes the behavior when the reachability changed
|
||||||
*
|
*
|
||||||
* @param changeBlock The block will be executed when the reachability changed.
|
* @param changeBlock The block will be executed when the reachability changed.
|
||||||
*/
|
*/
|
||||||
+(void) setReachabilityChangeBlock:(void(^)(int))changeBlock;
|
+(void) setReachabilityChangeBlock:(void(^)(int))changeBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the client reachability strategy
|
* Sets the client reachability strategy
|
||||||
*
|
*
|
||||||
* @param host The host of SWGApiClient.
|
* @param host The host of SWGApiClient.
|
||||||
*/
|
*/
|
||||||
+(void) configureCacheReachibilityForHost:(NSString*)host;
|
+(void) configureCacheReachibilityForHost:(NSString*)host;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect Accept header from accepts NSArray
|
* Detects Accept header from accepts NSArray
|
||||||
*
|
*
|
||||||
* @param accepts NSArray of header
|
* @param accepts NSArray of header
|
||||||
*
|
*
|
||||||
@ -131,7 +136,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
+(NSString *) selectHeaderAccept:(NSArray *)accepts;
|
+(NSString *) selectHeaderAccept:(NSArray *)accepts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect Content-Type header from contentTypes NSArray
|
* Detects Content-Type header from contentTypes NSArray
|
||||||
*
|
*
|
||||||
* @param contentTypes NSArray of header
|
* @param contentTypes NSArray of header
|
||||||
*
|
*
|
||||||
@ -140,7 +145,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
+(NSString *) selectHeaderContentType:(NSArray *)contentTypes;
|
+(NSString *) selectHeaderContentType:(NSArray *)contentTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set header for request
|
* Sets header for request
|
||||||
*
|
*
|
||||||
* @param value The header value
|
* @param value The header value
|
||||||
* @param forKey The header key
|
* @param forKey The header key
|
||||||
@ -149,7 +154,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
forKey:(NSString*) forKey;
|
forKey:(NSString*) forKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update header parameters and query parameters for authentication
|
* Updates header parameters and query parameters for authentication
|
||||||
*
|
*
|
||||||
* @param headers The header parameter will be udpated, passed by pointer to pointer.
|
* @param headers The header parameter will be udpated, passed by pointer to pointer.
|
||||||
* @param querys The query parameters will be updated, passed by pointer to pointer.
|
* @param querys The query parameters will be updated, passed by pointer to pointer.
|
||||||
@ -160,7 +165,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
WithAuthSettings:(NSArray *)authSettings;
|
WithAuthSettings:(NSArray *)authSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize the given data to Objective-C object.
|
* Deserializes the given data to Objective-C object.
|
||||||
*
|
*
|
||||||
* @param data The data will be deserialized.
|
* @param data The data will be deserialized.
|
||||||
* @param class The type of objective-c object.
|
* @param class The type of objective-c object.
|
||||||
@ -168,7 +173,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
- (id) deserialize:(id) data class:(NSString *) class;
|
- (id) deserialize:(id) data class:(NSString *) class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logging request and response
|
* Logs request and response
|
||||||
*
|
*
|
||||||
* @param operation AFHTTPRequestOperation for the HTTP request.
|
* @param operation AFHTTPRequestOperation for the HTTP request.
|
||||||
* @param request The HTTP request.
|
* @param request The HTTP request.
|
||||||
@ -179,7 +184,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
error:(NSError *)error;
|
error:(NSError *)error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform request
|
* Performs request
|
||||||
*
|
*
|
||||||
* @param path Request url.
|
* @param path Request url.
|
||||||
* @param method Request method.
|
* @param method Request method.
|
||||||
@ -189,7 +194,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
* @param authSettings Request authentication names.
|
* @param authSettings Request authentication names.
|
||||||
* @param requestContentType Request content-type.
|
* @param requestContentType Request content-type.
|
||||||
* @param responseContentType Response content-type.
|
* @param responseContentType Response content-type.
|
||||||
* @param completionBlock The block will be executed when the request completed.
|
* @param completionBlock The block will be executed when the request completed.
|
||||||
*
|
*
|
||||||
* @return The request id.
|
* @return The request id.
|
||||||
*/
|
*/
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SWGObject.h"
|
#import "SWGObject.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@protocol SWGCategory
|
@protocol SWGCategory
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SWGCategory : SWGObject
|
@interface SWGCategory : SWGObject
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
#import "SWGCategory.h"
|
#import "SWGCategory.h"
|
||||||
|
|
||||||
@implementation SWGCategory
|
@implementation SWGCategory
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maps json key to property name.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (JSONKeyMapper *)keyMapper
|
+ (JSONKeyMapper *)keyMapper
|
||||||
{
|
{
|
||||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the property with the given name is optional.
|
||||||
|
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||||
{
|
{
|
||||||
NSArray *optionalProperties = @[@"_id", @"name"];
|
NSArray *optionalProperties = @[@"_id", @"name"];
|
||||||
@ -19,4 +28,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string presentation of the object.
|
||||||
|
* This method will be called when logging model object using `NSLog`.
|
||||||
|
*/
|
||||||
|
- (NSString *)description {
|
||||||
|
return [[self toDictionary] description];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1,26 +1,36 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
/** The `SWGConfiguration` class manages the configurations for the sdk.
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
@interface SWGConfiguration : NSObject
|
@interface SWGConfiguration : NSObject
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Api key values for Api Key type Authentication
|
* Api key values for Api Key type Authentication
|
||||||
*
|
*
|
||||||
* To add or remove api key, use `setValue:forApiKeyField:`.
|
* To add or remove api key, use `setApiKey:forApiKeyIdentifier:`.
|
||||||
*/
|
*/
|
||||||
@property (readonly, nonatomic, strong) NSDictionary *apiKey;
|
@property (readonly, nonatomic, strong) NSDictionary *apiKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Api key prefix values to be prepend to the respective api key
|
* Api key prefix values to be prepend to the respective api key
|
||||||
*
|
*
|
||||||
* To add or remove prefix, use `setValue:forApiKeyPrefixField:`.
|
* To add or remove prefix, use `setApiKeyPrefix:forApiKeyPrefixIdentifier:`.
|
||||||
*/
|
*/
|
||||||
@property (readonly, nonatomic, strong) NSDictionary *apiKeyPrefix;
|
@property (readonly, nonatomic, strong) NSDictionary *apiKeyPrefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usename and Password for Basic type Authentication
|
* Usename for HTTP Basic Authentication
|
||||||
|
*/
|
||||||
|
@property (nonatomic) NSString *username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Password for HTTP Basic Authentication
|
||||||
*/
|
*/
|
||||||
@property (nonatomic) NSString *username;
|
|
||||||
@property (nonatomic) NSString *password;
|
@property (nonatomic) NSString *password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,37 +41,74 @@
|
|||||||
/**
|
/**
|
||||||
* Logging Settings
|
* Logging Settings
|
||||||
*/
|
*/
|
||||||
@property (nonatomic) BOOL debug;
|
|
||||||
@property (nonatomic) NSString *loggingFile;
|
|
||||||
@property (nonatomic) NSFileHandle *loggingFileHanlder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get configuration singleton instance
|
* Debug switch, default false
|
||||||
|
*/
|
||||||
|
@property (nonatomic) BOOL debug;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debug file location, default log in console
|
||||||
|
*/
|
||||||
|
@property (nonatomic) NSString *loggingFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log file handler, this property is used by sdk internally.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, readonly) NSFileHandle *loggingFileHanlder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets configuration singleton instance
|
||||||
*/
|
*/
|
||||||
+ (instancetype) sharedConfig;
|
+ (instancetype) sharedConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets field in `apiKey`
|
* Sets API key
|
||||||
|
*
|
||||||
|
* To remove a apiKey for an identifier, just set the apiKey to nil.
|
||||||
|
*
|
||||||
|
* @param apiKey API key or token.
|
||||||
|
* @param identifier API key identifier (authentication schema).
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
- (void) setValue:(NSString *)value forApiKeyField:(NSString*)field;
|
- (void) setApiKey:(NSString *)apiKey forApiKeyIdentifier:(NSString*)identifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets field in `apiKeyPrefix`
|
* Removes api key
|
||||||
|
*
|
||||||
|
* @param identifier API key identifier.
|
||||||
*/
|
*/
|
||||||
- (void) setValue:(NSString *)value forApiKeyPrefixField:(NSString *)field;
|
- (void) removeApiKey:(NSString *)identifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get API key (with prefix if set)
|
* Sets the prefix for API key
|
||||||
|
*
|
||||||
|
* To remove a apiKeyPrefix for an identifier, just set the apiKeyPrefix to nil.
|
||||||
|
*
|
||||||
|
* @param apiKeyPrefix API key prefix.
|
||||||
|
* @param identifier API key identifier.
|
||||||
|
*/
|
||||||
|
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes api key prefix
|
||||||
|
*
|
||||||
|
* @param identifier API key identifier.
|
||||||
|
*/
|
||||||
|
- (void) removeApiKeyPrefix:(NSString *)identifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets API key (with prefix if set)
|
||||||
*/
|
*/
|
||||||
- (NSString *) getApiKeyWithPrefix:(NSString *) key;
|
- (NSString *) getApiKeyWithPrefix:(NSString *) key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Basic Auth token
|
* Gets Basic Auth token
|
||||||
*/
|
*/
|
||||||
- (NSString *) getBasicAuthToken;
|
- (NSString *) getBasicAuthToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Authentication Setings
|
* Gets Authentication Setings
|
||||||
*/
|
*/
|
||||||
- (NSDictionary *) authSettings;
|
- (NSDictionary *) authSettings;
|
||||||
|
|
||||||
|
@ -60,12 +60,20 @@
|
|||||||
|
|
||||||
#pragma mark - Setter Methods
|
#pragma mark - Setter Methods
|
||||||
|
|
||||||
- (void) setValue:(NSString *)value forApiKeyField:(NSString *)field {
|
- (void) setApiKey:(NSString *)apiKey forApiKeyIdentifier:(NSString *)identifier {
|
||||||
[self.mutableApiKey setValue:value forKey:field];
|
[self.mutableApiKey setValue:apiKey forKey:identifier];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setValue:(NSString *)value forApiKeyPrefixField:(NSString *)field {
|
- (void) removeApiKey:(NSString *)identifier {
|
||||||
[self.mutableApiKeyPrefix setValue:value forKey:field];
|
[self.mutableApiKey removeObjectForKey:identifier];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier {
|
||||||
|
[self.mutableApiKeyPrefix setValue:prefix forKey:identifier];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) removeApiKeyPrefix:(NSString *)identifier {
|
||||||
|
[self.mutableApiKeyPrefix removeObjectForKey:identifier];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setLoggingFile:(NSString *)loggingFile {
|
- (void) setLoggingFile:(NSString *)loggingFile {
|
||||||
@ -75,10 +83,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
_loggingFile = loggingFile;
|
_loggingFile = loggingFile;
|
||||||
self.loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile];
|
_loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile];
|
||||||
if (self.loggingFileHanlder == nil) {
|
if (_loggingFileHanlder == nil) {
|
||||||
[[NSFileManager defaultManager] createFileAtPath:_loggingFile contents:nil attributes:nil];
|
[[NSFileManager defaultManager] createFileAtPath:_loggingFile contents:nil attributes:nil];
|
||||||
self.loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile];
|
_loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SWGObject.h"
|
#import "SWGObject.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@protocol SWGOrder
|
@protocol SWGOrder
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SWGOrder : SWGObject
|
@interface SWGOrder : SWGObject
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
#import "SWGOrder.h"
|
#import "SWGOrder.h"
|
||||||
|
|
||||||
@implementation SWGOrder
|
@implementation SWGOrder
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maps json key to property name.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (JSONKeyMapper *)keyMapper
|
+ (JSONKeyMapper *)keyMapper
|
||||||
{
|
{
|
||||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the property with the given name is optional.
|
||||||
|
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||||
{
|
{
|
||||||
NSArray *optionalProperties = @[@"_id", @"petId", @"quantity", @"shipDate", @"status", @"complete"];
|
NSArray *optionalProperties = @[@"_id", @"petId", @"quantity", @"shipDate", @"status", @"complete"];
|
||||||
@ -19,4 +28,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string presentation of the object.
|
||||||
|
* This method will be called when logging model object using `NSLog`.
|
||||||
|
*/
|
||||||
|
- (NSString *)description {
|
||||||
|
return [[self toDictionary] description];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SWGObject.h"
|
#import "SWGObject.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
#import "SWGTag.h"
|
#import "SWGTag.h"
|
||||||
#import "SWGCategory.h"
|
#import "SWGCategory.h"
|
||||||
|
|
||||||
|
|
||||||
@protocol SWGPet
|
@protocol SWGPet
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SWGPet : SWGObject
|
@interface SWGPet : SWGObject
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
#import "SWGPet.h"
|
#import "SWGPet.h"
|
||||||
|
|
||||||
@implementation SWGPet
|
@implementation SWGPet
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maps json key to property name.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (JSONKeyMapper *)keyMapper
|
+ (JSONKeyMapper *)keyMapper
|
||||||
{
|
{
|
||||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
|
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the property with the given name is optional.
|
||||||
|
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||||
{
|
{
|
||||||
NSArray *optionalProperties = @[@"_id", @"category", @"tags", @"status"];
|
NSArray *optionalProperties = @[@"_id", @"category", @"tags", @"status"];
|
||||||
@ -19,4 +28,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string presentation of the object.
|
||||||
|
* This method will be called when logging model object using `NSLog`.
|
||||||
|
*/
|
||||||
|
- (NSString *)description {
|
||||||
|
return [[self toDictionary] description];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
#import "SWGApiClient.h"
|
#import "SWGApiClient.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
@interface SWGPetApi: NSObject
|
@interface SWGPetApi: NSObject
|
||||||
|
|
||||||
@property(nonatomic, assign)SWGApiClient *apiClient;
|
@property(nonatomic, assign)SWGApiClient *apiClient;
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
#import "SWGApiClient.h"
|
#import "SWGApiClient.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
@interface SWGStoreApi: NSObject
|
@interface SWGStoreApi: NSObject
|
||||||
|
|
||||||
@property(nonatomic, assign)SWGApiClient *apiClient;
|
@property(nonatomic, assign)SWGApiClient *apiClient;
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SWGObject.h"
|
#import "SWGObject.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@protocol SWGTag
|
@protocol SWGTag
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SWGTag : SWGObject
|
@interface SWGTag : SWGObject
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
#import "SWGTag.h"
|
#import "SWGTag.h"
|
||||||
|
|
||||||
@implementation SWGTag
|
@implementation SWGTag
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maps json key to property name.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (JSONKeyMapper *)keyMapper
|
+ (JSONKeyMapper *)keyMapper
|
||||||
{
|
{
|
||||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the property with the given name is optional.
|
||||||
|
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||||
{
|
{
|
||||||
NSArray *optionalProperties = @[@"_id", @"name"];
|
NSArray *optionalProperties = @[@"_id", @"name"];
|
||||||
@ -19,4 +28,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string presentation of the object.
|
||||||
|
* This method will be called when logging model object using `NSLog`.
|
||||||
|
*/
|
||||||
|
- (NSString *)description {
|
||||||
|
return [[self toDictionary] description];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SWGObject.h"
|
#import "SWGObject.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@protocol SWGUser
|
@protocol SWGUser
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SWGUser : SWGObject
|
@interface SWGUser : SWGObject
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
#import "SWGUser.h"
|
#import "SWGUser.h"
|
||||||
|
|
||||||
@implementation SWGUser
|
@implementation SWGUser
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maps json key to property name.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (JSONKeyMapper *)keyMapper
|
+ (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] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the property with the given name is optional.
|
||||||
|
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
|
||||||
|
* This method is used by `JSONModel`.
|
||||||
|
*/
|
||||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||||
{
|
{
|
||||||
NSArray *optionalProperties = @[@"_id", @"username", @"firstName", @"lastName", @"email", @"password", @"phone", @"userStatus"];
|
NSArray *optionalProperties = @[@"_id", @"username", @"firstName", @"lastName", @"email", @"password", @"phone", @"userStatus"];
|
||||||
@ -19,4 +28,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string presentation of the object.
|
||||||
|
* This method will be called when logging model object using `NSLog`.
|
||||||
|
*/
|
||||||
|
- (NSString *)description {
|
||||||
|
return [[self toDictionary] description];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
#import "SWGApiClient.h"
|
#import "SWGApiClient.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
@interface SWGUserApi: NSObject
|
@interface SWGUserApi: NSObject
|
||||||
|
|
||||||
@property(nonatomic, assign)SWGApiClient *apiClient;
|
@property(nonatomic, assign)SWGApiClient *apiClient;
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
|
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
|
||||||
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
|
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
|
||||||
94BE6BE84795B5034A811E61 /* libPods-SwaggerClient_Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */; };
|
94BE6BE84795B5034A811E61 /* libPods-SwaggerClient_Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */; };
|
||||||
|
CF0ADB481B5F95D6008A2729 /* PetTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0ADB471B5F95D6008A2729 /* PetTest.m */; };
|
||||||
|
CF8F71391B5F73AC00162980 /* DeserializationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF8F71381B5F73AC00162980 /* DeserializationTest.m */; };
|
||||||
CFDFB4121B3CFFA8009739C5 /* UserApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40D1B3CFEC3009739C5 /* UserApiTest.m */; };
|
CFDFB4121B3CFFA8009739C5 /* UserApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40D1B3CFEC3009739C5 /* UserApiTest.m */; };
|
||||||
CFDFB4131B3CFFDD009739C5 /* PetApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40A1B3CFEC3009739C5 /* PetApiTest.m */; };
|
CFDFB4131B3CFFDD009739C5 /* PetApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40A1B3CFEC3009739C5 /* PetApiTest.m */; };
|
||||||
CFDFB4141B3CFFF6009739C5 /* StoreApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40B1B3CFEC3009739C5 /* StoreApiTest.m */; };
|
CFDFB4141B3CFFF6009739C5 /* StoreApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40B1B3CFEC3009739C5 /* StoreApiTest.m */; };
|
||||||
@ -65,6 +67,8 @@
|
|||||||
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
|
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
|
||||||
8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwaggerClient_Example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwaggerClient_Example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example.release.xcconfig"; sourceTree = "<group>"; };
|
BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
|
CF0ADB471B5F95D6008A2729 /* PetTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PetTest.m; sourceTree = "<group>"; };
|
||||||
|
CF8F71381B5F73AC00162980 /* DeserializationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeserializationTest.m; sourceTree = "<group>"; };
|
||||||
CFDFB40A1B3CFEC3009739C5 /* PetApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PetApiTest.m; sourceTree = "<group>"; };
|
CFDFB40A1B3CFEC3009739C5 /* PetApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PetApiTest.m; sourceTree = "<group>"; };
|
||||||
CFDFB40B1B3CFEC3009739C5 /* StoreApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StoreApiTest.m; sourceTree = "<group>"; };
|
CFDFB40B1B3CFEC3009739C5 /* StoreApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StoreApiTest.m; sourceTree = "<group>"; };
|
||||||
CFDFB40C1B3CFEC3009739C5 /* SWGApiClientTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGApiClientTest.m; sourceTree = "<group>"; };
|
CFDFB40C1B3CFEC3009739C5 /* SWGApiClientTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGApiClientTest.m; sourceTree = "<group>"; };
|
||||||
@ -166,6 +170,8 @@
|
|||||||
CFDFB40A1B3CFEC3009739C5 /* PetApiTest.m */,
|
CFDFB40A1B3CFEC3009739C5 /* PetApiTest.m */,
|
||||||
CFDFB40B1B3CFEC3009739C5 /* StoreApiTest.m */,
|
CFDFB40B1B3CFEC3009739C5 /* StoreApiTest.m */,
|
||||||
CFDFB40C1B3CFEC3009739C5 /* SWGApiClientTest.m */,
|
CFDFB40C1B3CFEC3009739C5 /* SWGApiClientTest.m */,
|
||||||
|
CF0ADB471B5F95D6008A2729 /* PetTest.m */,
|
||||||
|
CF8F71381B5F73AC00162980 /* DeserializationTest.m */,
|
||||||
CFDFB40D1B3CFEC3009739C5 /* UserApiTest.m */,
|
CFDFB40D1B3CFEC3009739C5 /* UserApiTest.m */,
|
||||||
6003F5BB195388D20070C39A /* Tests.m */,
|
6003F5BB195388D20070C39A /* Tests.m */,
|
||||||
6003F5B6195388D20070C39A /* Supporting Files */,
|
6003F5B6195388D20070C39A /* Supporting Files */,
|
||||||
@ -374,10 +380,12 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
CFDFB4141B3CFFF6009739C5 /* StoreApiTest.m in Sources */,
|
CFDFB4141B3CFFF6009739C5 /* StoreApiTest.m in Sources */,
|
||||||
|
CF0ADB481B5F95D6008A2729 /* PetTest.m in Sources */,
|
||||||
CFDFB4131B3CFFDD009739C5 /* PetApiTest.m in Sources */,
|
CFDFB4131B3CFFDD009739C5 /* PetApiTest.m in Sources */,
|
||||||
6003F5BC195388D20070C39A /* Tests.m in Sources */,
|
6003F5BC195388D20070C39A /* Tests.m in Sources */,
|
||||||
CFDFB4151B3D000B009739C5 /* SWGApiClientTest.m in Sources */,
|
CFDFB4151B3D000B009739C5 /* SWGApiClientTest.m in Sources */,
|
||||||
CFDFB4121B3CFFA8009739C5 /* UserApiTest.m in Sources */,
|
CFDFB4121B3CFFA8009739C5 /* UserApiTest.m in Sources */,
|
||||||
|
CF8F71391B5F73AC00162980 /* DeserializationTest.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "SWGViewController.h"
|
#import "SWGViewController.h"
|
||||||
|
#import <SwaggerClient/SWGPet.h>
|
||||||
|
#import <SwaggerClient/SWGConfiguration.h>
|
||||||
|
|
||||||
@interface SWGViewController ()
|
@interface SWGViewController ()
|
||||||
|
|
||||||
@ -17,13 +19,41 @@
|
|||||||
- (void)viewDidLoad
|
- (void)viewDidLoad
|
||||||
{
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
// Do any additional setup after loading the view, typically from a nib.
|
SWGConfiguration *config = [SWGConfiguration sharedConfig];
|
||||||
|
[config setApiKey:@"hello" forApiKeyIdentifier:@"world"];
|
||||||
|
[config setApiKey:@"geekerzp" forApiKeyIdentifier:@"zp"];
|
||||||
|
[config removeApiKey:@"zp"];
|
||||||
|
NSLog(@"%@", config.apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning
|
- (void)didReceiveMemoryWarning
|
||||||
{
|
{
|
||||||
[super didReceiveMemoryWarning];
|
[super didReceiveMemoryWarning];
|
||||||
// Dispose of any resources that can be recreated.
|
}
|
||||||
|
|
||||||
|
- (SWGPet*) createPet {
|
||||||
|
SWGPet * pet = [[SWGPet alloc] init];
|
||||||
|
pet._id = [[NSNumber alloc] initWithLong:[[NSDate date] timeIntervalSince1970]];
|
||||||
|
pet.name = @"monkey";
|
||||||
|
|
||||||
|
SWGCategory * category = [[SWGCategory alloc] init];
|
||||||
|
category._id = [[NSNumber alloc] initWithInteger:arc4random_uniform(100000)];
|
||||||
|
category.name = @"super-happy";
|
||||||
|
pet.category = category;
|
||||||
|
|
||||||
|
SWGTag *tag1 = [[SWGTag alloc] init];
|
||||||
|
tag1._id = [[NSNumber alloc] initWithInteger:arc4random_uniform(100000)];
|
||||||
|
tag1.name = @"test tag 1";
|
||||||
|
SWGTag *tag2 = [[SWGTag alloc] init];
|
||||||
|
tag2._id = [[NSNumber alloc] initWithInteger:arc4random_uniform(100000)];
|
||||||
|
tag2.name = @"test tag 2";
|
||||||
|
pet.tags = (NSArray<SWGTag> *)[[NSArray alloc] initWithObjects:tag1, tag2, nil];
|
||||||
|
|
||||||
|
pet.status = @"available";
|
||||||
|
|
||||||
|
NSArray * photos = [[NSArray alloc] initWithObjects:@"http://foo.bar.com/3", @"http://foo.bar.com/4", nil];
|
||||||
|
pet.photoUrls = photos;
|
||||||
|
return pet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -0,0 +1,119 @@
|
|||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
#import <XCTest/XCTest.h>
|
||||||
|
#import <SwaggerClient/SWGApiClient.h>
|
||||||
|
#import <SwaggerClient/SWGPet.h>
|
||||||
|
|
||||||
|
@interface DeserializationTest : XCTestCase {
|
||||||
|
|
||||||
|
@private SWGApiClient *apiClient;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation DeserializationTest
|
||||||
|
|
||||||
|
- (void)setUp {
|
||||||
|
[super setUp];
|
||||||
|
apiClient = [[SWGApiClient alloc] init];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testDeserializeDate {
|
||||||
|
NSString *dateStr = @"2012-09-27";
|
||||||
|
|
||||||
|
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
||||||
|
NSTimeZone *timezone = [NSTimeZone timeZoneWithName:@"UTC"];
|
||||||
|
[formatter setTimeZone:timezone];
|
||||||
|
[formatter setDateFormat:@"yyyy-MM-dd"];
|
||||||
|
NSDate *date = [formatter dateFromString:dateStr];
|
||||||
|
|
||||||
|
NSDate *deserializedDate = [apiClient deserialize:dateStr class:@"NSDate*"];
|
||||||
|
|
||||||
|
XCTAssertEqualWithAccuracy([date timeIntervalSinceReferenceDate], [deserializedDate timeIntervalSinceReferenceDate], 0.001);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testDeserializeDateTime {
|
||||||
|
NSString *dateTimeStr = @"1997-07-16T19:20:30+00:00";
|
||||||
|
|
||||||
|
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
||||||
|
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
|
||||||
|
NSDate *dateTime = [formatter dateFromString:dateTimeStr];
|
||||||
|
|
||||||
|
NSDate *deserializedDateTime = [apiClient deserialize:dateTimeStr class:@"NSDate*"];
|
||||||
|
|
||||||
|
XCTAssertEqualWithAccuracy([dateTime timeIntervalSinceReferenceDate], [deserializedDateTime timeIntervalSinceReferenceDate], 0.001);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testDeserializeObject {
|
||||||
|
XCTAssertTrue([[apiClient deserialize:@"" class:@"NSObject*"] isKindOfClass:[NSObject class]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testDeserializeString {
|
||||||
|
NSString *data = @"test string";
|
||||||
|
NSString *result = [apiClient deserialize:data class:@"NSString*"];
|
||||||
|
|
||||||
|
XCTAssertTrue([result isEqualToString:data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testDeserializeListOfModels {
|
||||||
|
NSArray *data =
|
||||||
|
@[
|
||||||
|
@{
|
||||||
|
@"id": @119,
|
||||||
|
@"category": @{
|
||||||
|
@"id": @0,
|
||||||
|
@"name": @"string"
|
||||||
|
},
|
||||||
|
@"name": @"doggie",
|
||||||
|
@"photoUrls": @[
|
||||||
|
@"string"
|
||||||
|
],
|
||||||
|
@"tags": @[
|
||||||
|
@{
|
||||||
|
@"id": @0,
|
||||||
|
@"name": @"string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
@"status": @"available"
|
||||||
|
|
||||||
|
}];
|
||||||
|
|
||||||
|
NSArray *result = [apiClient deserialize:data class:@"NSArray<SWGPet>*"];
|
||||||
|
|
||||||
|
XCTAssertTrue([result isKindOfClass:[NSArray class]]);
|
||||||
|
XCTAssertTrue([[result firstObject] isKindOfClass:[SWGPet class]]);
|
||||||
|
XCTAssertEqualObjects([[result firstObject] _id], @119);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testDeserializeMapOfModels {
|
||||||
|
NSDictionary *data =
|
||||||
|
@{
|
||||||
|
@"pet": @{
|
||||||
|
@"id": @119,
|
||||||
|
@"category": @{
|
||||||
|
@"id": @0,
|
||||||
|
@"name": @"string"
|
||||||
|
},
|
||||||
|
@"name": @"doggie",
|
||||||
|
@"photoUrls": @[
|
||||||
|
@"string"
|
||||||
|
],
|
||||||
|
@"tags": @[
|
||||||
|
@{
|
||||||
|
@"id": @0,
|
||||||
|
@"name": @"string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
@"status": @"available"
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
NSDictionary *result = [apiClient deserialize:data class:@"NSDictionary* /* NSString, SWGPet */"];
|
||||||
|
|
||||||
|
XCTAssertTrue([result isKindOfClass:[NSDictionary class]]);
|
||||||
|
XCTAssertTrue([result[@"pet"] isKindOfClass:[SWGPet class]]);
|
||||||
|
XCTAssertEqualObjects([result[@"pet"] _id], @119);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@ -0,0 +1,37 @@
|
|||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
#import <XCTest/XCTest.h>
|
||||||
|
#import <SwaggerClient/SWGPet.h>
|
||||||
|
|
||||||
|
@interface PetTest : XCTestCase {
|
||||||
|
|
||||||
|
@private SWGPet *pet;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation PetTest
|
||||||
|
|
||||||
|
- (void)setUp {
|
||||||
|
[super setUp];
|
||||||
|
|
||||||
|
NSDictionary *petDict = @{ @"id": @1, @"name": @"test pet",
|
||||||
|
@"status": @"sold",
|
||||||
|
@"photoUrls": @[@"string"],
|
||||||
|
@"category": @{ @"id": @1, @"name": @"test category" },
|
||||||
|
@"tags": @[ @{ @"id": @1, @"name": @"test tag" } ]};
|
||||||
|
pet = [[SWGPet alloc] initWithDictionary:petDict error:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testDescription {
|
||||||
|
NSDictionary *petDict = @{ @"id": @1, @"name": @"test pet",
|
||||||
|
@"status": @"sold",
|
||||||
|
@"photoUrls": @[@"string"],
|
||||||
|
@"category": @{ @"id": @1, @"name": @"test category" },
|
||||||
|
@"tags": @[ @{ @"id": @1, @"name": @"test tag" } ]};
|
||||||
|
NSString *petStr = [petDict description];
|
||||||
|
|
||||||
|
XCTAssertTrue([[pet description] isEqualToString:petStr]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@ -61,8 +61,8 @@
|
|||||||
|
|
||||||
- (void)testConfiguration {
|
- (void)testConfiguration {
|
||||||
SWGConfiguration *config = [SWGConfiguration sharedConfig];
|
SWGConfiguration *config = [SWGConfiguration sharedConfig];
|
||||||
[config setValue:@"123456" forApiKeyField:@"api_key"];
|
[config setApiKey:@"123456" forApiKeyIdentifier:@"api_key"];
|
||||||
[config setValue:@"PREFIX" forApiKeyPrefixField:@"api_key"];
|
[config setApiKeyPrefix:@"PREFIX" forApiKeyPrefixIdentifier:@"api_key"];
|
||||||
config.username = @"test_username";
|
config.username = @"test_username";
|
||||||
config.password = @"test_password";
|
config.password = @"test_password";
|
||||||
|
|
||||||
@ -98,77 +98,4 @@
|
|||||||
XCTAssertEqualObjects(basicAuthCredentials, [config getBasicAuthToken]);
|
XCTAssertEqualObjects(basicAuthCredentials, [config getBasicAuthToken]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testDeserialize {
|
|
||||||
id data;
|
|
||||||
id result;
|
|
||||||
|
|
||||||
// list of models
|
|
||||||
data =
|
|
||||||
@[
|
|
||||||
@{
|
|
||||||
@"id": @119,
|
|
||||||
@"category": @{
|
|
||||||
@"id": @0,
|
|
||||||
@"name": @"string"
|
|
||||||
},
|
|
||||||
@"name": @"doggie",
|
|
||||||
@"photoUrls": @[
|
|
||||||
@"string"
|
|
||||||
],
|
|
||||||
@"tags": @[
|
|
||||||
@{
|
|
||||||
@"id": @0,
|
|
||||||
@"name": @"string"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
@"status": @"available"
|
|
||||||
|
|
||||||
}];
|
|
||||||
result = [self.apiClient deserialize:data class:@"NSArray<SWGPet>*"];
|
|
||||||
|
|
||||||
XCTAssertTrue([result isKindOfClass:[NSArray class]]);
|
|
||||||
XCTAssertTrue([[result firstObject] isKindOfClass:[SWGPet class]]);
|
|
||||||
XCTAssertEqualObjects([[result firstObject] _id], @119);
|
|
||||||
|
|
||||||
// map of models
|
|
||||||
data =
|
|
||||||
@{
|
|
||||||
@"pet": @{
|
|
||||||
@"id": @119,
|
|
||||||
@"category": @{
|
|
||||||
@"id": @0,
|
|
||||||
@"name": @"string"
|
|
||||||
},
|
|
||||||
@"name": @"doggie",
|
|
||||||
@"photoUrls": @[
|
|
||||||
@"string"
|
|
||||||
],
|
|
||||||
@"tags": @[
|
|
||||||
@{
|
|
||||||
@"id": @0,
|
|
||||||
@"name": @"string"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
@"status": @"available"
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
result = [self.apiClient deserialize:data class:@"NSDictionary* /* NSString, SWGPet */"];
|
|
||||||
|
|
||||||
XCTAssertTrue([result isKindOfClass:[NSDictionary class]]);
|
|
||||||
XCTAssertTrue([result[@"pet"] isKindOfClass:[SWGPet class]]);
|
|
||||||
XCTAssertEqualObjects([result[@"pet"] _id], @119);
|
|
||||||
|
|
||||||
// pure object
|
|
||||||
result = [self.apiClient deserialize:@"" class:@"NSObject*"];
|
|
||||||
|
|
||||||
XCTAssertTrue([result isKindOfClass:[NSObject class]]);
|
|
||||||
|
|
||||||
// NSString
|
|
||||||
data = @"test string";
|
|
||||||
result = [self.apiClient deserialize:data class:@"NSString*"];
|
|
||||||
|
|
||||||
XCTAssertTrue([result isKindOfClass:[NSString class]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user