Update samples for ObjC&core-data. (#5202)

This commit is contained in:
Paŭlo Ebermann 2017-03-26 16:44:18 +02:00 committed by wing328
parent f8c3a69ebe
commit 8c575b0f0c
4 changed files with 7 additions and 67 deletions

View File

@ -60,9 +60,6 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
@ -132,9 +129,6 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (petId != nil) {
pathParams[@"petId"] = petId;
@ -195,9 +189,6 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByStatus"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
@ -256,9 +247,6 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByTags"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
@ -328,9 +316,6 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (petId != nil) {
pathParams[@"petId"] = petId;
@ -388,9 +373,6 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
@ -463,9 +445,6 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (petId != nil) {
pathParams[@"petId"] = petId;
@ -546,9 +525,6 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}/uploadImage"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (petId != nil) {
pathParams[@"petId"] = petId;

View File

@ -71,9 +71,6 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order/{orderId}"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (orderId != nil) {
pathParams[@"orderId"] = orderId;
@ -129,9 +126,6 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
(void (^)(NSDictionary<NSString*, NSNumber*>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
@ -197,9 +191,6 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order/{orderId}"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (orderId != nil) {
pathParams[@"orderId"] = orderId;
@ -257,9 +248,6 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];

View File

@ -60,9 +60,6 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
@ -118,9 +115,6 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithArray"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
@ -176,9 +170,6 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithList"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
@ -245,9 +236,6 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/{username}"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (username != nil) {
pathParams[@"username"] = username;
@ -316,9 +304,6 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/{username}"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (username != nil) {
pathParams[@"username"] = username;
@ -379,9 +364,6 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
completionHandler: (void (^)(NSString* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/login"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
@ -440,9 +422,6 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
(void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/logout"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
@ -511,9 +490,6 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/{username}"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (username != nil) {
pathParams[@"username"] = username;

View File

@ -89,7 +89,7 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
#pragma mark - Task Methods
- (NSURLSessionDataTask*) taskWithCompletionBlock: (NSURLRequest *)request completionBlock: (void (^)(id, NSError *))completionBlock {
NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
SWGDebugLogResponse(response, responseObject,request,error);
if(!error) {
@ -104,7 +104,7 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo];
completionBlock(nil, augmentedError);
}];
return task;
}
@ -135,7 +135,7 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
completionBlock(file, nil);
}];
return task;
}
@ -222,7 +222,7 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
[self postProcessRequest:request];
NSURLSessionTask *task = nil;
if ([self.downloadTaskResponseTypes containsObject:responseType]) {
@ -241,9 +241,9 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
completionBlock(response, error);
}];
}
[task resume];
return task;
}
@ -330,7 +330,7 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
NSMutableDictionary *headersWithAuth = [NSMutableDictionary dictionaryWithDictionary:*headers];
NSMutableDictionary *querysWithAuth = [NSMutableDictionary dictionaryWithDictionary:*querys];
id<SWGConfiguration> config = self.configuration;
for (NSString *auth in authSettings) {
NSDictionary *authSetting = config.authSettings[auth];