diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache index 2fcd91ac323..a7dec733321 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache @@ -53,6 +53,10 @@ static void (^reachabilityChangeBlock)(int); cacheEnabled = enabled; } ++(void) setReachabilityStatus:(AFNetworkReachabilityStatus)status { + reachabilityStatus = status; +} + - (void)setHeaderValue:(NSString*) value forKey:(NSString*) forKey { [self.requestSerializer setValue:value forHTTPHeaderField:forKey]; @@ -238,6 +242,10 @@ static void (^reachabilityChangeBlock)(int); return reachabilityStatus; } ++(bool) getOfflineState { + return offlineState; +} + +(void) setReachabilityChangeBlock:(void(^)(int))changeBlock { reachabilityChangeBlock = changeBlock; } diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache index 41f964044a1..ed3f5a2b38e 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache @@ -64,6 +64,20 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey; */ +(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 * diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h index 306ef4aeff5..a9e9590610e 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h @@ -73,6 +73,20 @@ extern NSString *const SWGResponseObjectErrorKey; */ +(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 * diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m index 5792adaca2e..042f282b885 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m @@ -53,6 +53,10 @@ static void (^reachabilityChangeBlock)(int); cacheEnabled = enabled; } ++(void) setReachabilityStatus:(AFNetworkReachabilityStatus)status { + reachabilityStatus = status; +} + - (void)setHeaderValue:(NSString*) value forKey:(NSString*) forKey { [self.requestSerializer setValue:value forHTTPHeaderField:forKey]; @@ -238,6 +242,10 @@ static void (^reachabilityChangeBlock)(int); return reachabilityStatus; } ++(bool) getOfflineState { + return offlineState; +} + +(void) setReachabilityChangeBlock:(void(^)(int))changeBlock { reachabilityChangeBlock = changeBlock; } diff --git a/samples/client/petstore/objc/SwaggerClient/SWGName.h b/samples/client/petstore/objc/SwaggerClient/SWGName.h index 5d390761827..fd34af7b66a 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGName.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGName.h @@ -17,4 +17,6 @@ @property(nonatomic) NSNumber* name; +@property(nonatomic) NSNumber* snakeCase; + @end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGName.m b/samples/client/petstore/objc/SwaggerClient/SWGName.m index 849e7f0d3f4..e11242833c1 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGName.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGName.m @@ -20,7 +20,7 @@ */ + (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 { - NSArray *optionalProperties = @[@"name"]; + NSArray *optionalProperties = @[@"name", @"snakeCase"]; if ([optionalProperties containsObject:propertyName]) { return YES;