mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 14:10:56 +00:00
Updates to iOS ApiClient - added getting for for offline state and settings for reachability status. This addresses "Default iOS reachability status #2422"
This commit is contained in:
parent
0941db6fbd
commit
553ebd659a
@ -53,6 +53,10 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
cacheEnabled = enabled;
|
cacheEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+(void) setReachabilityStatus:(AFNetworkReachabilityStatus)status {
|
||||||
|
reachabilityStatus = status;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setHeaderValue:(NSString*) value
|
- (void)setHeaderValue:(NSString*) value
|
||||||
forKey:(NSString*) forKey {
|
forKey:(NSString*) forKey {
|
||||||
[self.requestSerializer setValue:value forHTTPHeaderField:forKey];
|
[self.requestSerializer setValue:value forHTTPHeaderField:forKey];
|
||||||
@ -238,6 +242,10 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
return reachabilityStatus;
|
return reachabilityStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+(bool) getOfflineState {
|
||||||
|
return offlineState;
|
||||||
|
}
|
||||||
|
|
||||||
+(void) setReachabilityChangeBlock:(void(^)(int))changeBlock {
|
+(void) setReachabilityChangeBlock:(void(^)(int))changeBlock {
|
||||||
reachabilityChangeBlock = changeBlock;
|
reachabilityChangeBlock = changeBlock;
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,20 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
|||||||
*/
|
*/
|
||||||
+(void) setOfflineState:(BOOL) state;
|
+(void) setOfflineState:(BOOL) state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets if the client is unreachable
|
||||||
|
*
|
||||||
|
* @return The client offline state
|
||||||
|
*/
|
||||||
|
+(bool) getOfflineState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the client reachability, this may be override by the reachability manager if reachability changes
|
||||||
|
*
|
||||||
|
* @param The client reachability.
|
||||||
|
*/
|
||||||
|
+(void) setReachabilityStatus:(AFNetworkReachabilityStatus) status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the client reachability
|
* Gets the client reachability
|
||||||
*
|
*
|
||||||
|
@ -73,6 +73,20 @@ extern NSString *const SWGResponseObjectErrorKey;
|
|||||||
*/
|
*/
|
||||||
+(void) setOfflineState:(BOOL) state;
|
+(void) setOfflineState:(BOOL) state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets if the client is unreachable
|
||||||
|
*
|
||||||
|
* @return The client offline state
|
||||||
|
*/
|
||||||
|
+(bool) getOfflineState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the client reachability, this may be override by the reachability manager if reachability changes
|
||||||
|
*
|
||||||
|
* @param The client reachability.
|
||||||
|
*/
|
||||||
|
+(void) setReachabilityStatus:(AFNetworkReachabilityStatus) status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the client reachability
|
* Gets the client reachability
|
||||||
*
|
*
|
||||||
|
@ -53,6 +53,10 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
cacheEnabled = enabled;
|
cacheEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+(void) setReachabilityStatus:(AFNetworkReachabilityStatus)status {
|
||||||
|
reachabilityStatus = status;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setHeaderValue:(NSString*) value
|
- (void)setHeaderValue:(NSString*) value
|
||||||
forKey:(NSString*) forKey {
|
forKey:(NSString*) forKey {
|
||||||
[self.requestSerializer setValue:value forHTTPHeaderField:forKey];
|
[self.requestSerializer setValue:value forHTTPHeaderField:forKey];
|
||||||
@ -238,6 +242,10 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
return reachabilityStatus;
|
return reachabilityStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+(bool) getOfflineState {
|
||||||
|
return offlineState;
|
||||||
|
}
|
||||||
|
|
||||||
+(void) setReachabilityChangeBlock:(void(^)(int))changeBlock {
|
+(void) setReachabilityChangeBlock:(void(^)(int))changeBlock {
|
||||||
reachabilityChangeBlock = changeBlock;
|
reachabilityChangeBlock = changeBlock;
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,6 @@
|
|||||||
|
|
||||||
@property(nonatomic) NSNumber* name;
|
@property(nonatomic) NSNumber* name;
|
||||||
|
|
||||||
|
@property(nonatomic) NSNumber* snakeCase;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
+ (JSONKeyMapper *)keyMapper
|
+ (JSONKeyMapper *)keyMapper
|
||||||
{
|
{
|
||||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"name": @"name" }];
|
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"name": @"name", @"snake_case": @"snakeCase" }];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||||
{
|
{
|
||||||
NSArray *optionalProperties = @[@"name"];
|
NSArray *optionalProperties = @[@"name", @"snakeCase"];
|
||||||
|
|
||||||
if ([optionalProperties containsObject:propertyName]) {
|
if ([optionalProperties containsObject:propertyName]) {
|
||||||
return YES;
|
return YES;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user