diff --git a/samples/client/wordnik-api-objc/Podfile b/samples/client/wordnik-api-objc/Podfile deleted file mode 100644 index d5f43cfcb7d..00000000000 --- a/samples/client/wordnik-api-objc/Podfile +++ /dev/null @@ -1,4 +0,0 @@ -platform :ios, '6.0' -xcodeproj 'WordnikApiClient/WordnikApiClient.xcodeproj' -pod 'AFNetworking', '~> 1.0' - diff --git a/samples/client/wordnik-api-objc/client/SWGAccountApi.h b/samples/client/wordnik-api-objc/client/SWGAccountApi.h deleted file mode 100644 index 826c7b93327..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGAccountApi.h +++ /dev/null @@ -1,69 +0,0 @@ -#import -#import "SWGUser.h" -#import "SWGWordList.h" -#import "SWGApiTokenStatus.h" -#import "SWGAuthenticationToken.h" - - - -@interface SWGAccountApi: NSObject - --(void) addHeader:(NSString*)value forKey:(NSString*)key; --(unsigned long) requestQueueSize; -+(SWGAccountApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; -+(void) setBasePath:(NSString*)basePath; -+(NSString*) getBasePath; -/** - - Authenticates a User - - @param username A confirmed Wordnik username - @param password The user's password - */ --(NSNumber*) authenticateWithCompletionBlock :(NSString*) username - password:(NSString*) password - completionHandler: (void (^)(SWGAuthenticationToken* output, NSError* error))completionBlock; - -/** - - Authenticates a user - - @param username A confirmed Wordnik username - @param body The user's password - */ --(NSNumber*) authenticatePostWithCompletionBlock :(NSString*) username - body:(NSString*) body - completionHandler: (void (^)(SWGAuthenticationToken* output, NSError* error))completionBlock; - -/** - - Fetches WordList objects for the logged-in user. - - @param auth_token auth_token of logged-in user - @param skip Results to skip - @param limit Maximum number of results to return - */ --(NSNumber*) getWordListsForLoggedInUserWithCompletionBlock :(NSString*) auth_token - skip:(NSNumber*) skip - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; - -/** - - Returns usage statistics for the API account. - - @param api_key Wordnik authentication token - */ --(NSNumber*) getApiTokenStatusWithCompletionBlock :(NSString*) api_key - completionHandler: (void (^)(SWGApiTokenStatus* output, NSError* error))completionBlock; - -/** - - Returns the logged-in User - Requires a valid auth_token to be set. - @param auth_token The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) - */ --(NSNumber*) getLoggedInUserWithCompletionBlock :(NSString*) auth_token - completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock; - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGAccountApi.m b/samples/client/wordnik-api-objc/client/SWGAccountApi.m deleted file mode 100644 index 1330a284e6a..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGAccountApi.m +++ /dev/null @@ -1,318 +0,0 @@ -#import "SWGAccountApi.h" -#import "SWGFile.h" -#import "SWGApiClient.h" -#import "SWGUser.h" -#import "SWGWordList.h" -#import "SWGApiTokenStatus.h" -#import "SWGAuthenticationToken.h" - - - - -@implementation SWGAccountApi -static NSString * basePath = @"http://api.wordnik.com/v4"; - -+(SWGAccountApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { - static SWGAccountApi* singletonAPI = nil; - - if (singletonAPI == nil) { - singletonAPI = [[SWGAccountApi alloc] init]; - [singletonAPI addHeader:headerValue forKey:key]; - } - return singletonAPI; -} - -+(void) setBasePath:(NSString*)path { - basePath = path; -} - -+(NSString*) getBasePath { - return basePath; -} - --(SWGApiClient*) apiClient { - return [SWGApiClient sharedClientFromPool:basePath]; -} - --(void) addHeader:(NSString*)value forKey:(NSString*)key { - [[self apiClient] setHeaderValue:value forKey:key]; -} - --(id) init { - self = [super init]; - [self apiClient]; - return self; -} - --(void) setHeaderValue:(NSString*) value - forKey:(NSString*)key { - [[self apiClient] setHeaderValue:value forKey:key]; -} - --(unsigned long) requestQueueSize { - return [SWGApiClient requestQueueSize]; -} - - --(NSNumber*) authenticateWithCompletionBlock:(NSString*) username - password:(NSString*) password - completionHandler: (void (^)(SWGAuthenticationToken* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/account.{format}/authenticate/{username}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(password != nil) - queryParams[@"password"] = password; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(username == nil) { - // error - } - if(password == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGAuthenticationToken *result = nil; - if (data) { - result = [[SWGAuthenticationToken alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) authenticatePostWithCompletionBlock:(NSString*) username - body:(NSString*) body - completionHandler: (void (^)(SWGAuthenticationToken* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/account.{format}/authenticate/{username}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { - if([dict respondsToSelector:@selector(asDictionary)]) { - [objs addObject:[(SWGObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] - options:NSJSONReadingMutableContainers - error:&error]; - bodyDictionary = JSON; - } - else if([body isKindOfClass: [SWGFile class]]) { - requestContentType = @"form-data"; - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(username == nil) { - // error - } - if(body == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"POST" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGAuthenticationToken *result = nil; - if (data) { - result = [[SWGAuthenticationToken alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) getWordListsForLoggedInUserWithCompletionBlock:(NSString*) auth_token - skip:(NSNumber*) skip - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/account.{format}/wordLists", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(skip != nil) - queryParams[@"skip"] = skip; - if(limit != nil) - queryParams[@"limit"] = limit; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - if(auth_token != nil) - headerParams[@"auth_token"] = auth_token; - id bodyDictionary = nil; - if(auth_token == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - SWGWordList* d = [[SWGWordList alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - }]; - - -} - --(NSNumber*) getApiTokenStatusWithCompletionBlock:(NSString*) api_key - completionHandler: (void (^)(SWGApiTokenStatus* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/account.{format}/apiTokenStatus", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - if(api_key != nil) - headerParams[@"api_key"] = api_key; - id bodyDictionary = nil; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGApiTokenStatus *result = nil; - if (data) { - result = [[SWGApiTokenStatus alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) getLoggedInUserWithCompletionBlock:(NSString*) auth_token - completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/account.{format}/user", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - if(auth_token != nil) - headerParams[@"auth_token"] = auth_token; - id bodyDictionary = nil; - if(auth_token == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGUser *result = nil; - if (data) { - result = [[SWGUser alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - - - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGApiClient.h b/samples/client/wordnik-api-objc/client/SWGApiClient.h deleted file mode 100644 index aab60cd0595..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGApiClient.h +++ /dev/null @@ -1,64 +0,0 @@ -#import -#import "AFHTTPClient.h" - -@interface SWGApiClient : AFHTTPClient - -@property(nonatomic, assign) NSURLRequestCachePolicy cachePolicy; -@property(nonatomic, assign) NSTimeInterval timeoutInterval; -@property(nonatomic, assign) BOOL logRequests; -@property(nonatomic, assign) BOOL logCacheHits; -@property(nonatomic, assign) BOOL logServerResponses; -@property(nonatomic, assign) BOOL logJSON; -@property(nonatomic, assign) BOOL logHTTP; -@property(nonatomic, readonly) NSOperationQueue* queue; - -+(SWGApiClient *)sharedClientFromPool:(NSString *)baseUrl; - -+(NSOperationQueue*) sharedQueue; - -+(void)setLoggingEnabled:(bool) state; - -+(void)clearCache; - -+(void)setCacheEnabled:(BOOL) enabled; - -+(unsigned long)requestQueueSize; - -+(void) setOfflineState:(BOOL) state; - -+(AFNetworkReachabilityStatus) getReachabilityStatus; - -+(NSNumber*) nextRequestId; - -+(NSNumber*) queueRequest; - -+(void) cancelRequest:(NSNumber*)requestId; - -+(NSString*) escape:(id)unescaped; - -+(void) setReachabilityChangeBlock:(void(^)(int))changeBlock; - -+(void) configureCacheReachibilityForHost:(NSString*)host; - --(void)setHeaderValue:(NSString*) value - forKey:(NSString*) forKey; - --(NSNumber*) dictionary:(NSString*) path - method:(NSString*) method - queryParams:(NSDictionary*) queryParams - body:(id) body - headerParams:(NSDictionary*) headerParams - requestContentType:(NSString*) requestContentType - responseContentType:(NSString*) responseContentType - completionBlock:(void (^)(NSDictionary*, NSError *))completionBlock; - --(NSNumber*) stringWithCompletionBlock:(NSString*) path - method:(NSString*) method - queryParams:(NSDictionary*) queryParams - body:(id) body - headerParams:(NSDictionary*) headerParams - requestContentType:(NSString*) requestContentType - responseContentType:(NSString*) responseContentType - completionBlock:(void (^)(NSString*, NSError *))completionBlock; -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGApiClient.m b/samples/client/wordnik-api-objc/client/SWGApiClient.m deleted file mode 100644 index 1c48412bc5a..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGApiClient.m +++ /dev/null @@ -1,419 +0,0 @@ -#import "SWGApiClient.h" -#import "SWGFile.h" - -#import "AFJSONRequestOperation.h" - -@implementation SWGApiClient - -static long requestId = 0; -static bool offlineState = true; -static NSMutableSet * queuedRequests = nil; -static bool cacheEnabled = false; -static AFNetworkReachabilityStatus reachabilityStatus = AFNetworkReachabilityStatusNotReachable; -static NSOperationQueue* sharedQueue; -static void (^reachabilityChangeBlock)(int); -static bool loggingEnabled = false; - -+(void)setLoggingEnabled:(bool) state { - loggingEnabled = state; -} - -+(void)clearCache { - [[NSURLCache sharedURLCache] removeAllCachedResponses]; -} - -+(void)setCacheEnabled:(BOOL)enabled { - cacheEnabled = enabled; -} - -+(void)configureCacheWithMemoryAndDiskCapacity:(unsigned long) memorySize - diskSize:(unsigned long) diskSize { - NSAssert(memorySize > 0, @"invalid in-memory cache size"); - NSAssert(diskSize >= 0, @"invalid disk cache size"); - - NSURLCache *cache = - [[NSURLCache alloc] - initWithMemoryCapacity:memorySize - diskCapacity:diskSize - diskPath:@"swagger_url_cache"]; - - [NSURLCache setSharedURLCache:cache]; -} - -+(NSOperationQueue*) sharedQueue { - return sharedQueue; -} - -+(SWGApiClient *)sharedClientFromPool:(NSString *)baseUrl { - static NSMutableDictionary *_pool = nil; - if (queuedRequests == nil) { - queuedRequests = [[NSMutableSet alloc]init]; - } - if(_pool == nil) { - // setup static vars - // create queue - sharedQueue = [[NSOperationQueue alloc] init]; - - // create pool - _pool = [[NSMutableDictionary alloc] init]; - - // initialize URL cache - [SWGApiClient configureCacheWithMemoryAndDiskCapacity:4*1024*1024 diskSize:32*1024*1024]; - - // configure reachability - [SWGApiClient configureCacheReachibilityForHost:baseUrl]; - } - - @synchronized(self) { - SWGApiClient * client = [_pool objectForKey:baseUrl]; - if (client == nil) { - client = [[SWGApiClient alloc] initWithBaseURL:[NSURL URLWithString:baseUrl]]; - [client registerHTTPOperationClass:[AFJSONRequestOperation class]]; - client.parameterEncoding = AFJSONParameterEncoding; - [_pool setValue:client forKey:baseUrl ]; - if(loggingEnabled) - NSLog(@"new client for path %@", baseUrl); - } - if(loggingEnabled) - NSLog(@"returning client for path %@", baseUrl); - return client; - } -} - --(void)setHeaderValue:(NSString*) value - forKey:(NSString*) forKey { - [self setDefaultHeader:forKey value:value]; -} - -+(unsigned long)requestQueueSize { - return [queuedRequests count]; -} - -+(NSNumber*) nextRequestId { - long nextId = ++requestId; - if(loggingEnabled) - NSLog(@"got id %ld", nextId); - return [NSNumber numberWithLong:nextId]; -} - -+(NSNumber*) queueRequest { - NSNumber* requestId = [SWGApiClient nextRequestId]; - if(loggingEnabled) - NSLog(@"added %@ to request queue", requestId); - [queuedRequests addObject:requestId]; - return requestId; -} - -+(void) cancelRequest:(NSNumber*)requestId { - [queuedRequests removeObject:requestId]; -} - -+(NSString*) escape:(id)unescaped { - if([unescaped isKindOfClass:[NSString class]]){ - return (NSString *)CFBridgingRelease - (CFURLCreateStringByAddingPercentEscapes( - NULL, - (__bridge CFStringRef) unescaped, - NULL, - (CFStringRef)@"!*'();:@&=+$,/?%#[]", - kCFStringEncodingUTF8)); - } - else { - return [NSString stringWithFormat:@"%@", unescaped]; - } -} - --(Boolean) executeRequestWithId:(NSNumber*) requestId { - NSSet* matchingItems = [queuedRequests objectsPassingTest:^BOOL(id obj, BOOL *stop) { - if([obj intValue] == [requestId intValue]) - return TRUE; - else return FALSE; - }]; - - if(matchingItems.count == 1) { - if(loggingEnabled) - NSLog(@"removing request id %@", requestId); - [queuedRequests removeObject:requestId]; - return true; - } - else - return false; -} - --(id)initWithBaseURL:(NSURL *)url { - self = [super initWithBaseURL:url]; - if (!self) - return nil; - return self; -} - -+(AFNetworkReachabilityStatus) getReachabilityStatus { - return reachabilityStatus; -} - -+(void) setReachabilityChangeBlock:(void(^)(int))changeBlock { - reachabilityChangeBlock = changeBlock; -} - -+(void) setOfflineState:(BOOL) state { - offlineState = state; -} - -+(void) configureCacheReachibilityForHost:(NSString*)host { - [[SWGApiClient sharedClientFromPool:host ] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { - reachabilityStatus = status; - switch (status) { - case AFNetworkReachabilityStatusUnknown: - if(loggingEnabled) - NSLog(@"reachability changed to AFNetworkReachabilityStatusUnknown"); - [SWGApiClient setOfflineState:true]; - break; - - case AFNetworkReachabilityStatusNotReachable: - if(loggingEnabled) - NSLog(@"reachability changed to AFNetworkReachabilityStatusNotReachable"); - [SWGApiClient setOfflineState:true]; - break; - - case AFNetworkReachabilityStatusReachableViaWWAN: - if(loggingEnabled) - NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWWAN"); - [SWGApiClient setOfflineState:false]; - break; - - case AFNetworkReachabilityStatusReachableViaWiFi: - if(loggingEnabled) - NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWiFi"); - [SWGApiClient setOfflineState:false]; - break; - default: - break; - } - // call the reachability block, if configured - if(reachabilityChangeBlock != nil) { - reachabilityChangeBlock(status); - } - }]; -} - --(NSString*) pathWithQueryParamsToString:(NSString*) path - queryParams:(NSDictionary*) queryParams { - NSString * separator = nil; - int counter = 0; - - NSMutableString * requestUrl = [NSMutableString stringWithFormat:@"%@", path]; - if(queryParams != nil){ - for(NSString * key in [queryParams keyEnumerator]){ - if(counter == 0) separator = @"?"; - else separator = @"&"; - NSString * value; - if([[queryParams valueForKey:key] isKindOfClass:[NSString class]]){ - value = [SWGApiClient escape:[queryParams valueForKey:key]]; - } - else { - value = [NSString stringWithFormat:@"%@", [queryParams valueForKey:key]]; - } - [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, - [SWGApiClient escape:key], value]]; - counter += 1; - } - } - return requestUrl; -} - -- (NSString*)descriptionForRequest:(NSURLRequest*)request { - return [[request URL] absoluteString]; -} - -- (void)logRequest:(NSURLRequest*)request { - NSLog(@"request: %@", [self descriptionForRequest:request]); -} - -- (void)logResponse:(id)data forRequest:(NSURLRequest*)request error:(NSError*)error { - NSLog(@"request: %@ response: %@ ", [self descriptionForRequest:request], data ); -} - - --(NSNumber*) dictionary:(NSString*) path - method:(NSString*) method - queryParams:(NSDictionary*) queryParams - body:(id) body - headerParams:(NSDictionary*) headerParams - requestContentType:(NSString*) requestContentType - responseContentType:(NSString*) responseContentType - completionBlock:(void (^)(NSDictionary*, NSError *))completionBlock { - - NSMutableURLRequest * request = nil; - - if ([body isKindOfClass:[SWGFile class]]){ - SWGFile * file = (SWGFile*) body; - - request = [self multipartFormRequestWithMethod:@"POST" - path:path - parameters:nil - constructingBodyWithBlock: ^(id formData) { - [formData appendPartWithFileData:[file data] - name:@"image" - fileName:[file name] - mimeType:[file mimeType]]; - }]; - } - else { - request = [self requestWithMethod:method - path:[self pathWithQueryParamsToString:path queryParams:queryParams] - parameters:body]; - } - BOOL hasHeaderParams = false; - if(headerParams != nil && [headerParams count] > 0) - hasHeaderParams = true; - if(offlineState) { - NSLog(@"%@ cache forced", path); - [request setCachePolicy:NSURLRequestReturnCacheDataDontLoad]; - } - else if(!hasHeaderParams && [method isEqualToString:@"GET"] && cacheEnabled) { - NSLog(@"%@ cache enabled", path); - [request setCachePolicy:NSURLRequestUseProtocolCachePolicy]; - } - else { - NSLog(@"%@ cache disabled", path); - [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; - } - - if(body != nil) { - if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){ - [request setValue:requestContentType forHTTPHeaderField:@"Content-Type"]; - } - else if ([body isKindOfClass:[SWGFile class]]) {} - else { - NSAssert(false, @"unsupported post type!"); - } - } - if(headerParams != nil){ - for(NSString * key in [headerParams keyEnumerator]){ - [request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key]; - } - } - [request setValue:[headerParams valueForKey:responseContentType] forHTTPHeaderField:@"Accept"]; - - // Always disable cookies! - [request setHTTPShouldHandleCookies:NO]; - - - if (self.logRequests) { - [self logRequest:request]; - } - - NSNumber* requestId = [SWGApiClient queueRequest]; - AFJSONRequestOperation *op = - [AFJSONRequestOperation - JSONRequestOperationWithRequest:request - success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { - if([self executeRequestWithId:requestId]) { - if(self.logServerResponses) - [self logResponse:JSON forRequest:request error:nil]; - completionBlock(JSON, nil); - } - } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id data) { - if([self executeRequestWithId:requestId]) { - if(self.logServerResponses) - [self logResponse:nil forRequest:request error:error]; - completionBlock(nil, error); - } - } - ]; - - [self enqueueHTTPRequestOperation:op]; - return requestId; -} - --(NSNumber*) stringWithCompletionBlock:(NSString*) path - method:(NSString*) method - queryParams:(NSDictionary*) queryParams - body:(id) body - headerParams:(NSDictionary*) headerParams - requestContentType:(NSString*) requestContentType - responseContentType:(NSString*) responseContentType - completionBlock:(void (^)(NSString*, NSError *))completionBlock { - AFHTTPClient *client = self; - client.parameterEncoding = AFJSONParameterEncoding; - - NSMutableURLRequest * request = nil; - - if ([body isKindOfClass:[SWGFile class]]){ - SWGFile * file = (SWGFile*) body; - - request = [self multipartFormRequestWithMethod:@"POST" - path:path - parameters:nil - constructingBodyWithBlock: ^(id formData) { - [formData appendPartWithFileData:[file data] - name:@"image" - fileName:[file name] - mimeType:[file mimeType]]; - }]; - } - else { - request = [self requestWithMethod:method - path:[self pathWithQueryParamsToString:path queryParams:queryParams] - parameters:body]; - } - - BOOL hasHeaderParams = false; - if(headerParams != nil && [headerParams count] > 0) - hasHeaderParams = true; - if(offlineState) { - NSLog(@"%@ cache forced", path); - [request setCachePolicy:NSURLRequestReturnCacheDataDontLoad]; - } - else if(!hasHeaderParams && [method isEqualToString:@"GET"] && cacheEnabled) { - NSLog(@"%@ cache enabled", path); - [request setCachePolicy:NSURLRequestUseProtocolCachePolicy]; - } - else { - NSLog(@"%@ cache disabled", path); - [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; - } - - if(body != nil) { - if([body isKindOfClass:[NSDictionary class]]){ - [request setValue:requestContentType forHTTPHeaderField:@"Content-Type"]; - } - else if ([body isKindOfClass:[SWGFile class]]){} - else { - NSAssert(false, @"unsupported post type!"); - } - } - if(headerParams != nil){ - for(NSString * key in [headerParams keyEnumerator]){ - [request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key]; - } - } - [request setValue:[headerParams valueForKey:responseContentType] forHTTPHeaderField:@"Accept"]; - - // Always disable cookies! - [request setHTTPShouldHandleCookies:NO]; - - NSNumber* requestId = [SWGApiClient queueRequest]; - AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc] initWithRequest:request]; - [op setCompletionBlockWithSuccess: - ^(AFHTTPRequestOperation *resp, - id responseObject) { - NSString *response = [resp responseString]; - if([self executeRequestWithId:requestId]) { - if(self.logServerResponses) - [self logResponse:responseObject forRequest:request error:nil]; - completionBlock(response, nil); - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if([self executeRequestWithId:requestId]) { - if(self.logServerResponses) - [self logResponse:nil forRequest:request error:error]; - completionBlock(nil, error); - } - }]; - - [self enqueueHTTPRequestOperation:op]; - return requestId; -} - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGApiTokenStatus.h b/samples/client/wordnik-api-objc/client/SWGApiTokenStatus.h deleted file mode 100644 index 819c01144a0..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGApiTokenStatus.h +++ /dev/null @@ -1,31 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGApiTokenStatus : SWGObject - -@property(nonatomic) NSNumber* valid; - -@property(nonatomic) NSString* token; - -@property(nonatomic) NSNumber* resetsInMillis; - -@property(nonatomic) NSNumber* remainingCalls; - -@property(nonatomic) NSNumber* expiresInMillis; - -@property(nonatomic) NSNumber* totalRequests; - -- (id) valid: (NSNumber*) valid - token: (NSString*) token - resetsInMillis: (NSNumber*) resetsInMillis - remainingCalls: (NSNumber*) remainingCalls - expiresInMillis: (NSNumber*) expiresInMillis - totalRequests: (NSNumber*) totalRequests; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGApiTokenStatus.m b/samples/client/wordnik-api-objc/client/SWGApiTokenStatus.m deleted file mode 100644 index 91c9491df4d..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGApiTokenStatus.m +++ /dev/null @@ -1,51 +0,0 @@ -#import "SWGDate.h" -#import "SWGApiTokenStatus.h" - -@implementation SWGApiTokenStatus - --(id)valid: (NSNumber*) valid - token: (NSString*) token - resetsInMillis: (NSNumber*) resetsInMillis - remainingCalls: (NSNumber*) remainingCalls - expiresInMillis: (NSNumber*) expiresInMillis - totalRequests: (NSNumber*) totalRequests -{ - _valid = valid; - _token = token; - _resetsInMillis = resetsInMillis; - _remainingCalls = remainingCalls; - _expiresInMillis = expiresInMillis; - _totalRequests = totalRequests; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _valid = dict[@"valid"]; - _token = dict[@"token"]; - _resetsInMillis = dict[@"resetsInMillis"]; - _remainingCalls = dict[@"remainingCalls"]; - _expiresInMillis = dict[@"expiresInMillis"]; - _totalRequests = dict[@"totalRequests"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_valid != nil) dict[@"valid"] = _valid ; - if(_token != nil) dict[@"token"] = _token ; - if(_resetsInMillis != nil) dict[@"resetsInMillis"] = _resetsInMillis ; - if(_remainingCalls != nil) dict[@"remainingCalls"] = _remainingCalls ; - if(_expiresInMillis != nil) dict[@"expiresInMillis"] = _expiresInMillis ; - if(_totalRequests != nil) dict[@"totalRequests"] = _totalRequests ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGAudioFile.h b/samples/client/wordnik-api-objc/client/SWGAudioFile.h deleted file mode 100644 index 4002d5ea4d5..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGAudioFile.h +++ /dev/null @@ -1,56 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGDate.h" - - -@interface SWGAudioFile : SWGObject - -@property(nonatomic) NSString* attributionUrl; - -@property(nonatomic) NSNumber* commentCount; - -@property(nonatomic) NSNumber* voteCount; - -@property(nonatomic) NSString* fileUrl; - -@property(nonatomic) NSString* audioType; - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSNumber* duration; - -@property(nonatomic) NSString* attributionText; - -@property(nonatomic) NSString* createdBy; - -@property(nonatomic) NSString* description; - -@property(nonatomic) SWGDate* createdAt; - -@property(nonatomic) NSNumber* voteWeightedAverage; - -@property(nonatomic) NSNumber* voteAverage; - -@property(nonatomic) NSString* word; - -- (id) attributionUrl: (NSString*) attributionUrl - commentCount: (NSNumber*) commentCount - voteCount: (NSNumber*) voteCount - fileUrl: (NSString*) fileUrl - audioType: (NSString*) audioType - _id: (NSNumber*) _id - duration: (NSNumber*) duration - attributionText: (NSString*) attributionText - createdBy: (NSString*) createdBy - description: (NSString*) description - createdAt: (SWGDate*) createdAt - voteWeightedAverage: (NSNumber*) voteWeightedAverage - voteAverage: (NSNumber*) voteAverage - word: (NSString*) word; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGAudioFile.m b/samples/client/wordnik-api-objc/client/SWGAudioFile.m deleted file mode 100644 index 3ceeffa80eb..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGAudioFile.m +++ /dev/null @@ -1,102 +0,0 @@ -#import "SWGDate.h" -#import "SWGAudioFile.h" - -@implementation SWGAudioFile - --(id)attributionUrl: (NSString*) attributionUrl - commentCount: (NSNumber*) commentCount - voteCount: (NSNumber*) voteCount - fileUrl: (NSString*) fileUrl - audioType: (NSString*) audioType - _id: (NSNumber*) _id - duration: (NSNumber*) duration - attributionText: (NSString*) attributionText - createdBy: (NSString*) createdBy - description: (NSString*) description - createdAt: (SWGDate*) createdAt - voteWeightedAverage: (NSNumber*) voteWeightedAverage - voteAverage: (NSNumber*) voteAverage - word: (NSString*) word -{ - _attributionUrl = attributionUrl; - _commentCount = commentCount; - _voteCount = voteCount; - _fileUrl = fileUrl; - _audioType = audioType; - __id = _id; - _duration = duration; - _attributionText = attributionText; - _createdBy = createdBy; - _description = description; - _createdAt = createdAt; - _voteWeightedAverage = voteWeightedAverage; - _voteAverage = voteAverage; - _word = word; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _attributionUrl = dict[@"attributionUrl"]; - _commentCount = dict[@"commentCount"]; - _voteCount = dict[@"voteCount"]; - _fileUrl = dict[@"fileUrl"]; - _audioType = dict[@"audioType"]; - __id = dict[@"id"]; - _duration = dict[@"duration"]; - _attributionText = dict[@"attributionText"]; - _createdBy = dict[@"createdBy"]; - _description = dict[@"description"]; - id createdAt_dict = dict[@"createdAt"]; - if(createdAt_dict != nil) - _createdAt = [[SWGDate alloc]initWithValues:createdAt_dict]; - _voteWeightedAverage = dict[@"voteWeightedAverage"]; - _voteAverage = dict[@"voteAverage"]; - _word = dict[@"word"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_attributionUrl != nil) dict[@"attributionUrl"] = _attributionUrl ; - if(_commentCount != nil) dict[@"commentCount"] = _commentCount ; - if(_voteCount != nil) dict[@"voteCount"] = _voteCount ; - if(_fileUrl != nil) dict[@"fileUrl"] = _fileUrl ; - if(_audioType != nil) dict[@"audioType"] = _audioType ; - if(__id != nil) dict[@"id"] = __id ; - if(_duration != nil) dict[@"duration"] = _duration ; - if(_attributionText != nil) dict[@"attributionText"] = _attributionText ; - if(_createdBy != nil) dict[@"createdBy"] = _createdBy ; - if(_description != nil) dict[@"description"] = _description ; - if(_createdAt != nil){ - if([_createdAt isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGDate *createdAt in (NSArray*)_createdAt) { - [array addObject:[(SWGObject*)createdAt asDictionary]]; - } - dict[@"createdAt"] = array; - } - else if(_createdAt && [_createdAt isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_createdAt toString]; - if(dateString){ - dict[@"createdAt"] = dateString; - } - } - else { - if(_createdAt != nil) dict[@"createdAt"] = [(SWGObject*)_createdAt asDictionary]; - } - } - if(_voteWeightedAverage != nil) dict[@"voteWeightedAverage"] = _voteWeightedAverage ; - if(_voteAverage != nil) dict[@"voteAverage"] = _voteAverage ; - if(_word != nil) dict[@"word"] = _word ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGAuthenticationToken.h b/samples/client/wordnik-api-objc/client/SWGAuthenticationToken.h deleted file mode 100644 index c821521b909..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGAuthenticationToken.h +++ /dev/null @@ -1,22 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGAuthenticationToken : SWGObject - -@property(nonatomic) NSString* token; - -@property(nonatomic) NSNumber* userId; - -@property(nonatomic) NSString* userSignature; - -- (id) token: (NSString*) token - userId: (NSNumber*) userId - userSignature: (NSString*) userSignature; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGAuthenticationToken.m b/samples/client/wordnik-api-objc/client/SWGAuthenticationToken.m deleted file mode 100644 index aa78c3de3e6..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGAuthenticationToken.m +++ /dev/null @@ -1,39 +0,0 @@ -#import "SWGDate.h" -#import "SWGAuthenticationToken.h" - -@implementation SWGAuthenticationToken - --(id)token: (NSString*) token - userId: (NSNumber*) userId - userSignature: (NSString*) userSignature -{ - _token = token; - _userId = userId; - _userSignature = userSignature; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _token = dict[@"token"]; - _userId = dict[@"userId"]; - _userSignature = dict[@"userSignature"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_token != nil) dict[@"token"] = _token ; - if(_userId != nil) dict[@"userId"] = _userId ; - if(_userSignature != nil) dict[@"userSignature"] = _userSignature ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGBigram.h b/samples/client/wordnik-api-objc/client/SWGBigram.h deleted file mode 100644 index 51430a54661..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGBigram.h +++ /dev/null @@ -1,28 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGBigram : SWGObject - -@property(nonatomic) NSNumber* count; - -@property(nonatomic) NSString* gram2; - -@property(nonatomic) NSString* gram1; - -@property(nonatomic) NSNumber* wlmi; - -@property(nonatomic) NSNumber* mi; - -- (id) count: (NSNumber*) count - gram2: (NSString*) gram2 - gram1: (NSString*) gram1 - wlmi: (NSNumber*) wlmi - mi: (NSNumber*) mi; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGBigram.m b/samples/client/wordnik-api-objc/client/SWGBigram.m deleted file mode 100644 index 5cddc8dde7e..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGBigram.m +++ /dev/null @@ -1,47 +0,0 @@ -#import "SWGDate.h" -#import "SWGBigram.h" - -@implementation SWGBigram - --(id)count: (NSNumber*) count - gram2: (NSString*) gram2 - gram1: (NSString*) gram1 - wlmi: (NSNumber*) wlmi - mi: (NSNumber*) mi -{ - _count = count; - _gram2 = gram2; - _gram1 = gram1; - _wlmi = wlmi; - _mi = mi; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _count = dict[@"count"]; - _gram2 = dict[@"gram2"]; - _gram1 = dict[@"gram1"]; - _wlmi = dict[@"wlmi"]; - _mi = dict[@"mi"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_count != nil) dict[@"count"] = _count ; - if(_gram2 != nil) dict[@"gram2"] = _gram2 ; - if(_gram1 != nil) dict[@"gram1"] = _gram1 ; - if(_wlmi != nil) dict[@"wlmi"] = _wlmi ; - if(_mi != nil) dict[@"mi"] = _mi ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGCitation.h b/samples/client/wordnik-api-objc/client/SWGCitation.h deleted file mode 100644 index 4f06535d53b..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGCitation.h +++ /dev/null @@ -1,19 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGCitation : SWGObject - -@property(nonatomic) NSString* cite; - -@property(nonatomic) NSString* source; - -- (id) cite: (NSString*) cite - source: (NSString*) source; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGCitation.m b/samples/client/wordnik-api-objc/client/SWGCitation.m deleted file mode 100644 index a0ffb75d6f6..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGCitation.m +++ /dev/null @@ -1,35 +0,0 @@ -#import "SWGDate.h" -#import "SWGCitation.h" - -@implementation SWGCitation - --(id)cite: (NSString*) cite - source: (NSString*) source -{ - _cite = cite; - _source = source; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _cite = dict[@"cite"]; - _source = dict[@"source"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_cite != nil) dict[@"cite"] = _cite ; - if(_source != nil) dict[@"source"] = _source ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGContentProvider.h b/samples/client/wordnik-api-objc/client/SWGContentProvider.h deleted file mode 100644 index ca85afa74af..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGContentProvider.h +++ /dev/null @@ -1,19 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGContentProvider : SWGObject - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSString* name; - -- (id) _id: (NSNumber*) _id - name: (NSString*) name; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGContentProvider.m b/samples/client/wordnik-api-objc/client/SWGContentProvider.m deleted file mode 100644 index be5337c0b6d..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGContentProvider.m +++ /dev/null @@ -1,35 +0,0 @@ -#import "SWGDate.h" -#import "SWGContentProvider.h" - -@implementation SWGContentProvider - --(id)_id: (NSNumber*) _id - name: (NSString*) name -{ - __id = _id; - _name = name; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - __id = dict[@"id"]; - _name = dict[@"name"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) dict[@"id"] = __id ; - if(_name != nil) dict[@"name"] = _name ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGDate.h b/samples/client/wordnik-api-objc/client/SWGDate.h deleted file mode 100644 index 2c6c7cfe01b..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGDate.h +++ /dev/null @@ -1,12 +0,0 @@ -#import -#import "SWGObject.h" - -@interface SWGDate : SWGObject { -@private - NSDate *_date; -} -@property(nonatomic, readonly) NSDate* date; - -- (id) initWithValues: (NSString*)input; --(NSString*) toString; -@end \ No newline at end of file diff --git a/samples/client/wordnik-api-objc/client/SWGDate.m b/samples/client/wordnik-api-objc/client/SWGDate.m deleted file mode 100644 index 07a1405626b..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGDate.m +++ /dev/null @@ -1,34 +0,0 @@ -#import "SWGDate.h" - -@implementation SWGDate - -@synthesize date = _date; - -- (id) initWithValues:(NSString*)input { - if([input isKindOfClass:[NSString class]]){ - NSDateFormatter* df = [NSDateFormatter new]; - NSLocale *locale = [[NSLocale new] - initWithLocaleIdentifier:@"en_US_POSIX"]; - [df setLocale:locale]; - [df setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"]; - - _date = [df dateFromString:input]; - } - else if([input isKindOfClass:[NSNumber class]]) { - NSTimeInterval interval = [input doubleValue]; - _date = [[NSDate alloc] initWithTimeIntervalSince1970:interval]; - } - return self; -} - --(NSString*) toString { - NSDateFormatter* df = [NSDateFormatter new]; - NSLocale *locale = [[NSLocale new] - initWithLocaleIdentifier:@"en_US_POSIX"]; - [df setLocale:locale]; - [df setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"]; - - return [df stringFromDate:_date]; -} - -@end \ No newline at end of file diff --git a/samples/client/wordnik-api-objc/client/SWGDefinition.h b/samples/client/wordnik-api-objc/client/SWGDefinition.h deleted file mode 100644 index 170df8f3554..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGDefinition.h +++ /dev/null @@ -1,67 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGLabel.h" -#import "SWGExampleUsage.h" -#import "SWGTextPron.h" -#import "SWGCitation.h" -#import "SWGRelated.h" -#import "SWGNote.h" - - -@interface SWGDefinition : SWGObject - -@property(nonatomic) NSString* extendedText; - -@property(nonatomic) NSString* text; - -@property(nonatomic) NSString* sourceDictionary; - -@property(nonatomic) NSArray* citations; - -@property(nonatomic) NSArray* labels; - -@property(nonatomic) NSNumber* score; - -@property(nonatomic) NSArray* exampleUses; - -@property(nonatomic) NSString* attributionUrl; - -@property(nonatomic) NSString* seqString; - -@property(nonatomic) NSString* attributionText; - -@property(nonatomic) NSArray* relatedWords; - -@property(nonatomic) NSString* sequence; - -@property(nonatomic) NSString* word; - -@property(nonatomic) NSArray* notes; - -@property(nonatomic) NSArray* textProns; - -@property(nonatomic) NSString* partOfSpeech; - -- (id) extendedText: (NSString*) extendedText - text: (NSString*) text - sourceDictionary: (NSString*) sourceDictionary - citations: (NSArray*) citations - labels: (NSArray*) labels - score: (NSNumber*) score - exampleUses: (NSArray*) exampleUses - attributionUrl: (NSString*) attributionUrl - seqString: (NSString*) seqString - attributionText: (NSString*) attributionText - relatedWords: (NSArray*) relatedWords - sequence: (NSString*) sequence - word: (NSString*) word - notes: (NSArray*) notes - textProns: (NSArray*) textProns - partOfSpeech: (NSString*) partOfSpeech; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGDefinition.m b/samples/client/wordnik-api-objc/client/SWGDefinition.m deleted file mode 100644 index fa53497953e..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGDefinition.m +++ /dev/null @@ -1,307 +0,0 @@ -#import "SWGDate.h" -#import "SWGDefinition.h" - -@implementation SWGDefinition - --(id)extendedText: (NSString*) extendedText - text: (NSString*) text - sourceDictionary: (NSString*) sourceDictionary - citations: (NSArray*) citations - labels: (NSArray*) labels - score: (NSNumber*) score - exampleUses: (NSArray*) exampleUses - attributionUrl: (NSString*) attributionUrl - seqString: (NSString*) seqString - attributionText: (NSString*) attributionText - relatedWords: (NSArray*) relatedWords - sequence: (NSString*) sequence - word: (NSString*) word - notes: (NSArray*) notes - textProns: (NSArray*) textProns - partOfSpeech: (NSString*) partOfSpeech -{ - _extendedText = extendedText; - _text = text; - _sourceDictionary = sourceDictionary; - _citations = citations; - _labels = labels; - _score = score; - _exampleUses = exampleUses; - _attributionUrl = attributionUrl; - _seqString = seqString; - _attributionText = attributionText; - _relatedWords = relatedWords; - _sequence = sequence; - _word = word; - _notes = notes; - _textProns = textProns; - _partOfSpeech = partOfSpeech; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _extendedText = dict[@"extendedText"]; - _text = dict[@"text"]; - _sourceDictionary = dict[@"sourceDictionary"]; - id citations_dict = dict[@"citations"]; - if([citations_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)citations_dict count]]; - - if([(NSArray*)citations_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)citations_dict) { - SWGCitation* d = [[SWGCitation alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _citations = [[NSArray alloc] initWithArray:objs]; - } - else { - _citations = [[NSArray alloc] init]; - } - } - else { - _citations = [[NSArray alloc] init]; - } - id labels_dict = dict[@"labels"]; - if([labels_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)labels_dict count]]; - - if([(NSArray*)labels_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)labels_dict) { - SWGLabel* d = [[SWGLabel alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _labels = [[NSArray alloc] initWithArray:objs]; - } - else { - _labels = [[NSArray alloc] init]; - } - } - else { - _labels = [[NSArray alloc] init]; - } - _score = dict[@"score"]; - id exampleUses_dict = dict[@"exampleUses"]; - if([exampleUses_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)exampleUses_dict count]]; - - if([(NSArray*)exampleUses_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)exampleUses_dict) { - SWGExampleUsage* d = [[SWGExampleUsage alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _exampleUses = [[NSArray alloc] initWithArray:objs]; - } - else { - _exampleUses = [[NSArray alloc] init]; - } - } - else { - _exampleUses = [[NSArray alloc] init]; - } - _attributionUrl = dict[@"attributionUrl"]; - _seqString = dict[@"seqString"]; - _attributionText = dict[@"attributionText"]; - id relatedWords_dict = dict[@"relatedWords"]; - if([relatedWords_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)relatedWords_dict count]]; - - if([(NSArray*)relatedWords_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)relatedWords_dict) { - SWGRelated* d = [[SWGRelated alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _relatedWords = [[NSArray alloc] initWithArray:objs]; - } - else { - _relatedWords = [[NSArray alloc] init]; - } - } - else { - _relatedWords = [[NSArray alloc] init]; - } - _sequence = dict[@"sequence"]; - _word = dict[@"word"]; - id notes_dict = dict[@"notes"]; - if([notes_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)notes_dict count]]; - - if([(NSArray*)notes_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)notes_dict) { - SWGNote* d = [[SWGNote alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _notes = [[NSArray alloc] initWithArray:objs]; - } - else { - _notes = [[NSArray alloc] init]; - } - } - else { - _notes = [[NSArray alloc] init]; - } - id textProns_dict = dict[@"textProns"]; - if([textProns_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)textProns_dict count]]; - - if([(NSArray*)textProns_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)textProns_dict) { - SWGTextPron* d = [[SWGTextPron alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _textProns = [[NSArray alloc] initWithArray:objs]; - } - else { - _textProns = [[NSArray alloc] init]; - } - } - else { - _textProns = [[NSArray alloc] init]; - } - _partOfSpeech = dict[@"partOfSpeech"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_extendedText != nil) dict[@"extendedText"] = _extendedText ; - if(_text != nil) dict[@"text"] = _text ; - if(_sourceDictionary != nil) dict[@"sourceDictionary"] = _sourceDictionary ; - if(_citations != nil){ - if([_citations isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGCitation *citations in (NSArray*)_citations) { - [array addObject:[(SWGObject*)citations asDictionary]]; - } - dict[@"citations"] = array; - } - else if(_citations && [_citations isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_citations toString]; - if(dateString){ - dict[@"citations"] = dateString; - } - } - else { - if(_citations != nil) dict[@"citations"] = [(SWGObject*)_citations asDictionary]; - } - } - if(_labels != nil){ - if([_labels isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGLabel *labels in (NSArray*)_labels) { - [array addObject:[(SWGObject*)labels asDictionary]]; - } - dict[@"labels"] = array; - } - else if(_labels && [_labels isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_labels toString]; - if(dateString){ - dict[@"labels"] = dateString; - } - } - else { - if(_labels != nil) dict[@"labels"] = [(SWGObject*)_labels asDictionary]; - } - } - if(_score != nil) dict[@"score"] = _score ; - if(_exampleUses != nil){ - if([_exampleUses isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGExampleUsage *exampleUses in (NSArray*)_exampleUses) { - [array addObject:[(SWGObject*)exampleUses asDictionary]]; - } - dict[@"exampleUses"] = array; - } - else if(_exampleUses && [_exampleUses isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_exampleUses toString]; - if(dateString){ - dict[@"exampleUses"] = dateString; - } - } - else { - if(_exampleUses != nil) dict[@"exampleUses"] = [(SWGObject*)_exampleUses asDictionary]; - } - } - if(_attributionUrl != nil) dict[@"attributionUrl"] = _attributionUrl ; - if(_seqString != nil) dict[@"seqString"] = _seqString ; - if(_attributionText != nil) dict[@"attributionText"] = _attributionText ; - if(_relatedWords != nil){ - if([_relatedWords isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGRelated *relatedWords in (NSArray*)_relatedWords) { - [array addObject:[(SWGObject*)relatedWords asDictionary]]; - } - dict[@"relatedWords"] = array; - } - else if(_relatedWords && [_relatedWords isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_relatedWords toString]; - if(dateString){ - dict[@"relatedWords"] = dateString; - } - } - else { - if(_relatedWords != nil) dict[@"relatedWords"] = [(SWGObject*)_relatedWords asDictionary]; - } - } - if(_sequence != nil) dict[@"sequence"] = _sequence ; - if(_word != nil) dict[@"word"] = _word ; - if(_notes != nil){ - if([_notes isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGNote *notes in (NSArray*)_notes) { - [array addObject:[(SWGObject*)notes asDictionary]]; - } - dict[@"notes"] = array; - } - else if(_notes && [_notes isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_notes toString]; - if(dateString){ - dict[@"notes"] = dateString; - } - } - else { - if(_notes != nil) dict[@"notes"] = [(SWGObject*)_notes asDictionary]; - } - } - if(_textProns != nil){ - if([_textProns isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGTextPron *textProns in (NSArray*)_textProns) { - [array addObject:[(SWGObject*)textProns asDictionary]]; - } - dict[@"textProns"] = array; - } - else if(_textProns && [_textProns isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_textProns toString]; - if(dateString){ - dict[@"textProns"] = dateString; - } - } - else { - if(_textProns != nil) dict[@"textProns"] = [(SWGObject*)_textProns asDictionary]; - } - } - if(_partOfSpeech != nil) dict[@"partOfSpeech"] = _partOfSpeech ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGDefinitionSearchResults.h b/samples/client/wordnik-api-objc/client/SWGDefinitionSearchResults.h deleted file mode 100644 index b0fbf13e163..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGDefinitionSearchResults.h +++ /dev/null @@ -1,20 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGDefinition.h" - - -@interface SWGDefinitionSearchResults : SWGObject - -@property(nonatomic) NSArray* results; - -@property(nonatomic) NSNumber* totalResults; - -- (id) results: (NSArray*) results - totalResults: (NSNumber*) totalResults; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGDefinitionSearchResults.m b/samples/client/wordnik-api-objc/client/SWGDefinitionSearchResults.m deleted file mode 100644 index ac5a746043b..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGDefinitionSearchResults.m +++ /dev/null @@ -1,71 +0,0 @@ -#import "SWGDate.h" -#import "SWGDefinitionSearchResults.h" - -@implementation SWGDefinitionSearchResults - --(id)results: (NSArray*) results - totalResults: (NSNumber*) totalResults -{ - _results = results; - _totalResults = totalResults; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - id results_dict = dict[@"results"]; - if([results_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)results_dict count]]; - - if([(NSArray*)results_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)results_dict) { - SWGDefinition* d = [[SWGDefinition alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _results = [[NSArray alloc] initWithArray:objs]; - } - else { - _results = [[NSArray alloc] init]; - } - } - else { - _results = [[NSArray alloc] init]; - } - _totalResults = dict[@"totalResults"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_results != nil){ - if([_results isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGDefinition *results in (NSArray*)_results) { - [array addObject:[(SWGObject*)results asDictionary]]; - } - dict[@"results"] = array; - } - else if(_results && [_results isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_results toString]; - if(dateString){ - dict[@"results"] = dateString; - } - } - else { - if(_results != nil) dict[@"results"] = [(SWGObject*)_results asDictionary]; - } - } - if(_totalResults != nil) dict[@"totalResults"] = _totalResults ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGExample.h b/samples/client/wordnik-api-objc/client/SWGExample.h deleted file mode 100644 index eea0fe81a7b..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGExample.h +++ /dev/null @@ -1,52 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGSentence.h" -#import "SWGContentProvider.h" -#import "SWGScoredWord.h" - - -@interface SWGExample : SWGObject - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSNumber* exampleId; - -@property(nonatomic) NSString* title; - -@property(nonatomic) NSString* text; - -@property(nonatomic) SWGScoredWord* score; - -@property(nonatomic) SWGSentence* sentence; - -@property(nonatomic) NSString* word; - -@property(nonatomic) SWGContentProvider* provider; - -@property(nonatomic) NSNumber* year; - -@property(nonatomic) NSNumber* rating; - -@property(nonatomic) NSNumber* documentId; - -@property(nonatomic) NSString* url; - -- (id) _id: (NSNumber*) _id - exampleId: (NSNumber*) exampleId - title: (NSString*) title - text: (NSString*) text - score: (SWGScoredWord*) score - sentence: (SWGSentence*) sentence - word: (NSString*) word - provider: (SWGContentProvider*) provider - year: (NSNumber*) year - rating: (NSNumber*) rating - documentId: (NSNumber*) documentId - url: (NSString*) url; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGExample.m b/samples/client/wordnik-api-objc/client/SWGExample.m deleted file mode 100644 index 5249ceffde8..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGExample.m +++ /dev/null @@ -1,132 +0,0 @@ -#import "SWGDate.h" -#import "SWGExample.h" - -@implementation SWGExample - --(id)_id: (NSNumber*) _id - exampleId: (NSNumber*) exampleId - title: (NSString*) title - text: (NSString*) text - score: (SWGScoredWord*) score - sentence: (SWGSentence*) sentence - word: (NSString*) word - provider: (SWGContentProvider*) provider - year: (NSNumber*) year - rating: (NSNumber*) rating - documentId: (NSNumber*) documentId - url: (NSString*) url -{ - __id = _id; - _exampleId = exampleId; - _title = title; - _text = text; - _score = score; - _sentence = sentence; - _word = word; - _provider = provider; - _year = year; - _rating = rating; - _documentId = documentId; - _url = url; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - __id = dict[@"id"]; - _exampleId = dict[@"exampleId"]; - _title = dict[@"title"]; - _text = dict[@"text"]; - id score_dict = dict[@"score"]; - if(score_dict != nil) - _score = [[SWGScoredWord alloc]initWithValues:score_dict]; - id sentence_dict = dict[@"sentence"]; - if(sentence_dict != nil) - _sentence = [[SWGSentence alloc]initWithValues:sentence_dict]; - _word = dict[@"word"]; - id provider_dict = dict[@"provider"]; - if(provider_dict != nil) - _provider = [[SWGContentProvider alloc]initWithValues:provider_dict]; - _year = dict[@"year"]; - _rating = dict[@"rating"]; - _documentId = dict[@"documentId"]; - _url = dict[@"url"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) dict[@"id"] = __id ; - if(_exampleId != nil) dict[@"exampleId"] = _exampleId ; - if(_title != nil) dict[@"title"] = _title ; - if(_text != nil) dict[@"text"] = _text ; - if(_score != nil){ - if([_score isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGScoredWord *score in (NSArray*)_score) { - [array addObject:[(SWGObject*)score asDictionary]]; - } - dict[@"score"] = array; - } - else if(_score && [_score isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_score toString]; - if(dateString){ - dict[@"score"] = dateString; - } - } - else { - if(_score != nil) dict[@"score"] = [(SWGObject*)_score asDictionary]; - } - } - if(_sentence != nil){ - if([_sentence isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGSentence *sentence in (NSArray*)_sentence) { - [array addObject:[(SWGObject*)sentence asDictionary]]; - } - dict[@"sentence"] = array; - } - else if(_sentence && [_sentence isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_sentence toString]; - if(dateString){ - dict[@"sentence"] = dateString; - } - } - else { - if(_sentence != nil) dict[@"sentence"] = [(SWGObject*)_sentence asDictionary]; - } - } - if(_word != nil) dict[@"word"] = _word ; - if(_provider != nil){ - if([_provider isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGContentProvider *provider in (NSArray*)_provider) { - [array addObject:[(SWGObject*)provider asDictionary]]; - } - dict[@"provider"] = array; - } - else if(_provider && [_provider isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_provider toString]; - if(dateString){ - dict[@"provider"] = dateString; - } - } - else { - if(_provider != nil) dict[@"provider"] = [(SWGObject*)_provider asDictionary]; - } - } - if(_year != nil) dict[@"year"] = _year ; - if(_rating != nil) dict[@"rating"] = _rating ; - if(_documentId != nil) dict[@"documentId"] = _documentId ; - if(_url != nil) dict[@"url"] = _url ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGExampleSearchResults.h b/samples/client/wordnik-api-objc/client/SWGExampleSearchResults.h deleted file mode 100644 index e4caa320967..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGExampleSearchResults.h +++ /dev/null @@ -1,21 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGFacet.h" -#import "SWGExample.h" - - -@interface SWGExampleSearchResults : SWGObject - -@property(nonatomic) NSArray* facets; - -@property(nonatomic) NSArray* examples; - -- (id) facets: (NSArray*) facets - examples: (NSArray*) examples; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGExampleSearchResults.m b/samples/client/wordnik-api-objc/client/SWGExampleSearchResults.m deleted file mode 100644 index 01f1319c4fe..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGExampleSearchResults.m +++ /dev/null @@ -1,107 +0,0 @@ -#import "SWGDate.h" -#import "SWGExampleSearchResults.h" - -@implementation SWGExampleSearchResults - --(id)facets: (NSArray*) facets - examples: (NSArray*) examples -{ - _facets = facets; - _examples = examples; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - id facets_dict = dict[@"facets"]; - if([facets_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)facets_dict count]]; - - if([(NSArray*)facets_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)facets_dict) { - SWGFacet* d = [[SWGFacet alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _facets = [[NSArray alloc] initWithArray:objs]; - } - else { - _facets = [[NSArray alloc] init]; - } - } - else { - _facets = [[NSArray alloc] init]; - } - id examples_dict = dict[@"examples"]; - if([examples_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)examples_dict count]]; - - if([(NSArray*)examples_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)examples_dict) { - SWGExample* d = [[SWGExample alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _examples = [[NSArray alloc] initWithArray:objs]; - } - else { - _examples = [[NSArray alloc] init]; - } - } - else { - _examples = [[NSArray alloc] init]; - } - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_facets != nil){ - if([_facets isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGFacet *facets in (NSArray*)_facets) { - [array addObject:[(SWGObject*)facets asDictionary]]; - } - dict[@"facets"] = array; - } - else if(_facets && [_facets isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_facets toString]; - if(dateString){ - dict[@"facets"] = dateString; - } - } - else { - if(_facets != nil) dict[@"facets"] = [(SWGObject*)_facets asDictionary]; - } - } - if(_examples != nil){ - if([_examples isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGExample *examples in (NSArray*)_examples) { - [array addObject:[(SWGObject*)examples asDictionary]]; - } - dict[@"examples"] = array; - } - else if(_examples && [_examples isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_examples toString]; - if(dateString){ - dict[@"examples"] = dateString; - } - } - else { - if(_examples != nil) dict[@"examples"] = [(SWGObject*)_examples asDictionary]; - } - } - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGExampleUsage.h b/samples/client/wordnik-api-objc/client/SWGExampleUsage.h deleted file mode 100644 index 629139108e8..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGExampleUsage.h +++ /dev/null @@ -1,16 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGExampleUsage : SWGObject - -@property(nonatomic) NSString* text; - -- (id) text: (NSString*) text; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGExampleUsage.m b/samples/client/wordnik-api-objc/client/SWGExampleUsage.m deleted file mode 100644 index b4887d79255..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGExampleUsage.m +++ /dev/null @@ -1,31 +0,0 @@ -#import "SWGDate.h" -#import "SWGExampleUsage.h" - -@implementation SWGExampleUsage - --(id)text: (NSString*) text -{ - _text = text; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _text = dict[@"text"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_text != nil) dict[@"text"] = _text ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGFacet.h b/samples/client/wordnik-api-objc/client/SWGFacet.h deleted file mode 100644 index 2b6cec19304..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGFacet.h +++ /dev/null @@ -1,20 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGFacetValue.h" - - -@interface SWGFacet : SWGObject - -@property(nonatomic) NSArray* facetValues; - -@property(nonatomic) NSString* name; - -- (id) facetValues: (NSArray*) facetValues - name: (NSString*) name; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGFacet.m b/samples/client/wordnik-api-objc/client/SWGFacet.m deleted file mode 100644 index 4a48345e862..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGFacet.m +++ /dev/null @@ -1,71 +0,0 @@ -#import "SWGDate.h" -#import "SWGFacet.h" - -@implementation SWGFacet - --(id)facetValues: (NSArray*) facetValues - name: (NSString*) name -{ - _facetValues = facetValues; - _name = name; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - id facetValues_dict = dict[@"facetValues"]; - if([facetValues_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)facetValues_dict count]]; - - if([(NSArray*)facetValues_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)facetValues_dict) { - SWGFacetValue* d = [[SWGFacetValue alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _facetValues = [[NSArray alloc] initWithArray:objs]; - } - else { - _facetValues = [[NSArray alloc] init]; - } - } - else { - _facetValues = [[NSArray alloc] init]; - } - _name = dict[@"name"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_facetValues != nil){ - if([_facetValues isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGFacetValue *facetValues in (NSArray*)_facetValues) { - [array addObject:[(SWGObject*)facetValues asDictionary]]; - } - dict[@"facetValues"] = array; - } - else if(_facetValues && [_facetValues isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_facetValues toString]; - if(dateString){ - dict[@"facetValues"] = dateString; - } - } - else { - if(_facetValues != nil) dict[@"facetValues"] = [(SWGObject*)_facetValues asDictionary]; - } - } - if(_name != nil) dict[@"name"] = _name ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGFacetValue.h b/samples/client/wordnik-api-objc/client/SWGFacetValue.h deleted file mode 100644 index 3e434ae763a..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGFacetValue.h +++ /dev/null @@ -1,19 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGFacetValue : SWGObject - -@property(nonatomic) NSNumber* count; - -@property(nonatomic) NSString* value; - -- (id) count: (NSNumber*) count - value: (NSString*) value; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGFacetValue.m b/samples/client/wordnik-api-objc/client/SWGFacetValue.m deleted file mode 100644 index 6dbbfc755b6..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGFacetValue.m +++ /dev/null @@ -1,35 +0,0 @@ -#import "SWGDate.h" -#import "SWGFacetValue.h" - -@implementation SWGFacetValue - --(id)count: (NSNumber*) count - value: (NSString*) value -{ - _count = count; - _value = value; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _count = dict[@"count"]; - _value = dict[@"value"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_count != nil) dict[@"count"] = _count ; - if(_value != nil) dict[@"value"] = _value ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGFile.h b/samples/client/wordnik-api-objc/client/SWGFile.h deleted file mode 100644 index fe6e81c289d..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGFile.h +++ /dev/null @@ -1,13 +0,0 @@ -#import - -@interface SWGFile : NSObject - -@property(nonatomic, readonly) NSString* name; -@property(nonatomic, readonly) NSString* mimeType; -@property(nonatomic, readonly) NSData* data; - -- (id) initWithNameData: (NSString*) filename - mimeType: (NSString*) mimeType - data: (NSData*) data; - - @end \ No newline at end of file diff --git a/samples/client/wordnik-api-objc/client/SWGFile.m b/samples/client/wordnik-api-objc/client/SWGFile.m deleted file mode 100644 index 42552767af4..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGFile.m +++ /dev/null @@ -1,26 +0,0 @@ -#import "SWGFile.h" - -@implementation SWGFile - -@synthesize name = _name; -@synthesize mimeType = _mimeType; -@synthesize data = _data; - -- (id) init { - self = [super init]; - return self; -} - -- (id) initWithNameData: (NSString*) filename - mimeType: (NSString*) fileMimeType - data: (NSData*) data { - self = [super init]; - if(self) { - _name = filename; - _mimeType = fileMimeType; - _data = data; - } - return self; -} - -@end \ No newline at end of file diff --git a/samples/client/wordnik-api-objc/client/SWGFrequency.h b/samples/client/wordnik-api-objc/client/SWGFrequency.h deleted file mode 100644 index abe388e2c82..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGFrequency.h +++ /dev/null @@ -1,19 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGFrequency : SWGObject - -@property(nonatomic) NSNumber* count; - -@property(nonatomic) NSNumber* year; - -- (id) count: (NSNumber*) count - year: (NSNumber*) year; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGFrequency.m b/samples/client/wordnik-api-objc/client/SWGFrequency.m deleted file mode 100644 index cd7345d3b95..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGFrequency.m +++ /dev/null @@ -1,35 +0,0 @@ -#import "SWGDate.h" -#import "SWGFrequency.h" - -@implementation SWGFrequency - --(id)count: (NSNumber*) count - year: (NSNumber*) year -{ - _count = count; - _year = year; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _count = dict[@"count"]; - _year = dict[@"year"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_count != nil) dict[@"count"] = _count ; - if(_year != nil) dict[@"year"] = _year ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGFrequencySummary.h b/samples/client/wordnik-api-objc/client/SWGFrequencySummary.h deleted file mode 100644 index e7f25905dc0..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGFrequencySummary.h +++ /dev/null @@ -1,29 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGFrequency.h" - - -@interface SWGFrequencySummary : SWGObject - -@property(nonatomic) NSNumber* unknownYearCount; - -@property(nonatomic) NSNumber* totalCount; - -@property(nonatomic) NSString* frequencyString; - -@property(nonatomic) NSString* word; - -@property(nonatomic) NSArray* frequency; - -- (id) unknownYearCount: (NSNumber*) unknownYearCount - totalCount: (NSNumber*) totalCount - frequencyString: (NSString*) frequencyString - word: (NSString*) word - frequency: (NSArray*) frequency; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGFrequencySummary.m b/samples/client/wordnik-api-objc/client/SWGFrequencySummary.m deleted file mode 100644 index 46d28a6bb73..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGFrequencySummary.m +++ /dev/null @@ -1,83 +0,0 @@ -#import "SWGDate.h" -#import "SWGFrequencySummary.h" - -@implementation SWGFrequencySummary - --(id)unknownYearCount: (NSNumber*) unknownYearCount - totalCount: (NSNumber*) totalCount - frequencyString: (NSString*) frequencyString - word: (NSString*) word - frequency: (NSArray*) frequency -{ - _unknownYearCount = unknownYearCount; - _totalCount = totalCount; - _frequencyString = frequencyString; - _word = word; - _frequency = frequency; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _unknownYearCount = dict[@"unknownYearCount"]; - _totalCount = dict[@"totalCount"]; - _frequencyString = dict[@"frequencyString"]; - _word = dict[@"word"]; - id frequency_dict = dict[@"frequency"]; - if([frequency_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)frequency_dict count]]; - - if([(NSArray*)frequency_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)frequency_dict) { - SWGFrequency* d = [[SWGFrequency alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _frequency = [[NSArray alloc] initWithArray:objs]; - } - else { - _frequency = [[NSArray alloc] init]; - } - } - else { - _frequency = [[NSArray alloc] init]; - } - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_unknownYearCount != nil) dict[@"unknownYearCount"] = _unknownYearCount ; - if(_totalCount != nil) dict[@"totalCount"] = _totalCount ; - if(_frequencyString != nil) dict[@"frequencyString"] = _frequencyString ; - if(_word != nil) dict[@"word"] = _word ; - if(_frequency != nil){ - if([_frequency isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGFrequency *frequency in (NSArray*)_frequency) { - [array addObject:[(SWGObject*)frequency asDictionary]]; - } - dict[@"frequency"] = array; - } - else if(_frequency && [_frequency isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_frequency toString]; - if(dateString){ - dict[@"frequency"] = dateString; - } - } - else { - if(_frequency != nil) dict[@"frequency"] = [(SWGObject*)_frequency asDictionary]; - } - } - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGLabel.h b/samples/client/wordnik-api-objc/client/SWGLabel.h deleted file mode 100644 index bc3366425f9..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGLabel.h +++ /dev/null @@ -1,19 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGLabel : SWGObject - -@property(nonatomic) NSString* text; - -@property(nonatomic) NSString* type; - -- (id) text: (NSString*) text - type: (NSString*) type; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGLabel.m b/samples/client/wordnik-api-objc/client/SWGLabel.m deleted file mode 100644 index cb62621fcab..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGLabel.m +++ /dev/null @@ -1,35 +0,0 @@ -#import "SWGDate.h" -#import "SWGLabel.h" - -@implementation SWGLabel - --(id)text: (NSString*) text - type: (NSString*) type -{ - _text = text; - _type = type; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _text = dict[@"text"]; - _type = dict[@"type"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_text != nil) dict[@"text"] = _text ; - if(_type != nil) dict[@"type"] = _type ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGNote.h b/samples/client/wordnik-api-objc/client/SWGNote.h deleted file mode 100644 index 48d45fbc9bb..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGNote.h +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGNote : SWGObject - -@property(nonatomic) NSString* noteType; - -@property(nonatomic) NSArray* appliesTo; - -@property(nonatomic) NSString* value; - -@property(nonatomic) NSNumber* pos; - -- (id) noteType: (NSString*) noteType - appliesTo: (NSArray*) appliesTo - value: (NSString*) value - pos: (NSNumber*) pos; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGNote.m b/samples/client/wordnik-api-objc/client/SWGNote.m deleted file mode 100644 index 4755a8cc3b3..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGNote.m +++ /dev/null @@ -1,43 +0,0 @@ -#import "SWGDate.h" -#import "SWGNote.h" - -@implementation SWGNote - --(id)noteType: (NSString*) noteType - appliesTo: (NSArray*) appliesTo - value: (NSString*) value - pos: (NSNumber*) pos -{ - _noteType = noteType; - _appliesTo = appliesTo; - _value = value; - _pos = pos; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _noteType = dict[@"noteType"]; - _appliesTo = dict[@"appliesTo"]; - _value = dict[@"value"]; - _pos = dict[@"pos"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_noteType != nil) dict[@"noteType"] = _noteType ; - if(_appliesTo != nil) dict[@"appliesTo"] = _appliesTo ; - if(_value != nil) dict[@"value"] = _value ; - if(_pos != nil) dict[@"pos"] = _pos ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGObject.h b/samples/client/wordnik-api-objc/client/SWGObject.h deleted file mode 100644 index 031bae69279..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGObject.h +++ /dev/null @@ -1,6 +0,0 @@ -#import - -@interface SWGObject : NSObject -- (id) initWithValues:(NSDictionary*)dict; -- (NSDictionary*) asDictionary; -@end diff --git a/samples/client/wordnik-api-objc/client/SWGObject.m b/samples/client/wordnik-api-objc/client/SWGObject.m deleted file mode 100644 index 9b37b3592b1..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGObject.m +++ /dev/null @@ -1,17 +0,0 @@ -#import "SWGObject.h" - -@implementation SWGObject - -- (id) initWithValues:(NSDictionary*)dict { - return self; -} - -- (NSDictionary*) asDictionary{ - return [NSDictionary init]; -} - -- (NSString*)description { - return [NSString stringWithFormat:@"%@ %@", [super description], [self asDictionary]]; -} - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGRelated.h b/samples/client/wordnik-api-objc/client/SWGRelated.h deleted file mode 100644 index 2b5b19596cc..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGRelated.h +++ /dev/null @@ -1,34 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGRelated : SWGObject - -@property(nonatomic) NSString* label1; - -@property(nonatomic) NSString* relationshipType; - -@property(nonatomic) NSString* label2; - -@property(nonatomic) NSString* label3; - -@property(nonatomic) NSArray* words; - -@property(nonatomic) NSString* gram; - -@property(nonatomic) NSString* label4; - -- (id) label1: (NSString*) label1 - relationshipType: (NSString*) relationshipType - label2: (NSString*) label2 - label3: (NSString*) label3 - words: (NSArray*) words - gram: (NSString*) gram - label4: (NSString*) label4; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGRelated.m b/samples/client/wordnik-api-objc/client/SWGRelated.m deleted file mode 100644 index a13043ecb5d..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGRelated.m +++ /dev/null @@ -1,55 +0,0 @@ -#import "SWGDate.h" -#import "SWGRelated.h" - -@implementation SWGRelated - --(id)label1: (NSString*) label1 - relationshipType: (NSString*) relationshipType - label2: (NSString*) label2 - label3: (NSString*) label3 - words: (NSArray*) words - gram: (NSString*) gram - label4: (NSString*) label4 -{ - _label1 = label1; - _relationshipType = relationshipType; - _label2 = label2; - _label3 = label3; - _words = words; - _gram = gram; - _label4 = label4; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _label1 = dict[@"label1"]; - _relationshipType = dict[@"relationshipType"]; - _label2 = dict[@"label2"]; - _label3 = dict[@"label3"]; - _words = dict[@"words"]; - _gram = dict[@"gram"]; - _label4 = dict[@"label4"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_label1 != nil) dict[@"label1"] = _label1 ; - if(_relationshipType != nil) dict[@"relationshipType"] = _relationshipType ; - if(_label2 != nil) dict[@"label2"] = _label2 ; - if(_label3 != nil) dict[@"label3"] = _label3 ; - if(_words != nil) dict[@"words"] = _words ; - if(_gram != nil) dict[@"gram"] = _gram ; - if(_label4 != nil) dict[@"label4"] = _label4 ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGScoredWord.h b/samples/client/wordnik-api-objc/client/SWGScoredWord.h deleted file mode 100644 index 847c4ecdbb1..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGScoredWord.h +++ /dev/null @@ -1,46 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGScoredWord : SWGObject - -@property(nonatomic) NSNumber* position; - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSNumber* docTermCount; - -@property(nonatomic) NSString* lemma; - -@property(nonatomic) NSString* wordType; - -@property(nonatomic) NSNumber* score; - -@property(nonatomic) NSNumber* sentenceId; - -@property(nonatomic) NSString* word; - -@property(nonatomic) NSNumber* stopword; - -@property(nonatomic) NSNumber* baseWordScore; - -@property(nonatomic) NSString* partOfSpeech; - -- (id) position: (NSNumber*) position - _id: (NSNumber*) _id - docTermCount: (NSNumber*) docTermCount - lemma: (NSString*) lemma - wordType: (NSString*) wordType - score: (NSNumber*) score - sentenceId: (NSNumber*) sentenceId - word: (NSString*) word - stopword: (NSNumber*) stopword - baseWordScore: (NSNumber*) baseWordScore - partOfSpeech: (NSString*) partOfSpeech; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGScoredWord.m b/samples/client/wordnik-api-objc/client/SWGScoredWord.m deleted file mode 100644 index c8f508a076a..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGScoredWord.m +++ /dev/null @@ -1,71 +0,0 @@ -#import "SWGDate.h" -#import "SWGScoredWord.h" - -@implementation SWGScoredWord - --(id)position: (NSNumber*) position - _id: (NSNumber*) _id - docTermCount: (NSNumber*) docTermCount - lemma: (NSString*) lemma - wordType: (NSString*) wordType - score: (NSNumber*) score - sentenceId: (NSNumber*) sentenceId - word: (NSString*) word - stopword: (NSNumber*) stopword - baseWordScore: (NSNumber*) baseWordScore - partOfSpeech: (NSString*) partOfSpeech -{ - _position = position; - __id = _id; - _docTermCount = docTermCount; - _lemma = lemma; - _wordType = wordType; - _score = score; - _sentenceId = sentenceId; - _word = word; - _stopword = stopword; - _baseWordScore = baseWordScore; - _partOfSpeech = partOfSpeech; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _position = dict[@"position"]; - __id = dict[@"id"]; - _docTermCount = dict[@"docTermCount"]; - _lemma = dict[@"lemma"]; - _wordType = dict[@"wordType"]; - _score = dict[@"score"]; - _sentenceId = dict[@"sentenceId"]; - _word = dict[@"word"]; - _stopword = dict[@"stopword"]; - _baseWordScore = dict[@"baseWordScore"]; - _partOfSpeech = dict[@"partOfSpeech"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_position != nil) dict[@"position"] = _position ; - if(__id != nil) dict[@"id"] = __id ; - if(_docTermCount != nil) dict[@"docTermCount"] = _docTermCount ; - if(_lemma != nil) dict[@"lemma"] = _lemma ; - if(_wordType != nil) dict[@"wordType"] = _wordType ; - if(_score != nil) dict[@"score"] = _score ; - if(_sentenceId != nil) dict[@"sentenceId"] = _sentenceId ; - if(_word != nil) dict[@"word"] = _word ; - if(_stopword != nil) dict[@"stopword"] = _stopword ; - if(_baseWordScore != nil) dict[@"baseWordScore"] = _baseWordScore ; - if(_partOfSpeech != nil) dict[@"partOfSpeech"] = _partOfSpeech ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGScrabbleScoreResult.h b/samples/client/wordnik-api-objc/client/SWGScrabbleScoreResult.h deleted file mode 100644 index 03a7e8c2c8d..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGScrabbleScoreResult.h +++ /dev/null @@ -1,16 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGScrabbleScoreResult : SWGObject - -@property(nonatomic) NSNumber* value; - -- (id) value: (NSNumber*) value; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGScrabbleScoreResult.m b/samples/client/wordnik-api-objc/client/SWGScrabbleScoreResult.m deleted file mode 100644 index 16768110f6b..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGScrabbleScoreResult.m +++ /dev/null @@ -1,31 +0,0 @@ -#import "SWGDate.h" -#import "SWGScrabbleScoreResult.h" - -@implementation SWGScrabbleScoreResult - --(id)value: (NSNumber*) value -{ - _value = value; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _value = dict[@"value"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_value != nil) dict[@"value"] = _value ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGSentence.h b/samples/client/wordnik-api-objc/client/SWGSentence.h deleted file mode 100644 index 8ae078086eb..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGSentence.h +++ /dev/null @@ -1,32 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGScoredWord.h" - - -@interface SWGSentence : SWGObject - -@property(nonatomic) NSNumber* hasScoredWords; - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSArray* scoredWords; - -@property(nonatomic) NSString* display; - -@property(nonatomic) NSNumber* rating; - -@property(nonatomic) NSNumber* documentMetadataId; - -- (id) hasScoredWords: (NSNumber*) hasScoredWords - _id: (NSNumber*) _id - scoredWords: (NSArray*) scoredWords - display: (NSString*) display - rating: (NSNumber*) rating - documentMetadataId: (NSNumber*) documentMetadataId; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGSentence.m b/samples/client/wordnik-api-objc/client/SWGSentence.m deleted file mode 100644 index 5b716e70077..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGSentence.m +++ /dev/null @@ -1,87 +0,0 @@ -#import "SWGDate.h" -#import "SWGSentence.h" - -@implementation SWGSentence - --(id)hasScoredWords: (NSNumber*) hasScoredWords - _id: (NSNumber*) _id - scoredWords: (NSArray*) scoredWords - display: (NSString*) display - rating: (NSNumber*) rating - documentMetadataId: (NSNumber*) documentMetadataId -{ - _hasScoredWords = hasScoredWords; - __id = _id; - _scoredWords = scoredWords; - _display = display; - _rating = rating; - _documentMetadataId = documentMetadataId; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _hasScoredWords = dict[@"hasScoredWords"]; - __id = dict[@"id"]; - id scoredWords_dict = dict[@"scoredWords"]; - if([scoredWords_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)scoredWords_dict count]]; - - if([(NSArray*)scoredWords_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)scoredWords_dict) { - SWGScoredWord* d = [[SWGScoredWord alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _scoredWords = [[NSArray alloc] initWithArray:objs]; - } - else { - _scoredWords = [[NSArray alloc] init]; - } - } - else { - _scoredWords = [[NSArray alloc] init]; - } - _display = dict[@"display"]; - _rating = dict[@"rating"]; - _documentMetadataId = dict[@"documentMetadataId"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_hasScoredWords != nil) dict[@"hasScoredWords"] = _hasScoredWords ; - if(__id != nil) dict[@"id"] = __id ; - if(_scoredWords != nil){ - if([_scoredWords isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGScoredWord *scoredWords in (NSArray*)_scoredWords) { - [array addObject:[(SWGObject*)scoredWords asDictionary]]; - } - dict[@"scoredWords"] = array; - } - else if(_scoredWords && [_scoredWords isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_scoredWords toString]; - if(dateString){ - dict[@"scoredWords"] = dateString; - } - } - else { - if(_scoredWords != nil) dict[@"scoredWords"] = [(SWGObject*)_scoredWords asDictionary]; - } - } - if(_display != nil) dict[@"display"] = _display ; - if(_rating != nil) dict[@"rating"] = _rating ; - if(_documentMetadataId != nil) dict[@"documentMetadataId"] = _documentMetadataId ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGSimpleDefinition.h b/samples/client/wordnik-api-objc/client/SWGSimpleDefinition.h deleted file mode 100644 index 4f42e142c2b..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGSimpleDefinition.h +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGSimpleDefinition : SWGObject - -@property(nonatomic) NSString* text; - -@property(nonatomic) NSString* source; - -@property(nonatomic) NSString* note; - -@property(nonatomic) NSString* partOfSpeech; - -- (id) text: (NSString*) text - source: (NSString*) source - note: (NSString*) note - partOfSpeech: (NSString*) partOfSpeech; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGSimpleDefinition.m b/samples/client/wordnik-api-objc/client/SWGSimpleDefinition.m deleted file mode 100644 index b86c662dd10..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGSimpleDefinition.m +++ /dev/null @@ -1,43 +0,0 @@ -#import "SWGDate.h" -#import "SWGSimpleDefinition.h" - -@implementation SWGSimpleDefinition - --(id)text: (NSString*) text - source: (NSString*) source - note: (NSString*) note - partOfSpeech: (NSString*) partOfSpeech -{ - _text = text; - _source = source; - _note = note; - _partOfSpeech = partOfSpeech; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _text = dict[@"text"]; - _source = dict[@"source"]; - _note = dict[@"note"]; - _partOfSpeech = dict[@"partOfSpeech"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_text != nil) dict[@"text"] = _text ; - if(_source != nil) dict[@"source"] = _source ; - if(_note != nil) dict[@"note"] = _note ; - if(_partOfSpeech != nil) dict[@"partOfSpeech"] = _partOfSpeech ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGSimpleExample.h b/samples/client/wordnik-api-objc/client/SWGSimpleExample.h deleted file mode 100644 index 14a18851271..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGSimpleExample.h +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGSimpleExample : SWGObject - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSString* title; - -@property(nonatomic) NSString* text; - -@property(nonatomic) NSString* url; - -- (id) _id: (NSNumber*) _id - title: (NSString*) title - text: (NSString*) text - url: (NSString*) url; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGSimpleExample.m b/samples/client/wordnik-api-objc/client/SWGSimpleExample.m deleted file mode 100644 index e8892e522c7..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGSimpleExample.m +++ /dev/null @@ -1,43 +0,0 @@ -#import "SWGDate.h" -#import "SWGSimpleExample.h" - -@implementation SWGSimpleExample - --(id)_id: (NSNumber*) _id - title: (NSString*) title - text: (NSString*) text - url: (NSString*) url -{ - __id = _id; - _title = title; - _text = text; - _url = url; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - __id = dict[@"id"]; - _title = dict[@"title"]; - _text = dict[@"text"]; - _url = dict[@"url"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) dict[@"id"] = __id ; - if(_title != nil) dict[@"title"] = _title ; - if(_text != nil) dict[@"text"] = _text ; - if(_url != nil) dict[@"url"] = _url ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGStringValue.h b/samples/client/wordnik-api-objc/client/SWGStringValue.h deleted file mode 100644 index d96477cfe87..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGStringValue.h +++ /dev/null @@ -1,16 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGStringValue : SWGObject - -@property(nonatomic) NSString* word; - -- (id) word: (NSString*) word; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGStringValue.m b/samples/client/wordnik-api-objc/client/SWGStringValue.m deleted file mode 100644 index bf543f49b0c..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGStringValue.m +++ /dev/null @@ -1,31 +0,0 @@ -#import "SWGDate.h" -#import "SWGStringValue.h" - -@implementation SWGStringValue - --(id)word: (NSString*) word -{ - _word = word; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _word = dict[@"word"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_word != nil) dict[@"word"] = _word ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGSyllable.h b/samples/client/wordnik-api-objc/client/SWGSyllable.h deleted file mode 100644 index 1e2da7da648..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGSyllable.h +++ /dev/null @@ -1,22 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGSyllable : SWGObject - -@property(nonatomic) NSString* text; - -@property(nonatomic) NSNumber* seq; - -@property(nonatomic) NSString* type; - -- (id) text: (NSString*) text - seq: (NSNumber*) seq - type: (NSString*) type; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGSyllable.m b/samples/client/wordnik-api-objc/client/SWGSyllable.m deleted file mode 100644 index 7eba9045af5..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGSyllable.m +++ /dev/null @@ -1,39 +0,0 @@ -#import "SWGDate.h" -#import "SWGSyllable.h" - -@implementation SWGSyllable - --(id)text: (NSString*) text - seq: (NSNumber*) seq - type: (NSString*) type -{ - _text = text; - _seq = seq; - _type = type; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _text = dict[@"text"]; - _seq = dict[@"seq"]; - _type = dict[@"type"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_text != nil) dict[@"text"] = _text ; - if(_seq != nil) dict[@"seq"] = _seq ; - if(_type != nil) dict[@"type"] = _type ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGTextPron.h b/samples/client/wordnik-api-objc/client/SWGTextPron.h deleted file mode 100644 index 68f199ffc85..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGTextPron.h +++ /dev/null @@ -1,22 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGTextPron : SWGObject - -@property(nonatomic) NSString* raw; - -@property(nonatomic) NSNumber* seq; - -@property(nonatomic) NSString* rawType; - -- (id) raw: (NSString*) raw - seq: (NSNumber*) seq - rawType: (NSString*) rawType; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGTextPron.m b/samples/client/wordnik-api-objc/client/SWGTextPron.m deleted file mode 100644 index 7ac3f3969fa..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGTextPron.m +++ /dev/null @@ -1,39 +0,0 @@ -#import "SWGDate.h" -#import "SWGTextPron.h" - -@implementation SWGTextPron - --(id)raw: (NSString*) raw - seq: (NSNumber*) seq - rawType: (NSString*) rawType -{ - _raw = raw; - _seq = seq; - _rawType = rawType; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _raw = dict[@"raw"]; - _seq = dict[@"seq"]; - _rawType = dict[@"rawType"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_raw != nil) dict[@"raw"] = _raw ; - if(_seq != nil) dict[@"seq"] = _seq ; - if(_rawType != nil) dict[@"rawType"] = _rawType ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGUser.h b/samples/client/wordnik-api-objc/client/SWGUser.h deleted file mode 100644 index 494e5a7461d..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGUser.h +++ /dev/null @@ -1,37 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGUser : SWGObject - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSString* username; - -@property(nonatomic) NSString* email; - -@property(nonatomic) NSNumber* status; - -@property(nonatomic) NSString* faceBookId; - -@property(nonatomic) NSString* userName; - -@property(nonatomic) NSString* displayName; - -@property(nonatomic) NSString* password; - -- (id) _id: (NSNumber*) _id - username: (NSString*) username - email: (NSString*) email - status: (NSNumber*) status - faceBookId: (NSString*) faceBookId - userName: (NSString*) userName - displayName: (NSString*) displayName - password: (NSString*) password; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGUser.m b/samples/client/wordnik-api-objc/client/SWGUser.m deleted file mode 100644 index be8b3e255d2..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGUser.m +++ /dev/null @@ -1,59 +0,0 @@ -#import "SWGDate.h" -#import "SWGUser.h" - -@implementation SWGUser - --(id)_id: (NSNumber*) _id - username: (NSString*) username - email: (NSString*) email - status: (NSNumber*) status - faceBookId: (NSString*) faceBookId - userName: (NSString*) userName - displayName: (NSString*) displayName - password: (NSString*) password -{ - __id = _id; - _username = username; - _email = email; - _status = status; - _faceBookId = faceBookId; - _userName = userName; - _displayName = displayName; - _password = password; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - __id = dict[@"id"]; - _username = dict[@"username"]; - _email = dict[@"email"]; - _status = dict[@"status"]; - _faceBookId = dict[@"faceBookId"]; - _userName = dict[@"userName"]; - _displayName = dict[@"displayName"]; - _password = dict[@"password"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) dict[@"id"] = __id ; - if(_username != nil) dict[@"username"] = _username ; - if(_email != nil) dict[@"email"] = _email ; - if(_status != nil) dict[@"status"] = _status ; - if(_faceBookId != nil) dict[@"faceBookId"] = _faceBookId ; - if(_userName != nil) dict[@"userName"] = _userName ; - if(_displayName != nil) dict[@"displayName"] = _displayName ; - if(_password != nil) dict[@"password"] = _password ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordApi.h b/samples/client/wordnik-api-objc/client/SWGWordApi.h deleted file mode 100644 index 64fd0f44e6b..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordApi.h +++ /dev/null @@ -1,195 +0,0 @@ -#import -#import "SWGFrequencySummary.h" -#import "SWGBigram.h" -#import "SWGWordObject.h" -#import "SWGExampleSearchResults.h" -#import "SWGExample.h" -#import "SWGScrabbleScoreResult.h" -#import "SWGTextPron.h" -#import "SWGSyllable.h" -#import "SWGRelated.h" -#import "SWGDefinition.h" -#import "SWGAudioFile.h" - - - -@interface SWGWordApi: NSObject - --(void) addHeader:(NSString*)value forKey:(NSString*)key; --(unsigned long) requestQueueSize; -+(SWGWordApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; -+(void) setBasePath:(NSString*)basePath; -+(NSString*) getBasePath; -/** - - Returns examples for a word - - @param word Word to return examples for - @param includeDuplicates Show duplicate examples from different sources - @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - @param skip Results to skip - @param limit Maximum number of results to return - */ --(NSNumber*) getExamplesWithCompletionBlock :(NSString*) word - includeDuplicates:(NSString*) includeDuplicates - useCanonical:(NSString*) useCanonical - skip:(NSNumber*) skip - limit:(NSNumber*) limit - completionHandler: (void (^)(SWGExampleSearchResults* output, NSError* error))completionBlock; - -/** - - Given a word as a string, returns the WordObject that represents it - - @param word String value of WordObject to return - @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - @param includeSuggestions Return suggestions (for correct spelling, case variants, etc.) - */ --(NSNumber*) getWordWithCompletionBlock :(NSString*) word - useCanonical:(NSString*) useCanonical - includeSuggestions:(NSString*) includeSuggestions - completionHandler: (void (^)(SWGWordObject* output, NSError* error))completionBlock; - -/** - - Return definitions for a word - - @param word Word to return definitions for - @param partOfSpeech CSV list of part-of-speech types - @param sourceDictionaries Source dictionary to return definitions from. If 'all' is received, results are returned from all sources. If multiple values are received (e.g. 'century,wiktionary'), results are returned from the first specified dictionary that has definitions. If left blank, results are returned from the first dictionary that has definitions. By default, dictionaries are searched in this order: ahd, wiktionary, webster, century, wordnet - @param limit Maximum number of results to return - @param includeRelated Return related words with definitions - @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - @param includeTags Return a closed set of XML tags in response - */ --(NSNumber*) getDefinitionsWithCompletionBlock :(NSString*) word - partOfSpeech:(NSString*) partOfSpeech - sourceDictionaries:(NSString*) sourceDictionaries - limit:(NSNumber*) limit - includeRelated:(NSString*) includeRelated - useCanonical:(NSString*) useCanonical - includeTags:(NSString*) includeTags - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; - -/** - - Returns a top example for a word - - @param word Word to fetch examples for - @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - */ --(NSNumber*) getTopExampleWithCompletionBlock :(NSString*) word - useCanonical:(NSString*) useCanonical - completionHandler: (void (^)(SWGExample* output, NSError* error))completionBlock; - -/** - - Given a word as a string, returns relationships from the Word Graph - - @param word Word to fetch relationships for - @param relationshipTypes Limits the total results per type of relationship type - @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - @param limitPerRelationshipType Restrict to the supplied relatinship types - */ --(NSNumber*) getRelatedWordsWithCompletionBlock :(NSString*) word - relationshipTypes:(NSString*) relationshipTypes - useCanonical:(NSString*) useCanonical - limitPerRelationshipType:(NSNumber*) limitPerRelationshipType - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; - -/** - - Returns text pronunciations for a given word - - @param word Word to get pronunciations for - @param sourceDictionary Get from a single dictionary - @param typeFormat Text pronunciation type - @param useCanonical If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - @param limit Maximum number of results to return - */ --(NSNumber*) getTextPronunciationsWithCompletionBlock :(NSString*) word - sourceDictionary:(NSString*) sourceDictionary - typeFormat:(NSString*) typeFormat - useCanonical:(NSString*) useCanonical - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; - -/** - - Returns syllable information for a word - - @param word Word to get syllables for - @param sourceDictionary Get from a single dictionary. Valid options: ahd, century, wiktionary, webster, and wordnet. - @param useCanonical If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - @param limit Maximum number of results to return - */ --(NSNumber*) getHyphenationWithCompletionBlock :(NSString*) word - sourceDictionary:(NSString*) sourceDictionary - useCanonical:(NSString*) useCanonical - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; - -/** - - Returns word usage over time - - @param word Word to return - @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - @param startYear Starting Year - @param endYear Ending Year - */ --(NSNumber*) getWordFrequencyWithCompletionBlock :(NSString*) word - useCanonical:(NSString*) useCanonical - startYear:(NSNumber*) startYear - endYear:(NSNumber*) endYear - completionHandler: (void (^)(SWGFrequencySummary* output, NSError* error))completionBlock; - -/** - - Fetches bi-gram phrases for a word - - @param word Word to fetch phrases for - @param limit Maximum number of results to return - @param wlmi Minimum WLMI for the phrase - @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - */ --(NSNumber*) getPhrasesWithCompletionBlock :(NSString*) word - limit:(NSNumber*) limit - wlmi:(NSNumber*) wlmi - useCanonical:(NSString*) useCanonical - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; - -/** - - Fetches etymology data - - @param word Word to return - @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - */ --(NSNumber*) getEtymologiesWithCompletionBlock :(NSString*) word - useCanonical:(NSString*) useCanonical - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; - -/** - - Fetches audio metadata for a word. - The metadata includes a time-expiring fileUrl which allows reading the audio file directly from the API. Currently only audio pronunciations from the American Heritage Dictionary in mp3 format are supported. - @param word Word to get audio for. - @param useCanonical Use the canonical form of the word - @param limit Maximum number of results to return - */ --(NSNumber*) getAudioWithCompletionBlock :(NSString*) word - useCanonical:(NSString*) useCanonical - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; - -/** - - Returns the Scrabble score for a word - - @param word Word to get scrabble score for. - */ --(NSNumber*) getScrabbleScoreWithCompletionBlock :(NSString*) word - completionHandler: (void (^)(SWGScrabbleScoreResult* output, NSError* error))completionBlock; - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGWordApi.m b/samples/client/wordnik-api-objc/client/SWGWordApi.m deleted file mode 100644 index 3a65ccc62a1..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordApi.m +++ /dev/null @@ -1,691 +0,0 @@ -#import "SWGWordApi.h" -#import "SWGFile.h" -#import "SWGApiClient.h" -#import "SWGFrequencySummary.h" -#import "SWGBigram.h" -#import "SWGWordObject.h" -#import "SWGExampleSearchResults.h" -#import "SWGExample.h" -#import "SWGScrabbleScoreResult.h" -#import "SWGTextPron.h" -#import "SWGSyllable.h" -#import "SWGRelated.h" -#import "SWGDefinition.h" -#import "SWGAudioFile.h" - - - - -@implementation SWGWordApi -static NSString * basePath = @"http://api.wordnik.com/v4"; - -+(SWGWordApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { - static SWGWordApi* singletonAPI = nil; - - if (singletonAPI == nil) { - singletonAPI = [[SWGWordApi alloc] init]; - [singletonAPI addHeader:headerValue forKey:key]; - } - return singletonAPI; -} - -+(void) setBasePath:(NSString*)path { - basePath = path; -} - -+(NSString*) getBasePath { - return basePath; -} - --(SWGApiClient*) apiClient { - return [SWGApiClient sharedClientFromPool:basePath]; -} - --(void) addHeader:(NSString*)value forKey:(NSString*)key { - [[self apiClient] setHeaderValue:value forKey:key]; -} - --(id) init { - self = [super init]; - [self apiClient]; - return self; -} - --(void) setHeaderValue:(NSString*) value - forKey:(NSString*)key { - [[self apiClient] setHeaderValue:value forKey:key]; -} - --(unsigned long) requestQueueSize { - return [SWGApiClient requestQueueSize]; -} - - --(NSNumber*) getExamplesWithCompletionBlock:(NSString*) word - includeDuplicates:(NSString*) includeDuplicates - useCanonical:(NSString*) useCanonical - skip:(NSNumber*) skip - limit:(NSNumber*) limit - completionHandler: (void (^)(SWGExampleSearchResults* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/examples", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(includeDuplicates != nil) - queryParams[@"includeDuplicates"] = includeDuplicates; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - if(skip != nil) - queryParams[@"skip"] = skip; - if(limit != nil) - queryParams[@"limit"] = limit; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGExampleSearchResults *result = nil; - if (data) { - result = [[SWGExampleSearchResults alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) getWordWithCompletionBlock:(NSString*) word - useCanonical:(NSString*) useCanonical - includeSuggestions:(NSString*) includeSuggestions - completionHandler: (void (^)(SWGWordObject* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - if(includeSuggestions != nil) - queryParams[@"includeSuggestions"] = includeSuggestions; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGWordObject *result = nil; - if (data) { - result = [[SWGWordObject alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) getDefinitionsWithCompletionBlock:(NSString*) word - partOfSpeech:(NSString*) partOfSpeech - sourceDictionaries:(NSString*) sourceDictionaries - limit:(NSNumber*) limit - includeRelated:(NSString*) includeRelated - useCanonical:(NSString*) useCanonical - includeTags:(NSString*) includeTags - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/definitions", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(limit != nil) - queryParams[@"limit"] = limit; - if(partOfSpeech != nil) - queryParams[@"partOfSpeech"] = partOfSpeech; - if(includeRelated != nil) - queryParams[@"includeRelated"] = includeRelated; - if(sourceDictionaries != nil) - queryParams[@"sourceDictionaries"] = sourceDictionaries; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - if(includeTags != nil) - queryParams[@"includeTags"] = includeTags; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - SWGDefinition* d = [[SWGDefinition alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - }]; - - -} - --(NSNumber*) getTopExampleWithCompletionBlock:(NSString*) word - useCanonical:(NSString*) useCanonical - completionHandler: (void (^)(SWGExample* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/topExample", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGExample *result = nil; - if (data) { - result = [[SWGExample alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) getRelatedWordsWithCompletionBlock:(NSString*) word - relationshipTypes:(NSString*) relationshipTypes - useCanonical:(NSString*) useCanonical - limitPerRelationshipType:(NSNumber*) limitPerRelationshipType - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/relatedWords", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - if(relationshipTypes != nil) - queryParams[@"relationshipTypes"] = relationshipTypes; - if(limitPerRelationshipType != nil) - queryParams[@"limitPerRelationshipType"] = limitPerRelationshipType; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - SWGRelated* d = [[SWGRelated alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - }]; - - -} - --(NSNumber*) getTextPronunciationsWithCompletionBlock:(NSString*) word - sourceDictionary:(NSString*) sourceDictionary - typeFormat:(NSString*) typeFormat - useCanonical:(NSString*) useCanonical - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/pronunciations", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - if(sourceDictionary != nil) - queryParams[@"sourceDictionary"] = sourceDictionary; - if(typeFormat != nil) - queryParams[@"typeFormat"] = typeFormat; - if(limit != nil) - queryParams[@"limit"] = limit; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - SWGTextPron* d = [[SWGTextPron alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - }]; - - -} - --(NSNumber*) getHyphenationWithCompletionBlock:(NSString*) word - sourceDictionary:(NSString*) sourceDictionary - useCanonical:(NSString*) useCanonical - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/hyphenation", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - if(sourceDictionary != nil) - queryParams[@"sourceDictionary"] = sourceDictionary; - if(limit != nil) - queryParams[@"limit"] = limit; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - SWGSyllable* d = [[SWGSyllable alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - }]; - - -} - --(NSNumber*) getWordFrequencyWithCompletionBlock:(NSString*) word - useCanonical:(NSString*) useCanonical - startYear:(NSNumber*) startYear - endYear:(NSNumber*) endYear - completionHandler: (void (^)(SWGFrequencySummary* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/frequency", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - if(startYear != nil) - queryParams[@"startYear"] = startYear; - if(endYear != nil) - queryParams[@"endYear"] = endYear; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGFrequencySummary *result = nil; - if (data) { - result = [[SWGFrequencySummary alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) getPhrasesWithCompletionBlock:(NSString*) word - limit:(NSNumber*) limit - wlmi:(NSNumber*) wlmi - useCanonical:(NSString*) useCanonical - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/phrases", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(limit != nil) - queryParams[@"limit"] = limit; - if(wlmi != nil) - queryParams[@"wlmi"] = wlmi; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - SWGBigram* d = [[SWGBigram alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - }]; - - -} - --(NSNumber*) getEtymologiesWithCompletionBlock:(NSString*) word - useCanonical:(NSString*) useCanonical - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/etymologies", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - // NSString - - NSString* d = [[NSString alloc]initWithString: data]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - }]; - - -} - --(NSNumber*) getAudioWithCompletionBlock:(NSString*) word - useCanonical:(NSString*) useCanonical - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/audio", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(useCanonical != nil) - queryParams[@"useCanonical"] = useCanonical; - if(limit != nil) - queryParams[@"limit"] = limit; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - SWGAudioFile* d = [[SWGAudioFile alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - }]; - - -} - --(NSNumber*) getScrabbleScoreWithCompletionBlock:(NSString*) word - completionHandler: (void (^)(SWGScrabbleScoreResult* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/word.{format}/{word}/scrabbleScore", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"word", @"}"]] withString: [SWGApiClient escape:word]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(word == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGScrabbleScoreResult *result = nil; - if (data) { - result = [[SWGScrabbleScoreResult alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - - - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGWordList.h b/samples/client/wordnik-api-objc/client/SWGWordList.h deleted file mode 100644 index d444672f193..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordList.h +++ /dev/null @@ -1,47 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGDate.h" - - -@interface SWGWordList : SWGObject - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSString* permalink; - -@property(nonatomic) NSString* name; - -@property(nonatomic) SWGDate* createdAt; - -@property(nonatomic) SWGDate* updatedAt; - -@property(nonatomic) SWGDate* lastActivityAt; - -@property(nonatomic) NSString* username; - -@property(nonatomic) NSNumber* userId; - -@property(nonatomic) NSString* description; - -@property(nonatomic) NSNumber* numberWordsInList; - -@property(nonatomic) NSString* type; - -- (id) _id: (NSNumber*) _id - permalink: (NSString*) permalink - name: (NSString*) name - createdAt: (SWGDate*) createdAt - updatedAt: (SWGDate*) updatedAt - lastActivityAt: (SWGDate*) lastActivityAt - username: (NSString*) username - userId: (NSNumber*) userId - description: (NSString*) description - numberWordsInList: (NSNumber*) numberWordsInList - type: (NSString*) type; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordList.m b/samples/client/wordnik-api-objc/client/SWGWordList.m deleted file mode 100644 index e0dddb94b32..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordList.m +++ /dev/null @@ -1,128 +0,0 @@ -#import "SWGDate.h" -#import "SWGWordList.h" - -@implementation SWGWordList - --(id)_id: (NSNumber*) _id - permalink: (NSString*) permalink - name: (NSString*) name - createdAt: (SWGDate*) createdAt - updatedAt: (SWGDate*) updatedAt - lastActivityAt: (SWGDate*) lastActivityAt - username: (NSString*) username - userId: (NSNumber*) userId - description: (NSString*) description - numberWordsInList: (NSNumber*) numberWordsInList - type: (NSString*) type -{ - __id = _id; - _permalink = permalink; - _name = name; - _createdAt = createdAt; - _updatedAt = updatedAt; - _lastActivityAt = lastActivityAt; - _username = username; - _userId = userId; - _description = description; - _numberWordsInList = numberWordsInList; - _type = type; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - __id = dict[@"id"]; - _permalink = dict[@"permalink"]; - _name = dict[@"name"]; - id createdAt_dict = dict[@"createdAt"]; - if(createdAt_dict != nil) - _createdAt = [[SWGDate alloc]initWithValues:createdAt_dict]; - id updatedAt_dict = dict[@"updatedAt"]; - if(updatedAt_dict != nil) - _updatedAt = [[SWGDate alloc]initWithValues:updatedAt_dict]; - id lastActivityAt_dict = dict[@"lastActivityAt"]; - if(lastActivityAt_dict != nil) - _lastActivityAt = [[SWGDate alloc]initWithValues:lastActivityAt_dict]; - _username = dict[@"username"]; - _userId = dict[@"userId"]; - _description = dict[@"description"]; - _numberWordsInList = dict[@"numberWordsInList"]; - _type = dict[@"type"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) dict[@"id"] = __id ; - if(_permalink != nil) dict[@"permalink"] = _permalink ; - if(_name != nil) dict[@"name"] = _name ; - if(_createdAt != nil){ - if([_createdAt isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGDate *createdAt in (NSArray*)_createdAt) { - [array addObject:[(SWGObject*)createdAt asDictionary]]; - } - dict[@"createdAt"] = array; - } - else if(_createdAt && [_createdAt isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_createdAt toString]; - if(dateString){ - dict[@"createdAt"] = dateString; - } - } - else { - if(_createdAt != nil) dict[@"createdAt"] = [(SWGObject*)_createdAt asDictionary]; - } - } - if(_updatedAt != nil){ - if([_updatedAt isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGDate *updatedAt in (NSArray*)_updatedAt) { - [array addObject:[(SWGObject*)updatedAt asDictionary]]; - } - dict[@"updatedAt"] = array; - } - else if(_updatedAt && [_updatedAt isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_updatedAt toString]; - if(dateString){ - dict[@"updatedAt"] = dateString; - } - } - else { - if(_updatedAt != nil) dict[@"updatedAt"] = [(SWGObject*)_updatedAt asDictionary]; - } - } - if(_lastActivityAt != nil){ - if([_lastActivityAt isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGDate *lastActivityAt in (NSArray*)_lastActivityAt) { - [array addObject:[(SWGObject*)lastActivityAt asDictionary]]; - } - dict[@"lastActivityAt"] = array; - } - else if(_lastActivityAt && [_lastActivityAt isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_lastActivityAt toString]; - if(dateString){ - dict[@"lastActivityAt"] = dateString; - } - } - else { - if(_lastActivityAt != nil) dict[@"lastActivityAt"] = [(SWGObject*)_lastActivityAt asDictionary]; - } - } - if(_username != nil) dict[@"username"] = _username ; - if(_userId != nil) dict[@"userId"] = _userId ; - if(_description != nil) dict[@"description"] = _description ; - if(_numberWordsInList != nil) dict[@"numberWordsInList"] = _numberWordsInList ; - if(_type != nil) dict[@"type"] = _type ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordListApi.h b/samples/client/wordnik-api-objc/client/SWGWordListApi.h deleted file mode 100644 index 37345846180..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordListApi.h +++ /dev/null @@ -1,95 +0,0 @@ -#import -#import "SWGWordListWord.h" -#import "SWGWordList.h" -#import "SWGStringValue.h" - - - -@interface SWGWordListApi: NSObject - --(void) addHeader:(NSString*)value forKey:(NSString*)key; --(unsigned long) requestQueueSize; -+(SWGWordListApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; -+(void) setBasePath:(NSString*)basePath; -+(NSString*) getBasePath; -/** - - Updates an existing WordList - - @param permalink permalink of WordList to update - @param body Updated WordList - @param auth_token The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) - */ --(NSNumber*) updateWordListWithCompletionBlock :(NSString*) permalink - body:(SWGWordList*) body - auth_token:(NSString*) auth_token - completionHandler: (void (^)(NSError* error))completionBlock; - -/** - - Deletes an existing WordList - - @param permalink ID of WordList to delete - @param auth_token The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) - */ --(NSNumber*) deleteWordListWithCompletionBlock :(NSString*) permalink - auth_token:(NSString*) auth_token - completionHandler: (void (^)(NSError* error))completionBlock; - -/** - - Fetches a WordList by ID - - @param permalink permalink of WordList to fetch - @param auth_token The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) - */ --(NSNumber*) getWordListByPermalinkWithCompletionBlock :(NSString*) permalink - auth_token:(NSString*) auth_token - completionHandler: (void (^)(SWGWordList* output, NSError* error))completionBlock; - -/** - - Adds words to a WordList - - @param permalink permalink of WordList to user - @param body Array of words to add to WordList - @param auth_token The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) - */ --(NSNumber*) addWordsToWordListWithCompletionBlock :(NSString*) permalink - body:(NSArray*) body - auth_token:(NSString*) auth_token - completionHandler: (void (^)(NSError* error))completionBlock; - -/** - - Fetches words in a WordList - - @param permalink ID of WordList to use - @param auth_token The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) - @param sortBy Field to sort by - @param sortOrder Direction to sort - @param skip Results to skip - @param limit Maximum number of results to return - */ --(NSNumber*) getWordListWordsWithCompletionBlock :(NSString*) permalink - auth_token:(NSString*) auth_token - sortBy:(NSString*) sortBy - sortOrder:(NSString*) sortOrder - skip:(NSNumber*) skip - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; - -/** - - Removes words from a WordList - - @param permalink permalink of WordList to use - @param body Words to remove from WordList - @param auth_token The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) - */ --(NSNumber*) deleteWordsFromWordListWithCompletionBlock :(NSString*) permalink - body:(NSArray*) body - auth_token:(NSString*) auth_token - completionHandler: (void (^)(NSError* error))completionBlock; - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGWordListApi.m b/samples/client/wordnik-api-objc/client/SWGWordListApi.m deleted file mode 100644 index b96b0f7e052..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordListApi.m +++ /dev/null @@ -1,451 +0,0 @@ -#import "SWGWordListApi.h" -#import "SWGFile.h" -#import "SWGApiClient.h" -#import "SWGWordListWord.h" -#import "SWGWordList.h" -#import "SWGStringValue.h" - - - - -@implementation SWGWordListApi -static NSString * basePath = @"http://api.wordnik.com/v4"; - -+(SWGWordListApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { - static SWGWordListApi* singletonAPI = nil; - - if (singletonAPI == nil) { - singletonAPI = [[SWGWordListApi alloc] init]; - [singletonAPI addHeader:headerValue forKey:key]; - } - return singletonAPI; -} - -+(void) setBasePath:(NSString*)path { - basePath = path; -} - -+(NSString*) getBasePath { - return basePath; -} - --(SWGApiClient*) apiClient { - return [SWGApiClient sharedClientFromPool:basePath]; -} - --(void) addHeader:(NSString*)value forKey:(NSString*)key { - [[self apiClient] setHeaderValue:value forKey:key]; -} - --(id) init { - self = [super init]; - [self apiClient]; - return self; -} - --(void) setHeaderValue:(NSString*) value - forKey:(NSString*)key { - [[self apiClient] setHeaderValue:value forKey:key]; -} - --(unsigned long) requestQueueSize { - return [SWGApiClient requestQueueSize]; -} - - --(NSNumber*) updateWordListWithCompletionBlock:(NSString*) permalink - body:(SWGWordList*) body - auth_token:(NSString*) auth_token - completionHandler: (void (^)(NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/wordList.{format}/{permalink}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [SWGApiClient escape:permalink]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - if(auth_token != nil) - headerParams[@"auth_token"] = auth_token; - id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { - if([dict respondsToSelector:@selector(asDictionary)]) { - [objs addObject:[(SWGObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] - options:NSJSONReadingMutableContainers - error:&error]; - bodyDictionary = JSON; - } - else if([body isKindOfClass: [SWGFile class]]) { - requestContentType = @"form-data"; - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(permalink == nil) { - // error - } - if(auth_token == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client stringWithCompletionBlock:requestUrl - method:@"PUT" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock:^(NSString *data, NSError *error) { - if (error) { - completionBlock(error); - return; - } - completionBlock(nil); - }]; - - -} - --(NSNumber*) deleteWordListWithCompletionBlock:(NSString*) permalink - auth_token:(NSString*) auth_token - completionHandler: (void (^)(NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/wordList.{format}/{permalink}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [SWGApiClient escape:permalink]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - if(auth_token != nil) - headerParams[@"auth_token"] = auth_token; - id bodyDictionary = nil; - if(permalink == nil) { - // error - } - if(auth_token == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client stringWithCompletionBlock:requestUrl - method:@"DELETE" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock:^(NSString *data, NSError *error) { - if (error) { - completionBlock(error); - return; - } - completionBlock(nil); - }]; - - -} - --(NSNumber*) getWordListByPermalinkWithCompletionBlock:(NSString*) permalink - auth_token:(NSString*) auth_token - completionHandler: (void (^)(SWGWordList* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/wordList.{format}/{permalink}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [SWGApiClient escape:permalink]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - if(auth_token != nil) - headerParams[@"auth_token"] = auth_token; - id bodyDictionary = nil; - if(permalink == nil) { - // error - } - if(auth_token == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGWordList *result = nil; - if (data) { - result = [[SWGWordList alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) addWordsToWordListWithCompletionBlock:(NSString*) permalink - body:(NSArray*) body - auth_token:(NSString*) auth_token - completionHandler: (void (^)(NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/wordList.{format}/{permalink}/words", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [SWGApiClient escape:permalink]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - if(auth_token != nil) - headerParams[@"auth_token"] = auth_token; - id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { - if([dict respondsToSelector:@selector(asDictionary)]) { - [objs addObject:[(SWGObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] - options:NSJSONReadingMutableContainers - error:&error]; - bodyDictionary = JSON; - } - else if([body isKindOfClass: [SWGFile class]]) { - requestContentType = @"form-data"; - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(permalink == nil) { - // error - } - if(auth_token == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client stringWithCompletionBlock:requestUrl - method:@"POST" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock:^(NSString *data, NSError *error) { - if (error) { - completionBlock(error); - return; - } - completionBlock(nil); - }]; - - -} - --(NSNumber*) getWordListWordsWithCompletionBlock:(NSString*) permalink - auth_token:(NSString*) auth_token - sortBy:(NSString*) sortBy - sortOrder:(NSString*) sortOrder - skip:(NSNumber*) skip - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/wordList.{format}/{permalink}/words", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [SWGApiClient escape:permalink]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(sortBy != nil) - queryParams[@"sortBy"] = sortBy; - if(sortOrder != nil) - queryParams[@"sortOrder"] = sortOrder; - if(skip != nil) - queryParams[@"skip"] = skip; - if(limit != nil) - queryParams[@"limit"] = limit; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - if(auth_token != nil) - headerParams[@"auth_token"] = auth_token; - id bodyDictionary = nil; - if(permalink == nil) { - // error - } - if(auth_token == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - SWGWordListWord* d = [[SWGWordListWord alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - }]; - - -} - --(NSNumber*) deleteWordsFromWordListWithCompletionBlock:(NSString*) permalink - body:(NSArray*) body - auth_token:(NSString*) auth_token - completionHandler: (void (^)(NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/wordList.{format}/{permalink}/deleteWords", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [SWGApiClient escape:permalink]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - if(auth_token != nil) - headerParams[@"auth_token"] = auth_token; - id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { - if([dict respondsToSelector:@selector(asDictionary)]) { - [objs addObject:[(SWGObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] - options:NSJSONReadingMutableContainers - error:&error]; - bodyDictionary = JSON; - } - else if([body isKindOfClass: [SWGFile class]]) { - requestContentType = @"form-data"; - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(permalink == nil) { - // error - } - if(auth_token == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client stringWithCompletionBlock:requestUrl - method:@"POST" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock:^(NSString *data, NSError *error) { - if (error) { - completionBlock(error); - return; - } - completionBlock(nil); - }]; - - -} - - - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGWordListWord.h b/samples/client/wordnik-api-objc/client/SWGWordListWord.h deleted file mode 100644 index dbb9f3a88ae..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordListWord.h +++ /dev/null @@ -1,35 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGDate.h" - - -@interface SWGWordListWord : SWGObject - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSString* word; - -@property(nonatomic) NSString* username; - -@property(nonatomic) NSNumber* userId; - -@property(nonatomic) SWGDate* createdAt; - -@property(nonatomic) NSNumber* numberCommentsOnWord; - -@property(nonatomic) NSNumber* numberLists; - -- (id) _id: (NSNumber*) _id - word: (NSString*) word - username: (NSString*) username - userId: (NSNumber*) userId - createdAt: (SWGDate*) createdAt - numberCommentsOnWord: (NSNumber*) numberCommentsOnWord - numberLists: (NSNumber*) numberLists; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordListWord.m b/samples/client/wordnik-api-objc/client/SWGWordListWord.m deleted file mode 100644 index 27f63ee701c..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordListWord.m +++ /dev/null @@ -1,74 +0,0 @@ -#import "SWGDate.h" -#import "SWGWordListWord.h" - -@implementation SWGWordListWord - --(id)_id: (NSNumber*) _id - word: (NSString*) word - username: (NSString*) username - userId: (NSNumber*) userId - createdAt: (SWGDate*) createdAt - numberCommentsOnWord: (NSNumber*) numberCommentsOnWord - numberLists: (NSNumber*) numberLists -{ - __id = _id; - _word = word; - _username = username; - _userId = userId; - _createdAt = createdAt; - _numberCommentsOnWord = numberCommentsOnWord; - _numberLists = numberLists; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - __id = dict[@"id"]; - _word = dict[@"word"]; - _username = dict[@"username"]; - _userId = dict[@"userId"]; - id createdAt_dict = dict[@"createdAt"]; - if(createdAt_dict != nil) - _createdAt = [[SWGDate alloc]initWithValues:createdAt_dict]; - _numberCommentsOnWord = dict[@"numberCommentsOnWord"]; - _numberLists = dict[@"numberLists"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) dict[@"id"] = __id ; - if(_word != nil) dict[@"word"] = _word ; - if(_username != nil) dict[@"username"] = _username ; - if(_userId != nil) dict[@"userId"] = _userId ; - if(_createdAt != nil){ - if([_createdAt isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGDate *createdAt in (NSArray*)_createdAt) { - [array addObject:[(SWGObject*)createdAt asDictionary]]; - } - dict[@"createdAt"] = array; - } - else if(_createdAt && [_createdAt isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_createdAt toString]; - if(dateString){ - dict[@"createdAt"] = dateString; - } - } - else { - if(_createdAt != nil) dict[@"createdAt"] = [(SWGObject*)_createdAt asDictionary]; - } - } - if(_numberCommentsOnWord != nil) dict[@"numberCommentsOnWord"] = _numberCommentsOnWord ; - if(_numberLists != nil) dict[@"numberLists"] = _numberLists ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordListsApi.h b/samples/client/wordnik-api-objc/client/SWGWordListsApi.h deleted file mode 100644 index 8717887867e..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordListsApi.h +++ /dev/null @@ -1,24 +0,0 @@ -#import -#import "SWGWordList.h" - - - -@interface SWGWordListsApi: NSObject - --(void) addHeader:(NSString*)value forKey:(NSString*)key; --(unsigned long) requestQueueSize; -+(SWGWordListsApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; -+(void) setBasePath:(NSString*)basePath; -+(NSString*) getBasePath; -/** - - Creates a WordList. - - @param body WordList to create - @param auth_token The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) - */ --(NSNumber*) createWordListWithCompletionBlock :(SWGWordList*) body - auth_token:(NSString*) auth_token - completionHandler: (void (^)(SWGWordList* output, NSError* error))completionBlock; - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGWordListsApi.m b/samples/client/wordnik-api-objc/client/SWGWordListsApi.m deleted file mode 100644 index 4b15a6a2b41..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordListsApi.m +++ /dev/null @@ -1,132 +0,0 @@ -#import "SWGWordListsApi.h" -#import "SWGFile.h" -#import "SWGApiClient.h" -#import "SWGWordList.h" - - - - -@implementation SWGWordListsApi -static NSString * basePath = @"http://api.wordnik.com/v4"; - -+(SWGWordListsApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { - static SWGWordListsApi* singletonAPI = nil; - - if (singletonAPI == nil) { - singletonAPI = [[SWGWordListsApi alloc] init]; - [singletonAPI addHeader:headerValue forKey:key]; - } - return singletonAPI; -} - -+(void) setBasePath:(NSString*)path { - basePath = path; -} - -+(NSString*) getBasePath { - return basePath; -} - --(SWGApiClient*) apiClient { - return [SWGApiClient sharedClientFromPool:basePath]; -} - --(void) addHeader:(NSString*)value forKey:(NSString*)key { - [[self apiClient] setHeaderValue:value forKey:key]; -} - --(id) init { - self = [super init]; - [self apiClient]; - return self; -} - --(void) setHeaderValue:(NSString*) value - forKey:(NSString*)key { - [[self apiClient] setHeaderValue:value forKey:key]; -} - --(unsigned long) requestQueueSize { - return [SWGApiClient requestQueueSize]; -} - - --(NSNumber*) createWordListWithCompletionBlock:(SWGWordList*) body - auth_token:(NSString*) auth_token - completionHandler: (void (^)(SWGWordList* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/wordLists.{format}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - if(auth_token != nil) - headerParams[@"auth_token"] = auth_token; - id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { - if([dict respondsToSelector:@selector(asDictionary)]) { - [objs addObject:[(SWGObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] - options:NSJSONReadingMutableContainers - error:&error]; - bodyDictionary = JSON; - } - else if([body isKindOfClass: [SWGFile class]]) { - requestContentType = @"form-data"; - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(auth_token == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"POST" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGWordList *result = nil; - if (data) { - result = [[SWGWordList alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - - - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGWordObject.h b/samples/client/wordnik-api-objc/client/SWGWordObject.h deleted file mode 100644 index 2dff129e2bf..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordObject.h +++ /dev/null @@ -1,31 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGWordObject : SWGObject - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSString* word; - -@property(nonatomic) NSString* originalWord; - -@property(nonatomic) NSArray* suggestions; - -@property(nonatomic) NSString* canonicalForm; - -@property(nonatomic) NSString* vulgar; - -- (id) _id: (NSNumber*) _id - word: (NSString*) word - originalWord: (NSString*) originalWord - suggestions: (NSArray*) suggestions - canonicalForm: (NSString*) canonicalForm - vulgar: (NSString*) vulgar; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordObject.m b/samples/client/wordnik-api-objc/client/SWGWordObject.m deleted file mode 100644 index f1af8371a3a..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordObject.m +++ /dev/null @@ -1,51 +0,0 @@ -#import "SWGDate.h" -#import "SWGWordObject.h" - -@implementation SWGWordObject - --(id)_id: (NSNumber*) _id - word: (NSString*) word - originalWord: (NSString*) originalWord - suggestions: (NSArray*) suggestions - canonicalForm: (NSString*) canonicalForm - vulgar: (NSString*) vulgar -{ - __id = _id; - _word = word; - _originalWord = originalWord; - _suggestions = suggestions; - _canonicalForm = canonicalForm; - _vulgar = vulgar; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - __id = dict[@"id"]; - _word = dict[@"word"]; - _originalWord = dict[@"originalWord"]; - _suggestions = dict[@"suggestions"]; - _canonicalForm = dict[@"canonicalForm"]; - _vulgar = dict[@"vulgar"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) dict[@"id"] = __id ; - if(_word != nil) dict[@"word"] = _word ; - if(_originalWord != nil) dict[@"originalWord"] = _originalWord ; - if(_suggestions != nil) dict[@"suggestions"] = _suggestions ; - if(_canonicalForm != nil) dict[@"canonicalForm"] = _canonicalForm ; - if(_vulgar != nil) dict[@"vulgar"] = _vulgar ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordOfTheDay.h b/samples/client/wordnik-api-objc/client/SWGWordOfTheDay.h deleted file mode 100644 index c47646fb58a..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordOfTheDay.h +++ /dev/null @@ -1,53 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGDate.h" -#import "SWGSimpleExample.h" -#import "SWGSimpleDefinition.h" -#import "SWGContentProvider.h" - - -@interface SWGWordOfTheDay : SWGObject - -@property(nonatomic) NSNumber* _id; - -@property(nonatomic) NSString* parentId; - -@property(nonatomic) NSString* category; - -@property(nonatomic) NSString* createdBy; - -@property(nonatomic) SWGDate* createdAt; - -@property(nonatomic) SWGContentProvider* contentProvider; - -@property(nonatomic) NSString* htmlExtra; - -@property(nonatomic) NSString* word; - -@property(nonatomic) NSArray* definitions; - -@property(nonatomic) NSArray* examples; - -@property(nonatomic) NSString* note; - -@property(nonatomic) SWGDate* publishDate; - -- (id) _id: (NSNumber*) _id - parentId: (NSString*) parentId - category: (NSString*) category - createdBy: (NSString*) createdBy - createdAt: (SWGDate*) createdAt - contentProvider: (SWGContentProvider*) contentProvider - htmlExtra: (NSString*) htmlExtra - word: (NSString*) word - definitions: (NSArray*) definitions - examples: (NSArray*) examples - note: (NSString*) note - publishDate: (SWGDate*) publishDate; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordOfTheDay.m b/samples/client/wordnik-api-objc/client/SWGWordOfTheDay.m deleted file mode 100644 index 5d1d8ee90e3..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordOfTheDay.m +++ /dev/null @@ -1,204 +0,0 @@ -#import "SWGDate.h" -#import "SWGWordOfTheDay.h" - -@implementation SWGWordOfTheDay - --(id)_id: (NSNumber*) _id - parentId: (NSString*) parentId - category: (NSString*) category - createdBy: (NSString*) createdBy - createdAt: (SWGDate*) createdAt - contentProvider: (SWGContentProvider*) contentProvider - htmlExtra: (NSString*) htmlExtra - word: (NSString*) word - definitions: (NSArray*) definitions - examples: (NSArray*) examples - note: (NSString*) note - publishDate: (SWGDate*) publishDate -{ - __id = _id; - _parentId = parentId; - _category = category; - _createdBy = createdBy; - _createdAt = createdAt; - _contentProvider = contentProvider; - _htmlExtra = htmlExtra; - _word = word; - _definitions = definitions; - _examples = examples; - _note = note; - _publishDate = publishDate; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - __id = dict[@"id"]; - _parentId = dict[@"parentId"]; - _category = dict[@"category"]; - _createdBy = dict[@"createdBy"]; - id createdAt_dict = dict[@"createdAt"]; - if(createdAt_dict != nil) - _createdAt = [[SWGDate alloc]initWithValues:createdAt_dict]; - id contentProvider_dict = dict[@"contentProvider"]; - if(contentProvider_dict != nil) - _contentProvider = [[SWGContentProvider alloc]initWithValues:contentProvider_dict]; - _htmlExtra = dict[@"htmlExtra"]; - _word = dict[@"word"]; - id definitions_dict = dict[@"definitions"]; - if([definitions_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)definitions_dict count]]; - - if([(NSArray*)definitions_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)definitions_dict) { - SWGSimpleDefinition* d = [[SWGSimpleDefinition alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _definitions = [[NSArray alloc] initWithArray:objs]; - } - else { - _definitions = [[NSArray alloc] init]; - } - } - else { - _definitions = [[NSArray alloc] init]; - } - id examples_dict = dict[@"examples"]; - if([examples_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)examples_dict count]]; - - if([(NSArray*)examples_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)examples_dict) { - SWGSimpleExample* d = [[SWGSimpleExample alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _examples = [[NSArray alloc] initWithArray:objs]; - } - else { - _examples = [[NSArray alloc] init]; - } - } - else { - _examples = [[NSArray alloc] init]; - } - _note = dict[@"note"]; - id publishDate_dict = dict[@"publishDate"]; - if(publishDate_dict != nil) - _publishDate = [[SWGDate alloc]initWithValues:publishDate_dict]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) dict[@"id"] = __id ; - if(_parentId != nil) dict[@"parentId"] = _parentId ; - if(_category != nil) dict[@"category"] = _category ; - if(_createdBy != nil) dict[@"createdBy"] = _createdBy ; - if(_createdAt != nil){ - if([_createdAt isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGDate *createdAt in (NSArray*)_createdAt) { - [array addObject:[(SWGObject*)createdAt asDictionary]]; - } - dict[@"createdAt"] = array; - } - else if(_createdAt && [_createdAt isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_createdAt toString]; - if(dateString){ - dict[@"createdAt"] = dateString; - } - } - else { - if(_createdAt != nil) dict[@"createdAt"] = [(SWGObject*)_createdAt asDictionary]; - } - } - if(_contentProvider != nil){ - if([_contentProvider isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGContentProvider *contentProvider in (NSArray*)_contentProvider) { - [array addObject:[(SWGObject*)contentProvider asDictionary]]; - } - dict[@"contentProvider"] = array; - } - else if(_contentProvider && [_contentProvider isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_contentProvider toString]; - if(dateString){ - dict[@"contentProvider"] = dateString; - } - } - else { - if(_contentProvider != nil) dict[@"contentProvider"] = [(SWGObject*)_contentProvider asDictionary]; - } - } - if(_htmlExtra != nil) dict[@"htmlExtra"] = _htmlExtra ; - if(_word != nil) dict[@"word"] = _word ; - if(_definitions != nil){ - if([_definitions isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGSimpleDefinition *definitions in (NSArray*)_definitions) { - [array addObject:[(SWGObject*)definitions asDictionary]]; - } - dict[@"definitions"] = array; - } - else if(_definitions && [_definitions isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_definitions toString]; - if(dateString){ - dict[@"definitions"] = dateString; - } - } - else { - if(_definitions != nil) dict[@"definitions"] = [(SWGObject*)_definitions asDictionary]; - } - } - if(_examples != nil){ - if([_examples isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGSimpleExample *examples in (NSArray*)_examples) { - [array addObject:[(SWGObject*)examples asDictionary]]; - } - dict[@"examples"] = array; - } - else if(_examples && [_examples isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_examples toString]; - if(dateString){ - dict[@"examples"] = dateString; - } - } - else { - if(_examples != nil) dict[@"examples"] = [(SWGObject*)_examples asDictionary]; - } - } - if(_note != nil) dict[@"note"] = _note ; - if(_publishDate != nil){ - if([_publishDate isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGDate *publishDate in (NSArray*)_publishDate) { - [array addObject:[(SWGObject*)publishDate asDictionary]]; - } - dict[@"publishDate"] = array; - } - else if(_publishDate && [_publishDate isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_publishDate toString]; - if(dateString){ - dict[@"publishDate"] = dateString; - } - } - else { - if(_publishDate != nil) dict[@"publishDate"] = [(SWGObject*)_publishDate asDictionary]; - } - } - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordSearchResult.h b/samples/client/wordnik-api-objc/client/SWGWordSearchResult.h deleted file mode 100644 index 9dde43803c1..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordSearchResult.h +++ /dev/null @@ -1,22 +0,0 @@ -#import -#import "SWGObject.h" - - -@interface SWGWordSearchResult : SWGObject - -@property(nonatomic) NSNumber* count; - -@property(nonatomic) NSNumber* lexicality; - -@property(nonatomic) NSString* word; - -- (id) count: (NSNumber*) count - lexicality: (NSNumber*) lexicality - word: (NSString*) word; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordSearchResult.m b/samples/client/wordnik-api-objc/client/SWGWordSearchResult.m deleted file mode 100644 index 73e3f4c7b88..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordSearchResult.m +++ /dev/null @@ -1,39 +0,0 @@ -#import "SWGDate.h" -#import "SWGWordSearchResult.h" - -@implementation SWGWordSearchResult - --(id)count: (NSNumber*) count - lexicality: (NSNumber*) lexicality - word: (NSString*) word -{ - _count = count; - _lexicality = lexicality; - _word = word; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - _count = dict[@"count"]; - _lexicality = dict[@"lexicality"]; - _word = dict[@"word"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_count != nil) dict[@"count"] = _count ; - if(_lexicality != nil) dict[@"lexicality"] = _lexicality ; - if(_word != nil) dict[@"word"] = _word ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordSearchResults.h b/samples/client/wordnik-api-objc/client/SWGWordSearchResults.h deleted file mode 100644 index 2e74b77e2e0..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordSearchResults.h +++ /dev/null @@ -1,20 +0,0 @@ -#import -#import "SWGObject.h" -#import "SWGWordSearchResult.h" - - -@interface SWGWordSearchResults : SWGObject - -@property(nonatomic) NSArray* searchResults; - -@property(nonatomic) NSNumber* totalResults; - -- (id) searchResults: (NSArray*) searchResults - totalResults: (NSNumber*) totalResults; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; - - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordSearchResults.m b/samples/client/wordnik-api-objc/client/SWGWordSearchResults.m deleted file mode 100644 index 697542ca111..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordSearchResults.m +++ /dev/null @@ -1,71 +0,0 @@ -#import "SWGDate.h" -#import "SWGWordSearchResults.h" - -@implementation SWGWordSearchResults - --(id)searchResults: (NSArray*) searchResults - totalResults: (NSNumber*) totalResults -{ - _searchResults = searchResults; - _totalResults = totalResults; - return self; -} - --(id) initWithValues:(NSDictionary*)dict -{ - self = [super init]; - if(self) { - id searchResults_dict = dict[@"searchResults"]; - if([searchResults_dict isKindOfClass:[NSArray class]]) { - - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)searchResults_dict count]]; - - if([(NSArray*)searchResults_dict count] > 0) { - for (NSDictionary* dict in (NSArray*)searchResults_dict) { - SWGWordSearchResult* d = [[SWGWordSearchResult alloc] initWithValues:dict]; - [objs addObject:d]; - } - - _searchResults = [[NSArray alloc] initWithArray:objs]; - } - else { - _searchResults = [[NSArray alloc] init]; - } - } - else { - _searchResults = [[NSArray alloc] init]; - } - _totalResults = dict[@"totalResults"]; - - - } - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(_searchResults != nil){ - if([_searchResults isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( SWGWordSearchResult *searchResults in (NSArray*)_searchResults) { - [array addObject:[(SWGObject*)searchResults asDictionary]]; - } - dict[@"searchResults"] = array; - } - else if(_searchResults && [_searchResults isKindOfClass:[SWGDate class]]) { - NSString * dateString = [(SWGDate*)_searchResults toString]; - if(dateString){ - dict[@"searchResults"] = dateString; - } - } - else { - if(_searchResults != nil) dict[@"searchResults"] = [(SWGObject*)_searchResults asDictionary]; - } - } - if(_totalResults != nil) dict[@"totalResults"] = _totalResults ; - NSDictionary* output = [dict copy]; - return output; -} - -@end - diff --git a/samples/client/wordnik-api-objc/client/SWGWordsApi.h b/samples/client/wordnik-api-objc/client/SWGWordsApi.h deleted file mode 100644 index 24d421ef174..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordsApi.h +++ /dev/null @@ -1,151 +0,0 @@ -#import -#import "SWGDefinitionSearchResults.h" -#import "SWGWordObject.h" -#import "SWGWordOfTheDay.h" -#import "SWGWordSearchResults.h" - - - -@interface SWGWordsApi: NSObject - --(void) addHeader:(NSString*)value forKey:(NSString*)key; --(unsigned long) requestQueueSize; -+(SWGWordsApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; -+(void) setBasePath:(NSString*)basePath; -+(NSString*) getBasePath; -/** - - Searches words - - @param query Search query - @param includePartOfSpeech Only include these comma-delimited parts of speech - @param excludePartOfSpeech Exclude these comma-delimited parts of speech - @param caseSensitive Search case sensitive - @param minCorpusCount Minimum corpus frequency for terms - @param maxCorpusCount Maximum corpus frequency for terms - @param minDictionaryCount Minimum number of dictionary entries for words returned - @param maxDictionaryCount Maximum dictionary definition count - @param minLength Minimum word length - @param maxLength Maximum word length - @param skip Results to skip - @param limit Maximum number of results to return - */ --(NSNumber*) searchWordsWithCompletionBlock :(NSString*) query - includePartOfSpeech:(NSString*) includePartOfSpeech - excludePartOfSpeech:(NSString*) excludePartOfSpeech - caseSensitive:(NSString*) caseSensitive - minCorpusCount:(NSNumber*) minCorpusCount - maxCorpusCount:(NSNumber*) maxCorpusCount - minDictionaryCount:(NSNumber*) minDictionaryCount - maxDictionaryCount:(NSNumber*) maxDictionaryCount - minLength:(NSNumber*) minLength - maxLength:(NSNumber*) maxLength - skip:(NSNumber*) skip - limit:(NSNumber*) limit - completionHandler: (void (^)(SWGWordSearchResults* output, NSError* error))completionBlock; - -/** - - Returns a specific WordOfTheDay - - @param date Fetches by date in yyyy-MM-dd - */ --(NSNumber*) getWordOfTheDayWithCompletionBlock :(NSString*) date - completionHandler: (void (^)(SWGWordOfTheDay* output, NSError* error))completionBlock; - -/** - - Reverse dictionary search - - @param query Search term - @param findSenseForWord Restricts words and finds closest sense - @param includeSourceDictionaries Only include these comma-delimited source dictionaries - @param excludeSourceDictionaries Exclude these comma-delimited source dictionaries - @param includePartOfSpeech Only include these comma-delimited parts of speech - @param excludePartOfSpeech Exclude these comma-delimited parts of speech - @param expandTerms Expand terms - @param sortBy Attribute to sort by - @param sortOrder Sort direction - @param minCorpusCount Minimum corpus frequency for terms - @param maxCorpusCount Maximum corpus frequency for terms - @param minLength Minimum word length - @param maxLength Maximum word length - @param includeTags Return a closed set of XML tags in response - @param skip Results to skip - @param limit Maximum number of results to return - */ --(NSNumber*) reverseDictionaryWithCompletionBlock :(NSString*) query - findSenseForWord:(NSString*) findSenseForWord - includeSourceDictionaries:(NSString*) includeSourceDictionaries - excludeSourceDictionaries:(NSString*) excludeSourceDictionaries - includePartOfSpeech:(NSString*) includePartOfSpeech - excludePartOfSpeech:(NSString*) excludePartOfSpeech - expandTerms:(NSString*) expandTerms - sortBy:(NSString*) sortBy - sortOrder:(NSString*) sortOrder - minCorpusCount:(NSNumber*) minCorpusCount - maxCorpusCount:(NSNumber*) maxCorpusCount - minLength:(NSNumber*) minLength - maxLength:(NSNumber*) maxLength - includeTags:(NSString*) includeTags - skip:(NSString*) skip - limit:(NSNumber*) limit - completionHandler: (void (^)(SWGDefinitionSearchResults* output, NSError* error))completionBlock; - -/** - - Returns an array of random WordObjects - - @param includePartOfSpeech CSV part-of-speech values to include - @param excludePartOfSpeech CSV part-of-speech values to exclude - @param sortBy Attribute to sort by - @param sortOrder Sort direction - @param hasDictionaryDef Only return words with dictionary definitions - @param minCorpusCount Minimum corpus frequency for terms - @param maxCorpusCount Maximum corpus frequency for terms - @param minDictionaryCount Minimum dictionary count - @param maxDictionaryCount Maximum dictionary count - @param minLength Minimum word length - @param maxLength Maximum word length - @param limit Maximum number of results to return - */ --(NSNumber*) getRandomWordsWithCompletionBlock :(NSString*) includePartOfSpeech - excludePartOfSpeech:(NSString*) excludePartOfSpeech - sortBy:(NSString*) sortBy - sortOrder:(NSString*) sortOrder - hasDictionaryDef:(NSString*) hasDictionaryDef - minCorpusCount:(NSNumber*) minCorpusCount - maxCorpusCount:(NSNumber*) maxCorpusCount - minDictionaryCount:(NSNumber*) minDictionaryCount - maxDictionaryCount:(NSNumber*) maxDictionaryCount - minLength:(NSNumber*) minLength - maxLength:(NSNumber*) maxLength - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; - -/** - - Returns a single random WordObject - - @param includePartOfSpeech CSV part-of-speech values to include - @param excludePartOfSpeech CSV part-of-speech values to exclude - @param hasDictionaryDef Only return words with dictionary definitions - @param minCorpusCount Minimum corpus frequency for terms - @param maxCorpusCount Maximum corpus frequency for terms - @param minDictionaryCount Minimum dictionary count - @param maxDictionaryCount Maximum dictionary count - @param minLength Minimum word length - @param maxLength Maximum word length - */ --(NSNumber*) getRandomWordWithCompletionBlock :(NSString*) includePartOfSpeech - excludePartOfSpeech:(NSString*) excludePartOfSpeech - hasDictionaryDef:(NSString*) hasDictionaryDef - minCorpusCount:(NSNumber*) minCorpusCount - maxCorpusCount:(NSNumber*) maxCorpusCount - minDictionaryCount:(NSNumber*) minDictionaryCount - maxDictionaryCount:(NSNumber*) maxDictionaryCount - minLength:(NSNumber*) minLength - maxLength:(NSNumber*) maxLength - completionHandler: (void (^)(SWGWordObject* output, NSError* error))completionBlock; - -@end diff --git a/samples/client/wordnik-api-objc/client/SWGWordsApi.m b/samples/client/wordnik-api-objc/client/SWGWordsApi.m deleted file mode 100644 index 6d8ad8fdcfc..00000000000 --- a/samples/client/wordnik-api-objc/client/SWGWordsApi.m +++ /dev/null @@ -1,399 +0,0 @@ -#import "SWGWordsApi.h" -#import "SWGFile.h" -#import "SWGApiClient.h" -#import "SWGDefinitionSearchResults.h" -#import "SWGWordObject.h" -#import "SWGWordOfTheDay.h" -#import "SWGWordSearchResults.h" - - - - -@implementation SWGWordsApi -static NSString * basePath = @"http://api.wordnik.com/v4"; - -+(SWGWordsApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { - static SWGWordsApi* singletonAPI = nil; - - if (singletonAPI == nil) { - singletonAPI = [[SWGWordsApi alloc] init]; - [singletonAPI addHeader:headerValue forKey:key]; - } - return singletonAPI; -} - -+(void) setBasePath:(NSString*)path { - basePath = path; -} - -+(NSString*) getBasePath { - return basePath; -} - --(SWGApiClient*) apiClient { - return [SWGApiClient sharedClientFromPool:basePath]; -} - --(void) addHeader:(NSString*)value forKey:(NSString*)key { - [[self apiClient] setHeaderValue:value forKey:key]; -} - --(id) init { - self = [super init]; - [self apiClient]; - return self; -} - --(void) setHeaderValue:(NSString*) value - forKey:(NSString*)key { - [[self apiClient] setHeaderValue:value forKey:key]; -} - --(unsigned long) requestQueueSize { - return [SWGApiClient requestQueueSize]; -} - - --(NSNumber*) searchWordsWithCompletionBlock:(NSString*) query - includePartOfSpeech:(NSString*) includePartOfSpeech - excludePartOfSpeech:(NSString*) excludePartOfSpeech - caseSensitive:(NSString*) caseSensitive - minCorpusCount:(NSNumber*) minCorpusCount - maxCorpusCount:(NSNumber*) maxCorpusCount - minDictionaryCount:(NSNumber*) minDictionaryCount - maxDictionaryCount:(NSNumber*) maxDictionaryCount - minLength:(NSNumber*) minLength - maxLength:(NSNumber*) maxLength - skip:(NSNumber*) skip - limit:(NSNumber*) limit - completionHandler: (void (^)(SWGWordSearchResults* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/words.{format}/search/{query}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"query", @"}"]] withString: [SWGApiClient escape:query]]; - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(caseSensitive != nil) - queryParams[@"caseSensitive"] = caseSensitive; - if(includePartOfSpeech != nil) - queryParams[@"includePartOfSpeech"] = includePartOfSpeech; - if(excludePartOfSpeech != nil) - queryParams[@"excludePartOfSpeech"] = excludePartOfSpeech; - if(minCorpusCount != nil) - queryParams[@"minCorpusCount"] = minCorpusCount; - if(maxCorpusCount != nil) - queryParams[@"maxCorpusCount"] = maxCorpusCount; - if(minDictionaryCount != nil) - queryParams[@"minDictionaryCount"] = minDictionaryCount; - if(maxDictionaryCount != nil) - queryParams[@"maxDictionaryCount"] = maxDictionaryCount; - if(minLength != nil) - queryParams[@"minLength"] = minLength; - if(maxLength != nil) - queryParams[@"maxLength"] = maxLength; - if(skip != nil) - queryParams[@"skip"] = skip; - if(limit != nil) - queryParams[@"limit"] = limit; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(query == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGWordSearchResults *result = nil; - if (data) { - result = [[SWGWordSearchResults alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) getWordOfTheDayWithCompletionBlock:(NSString*) date - completionHandler: (void (^)(SWGWordOfTheDay* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/words.{format}/wordOfTheDay", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(date != nil) - queryParams[@"date"] = date; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGWordOfTheDay *result = nil; - if (data) { - result = [[SWGWordOfTheDay alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) reverseDictionaryWithCompletionBlock:(NSString*) query - findSenseForWord:(NSString*) findSenseForWord - includeSourceDictionaries:(NSString*) includeSourceDictionaries - excludeSourceDictionaries:(NSString*) excludeSourceDictionaries - includePartOfSpeech:(NSString*) includePartOfSpeech - excludePartOfSpeech:(NSString*) excludePartOfSpeech - expandTerms:(NSString*) expandTerms - sortBy:(NSString*) sortBy - sortOrder:(NSString*) sortOrder - minCorpusCount:(NSNumber*) minCorpusCount - maxCorpusCount:(NSNumber*) maxCorpusCount - minLength:(NSNumber*) minLength - maxLength:(NSNumber*) maxLength - includeTags:(NSString*) includeTags - skip:(NSString*) skip - limit:(NSNumber*) limit - completionHandler: (void (^)(SWGDefinitionSearchResults* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/words.{format}/reverseDictionary", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(query != nil) - queryParams[@"query"] = query; - if(findSenseForWord != nil) - queryParams[@"findSenseForWord"] = findSenseForWord; - if(includeSourceDictionaries != nil) - queryParams[@"includeSourceDictionaries"] = includeSourceDictionaries; - if(excludeSourceDictionaries != nil) - queryParams[@"excludeSourceDictionaries"] = excludeSourceDictionaries; - if(includePartOfSpeech != nil) - queryParams[@"includePartOfSpeech"] = includePartOfSpeech; - if(excludePartOfSpeech != nil) - queryParams[@"excludePartOfSpeech"] = excludePartOfSpeech; - if(minCorpusCount != nil) - queryParams[@"minCorpusCount"] = minCorpusCount; - if(maxCorpusCount != nil) - queryParams[@"maxCorpusCount"] = maxCorpusCount; - if(minLength != nil) - queryParams[@"minLength"] = minLength; - if(maxLength != nil) - queryParams[@"maxLength"] = maxLength; - if(expandTerms != nil) - queryParams[@"expandTerms"] = expandTerms; - if(includeTags != nil) - queryParams[@"includeTags"] = includeTags; - if(sortBy != nil) - queryParams[@"sortBy"] = sortBy; - if(sortOrder != nil) - queryParams[@"sortOrder"] = sortOrder; - if(skip != nil) - queryParams[@"skip"] = skip; - if(limit != nil) - queryParams[@"limit"] = limit; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(query == nil) { - // error - } - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGDefinitionSearchResults *result = nil; - if (data) { - result = [[SWGDefinitionSearchResults alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - --(NSNumber*) getRandomWordsWithCompletionBlock:(NSString*) includePartOfSpeech - excludePartOfSpeech:(NSString*) excludePartOfSpeech - sortBy:(NSString*) sortBy - sortOrder:(NSString*) sortOrder - hasDictionaryDef:(NSString*) hasDictionaryDef - minCorpusCount:(NSNumber*) minCorpusCount - maxCorpusCount:(NSNumber*) maxCorpusCount - minDictionaryCount:(NSNumber*) minDictionaryCount - maxDictionaryCount:(NSNumber*) maxDictionaryCount - minLength:(NSNumber*) minLength - maxLength:(NSNumber*) maxLength - limit:(NSNumber*) limit - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/words.{format}/randomWords", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(hasDictionaryDef != nil) - queryParams[@"hasDictionaryDef"] = hasDictionaryDef; - if(includePartOfSpeech != nil) - queryParams[@"includePartOfSpeech"] = includePartOfSpeech; - if(excludePartOfSpeech != nil) - queryParams[@"excludePartOfSpeech"] = excludePartOfSpeech; - if(minCorpusCount != nil) - queryParams[@"minCorpusCount"] = minCorpusCount; - if(maxCorpusCount != nil) - queryParams[@"maxCorpusCount"] = maxCorpusCount; - if(minDictionaryCount != nil) - queryParams[@"minDictionaryCount"] = minDictionaryCount; - if(maxDictionaryCount != nil) - queryParams[@"maxDictionaryCount"] = maxDictionaryCount; - if(minLength != nil) - queryParams[@"minLength"] = minLength; - if(maxLength != nil) - queryParams[@"maxLength"] = maxLength; - if(sortBy != nil) - queryParams[@"sortBy"] = sortBy; - if(sortOrder != nil) - queryParams[@"sortOrder"] = sortOrder; - if(limit != nil) - queryParams[@"limit"] = limit; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - SWGWordObject* d = [[SWGWordObject alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - }]; - - -} - --(NSNumber*) getRandomWordWithCompletionBlock:(NSString*) includePartOfSpeech - excludePartOfSpeech:(NSString*) excludePartOfSpeech - hasDictionaryDef:(NSString*) hasDictionaryDef - minCorpusCount:(NSNumber*) minCorpusCount - maxCorpusCount:(NSNumber*) maxCorpusCount - minDictionaryCount:(NSNumber*) minDictionaryCount - maxDictionaryCount:(NSNumber*) maxDictionaryCount - minLength:(NSNumber*) minLength - maxLength:(NSNumber*) maxLength - completionHandler: (void (^)(SWGWordObject* output, NSError* error))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/words.{format}/randomWord", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSString* requestContentType = @"application/json"; - NSString* responseContentType = @"application/json"; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(hasDictionaryDef != nil) - queryParams[@"hasDictionaryDef"] = hasDictionaryDef; - if(includePartOfSpeech != nil) - queryParams[@"includePartOfSpeech"] = includePartOfSpeech; - if(excludePartOfSpeech != nil) - queryParams[@"excludePartOfSpeech"] = excludePartOfSpeech; - if(minCorpusCount != nil) - queryParams[@"minCorpusCount"] = minCorpusCount; - if(maxCorpusCount != nil) - queryParams[@"maxCorpusCount"] = maxCorpusCount; - if(minDictionaryCount != nil) - queryParams[@"minDictionaryCount"] = minDictionaryCount; - if(maxDictionaryCount != nil) - queryParams[@"maxDictionaryCount"] = maxDictionaryCount; - if(minLength != nil) - queryParams[@"minLength"] = minLength; - if(maxLength != nil) - queryParams[@"maxLength"] = maxLength; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - - return [client dictionary:requestUrl - method:@"GET" - queryParams:queryParams - body:bodyDictionary - headerParams:headerParams - requestContentType:requestContentType - responseContentType:responseContentType - completionBlock:^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - SWGWordObject *result = nil; - if (data) { - result = [[SWGWordObject alloc]initWithValues: data]; - } - completionBlock(result , nil);}]; - - -} - - - -@end diff --git a/samples/client/wordnik-api-php/PHPWordnikApiCodegen.scala b/samples/client/wordnik-api-php/PHPWordnikApiCodegen.scala deleted file mode 100644 index 91573211cb9..00000000000 --- a/samples/client/wordnik-api-php/PHPWordnikApiCodegen.scala +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright 2014 Wordnik, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import java.io.File - -object PHPWordnikApiCodegen extends BasicPHPGenerator { - def main(args: Array[String]) = generateClient(args) - - override def supportingFiles = List( - ("Swagger.mustache", destinationDir + File.separator + apiPackage.get, "Swagger.php") - ) - - override def destinationDir = "samples/client/wordnik-api/php/wordnik" -} diff --git a/samples/client/wordnik-api-php/README.md b/samples/client/wordnik-api-php/README.md deleted file mode 100644 index 9455aaf04da..00000000000 --- a/samples/client/wordnik-api-php/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# PHP client for Wordnik.com API - -## Overview - -This is a PHP client for the Wordnik.com v4 API. For more information, see http://developer.wordnik.com/ . - -## Generation - -This client was generated using the provided script: - -``` -/bin/php-wordnik-api.sh -``` - -## Testing - -These tests require PHPUnit. If you require PHPUnit to be installed, first get PEAR: - -```sh -wget http://pear.php.net/go-pear.phar -php -d detect_unicode=0 go-pear.phar -``` - -Then install PHPUnit: - -```sh -pear config-set auto_discover 1 -pear install pear.phpunit.de/PHPUnit -``` - -The tests require you to set three environment varibales: - -```sh -export API_KEY=your api key -export USER_NAME=some wordnik.com username -export PASSWORD=the user's password -``` - -The tests can be run as follows: - -```sh -phpunit tests/AccountApiTest.php -phpunit tests/WordApiTest.php -phpunit tests/WordsApiTest.php -phpunit tests/WordListApiTest.php -phpunit tests/WordListsApiTest.php -``` diff --git a/samples/client/wordnik-api-php/tests/BaseApiTest.php b/samples/client/wordnik-api-php/tests/BaseApiTest.php deleted file mode 100644 index ac32b689778..00000000000 --- a/samples/client/wordnik-api-php/tests/BaseApiTest.php +++ /dev/null @@ -1,56 +0,0 @@ -apiUrl = 'https://api.wordnik.com/v4'; - $this->apiKey = getenv('API_KEY'); - $this->username = getenv('USER_NAME'); - $this->password = getenv('PASSWORD'); - $this->client = new APIClient($this->apiKey, $this->apiUrl); - $this->accountApi = new AccountApi($this->client); - $this->wordApi = new WordApi($this->client); - $this->wordListApi = new WordListApi($this->client); - $this->wordListsApi = new WordListsApi($this->client); - $this->wordsApi = new WordsApi($this->client); - } - - public function tearDown() { - unset($this->client); - } - -} - - -?> diff --git a/samples/client/wordnik-api-php/wordnik/AccountApi.php b/samples/client/wordnik-api-php/wordnik/AccountApi.php deleted file mode 100644 index 6b77a5fe01c..00000000000 --- a/samples/client/wordnik-api-php/wordnik/AccountApi.php +++ /dev/null @@ -1,250 +0,0 @@ -apiClient = $apiClient; - } - - /** - * authenticate - * Authenticates a User - * username, string: A confirmed Wordnik username (required) - - * password, string: The user's password (required) - - * @return AuthenticationToken - */ - - public function authenticate($username, $password) { - - //parse inputs - $resourcePath = "/account.{format}/authenticate/{username}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $queryParams = array(); - $headerParams = array(); - $headerParams['Accept'] = 'application/json'; - $headerParams['Content-Type'] = 'application/json'; - - if($password != null) { - $queryParams['password'] = $this->apiClient->toQueryValue($password); - } - if($username != null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } - //make the API Call - if (! isset($body)) { - $body = null; - } - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); - - - if(! $response){ - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'AuthenticationToken'); - return $responseObject; - - } - /** - * authenticatePost - * Authenticates a user - * username, string: A confirmed Wordnik username (required) - - * body, string: The user's password (required) - - * @return AuthenticationToken - */ - - public function authenticatePost($username, $body) { - - //parse inputs - $resourcePath = "/account.{format}/authenticate/{username}"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "POST"; - $queryParams = array(); - $headerParams = array(); - $headerParams['Accept'] = 'application/json'; - $headerParams['Content-Type'] = 'application/json'; - - if($username != null) { - $resourcePath = str_replace("{" . "username" . "}", - $this->apiClient->toPathValue($username), $resourcePath); - } - //make the API Call - if (! isset($body)) { - $body = null; - } - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); - - - if(! $response){ - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'AuthenticationToken'); - return $responseObject; - - } - /** - * getWordListsForLoggedInUser - * Fetches WordList objects for the logged-in user. - * auth_token, string: auth_token of logged-in user (required) - - * skip, int: Results to skip (optional) - - * limit, int: Maximum number of results to return (optional) - - * @return array[WordList] - */ - - public function getWordListsForLoggedInUser($auth_token, $skip=null, $limit=null) { - - //parse inputs - $resourcePath = "/account.{format}/wordLists"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $queryParams = array(); - $headerParams = array(); - $headerParams['Accept'] = 'application/json'; - $headerParams['Content-Type'] = 'application/json'; - - if($skip != null) { - $queryParams['skip'] = $this->apiClient->toQueryValue($skip); - } - if($limit != null) { - $queryParams['limit'] = $this->apiClient->toQueryValue($limit); - } - if($auth_token != null) { - $headerParams['auth_token'] = $this->apiClient->toHeaderValue($auth_token); - } - //make the API Call - if (! isset($body)) { - $body = null; - } - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); - - - if(! $response){ - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'array[WordList]'); - return $responseObject; - - } - /** - * getApiTokenStatus - * Returns usage statistics for the API account. - * api_key, string: Wordnik authentication token (optional) - - * @return ApiTokenStatus - */ - - public function getApiTokenStatus($api_key=null) { - - //parse inputs - $resourcePath = "/account.{format}/apiTokenStatus"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $queryParams = array(); - $headerParams = array(); - $headerParams['Accept'] = 'application/json'; - $headerParams['Content-Type'] = 'application/json'; - - if($api_key != null) { - $headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key); - } - //make the API Call - if (! isset($body)) { - $body = null; - } - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); - - - if(! $response){ - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'ApiTokenStatus'); - return $responseObject; - - } - /** - * getLoggedInUser - * Returns the logged-in User - * auth_token, string: The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) (required) - - * @return User - */ - - public function getLoggedInUser($auth_token) { - - //parse inputs - $resourcePath = "/account.{format}/user"; - $resourcePath = str_replace("{format}", "json", $resourcePath); - $method = "GET"; - $queryParams = array(); - $headerParams = array(); - $headerParams['Accept'] = 'application/json'; - $headerParams['Content-Type'] = 'application/json'; - - if($auth_token != null) { - $headerParams['auth_token'] = $this->apiClient->toHeaderValue($auth_token); - } - //make the API Call - if (! isset($body)) { - $body = null; - } - $response = $this->apiClient->callAPI($resourcePath, $method, - $queryParams, $body, - $headerParams); - - - if(! $response){ - return null; - } - - $responseObject = $this->apiClient->deserialize($response, - 'User'); - return $responseObject; - - } - - -} - diff --git a/samples/client/wordnik-api/scala/src/test/scala/AccountApiTest.scala b/samples/client/wordnik-api/scala/src/test/scala/AccountApiTest.scala deleted file mode 100644 index 474406fd229..00000000000 --- a/samples/client/wordnik-api/scala/src/test/scala/AccountApiTest.scala +++ /dev/null @@ -1,65 +0,0 @@ - - -@RunWith(classOf[JUnitRunner]) -class AccountApiTest extends FlatSpec with Matchers with BaseApiTest { - behavior of "AccountApi" - val api = new AccountApi - - api.addHeader("api_key", API_KEY) - - val auth = api.authenticate(USER_NAME, PASSWORD).get - - it should "authenticate" in { - api.authenticate(USER_NAME, PASSWORD) match { - case Some(key) => { - key.token should not be (null) - key.userId should not be (0) - key.userSignature should not be null - } - case None => fail("couldn't authenticate") - } - } - - it should "authenticate with post" in { - api.authenticatePost(USER_NAME, PASSWORD) match { - case Some(key) => { - key.token should not be (null) - key.userId should not be (0) - key.userSignature should not be null - } - case None => fail("couldn't authenticate") - } - } - - it should "fetch word lists for the current user" in { - api.getWordListsForLoggedInUser(auth.token, 0, 15) match { - case Some(lists) => { - lists.size should not be (0) - } - case None => fail("didn't fetch lists for user") - } - } - - it should "fetch api token status" in { - api.getApiTokenStatus(API_KEY) match { - case Some(status) => { - status.valid should be(true) - status.token should not be (null) - status.remainingCalls should not be (0) - } - case None => fail("ooops") - } - } - - it should "get the logged in user" in { - api.getLoggedInUser(auth.token) match { - case Some(user) => { - user.id should not be (0) - user.username should be(USER_NAME) - user.status should be(0) - user.email should not be (null) - } - case None => fail("didn't get user") - } - } -} \ No newline at end of file diff --git a/samples/client/wordnik-api/scala/src/test/scala/WordApiTest.scala b/samples/client/wordnik-api/scala/src/test/scala/WordApiTest.scala deleted file mode 100644 index 58401c904d5..00000000000 --- a/samples/client/wordnik-api/scala/src/test/scala/WordApiTest.scala +++ /dev/null @@ -1,131 +0,0 @@ -import scala.io.Source - -@RunWith(classOf[JUnitRunner]) -class WordApiTest extends FlatSpec with Matchers with BaseApiTest { - behavior of "WordApi" - val api = new WordApi - - api.addHeader("api_key", API_KEY) - - it should "verify the word apis" in { - val json = Source.fromURL("http://api.wordnik.com/v4/word.json").mkString - val doc = JsonUtil.getJsonMapper.readValue(json, classOf[Documentation]) - assert(doc.getApis.size === 12) - } - - it should "fetch a word" in { - api.getWord("cat") match { - case Some(word) => { - word.word should be("cat") - word should not be (null) - } - case None => fail("didn't find word cat") - } - } - - it should "fetch a word with suggestions" in { - api.getWord("cAt", "false", "true") match { - case Some(word) => { - word.word should be("cAt") - word.suggestions.size should be(1) - word.suggestions(0) should be("cat") - word should not be (null) - } - case None => fail("didn't find word cAt") - } - } - - it should "fetch a word with canonical form" in { - api.getWord("cAt", "true") match { - case Some(word) => { - word.word should be("cat") - word should not be (null) - } - case None => fail("didn't find word cat") - } - } - - it should "fetch definitions for a word" in { - api.getDefinitions("cat", null, null, 10) match { - case Some(definitions) => { - definitions.size should be(10) - } - case None => fail("didn't find definitions for cat") - } - } - - it should "fetch examples for a word" in { - api.getExamples("cat", "false", "false", 0, 5) match { - case Some(examples) => { - examples.examples.size should be(5) - } - case None => fail("didn't find examples for cat") - } - } - - it should "fetch a top example for a word" in { - api.getTopExample("cat") match { - case Some(example) => { - example.word should be("cat") - } - case None => fail("didn't find examples for cat") - } - } - - it should "get text pronunciations for a word" in { - api.getTextPronunciations("cat", null, null, null, 2) match { - case Some(prons) => { - prons.size should be(2) - } - case None => fail("didn't find prons for cat") - } - } - - it should "get hyphenation for a word" in { - api.getHyphenation("catalog", null, null) match { - case Some(hyphenation) => { - hyphenation.size should be(3) - } - case None => fail("didn't find hyphenation for catalog") - } - } - - it should "get word frequency for a word" in { - api.getWordFrequency("cat") match { - case Some(frequency) => { - frequency.totalCount should not be (0) - } - case None => fail("didn't find frequency for cat") - } - } - - it should "get word phrases for a word" in { - api.getPhrases("money", 10, 0) match { - case Some(phrases) => { - phrases.size should not be (0) - } - case None => fail("didn't find phrases for money") - } - } - - it should "get related words" in { - api.getRelatedWords("cat", null, null) match { - case Some(relateds) => { - var count = 0 - relateds.foreach(related => { - related.words.size should (be <= 10) - }) - } - case None => fail("didn't find related words") - } - } - - it should "get audio for a word" in { - api.getAudio("cat", "true", 2) match { - case Some(audio) => { - audio.size should be(2) - } - case None => fail("didn't find audio") - } - } -} diff --git a/samples/client/wordnik-api/scala/src/test/scala/WordListApiTest.scala b/samples/client/wordnik-api/scala/src/test/scala/WordListApiTest.scala deleted file mode 100644 index 1c5adaa871b..00000000000 --- a/samples/client/wordnik-api/scala/src/test/scala/WordListApiTest.scala +++ /dev/null @@ -1,87 +0,0 @@ - - -@RunWith(classOf[JUnitRunner]) -class WordListApiTest extends FlatSpec with Matchers with BaseApiTest { - behavior of "WordListApi" - val api = new WordListApi - - api.addHeader("api_key", API_KEY) - - val accountApi = new AccountApi - val auth = accountApi.authenticate(USER_NAME, PASSWORD).get - val existingList = accountApi.getWordListsForLoggedInUser(auth.token, 0, 1).get.head - - val wordListsApi = new WordListsApi - - val wordList = WordList( - 0, // id - null, // permalink - "my test list", // name - new java.util.Date, //created at - null, // updated at - null, // lastActivityAt - null, // username - 0, // user id - "some words I want to play with", // description - 0, // words in list - "PUBLIC") // type - - var sampleList = wordListsApi.createWordList(wordList, auth.token) match { - case Some(wl) => wl - case None => throw new Exception("can't create test list to run tests with") - } - - it should "get a word list by permalink" in { - api.getWordListByPermalink(existingList.permalink, auth.token) match { - case Some(list) => { - list should not be (null) - } - case None => fail("didn't get existing word list") - } - } - - it should "update a word list" in { - val description = "list updated at " + new java.util.Date - - val updatedList = existingList.copy(description = description) - api.updateWordList(updatedList.permalink, updatedList, auth.token) - - api.getWordListByPermalink(updatedList.permalink, auth.token) match { - case Some(list) => list.description should be(description) - case None => fail("didn't update word list") - } - } - - it should "add words to a list" in { - val wordsToAdd = List( - StringValue("delicious"), - StringValue("tasty"), - StringValue("scrumptious") - ) - - api.addWordsToWordList(sampleList.permalink, wordsToAdd, auth.token) - } - - it should "get word list words" in { - api.getWordListWords(sampleList.permalink, auth.token) match { - case Some(words) => { - ((words.map(w => w.word)).toSet & Set("delicious", "tasty", "scrumptious")).size should be(3) - } - case None => fail("didn't get word list") - } - } - - it should "remove words from a list" in { - val wordsToRemove = List( - StringValue("delicious"), - StringValue("tasty") - ) - - api.deleteWordsFromWordList(sampleList.permalink, wordsToRemove, auth.token) - api.getWordListWords(sampleList.permalink, auth.token).get.size should be(1) - } - - it should "delete a word list" in { - api.deleteWordList(sampleList.permalink, auth.token) - } -} \ No newline at end of file diff --git a/samples/client/wordnik-api/scala/src/test/scala/WordsApiTest.scala b/samples/client/wordnik-api/scala/src/test/scala/WordsApiTest.scala deleted file mode 100644 index 1f518940bcb..00000000000 --- a/samples/client/wordnik-api/scala/src/test/scala/WordsApiTest.scala +++ /dev/null @@ -1,58 +0,0 @@ - - -@RunWith(classOf[JUnitRunner]) -class WordsApiTest extends FlatSpec with Matchers with BaseApiTest { - behavior of "WordsApi" - val api = new WordsApi - - api.addHeader("api_key", API_KEY) - - it should "search words by path" in { - api.searchWords("ca", null, null) match { - case Some(words) => { - words should not be (null) - words.searchResults(0).word should be("ca") - words.searchResults.size should be(11) - words.totalResults should not be (0) - } - case None => fail("didn't find word cat") - } - } - - it should "get word of the day" in { - api.getWordOfTheDay(null) match { - case Some(wotd) => { - wotd.word should not be (null) - } - case None => fail("didn't get wotd") - } - } - - it should "call the reverse dictionary" in { - api.reverseDictionary("hairy", null, null, null, null, null, null, null, null) match { - case Some(search) => { - search.totalResults should not be (0) - search.results.size should not be (0) - } - case None => fail("failed to get words") - } - } - - it should "get 10 random words" in { - api.getRandomWords(null, null, null, null) match { - case Some(words) => { - words.size should be(10) - } - case None => fail("didn't get random words") - } - } - - it should "get one random words" in { - api.getRandomWord(null, null) match { - case Some(word) => { - word should not be (null) - } - case None => fail("didn't get random word") - } - } -} \ No newline at end of file diff --git a/samples/client/wordnik/akka-scala/pom.xml b/samples/client/wordnik/akka-scala/pom.xml deleted file mode 100644 index 07ba600a902..00000000000 --- a/samples/client/wordnik/akka-scala/pom.xml +++ /dev/null @@ -1,230 +0,0 @@ - - 4.0.0 - com.wordnik - swagger-client - jar - swagger-client - 1.0.0 - - 2.2.0 - - - - - maven-mongodb-plugin-repo - maven mongodb plugin repository - http://maven-mongodb-plugin.googlecode.com/svn/maven/repo - default - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory}/lib - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.2 - - - - jar - test-jar - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add_sources - generate-sources - - add-source - - - - - src/main/java - - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - - src/test/java - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - - 1.6 - - 1.6 - - - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin-version} - - - scala-compile-first - process-resources - - add-source - compile - - - - scala-test-compile - process-test-resources - - testCompile - - - - - - -feature - - - -Xms128m - -Xmx1500m - - - - - - - - - org.scala-tools - maven-scala-plugin - - ${scala-version} - - - - - - - org.scala-lang - scala-library - ${scala-version} - - - com.wordnik - swagger-core - ${swagger-core-version} - - - org.scalatest - scalatest_2.10 - ${scala-test-version} - test - - - junit - junit - ${junit-version} - test - - - joda-time - joda-time - ${joda-time-version} - - - org.joda - joda-convert - ${joda-version} - - - com.typesafe - config - 1.2.1 - - - com.typesafe.akka - akka-actor_2.10 - ${akka-version} - - - io.spray - spray-client - ${spray-version} - - - org.json4s - json4s-jackson_2.10 - ${json4s-jackson-version} - - - - 2.10.4 - 3.2.11 - 3.2.11 - 1.3.1 - 2.3.9 - 1.2 - 2.2 - 1.5.0-M1 - 1.0.0 - - 4.8.1 - 3.1.5 - 2.1.3 - - diff --git a/samples/client/wordnik/akka-scala/src/main/resources/reference.conf b/samples/client/wordnik/akka-scala/src/main/resources/reference.conf deleted file mode 100644 index 41f5f4a60cc..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/resources/reference.conf +++ /dev/null @@ -1,24 +0,0 @@ -io.swagger.client { - - apiRequest { - - compression { - enabled: false - size-threshold: 0 - } - - trust-certificates: true - - connection-timeout: 5000ms - - default-headers { - "userAgent": "swagger-client_1.0.0" - } - - // let you define custom http status code, as in : - // { code: 601, reason: "some custom http status code", success: false } - custom-codes: [] - } -} - -spray.can.host-connector.max-redirects = 10 \ No newline at end of file diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/AccountApi.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/AccountApi.scala deleted file mode 100644 index 0b722750b24..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/AccountApi.scala +++ /dev/null @@ -1,100 +0,0 @@ -package io.swagger.client.api - -object AccountApi { - - /** - * - * - * Expected answers: - * code 200 : ApiTokenStatus (Usage statistics for the supplied API key) - * code 400 : (No token supplied.) - * code 404 : (No API account with supplied token.) - * - * @param apiKey Wordnik authentication token - */ - def getApiTokenStatus(apiKey: Option[String] = None): ApiRequest[ApiTokenStatus] = - ApiRequest[ApiTokenStatus](ApiMethods.GET, "https://api.wordnik.com/v4", "/account.json/apiTokenStatus", "application/json") - .withHeaderParam("api_key", apiKey) - .withSuccessResponse[ApiTokenStatus](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : AuthenticationToken (A valid authentication token) - * code 403 : (Account not available.) - * code 404 : (User not found.) - * - * @param username A confirmed Wordnik username - * @param password The user's password - */ - def authenticate(username: String, password: String): ApiRequest[AuthenticationToken] = - ApiRequest[AuthenticationToken](ApiMethods.GET, "https://api.wordnik.com/v4", "/account.json/authenticate/{username}", "application/json") - .withQueryParam("password", password) - .withPathParam("username", username) - .withSuccessResponse[AuthenticationToken](200) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : AuthenticationToken (A valid authentication token) - * code 403 : (Account not available.) - * code 404 : (User not found.) - * - * @param username A confirmed Wordnik username - * @param body The user's password - */ - def authenticatePost(username: String, body: String): ApiRequest[AuthenticationToken] = - ApiRequest[AuthenticationToken](ApiMethods.POST, "https://api.wordnik.com/v4", "/account.json/authenticate/{username}", "application/json") - .withBody(body) - .withPathParam("username", username) - .withSuccessResponse[AuthenticationToken](200) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - /** - * Requires a valid auth_token to be set. - * - * Expected answers: - * code 200 : User (The logged-in user) - * code 403 : (Not logged in.) - * code 404 : (User not found.) - * - * @param authToken The auth token of the logged-in user, obtained by calling /account.json/authenticate/{username} (described above) - */ - def getLoggedInUser(authToken: String): ApiRequest[User] = - ApiRequest[User](ApiMethods.GET, "https://api.wordnik.com/v4", "/account.json/user", "application/json") - .withHeaderParam("auth_token", authToken) - .withSuccessResponse[User](200) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : Seq[WordList] (success) - * code 403 : (Not authenticated.) - * code 404 : (User account not found.) - * - * @param authToken auth_token of logged-in user - * @param skip Results to skip - * @param limit Maximum number of results to return - */ - def getWordListsForLoggedInUser(authToken: String, skip: Option[Int] = None, limit: Option[Int] = None): ApiRequest[Seq[WordList]] = - ApiRequest[Seq[WordList]](ApiMethods.GET, "https://api.wordnik.com/v4", "/account.json/wordLists", "application/json") - .withQueryParam("skip", skip) - .withQueryParam("limit", limit) - .withHeaderParam("auth_token", authToken) - .withSuccessResponse[Seq[WordList]](200) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - -} - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/EnumsSerializers.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/EnumsSerializers.scala deleted file mode 100644 index 43b0284db57..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/EnumsSerializers.scala +++ /dev/null @@ -1,37 +0,0 @@ -package io.swagger.client.api - -import scala.reflect.ClassTag - -object EnumsSerializers { - - def all = Seq[Serializer[_]]() - - - private class EnumNameSerializer[E <: Enumeration : ClassTag](enum: E) - extends Serializer[E#Value] { - - val EnumerationClass = classOf[E#Value] - - def deserialize(implicit format: Formats): - PartialFunction[(TypeInfo, JValue), E#Value] = { - case (t@TypeInfo(EnumerationClass, _), json) if isValid(json) => { - json match { - case JString(value) => - enum.withName(value) - case value => - throw new MappingException(s"Can't convert $value to $EnumerationClass") - } - } - } - - private[this] def isValid(json: JValue) = json match { - case JString(value) if enum.values.exists(_.toString == value) => true - case _ => false - } - - def serialize(implicit format: Formats): PartialFunction[Any, JValue] = { - case i: E#Value => i.toString - } - } - -} \ No newline at end of file diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordApi.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordApi.scala deleted file mode 100644 index 04c0a046750..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordApi.scala +++ /dev/null @@ -1,242 +0,0 @@ -package io.swagger.client.api - -object WordApi { - - /** - * - * - * Expected answers: - * code 200 : WordObject (success) - * code 400 : (Invalid word supplied.) - * - * @param word String value of WordObject to return - * @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - * @param includeSuggestions Return suggestions (for correct spelling, case variants, etc.) - */ - def getWord(word: String, useCanonical: Option[String] = None, includeSuggestions: Option[String] = None): ApiRequest[WordObject] = - ApiRequest[WordObject](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}", "application/json") - .withQueryParam("useCanonical", useCanonical) - .withQueryParam("includeSuggestions", includeSuggestions) - .withPathParam("word", word) - .withSuccessResponse[WordObject](200) - .withErrorResponse[Unit](400) - - /** - * The metadata includes a time-expiring fileUrl which allows reading the audio file directly from the API. Currently only audio pronunciations from the American Heritage Dictionary in mp3 format are supported. - * - * Expected answers: - * code 200 : Seq[AudioFile] (success) - * code 400 : (Invalid word supplied.) - * - * @param word Word to get audio for. - * @param useCanonical Use the canonical form of the word - * @param limit Maximum number of results to return - */ - def getAudio(word: String, useCanonical: Option[String] = None, limit: Option[Int] = None): ApiRequest[Seq[AudioFile]] = - ApiRequest[Seq[AudioFile]](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}/audio", "application/json") - .withQueryParam("useCanonical", useCanonical) - .withQueryParam("limit", limit) - .withPathParam("word", word) - .withSuccessResponse[Seq[AudioFile]](200) - .withErrorResponse[Unit](400) - - /** - * - * - * Expected answers: - * code 200 : Seq[Definition] (success) - * code 400 : (Invalid word supplied.) - * code 404 : (No definitions found.) - * - * @param word Word to return definitions for - * @param limit Maximum number of results to return - * @param partOfSpeech CSV list of part-of-speech types - * @param includeRelated Return related words with definitions - * @param sourceDictionaries Source dictionary to return definitions from. If 'all' is received, results are returned from all sources. If multiple values are received (e.g. 'century,wiktionary'), results are returned from the first specified dictionary that has definitions. If left blank, results are returned from the first dictionary that has definitions. By default, dictionaries are searched in this order: ahd, wiktionary, webster, century, wordnet - * @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - * @param includeTags Return a closed set of XML tags in response - */ - def getDefinitions(word: String, limit: Option[Int] = None, partOfSpeech: Option[String] = None, includeRelated: Option[String] = None, sourceDictionaries: Seq[String], useCanonical: Option[String] = None, includeTags: Option[String] = None): ApiRequest[Seq[Definition]] = - ApiRequest[Seq[Definition]](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}/definitions", "application/json") - .withQueryParam("limit", limit) - .withQueryParam("partOfSpeech", partOfSpeech) - .withQueryParam("includeRelated", includeRelated) - .withQueryParam("sourceDictionaries", ArrayValues(sourceDictionaries, CSV)) - .withQueryParam("useCanonical", useCanonical) - .withQueryParam("includeTags", includeTags) - .withPathParam("word", word) - .withSuccessResponse[Seq[Definition]](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : Seq[String] (success) - * code 400 : (Invalid word supplied.) - * code 404 : (No definitions found.) - * - * @param word Word to return - * @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - */ - def getEtymologies(word: String, useCanonical: Option[String] = None): ApiRequest[Seq[String]] = - ApiRequest[Seq[String]](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}/etymologies", "application/json") - .withQueryParam("useCanonical", useCanonical) - .withPathParam("word", word) - .withSuccessResponse[Seq[String]](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : (success) - * code 400 : (Invalid word supplied.) - * - * @param word Word to return examples for - * @param includeDuplicates Show duplicate examples from different sources - * @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - * @param skip Results to skip - * @param limit Maximum number of results to return - */ - def getExamples(word: String, includeDuplicates: Option[String] = None, useCanonical: Option[String] = None, skip: Option[Int] = None, limit: Option[Int] = None): ApiRequest[Unit] = - ApiRequest[Unit](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}/examples", "application/json") - .withQueryParam("includeDuplicates", includeDuplicates) - .withQueryParam("useCanonical", useCanonical) - .withQueryParam("skip", skip) - .withQueryParam("limit", limit) - .withPathParam("word", word) - .withSuccessResponse[Unit](200) - .withErrorResponse[Unit](400) - - /** - * - * - * Expected answers: - * code 200 : FrequencySummary (success) - * code 400 : (Invalid word supplied.) - * code 404 : (No results.) - * - * @param word Word to return - * @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - * @param startYear Starting Year - * @param endYear Ending Year - */ - def getWordFrequency(word: String, useCanonical: Option[String] = None, startYear: Option[Int] = None, endYear: Option[Int] = None): ApiRequest[FrequencySummary] = - ApiRequest[FrequencySummary](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}/frequency", "application/json") - .withQueryParam("useCanonical", useCanonical) - .withQueryParam("startYear", startYear) - .withQueryParam("endYear", endYear) - .withPathParam("word", word) - .withSuccessResponse[FrequencySummary](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : (success) - * code 400 : (Invalid word supplied.) - * - * @param word Word to get syllables for - * @param useCanonical If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - * @param sourceDictionary Get from a single dictionary. Valid options: ahd, century, wiktionary, webster, and wordnet. - * @param limit Maximum number of results to return - */ - def getHyphenation(word: String, useCanonical: Option[String] = None, sourceDictionary: Option[String] = None, limit: Option[Int] = None): ApiRequest[Unit] = - ApiRequest[Unit](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}/hyphenation", "application/json") - .withQueryParam("useCanonical", useCanonical) - .withQueryParam("sourceDictionary", sourceDictionary) - .withQueryParam("limit", limit) - .withPathParam("word", word) - .withSuccessResponse[Unit](200) - .withErrorResponse[Unit](400) - - /** - * - * - * Expected answers: - * code 200 : Seq[Bigram] (success) - * code 400 : (Invalid word supplied.) - * - * @param word Word to fetch phrases for - * @param limit Maximum number of results to return - * @param wlmi Minimum WLMI for the phrase - * @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - */ - def getPhrases(word: String, limit: Option[Int] = None, wlmi: Option[Int] = None, useCanonical: Option[String] = None): ApiRequest[Seq[Bigram]] = - ApiRequest[Seq[Bigram]](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}/phrases", "application/json") - .withQueryParam("limit", limit) - .withQueryParam("wlmi", wlmi) - .withQueryParam("useCanonical", useCanonical) - .withPathParam("word", word) - .withSuccessResponse[Seq[Bigram]](200) - .withErrorResponse[Unit](400) - - /** - * - * - * Expected answers: - * code 200 : (success) - * code 400 : (Invalid word supplied.) - * - * @param word Word to get pronunciations for - * @param useCanonical If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - * @param sourceDictionary Get from a single dictionary - * @param typeFormat Text pronunciation type - * @param limit Maximum number of results to return - */ - def getTextPronunciations(word: String, useCanonical: Option[String] = None, sourceDictionary: Option[String] = None, typeFormat: Option[String] = None, limit: Option[Int] = None): ApiRequest[Unit] = - ApiRequest[Unit](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}/pronunciations", "application/json") - .withQueryParam("useCanonical", useCanonical) - .withQueryParam("sourceDictionary", sourceDictionary) - .withQueryParam("typeFormat", typeFormat) - .withQueryParam("limit", limit) - .withPathParam("word", word) - .withSuccessResponse[Unit](200) - .withErrorResponse[Unit](400) - - /** - * - * - * Expected answers: - * code 200 : (success) - * code 400 : (Invalid word supplied.) - * - * @param word Word to fetch relationships for - * @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - * @param relationshipTypes Limits the total results per type of relationship type - * @param limitPerRelationshipType Restrict to the supplied relationship types - */ - def getRelatedWords(word: String, useCanonical: Option[String] = None, relationshipTypes: Option[String] = None, limitPerRelationshipType: Option[Int] = None): ApiRequest[Unit] = - ApiRequest[Unit](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}/relatedWords", "application/json") - .withQueryParam("useCanonical", useCanonical) - .withQueryParam("relationshipTypes", relationshipTypes) - .withQueryParam("limitPerRelationshipType", limitPerRelationshipType) - .withPathParam("word", word) - .withSuccessResponse[Unit](200) - .withErrorResponse[Unit](400) - - /** - * - * - * Expected answers: - * code 200 : Example (success) - * code 400 : (Invalid word supplied.) - * - * @param word Word to fetch examples for - * @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested. - */ - def getTopExample(word: String, useCanonical: Option[String] = None): ApiRequest[Example] = - ApiRequest[Example](ApiMethods.GET, "https://api.wordnik.com/v4", "/word.json/{word}/topExample", "application/json") - .withQueryParam("useCanonical", useCanonical) - .withPathParam("word", word) - .withSuccessResponse[Example](200) - .withErrorResponse[Unit](400) - - -} - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordListApi.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordListApi.scala deleted file mode 100644 index e150a96ce77..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordListApi.scala +++ /dev/null @@ -1,147 +0,0 @@ -package io.swagger.client.api - -object WordListApi { - - /** - * - * - * Expected answers: - * code 200 : WordList (success) - * code 400 : (Invalid ID supplied) - * code 403 : (Not Authorized to access WordList) - * code 404 : (WordList not found) - * - * @param permalink permalink of WordList to fetch - * @param authToken The auth token of the logged-in user, obtained by calling /account.json/authenticate/{username} (described above) - */ - def getWordListByPermalink(permalink: String, authToken: String): ApiRequest[WordList] = - ApiRequest[WordList](ApiMethods.GET, "https://api.wordnik.com/v4", "/wordList.json/{permalink}", "application/json") - .withPathParam("permalink", permalink) - .withHeaderParam("auth_token", authToken) - .withSuccessResponse[WordList](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : (success) - * code 400 : (Invalid ID supplied) - * code 403 : (Not Authorized to update WordList) - * code 404 : (WordList not found) - * - * @param permalink permalink of WordList to update - * @param body Updated WordList - * @param authToken The auth token of the logged-in user, obtained by calling /account.json/authenticate/{username} (described above) - */ - def updateWordList(permalink: String, body: Option[WordList] = None, authToken: String): ApiRequest[Unit] = - ApiRequest[Unit](ApiMethods.PUT, "https://api.wordnik.com/v4", "/wordList.json/{permalink}", "application/json") - .withBody(body) - .withPathParam("permalink", permalink) - .withHeaderParam("auth_token", authToken) - .withSuccessResponse[Unit](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : (success) - * code 400 : (Invalid ID supplied) - * code 403 : (Not Authorized to delete WordList) - * code 404 : (WordList not found) - * - * @param permalink ID of WordList to delete - * @param authToken The auth token of the logged-in user, obtained by calling /account.json/authenticate/{username} (described above) - */ - def deleteWordList(permalink: String, authToken: String): ApiRequest[Unit] = - ApiRequest[Unit](ApiMethods.DELETE, "https://api.wordnik.com/v4", "/wordList.json/{permalink}", "application/json") - .withPathParam("permalink", permalink) - .withHeaderParam("auth_token", authToken) - .withSuccessResponse[Unit](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : (success) - * code 400 : (Invalid permalink supplied) - * code 403 : (Not Authorized to modify WordList) - * code 404 : (WordList not found) - * - * @param permalink permalink of WordList to use - * @param body Words to remove from WordList - * @param authToken The auth token of the logged-in user, obtained by calling /account.json/authenticate/{username} (described above) - */ - def deleteWordsFromWordList(permalink: String, body: Seq[StringValue], authToken: String): ApiRequest[Unit] = - ApiRequest[Unit](ApiMethods.POST, "https://api.wordnik.com/v4", "/wordList.json/{permalink}/deleteWords", "application/json") - .withBody(body) - .withPathParam("permalink", permalink) - .withHeaderParam("auth_token", authToken) - .withSuccessResponse[Unit](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : (success) - * code 400 : (Invalid ID supplied) - * code 403 : (Not Authorized to access WordList) - * code 404 : (WordList not found) - * - * @param permalink ID of WordList to use - * @param sortBy Field to sort by - * @param sortOrder Direction to sort - * @param skip Results to skip - * @param limit Maximum number of results to return - * @param authToken The auth token of the logged-in user, obtained by calling /account.json/authenticate/{username} (described above) - */ - def getWordListWords(permalink: String, sortBy: Option[String] = None, sortOrder: Option[String] = None, skip: Option[Int] = None, limit: Option[Int] = None, authToken: String): ApiRequest[Unit] = - ApiRequest[Unit](ApiMethods.GET, "https://api.wordnik.com/v4", "/wordList.json/{permalink}/words", "application/json") - .withQueryParam("sortBy", sortBy) - .withQueryParam("sortOrder", sortOrder) - .withQueryParam("skip", skip) - .withQueryParam("limit", limit) - .withPathParam("permalink", permalink) - .withHeaderParam("auth_token", authToken) - .withSuccessResponse[Unit](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : (success) - * code 400 : (Invalid permalink supplied) - * code 403 : (Not Authorized to access WordList) - * code 404 : (WordList not found) - * - * @param permalink permalink of WordList to user - * @param body Array of words to add to WordList - * @param authToken The auth token of the logged-in user, obtained by calling /account.json/authenticate/{username} (described above) - */ - def addWordsToWordList(permalink: String, body: Seq[StringValue], authToken: String): ApiRequest[Unit] = - ApiRequest[Unit](ApiMethods.POST, "https://api.wordnik.com/v4", "/wordList.json/{permalink}/words", "application/json") - .withBody(body) - .withPathParam("permalink", permalink) - .withHeaderParam("auth_token", authToken) - .withSuccessResponse[Unit](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - -} - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordListsApi.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordListsApi.scala deleted file mode 100644 index ad1e1e95877..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordListsApi.scala +++ /dev/null @@ -1,28 +0,0 @@ -package io.swagger.client.api - -object WordListsApi { - - /** - * - * - * Expected answers: - * code 200 : WordList (success) - * code 400 : (Invalid WordList supplied or mandatory fields are missing) - * code 403 : (Not authenticated) - * code 404 : (WordList owner not found) - * - * @param body WordList to create - * @param authToken The auth token of the logged-in user, obtained by calling /account.json/authenticate/{username} (described above) - */ - def createWordList(body: Option[WordList] = None, authToken: String): ApiRequest[WordList] = - ApiRequest[WordList](ApiMethods.POST, "https://api.wordnik.com/v4", "/wordLists.json", "application/json") - .withBody(body) - .withHeaderParam("auth_token", authToken) - .withSuccessResponse[WordList](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](403) - .withErrorResponse[Unit](404) - - -} - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordsApi.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordsApi.scala deleted file mode 100644 index 413271f6665..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/api/WordsApi.scala +++ /dev/null @@ -1,172 +0,0 @@ -package io.swagger.client.api - -object WordsApi { - - /** - * - * - * Expected answers: - * code 200 : WordObject (success) - * code 404 : (No word found.) - * - * @param hasDictionaryDef Only return words with dictionary definitions - * @param includePartOfSpeech CSV part-of-speech values to include - * @param excludePartOfSpeech CSV part-of-speech values to exclude - * @param minCorpusCount Minimum corpus frequency for terms - * @param maxCorpusCount Maximum corpus frequency for terms - * @param minDictionaryCount Minimum dictionary count - * @param maxDictionaryCount Maximum dictionary count - * @param minLength Minimum word length - * @param maxLength Maximum word length - */ - def getRandomWord(hasDictionaryDef: Option[String] = None, includePartOfSpeech: Option[String] = None, excludePartOfSpeech: Option[String] = None, minCorpusCount: Option[Int] = None, maxCorpusCount: Option[Int] = None, minDictionaryCount: Option[Int] = None, maxDictionaryCount: Option[Int] = None, minLength: Option[Int] = None, maxLength: Option[Int] = None): ApiRequest[WordObject] = - ApiRequest[WordObject](ApiMethods.GET, "https://api.wordnik.com/v4", "/words.json/randomWord", "application/json") - .withQueryParam("hasDictionaryDef", hasDictionaryDef) - .withQueryParam("includePartOfSpeech", includePartOfSpeech) - .withQueryParam("excludePartOfSpeech", excludePartOfSpeech) - .withQueryParam("minCorpusCount", minCorpusCount) - .withQueryParam("maxCorpusCount", maxCorpusCount) - .withQueryParam("minDictionaryCount", minDictionaryCount) - .withQueryParam("maxDictionaryCount", maxDictionaryCount) - .withQueryParam("minLength", minLength) - .withQueryParam("maxLength", maxLength) - .withSuccessResponse[WordObject](200) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : (success) - * code 400 : (Invalid term supplied.) - * code 404 : (No results.) - * - * @param hasDictionaryDef Only return words with dictionary definitions - * @param includePartOfSpeech CSV part-of-speech values to include - * @param excludePartOfSpeech CSV part-of-speech values to exclude - * @param minCorpusCount Minimum corpus frequency for terms - * @param maxCorpusCount Maximum corpus frequency for terms - * @param minDictionaryCount Minimum dictionary count - * @param maxDictionaryCount Maximum dictionary count - * @param minLength Minimum word length - * @param maxLength Maximum word length - * @param sortBy Attribute to sort by - * @param sortOrder Sort direction - * @param limit Maximum number of results to return - */ - def getRandomWords(hasDictionaryDef: Option[String] = None, includePartOfSpeech: Option[String] = None, excludePartOfSpeech: Option[String] = None, minCorpusCount: Option[Int] = None, maxCorpusCount: Option[Int] = None, minDictionaryCount: Option[Int] = None, maxDictionaryCount: Option[Int] = None, minLength: Option[Int] = None, maxLength: Option[Int] = None, sortBy: Option[String] = None, sortOrder: Option[String] = None, limit: Option[Int] = None): ApiRequest[Unit] = - ApiRequest[Unit](ApiMethods.GET, "https://api.wordnik.com/v4", "/words.json/randomWords", "application/json") - .withQueryParam("hasDictionaryDef", hasDictionaryDef) - .withQueryParam("includePartOfSpeech", includePartOfSpeech) - .withQueryParam("excludePartOfSpeech", excludePartOfSpeech) - .withQueryParam("minCorpusCount", minCorpusCount) - .withQueryParam("maxCorpusCount", maxCorpusCount) - .withQueryParam("minDictionaryCount", minDictionaryCount) - .withQueryParam("maxDictionaryCount", maxDictionaryCount) - .withQueryParam("minLength", minLength) - .withQueryParam("maxLength", maxLength) - .withQueryParam("sortBy", sortBy) - .withQueryParam("sortOrder", sortOrder) - .withQueryParam("limit", limit) - .withSuccessResponse[Unit](200) - .withErrorResponse[Unit](400) - .withErrorResponse[Unit](404) - - /** - * - * - * Expected answers: - * code 200 : DefinitionSearchResults (success) - * code 400 : (Invalid term supplied.) - * - * @param query Search term - * @param findSenseForWord Restricts words and finds closest sense - * @param includeSourceDictionaries Only include these comma-delimited source dictionaries - * @param excludeSourceDictionaries Exclude these comma-delimited source dictionaries - * @param includePartOfSpeech Only include these comma-delimited parts of speech - * @param excludePartOfSpeech Exclude these comma-delimited parts of speech - * @param minCorpusCount Minimum corpus frequency for terms - * @param maxCorpusCount Maximum corpus frequency for terms - * @param minLength Minimum word length - * @param maxLength Maximum word length - * @param expandTerms Expand terms - * @param includeTags Return a closed set of XML tags in response - * @param sortBy Attribute to sort by - * @param sortOrder Sort direction - * @param skip Results to skip - * @param limit Maximum number of results to return - */ - def reverseDictionary(query: String, findSenseForWord: Option[String] = None, includeSourceDictionaries: Option[String] = None, excludeSourceDictionaries: Option[String] = None, includePartOfSpeech: Option[String] = None, excludePartOfSpeech: Option[String] = None, minCorpusCount: Option[Int] = None, maxCorpusCount: Option[Int] = None, minLength: Option[Int] = None, maxLength: Option[Int] = None, expandTerms: Option[String] = None, includeTags: Option[String] = None, sortBy: Option[String] = None, sortOrder: Option[String] = None, skip: Option[String] = None, limit: Option[Int] = None): ApiRequest[DefinitionSearchResults] = - ApiRequest[DefinitionSearchResults](ApiMethods.GET, "https://api.wordnik.com/v4", "/words.json/reverseDictionary", "application/json") - .withQueryParam("query", query) - .withQueryParam("findSenseForWord", findSenseForWord) - .withQueryParam("includeSourceDictionaries", includeSourceDictionaries) - .withQueryParam("excludeSourceDictionaries", excludeSourceDictionaries) - .withQueryParam("includePartOfSpeech", includePartOfSpeech) - .withQueryParam("excludePartOfSpeech", excludePartOfSpeech) - .withQueryParam("minCorpusCount", minCorpusCount) - .withQueryParam("maxCorpusCount", maxCorpusCount) - .withQueryParam("minLength", minLength) - .withQueryParam("maxLength", maxLength) - .withQueryParam("expandTerms", expandTerms) - .withQueryParam("includeTags", includeTags) - .withQueryParam("sortBy", sortBy) - .withQueryParam("sortOrder", sortOrder) - .withQueryParam("skip", skip) - .withQueryParam("limit", limit) - .withSuccessResponse[DefinitionSearchResults](200) - .withErrorResponse[Unit](400) - - /** - * - * - * Expected answers: - * code 200 : WordSearchResults (success) - * code 400 : (Invalid query supplied.) - * - * @param query Search query - * @param caseSensitive Search case sensitive - * @param includePartOfSpeech Only include these comma-delimited parts of speech - * @param excludePartOfSpeech Exclude these comma-delimited parts of speech - * @param minCorpusCount Minimum corpus frequency for terms - * @param maxCorpusCount Maximum corpus frequency for terms - * @param minDictionaryCount Minimum number of dictionary entries for words returned - * @param maxDictionaryCount Maximum dictionary definition count - * @param minLength Minimum word length - * @param maxLength Maximum word length - * @param skip Results to skip - * @param limit Maximum number of results to return - */ - def searchWords(query: String, caseSensitive: Option[String] = None, includePartOfSpeech: Option[String] = None, excludePartOfSpeech: Option[String] = None, minCorpusCount: Option[Int] = None, maxCorpusCount: Option[Int] = None, minDictionaryCount: Option[Int] = None, maxDictionaryCount: Option[Int] = None, minLength: Option[Int] = None, maxLength: Option[Int] = None, skip: Option[Int] = None, limit: Option[Int] = None): ApiRequest[WordSearchResults] = - ApiRequest[WordSearchResults](ApiMethods.GET, "https://api.wordnik.com/v4", "/words.json/search/{query}", "application/json") - .withQueryParam("caseSensitive", caseSensitive) - .withQueryParam("includePartOfSpeech", includePartOfSpeech) - .withQueryParam("excludePartOfSpeech", excludePartOfSpeech) - .withQueryParam("minCorpusCount", minCorpusCount) - .withQueryParam("maxCorpusCount", maxCorpusCount) - .withQueryParam("minDictionaryCount", minDictionaryCount) - .withQueryParam("maxDictionaryCount", maxDictionaryCount) - .withQueryParam("minLength", minLength) - .withQueryParam("maxLength", maxLength) - .withQueryParam("skip", skip) - .withQueryParam("limit", limit) - .withPathParam("query", query) - .withSuccessResponse[WordSearchResults](200) - .withErrorResponse[Unit](400) - - /** - * - * - * Expected answers: - * code 0 : WordOfTheDay (success) - * - * @param date Fetches by date in yyyy-MM-dd - */ - def getWordOfTheDay(date: Option[String] = None): ApiRequest[WordOfTheDay] = - ApiRequest[WordOfTheDay](ApiMethods.GET, "https://api.wordnik.com/v4", "/words.json/wordOfTheDay", "application/json") - .withQueryParam("date", date) - .withDefaultSuccessResponse[WordOfTheDay] - - -} - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/ApiInvoker.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/ApiInvoker.scala deleted file mode 100644 index 01569183c48..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/ApiInvoker.scala +++ /dev/null @@ -1,297 +0,0 @@ -package io.swagger.client.core - -import java.io.File -import java.security.cert.X509Certificate -import javax.net.ssl._ - -import scala.concurrent.{ExecutionContext, Future} -import scala.reflect.ClassTag -import scala.util.control.NonFatal - -object ApiInvoker { - - def apply()(implicit system: ActorSystem): ApiInvoker = - apply(DefaultFormats + DateTimeSerializer) - - def apply(serializers: Traversable[Serializer[_]])(implicit system: ActorSystem): ApiInvoker = - apply(DefaultFormats + DateTimeSerializer ++ serializers) - - def apply(formats: Formats)(implicit system: ActorSystem): ApiInvoker = new ApiInvoker(formats) - - def addCustomStatusCode(code: CustomStatusCode): Unit = addCustomStatusCode(code.value, code.reason, code.isSuccess) - - def addCustomStatusCode(code: Int, reason: String = "Application defined code", isSuccess: Boolean = true) = { - StatusCodes.getForKey(code) foreach { c => - StatusCodes.registerCustom(code, reason, reason, isSuccess, allowsEntity = true) - } - } - - case class CustomStatusCode(value: Int, reason: String = "Application-defined status code", isSuccess: Boolean = true) - - /** - * Allows request execution without calling apiInvoker.execute(request) - * request.response can be used to get a future of the ApiResponse generated. - * request.result can be used to get a future of the expected ApiResponse content. If content doesn't match, a - * Future will failed with a ClassCastException - * @param request the apiRequest to be executed - */ - implicit class ApiRequestImprovements[T](request: ApiRequest[T]) { - - def response(invoker: ApiInvoker)(implicit ec: ExecutionContext, system: ActorSystem): Future[ApiResponse[T]] = - response(ec, system, invoker) - - def response(implicit ec: ExecutionContext, system: ActorSystem, invoker: ApiInvoker): Future[ApiResponse[T]] = - invoker.execute(request) - - def result[U <: T](implicit c: ClassTag[U], ec: ExecutionContext, system: ActorSystem, invoker: ApiInvoker): Future[U] = - invoker.execute(request).map(_.content).mapTo[U] - - } - - /** - * Allows transformation from ApiMethod to spray HttpMethods - * @param method the ApiMethod to be converted - */ - implicit class ApiMethodExtensions(val method: ApiMethod) { - def toSprayMethod: HttpMethod = HttpMethods.getForKey(method.value).getOrElse(HttpMethods.GET) - } - - case object DateTimeSerializer extends CustomSerializer[DateTime](format => ( { - case JString(s) => - ISODateTimeFormat.dateTimeParser().parseDateTime(s) - }, { - case d: DateTime => - JString(ISODateTimeFormat.dateTimeParser().print(d)) - })) - -} - -class ApiInvoker(formats: Formats)(implicit system: ActorSystem) extends UntrustedSslContext with CustomContentTypes { - - implicit val ec = system.dispatcher - implicit val jsonFormats = formats - val CompressionFilter = MessagePredicate({ _ => settings.compressionEnabled }) && - Encoder.DefaultFilter && - minEntitySize(settings.compressionSizeThreshold) - - def execute[T](r: ApiRequest[T]): Future[ApiResponse[T]] = { - try { - implicit val timeout: Timeout = settings.connectionTimeout - - val uri = makeUri(r) - - val connector = HostConnectorSetup( - uri.authority.host.toString, - uri.effectivePort, - sslEncryption = "https".equals(uri.scheme), - defaultHeaders = settings.defaultHeaders ++ List(`Accept-Encoding`(gzip, deflate))) - - val request = createRequest(uri, r) - - for { - Http.HostConnectorInfo(hostConnector, _) <- IO(Http) ? connector - response <- hostConnector.ask(request).mapTo[HttpResponse] - } yield { - response ~> decode(Deflate) ~> decode(Gzip) ~> unmarshallApiResponse(r) - } - } - catch { - case NonFatal(x) => Future.failed(x) - } - } - - settings.customCodes.foreach(addCustomStatusCode) - - def settings = ApiSettings(system) - - private def createRequest(uri: Uri, request: ApiRequest[_]): HttpRequest = { - - val builder = new RequestBuilder(request.method.toSprayMethod) - val httpRequest = request.method.toSprayMethod match { - case HttpMethods.GET | HttpMethods.DELETE => builder.apply(uri) - case HttpMethods.POST | HttpMethods.PUT => - formDataContent(request) orElse bodyContent(request) match { - case Some(c: FormData) => - builder.apply(uri, c) - case Some(c: MultipartFormData) => - builder.apply(uri, c) - case Some(c: String) => - builder.apply(uri, HttpEntity(normalizedContentType(request.contentType), c)) - case _ => - builder.apply(uri, HttpEntity(normalizedContentType(request.contentType), " ")) - } - case _ => builder.apply(uri) - } - - httpRequest ~> - addHeaders(request.headerParams) ~> - addAuthentication(request.credentials) ~> - encode(Gzip(CompressionFilter)) - } - - private def addAuthentication(credentialsSeq: Seq[Credentials]): pipelining.RequestTransformer = - request => - credentialsSeq.foldLeft(request) { - case (req, BasicCredentials(login, password)) => - req ~> addCredentials(BasicHttpCredentials(login, password)) - case (req, ApiKeyCredentials(keyValue, keyName, ApiKeyLocations.HEADER)) => - req ~> addHeader(RawHeader(keyName, keyValue.value)) - case (req, _) => req - } - - private def addHeaders(headers: Map[String, Any]): pipelining.RequestTransformer = { request => - - val rawHeaders = for { - (name, value) <- headers.asFormattedParams - header = RawHeader(name, String.valueOf(value)) - } yield header - - request.withHeaders(rawHeaders.toList) - } - - private def formDataContent(request: ApiRequest[_]) = { - val params = request.formParams.asFormattedParams - if (params.isEmpty) - None - else - Some( - normalizedContentType(request.contentType).mediaType match { - case MediaTypes.`multipart/form-data` => - MultipartFormData(params.map { case (name, value) => (name, bodyPart(name, value)) }) - case MediaTypes.`application/x-www-form-urlencoded` => - FormData(params.mapValues(String.valueOf)) - case m: MediaType => // Default : application/x-www-form-urlencoded. - FormData(params.mapValues(String.valueOf)) - } - ) - } - - private def bodyPart(name: String, value: Any): BodyPart = { - value match { - case f: File => - BodyPart(f, name) - case v: String => - BodyPart(HttpEntity(String.valueOf(v))) - case NumericValue(v) => - BodyPart(HttpEntity(String.valueOf(v))) - case m: ApiModel => - BodyPart(HttpEntity(Serialization.write(m))) - } - } - - private def bodyContent(request: ApiRequest[_]): Option[Any] = { - request.bodyParam.map(Extraction.decompose).map(compact) - } - - def makeUri(r: ApiRequest[_]): Uri = { - val opPath = r.operationPath.replaceAll("\\{format\\}", "json") - val opPathWithParams = r.pathParams.asFormattedParams - .mapValues(String.valueOf) - .foldLeft(opPath) { - case (path, (name, value)) => path.replaceAll(s"\\{$name\\}", value) - } - val query = makeQuery(r) - - Uri(r.basePath + opPathWithParams).withQuery(query) - } - - def makeQuery(r: ApiRequest[_]): Query = { - r.credentials.foldLeft(r.queryParams) { - case (params, ApiKeyCredentials(key, keyName, ApiKeyLocations.QUERY)) => - params + (keyName -> key.value) - case (params, _) => params - }.asFormattedParams - .mapValues(String.valueOf) - .foldRight[Query](Uri.Query.Empty) { - case ((name, value), acc) => acc.+:(name, value) - } - } - - def unmarshallApiResponse[T](request: ApiRequest[T])(response: HttpResponse): ApiResponse[T] = { - request.responseForCode(response.status.intValue) match { - case Some((manifest: Manifest[T], state: ResponseState)) => - entityUnmarshaller(manifest)(response.entity) match { - case Right(value) ⇒ - state match { - case ResponseState.Success => - ApiResponse(response.status.intValue, value, response.headers.map(header => (header.name, header.value)).toMap) - case ResponseState.Error => - throw new ApiError(response.status.intValue, "Error response received", - Some(value), - headers = response.headers.map(header => (header.name, header.value)).toMap) - } - - case Left(MalformedContent(error, Some(cause))) ⇒ - throw new ApiError(response.status.intValue, s"Unable to unmarshall content to [$manifest]", Some(response.entity.toString), cause) - - case Left(MalformedContent(error, None)) ⇒ - throw new ApiError(response.status.intValue, s"Unable to unmarshall content to [$manifest]", Some(response.entity.toString)) - - case Left(ContentExpected) ⇒ - throw new ApiError(response.status.intValue, s"Unable to unmarshall empty response to [$manifest]", Some(response.entity.toString)) - } - - case _ => throw new ApiError(response.status.intValue, "Unexpected response code", Some(response.entity.toString)) - } - } - - def entityUnmarshaller[T](implicit mf: Manifest[T]): Unmarshaller[T] = - Unmarshaller[T](MediaTypes.`application/json`) { - case x: HttpEntity.NonEmpty ⇒ - parse(x.asString(defaultCharset = HttpCharsets.`UTF-8`)) - .noNulls - .camelizeKeys - .extract[T] - } - -} - -sealed trait CustomContentTypes { - - def normalizedContentType(original: String): ContentType = - MediaTypes.forExtension(original) map (ContentType(_)) getOrElse parseContentType(original) - - def parseContentType(contentType: String): ContentType = { - val contentTypeAsRawHeader = HttpHeaders.RawHeader("Content-Type", contentType) - val parsedContentTypeHeader = HttpParser.parseHeader(contentTypeAsRawHeader) - (parsedContentTypeHeader: @unchecked) match { - case Right(ct: HttpHeaders.`Content-Type`) => - ct.contentType - case Left(error: ErrorInfo) => - throw new IllegalArgumentException( - s"Error converting '$contentType' to a ContentType header: '${error.summary}'") - } - } -} - -sealed trait UntrustedSslContext { - this: ApiInvoker => - - implicit lazy val trustfulSslContext: SSLContext = { - settings.alwaysTrustCertificates match { - case false => - SSLContext.getDefault - - case true => - class IgnoreX509TrustManager extends X509TrustManager { - def checkClientTrusted(chain: Array[X509Certificate], authType: String): Unit = {} - - def checkServerTrusted(chain: Array[X509Certificate], authType: String): Unit = {} - - def getAcceptedIssuers = null - } - - val context = SSLContext.getInstance("TLS") - context.init(null, Array(new IgnoreX509TrustManager), null) - context - } - } - - implicit val clientSSLEngineProvider = - ClientSSLEngineProvider { - _ => - val engine = trustfulSslContext.createSSLEngine() - engine.setUseClientMode(true) - engine - } -} diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/ApiRequest.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/ApiRequest.scala deleted file mode 100644 index 794c43f5f41..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/ApiRequest.scala +++ /dev/null @@ -1,54 +0,0 @@ -package io.swagger.client.core - -sealed trait ResponseState - -object ResponseState { - - case object Success extends ResponseState - - case object Error extends ResponseState - -} - -case class ApiRequest[U]( - // required fields - method: ApiMethod, - basePath: String, - operationPath: String, - contentType: String, - - // optional fields - responses: Map[Int, (Manifest[_], ResponseState)] = Map.empty, - bodyParam: Option[Any] = None, - formParams: Map[String, Any] = Map.empty, - pathParams: Map[String, Any] = Map.empty, - queryParams: Map[String, Any] = Map.empty, - headerParams: Map[String, Any] = Map.empty, - credentials: Seq[Credentials] = List.empty) { - - def withCredentials(cred: Credentials) = copy[U](credentials = credentials :+ cred) - - def withApiKey(key: ApiKeyValue, keyName: String, location: ApiKeyLocation) = withCredentials(ApiKeyCredentials(key, keyName, location)) - - def withSuccessResponse[T](code: Int)(implicit m: Manifest[T]) = copy[U](responses = responses + (code ->(m, ResponseState.Success))) - - def withErrorResponse[T](code: Int)(implicit m: Manifest[T]) = copy[U](responses = responses + (code ->(m, ResponseState.Error))) - - def withDefaultSuccessResponse[T](implicit m: Manifest[T]) = withSuccessResponse[T](0) - - def withDefaultErrorResponse[T](implicit m: Manifest[T]) = withErrorResponse[T](0) - - def responseForCode(statusCode: Int): Option[(Manifest[_], ResponseState)] = responses.get(statusCode) orElse responses.get(0) - - def withoutBody() = copy[U](bodyParam = None) - - def withBody(body: Any) = copy[U](bodyParam = Some(body)) - - def withFormParam(name: String, value: Any) = copy[U](formParams = formParams + (name -> value)) - - def withPathParam(name: String, value: Any) = copy[U](pathParams = pathParams + (name -> value)) - - def withQueryParam(name: String, value: Any) = copy[U](queryParams = queryParams + (name -> value)) - - def withHeaderParam(name: String, value: Any) = copy[U](headerParams = headerParams + (name -> value)) -} diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/ApiSettings.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/ApiSettings.scala deleted file mode 100644 index 0eb4fb5e09b..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/ApiSettings.scala +++ /dev/null @@ -1,26 +0,0 @@ -package io.swagger.client.core - -import java.util.concurrent.TimeUnit - -import scala.concurrent.duration.FiniteDuration - -class ApiSettings(config: Config) extends Extension { - val alwaysTrustCertificates = cfg.getBoolean("trust-certificates") - val defaultHeaders = cfg.getConfig("default-headers").entrySet.toList.map(c => RawHeader(c.getKey, c.getValue.render)) - val connectionTimeout = FiniteDuration(cfg.getDuration("connection-timeout", TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS) - val compressionEnabled = cfg.getBoolean("compression.enabled") - val compressionSizeThreshold = cfg.getBytes("compression.size-threshold").toInt - val customCodes = cfg.getConfigList("custom-codes").toList.map { c => CustomStatusCode( - c.getInt("code"), - c.getString("reason"), - c.getBoolean("success")) - } - - def this(system: ExtendedActorSystem) = this(system.settings.config) - - private def cfg = config.getConfig("io.swagger.client.apiRequest") - - -} - -object ApiSettings extends ExtensionKey[ApiSettings] diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/requests.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/requests.scala deleted file mode 100644 index 9ed9f6e1f3f..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/core/requests.scala +++ /dev/null @@ -1,181 +0,0 @@ -package io.swagger.client.core - -import java.io.File -import java.net.URLEncoder - -import scala.util.Try - -sealed trait ApiReturnWithHeaders { - def headers: Map[String, String] - - def header(name: String): Option[String] = headers.get(name) - - def getStringHeader(name: String) = header(name) - - def getIntHeader(name: String) = castedHeader(name, java.lang.Integer.parseInt) - - def getLongHeader(name: String) = castedHeader(name, java.lang.Long.parseLong) - - def getFloatHeader(name: String) = castedHeader(name, java.lang.Float.parseFloat) - - def getDoubleHeader(name: String) = castedHeader(name, java.lang.Double.parseDouble) - - def getBooleanHeader(name: String) = castedHeader(name, java.lang.Boolean.parseBoolean) - - private def castedHeader[U](name: String, conversion: String => U): Option[U] = { - Try { - header(name).map(conversion) - }.get - } -} - -sealed case class ApiResponse[T](code: Int, content: T, headers: Map[String, String] = Map.empty) - extends ApiReturnWithHeaders - -sealed case class ApiError[T](code: Int, message: String, responseContent: Option[T], cause: Throwable = null, headers: Map[String, String] = Map.empty) - extends Throwable(s"($code) $message.${responseContent.map(s => s" Content : $s").getOrElse("")}", cause) - with ApiReturnWithHeaders - -sealed case class ApiMethod(value: String) - -object ApiMethods { - val CONNECT = ApiMethod("CONNECT") - val DELETE = ApiMethod("DELETE") - val GET = ApiMethod("GET") - val HEAD = ApiMethod("HEAD") - val OPTIONS = ApiMethod("OPTIONS") - val PATCH = ApiMethod("PATCH") - val POST = ApiMethod("POST") - val PUT = ApiMethod("PUT") - val TRACE = ApiMethod("TRACE") -} - -/** - * This trait needs to be added to any model defined by the api. - */ -trait ApiModel - -/** - * Single trait defining a credential that can be transformed to a paramName / paramValue tupple - */ -sealed trait Credentials { - def asQueryParam: Option[(String, String)] = None -} - -sealed case class BasicCredentials(user: String, password: String) extends Credentials - -sealed case class ApiKeyCredentials(key: ApiKeyValue, keyName: String, location: ApiKeyLocation) extends Credentials { - override def asQueryParam: Option[(String, String)] = location match { - case ApiKeyLocations.QUERY => Some((keyName, key.value)) - case _ => None - } -} - -sealed case class ApiKeyValue(value: String) - -sealed trait ApiKeyLocation - -object ApiKeyLocations { - - case object QUERY extends ApiKeyLocation - - case object HEADER extends ApiKeyLocation - -} - - -/** - * Case class used to unapply numeric values only in pattern matching - * @param value the string representation of the numeric value - */ -sealed case class NumericValue(value: String) { - override def toString = value -} - -object NumericValue { - def unapply(n: Any): Option[NumericValue] = n match { - case (_: Int | _: Long | _: Float | _: Double | _: Boolean | _: Byte) => Some(NumericValue(String.valueOf(n))) - case _ => None - } -} - -/** - * Used for params being arrays - */ -sealed case class ArrayValues(values: Seq[Any], format: CollectionFormat = CollectionFormats.CSV) - -object ArrayValues { - def apply(values: Option[Seq[Any]], format: CollectionFormat): ArrayValues = - ArrayValues(values.getOrElse(Seq.empty), format) - - def apply(values: Option[Seq[Any]]): ArrayValues = ArrayValues(values, CollectionFormats.CSV) -} - - -/** - * Defines how arrays should be rendered in query strings. - */ -sealed trait CollectionFormat - -trait MergedArrayFormat extends CollectionFormat { - def separator: String -} - -object CollectionFormats { - - case object CSV extends MergedArrayFormat { - override val separator = "," - } - - case object TSV extends MergedArrayFormat { - override val separator = "\t" - } - - case object SSV extends MergedArrayFormat { - override val separator = " " - } - - case object PIPES extends MergedArrayFormat { - override val separator = "|" - } - - case object MULTI extends CollectionFormat - -} - -object ParametersMap { - - /** - * Pimp parameters maps (Map[String, Any]) in order to transform them in a sequence of String -> Any tupples, - * with valid url-encoding, arrays handling, files preservation, ... - */ - implicit class ParametersMapImprovements(val m: Map[String, Any]) { - - def asFormattedParamsList = m.toList.flatMap(formattedParams) - - def asFormattedParams = m.flatMap(formattedParams) - - private def urlEncode(v: Any) = URLEncoder.encode(String.valueOf(v), "utf-8").replaceAll("\\+", "%20") - - private def formattedParams(tuple: (String, Any)): Seq[(String, Any)] = formattedParams(tuple._1, tuple._2) - - private def formattedParams(name: String, value: Any): Seq[(String, Any)] = value match { - case arr: ArrayValues => - arr.format match { - case CollectionFormats.MULTI => arr.values.flatMap(formattedParams(name, _)) - case format: MergedArrayFormat => Seq((name, arr.values.mkString(format.separator))) - } - case None => Seq.empty - case Some(opt) => - formattedParams(name, opt) - case s: Seq[Any] => - formattedParams(name, ArrayValues(s)) - case v: String => Seq((name, urlEncode(v))) - case NumericValue(v) => Seq((name, urlEncode(v))) - case f: File => Seq((name, f)) - case m: ApiModel => Seq((name, m)) - } - - } - -} diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ApiTokenStatus.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ApiTokenStatus.scala deleted file mode 100644 index 1c099f61d88..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ApiTokenStatus.scala +++ /dev/null @@ -1,13 +0,0 @@ -package io.swagger.client.model - - -case class ApiTokenStatus( - valid: Option[Boolean], - token: Option[String], - resetsInMillis: Option[Long], - remainingCalls: Option[Long], - expiresInMillis: Option[Long], - totalRequests: Option[Long]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/AudioFile.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/AudioFile.scala deleted file mode 100644 index ae1975d3359..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/AudioFile.scala +++ /dev/null @@ -1,21 +0,0 @@ -package io.swagger.client.model - - -case class AudioFile( - attributionUrl: Option[String], - commentCount: Option[Int], - voteCount: Option[Int], - fileUrl: Option[String], - audioType: Option[String], - id: Option[Long], - duration: Option[Double], - attributionText: Option[String], - createdBy: Option[String], - description: Option[String], - createdAt: Option[DateTime], - voteWeightedAverage: Option[Float], - voteAverage: Option[Float], - word: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/AudioType.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/AudioType.scala deleted file mode 100644 index 90984887967..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/AudioType.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class AudioType( - id: Option[Int], - name: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/AuthenticationToken.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/AuthenticationToken.scala deleted file mode 100644 index c150a7b6385..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/AuthenticationToken.scala +++ /dev/null @@ -1,10 +0,0 @@ -package io.swagger.client.model - - -case class AuthenticationToken( - token: Option[String], - userId: Option[Long], - userSignature: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Bigram.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Bigram.scala deleted file mode 100644 index ac0bb8c5f1f..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Bigram.scala +++ /dev/null @@ -1,12 +0,0 @@ -package io.swagger.client.model - - -case class Bigram( - count: Option[Long], - gram2: Option[String], - gram1: Option[String], - wlmi: Option[Double], - mi: Option[Double]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Category.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Category.scala deleted file mode 100644 index d965ec4d6bd..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Category.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class Category( - id: Option[Long], - name: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Citation.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Citation.scala deleted file mode 100644 index c93d8b9e2ed..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Citation.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class Citation( - cite: Option[String], - source: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ContentProvider.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ContentProvider.scala deleted file mode 100644 index 3baf96be8e1..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ContentProvider.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class ContentProvider( - id: Option[Int], - name: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Definition.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Definition.scala deleted file mode 100644 index f0b97f3d726..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Definition.scala +++ /dev/null @@ -1,23 +0,0 @@ -package io.swagger.client.model - - -case class Definition( - extendedText: Option[String], - text: Option[String], - sourceDictionary: Option[String], - citations: Option[Seq[Citation]], - labels: Option[Seq[Label]], - score: Option[Float], - exampleUses: Option[Seq[ExampleUsage]], - attributionUrl: Option[String], - seqString: Option[String], - attributionText: Option[String], - relatedWords: Option[Seq[Related]], - sequence: Option[String], - word: Option[String], - notes: Option[Seq[Note]], - textProns: Option[Seq[TextPron]], - partOfSpeech: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/DefinitionSearchResults.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/DefinitionSearchResults.scala deleted file mode 100644 index 4c35cec842c..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/DefinitionSearchResults.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class DefinitionSearchResults( - results: Option[Seq[Definition]], - totalResults: Option[Int]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Example.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Example.scala deleted file mode 100644 index 9557c5d8a24..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Example.scala +++ /dev/null @@ -1,19 +0,0 @@ -package io.swagger.client.model - - -case class Example( - id: Option[Long], - exampleId: Option[Long], - title: Option[String], - text: Option[String], - score: Option[ScoredWord], - sentence: Option[Sentence], - word: Option[String], - provider: Option[ContentProvider], - year: Option[Int], - rating: Option[Float], - documentId: Option[Long], - url: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ExampleSearchResults.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ExampleSearchResults.scala deleted file mode 100644 index 51107d9e4b6..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ExampleSearchResults.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class ExampleSearchResults( - facets: Option[Seq[Facet]], - examples: Option[Seq[Example]]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ExampleUsage.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ExampleUsage.scala deleted file mode 100644 index 10706036a58..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ExampleUsage.scala +++ /dev/null @@ -1,8 +0,0 @@ -package io.swagger.client.model - - -case class ExampleUsage( - text: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Facet.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Facet.scala deleted file mode 100644 index 1feb9cd7ec6..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Facet.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class Facet( - facetValues: Option[Seq[FacetValue]], - name: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/FacetValue.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/FacetValue.scala deleted file mode 100644 index 9f38118203a..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/FacetValue.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class FacetValue( - count: Option[Long], - value: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Frequency.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Frequency.scala deleted file mode 100644 index 8eee02d1187..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Frequency.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class Frequency( - count: Option[Long], - year: Option[Int]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/FrequencySummary.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/FrequencySummary.scala deleted file mode 100644 index 7bb89bed051..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/FrequencySummary.scala +++ /dev/null @@ -1,12 +0,0 @@ -package io.swagger.client.model - - -case class FrequencySummary( - unknownYearCount: Option[Int], - totalCount: Option[Long], - frequencyString: Option[String], - word: Option[String], - frequency: Option[Seq[Frequency]]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Label.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Label.scala deleted file mode 100644 index 528bf4a5763..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Label.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class Label( - text: Option[String], - `type`: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Note.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Note.scala deleted file mode 100644 index d898b662a3f..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Note.scala +++ /dev/null @@ -1,11 +0,0 @@ -package io.swagger.client.model - - -case class Note( - noteType: Option[String], - appliesTo: Option[Seq[String]], - value: Option[String], - pos: Option[Int]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/PartOfSpeech.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/PartOfSpeech.scala deleted file mode 100644 index 8f1b90d974b..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/PartOfSpeech.scala +++ /dev/null @@ -1,10 +0,0 @@ -package io.swagger.client.model - - -case class PartOfSpeech( - roots: Option[Seq[Root]], - storageAbbr: Option[Seq[String]], - allCategories: Option[Seq[Category]]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Related.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Related.scala deleted file mode 100644 index c0bd46c0030..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Related.scala +++ /dev/null @@ -1,14 +0,0 @@ -package io.swagger.client.model - - -case class Related( - label1: Option[String], - relationshipType: Option[String], - label2: Option[String], - label3: Option[String], - words: Option[Seq[String]], - gram: Option[String], - label4: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Root.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Root.scala deleted file mode 100644 index b2205936656..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Root.scala +++ /dev/null @@ -1,10 +0,0 @@ -package io.swagger.client.model - - -case class Root( - id: Option[Long], - name: Option[String], - categories: Option[Seq[Category]]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ScoredWord.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ScoredWord.scala deleted file mode 100644 index 9a37a609a3b..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/ScoredWord.scala +++ /dev/null @@ -1,18 +0,0 @@ -package io.swagger.client.model - - -case class ScoredWord( - position: Option[Int], - id: Option[Long], - docTermCount: Option[Int], - lemma: Option[String], - wordType: Option[String], - score: Option[Float], - sentenceId: Option[Long], - word: Option[String], - stopword: Option[Boolean], - baseWordScore: Option[Double], - partOfSpeech: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Sentence.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Sentence.scala deleted file mode 100644 index 401d64d012a..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Sentence.scala +++ /dev/null @@ -1,13 +0,0 @@ -package io.swagger.client.model - - -case class Sentence( - hasScoredWords: Option[Boolean], - id: Option[Long], - scoredWords: Option[Seq[ScoredWord]], - display: Option[String], - rating: Option[Int], - documentMetadataId: Option[Long]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/SimpleDefinition.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/SimpleDefinition.scala deleted file mode 100644 index b7e7d4d49f5..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/SimpleDefinition.scala +++ /dev/null @@ -1,11 +0,0 @@ -package io.swagger.client.model - - -case class SimpleDefinition( - text: Option[String], - source: Option[String], - note: Option[String], - partOfSpeech: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/SimpleExample.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/SimpleExample.scala deleted file mode 100644 index cfd8626465a..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/SimpleExample.scala +++ /dev/null @@ -1,11 +0,0 @@ -package io.swagger.client.model - - -case class SimpleExample( - id: Option[Long], - title: Option[String], - text: Option[String], - url: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/StringValue.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/StringValue.scala deleted file mode 100644 index e324032e9be..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/StringValue.scala +++ /dev/null @@ -1,8 +0,0 @@ -package io.swagger.client.model - - -case class StringValue( - word: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Syllable.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Syllable.scala deleted file mode 100644 index eba455d9e8a..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/Syllable.scala +++ /dev/null @@ -1,10 +0,0 @@ -package io.swagger.client.model - - -case class Syllable( - text: Option[String], - seq: Option[Int], - `type`: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/TextPron.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/TextPron.scala deleted file mode 100644 index 690e54f6eba..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/TextPron.scala +++ /dev/null @@ -1,10 +0,0 @@ -package io.swagger.client.model - - -case class TextPron( - raw: Option[String], - seq: Option[Int], - rawType: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/User.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/User.scala deleted file mode 100644 index 4e2cbd1dc78..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/User.scala +++ /dev/null @@ -1,15 +0,0 @@ -package io.swagger.client.model - - -case class User( - id: Option[Long], - username: Option[String], - email: Option[String], - status: Option[Int], - faceBookId: Option[String], - userName: Option[String], - displayName: Option[String], - password: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordList.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordList.scala deleted file mode 100644 index db2a94d7052..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordList.scala +++ /dev/null @@ -1,18 +0,0 @@ -package io.swagger.client.model - - -case class WordList( - id: Option[Long], - permalink: Option[String], - name: Option[String], - createdAt: Option[DateTime], - updatedAt: Option[DateTime], - lastActivityAt: Option[DateTime], - username: Option[String], - userId: Option[Long], - description: Option[String], - numberWordsInList: Option[Long], - `type`: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordListWord.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordListWord.scala deleted file mode 100644 index 6bfce5522b8..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordListWord.scala +++ /dev/null @@ -1,14 +0,0 @@ -package io.swagger.client.model - - -case class WordListWord( - id: Option[Long], - word: Option[String], - username: Option[String], - userId: Option[Long], - createdAt: Option[DateTime], - numberCommentsOnWord: Option[Long], - numberLists: Option[Long]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordObject.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordObject.scala deleted file mode 100644 index 965bed21104..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordObject.scala +++ /dev/null @@ -1,13 +0,0 @@ -package io.swagger.client.model - - -case class WordObject( - id: Option[Long], - word: Option[String], - originalWord: Option[String], - suggestions: Option[Seq[String]], - canonicalForm: Option[String], - vulgar: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordOfTheDay.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordOfTheDay.scala deleted file mode 100644 index 68a41d87b62..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordOfTheDay.scala +++ /dev/null @@ -1,19 +0,0 @@ -package io.swagger.client.model - - -case class WordOfTheDay( - id: Option[Long], - parentId: Option[String], - category: Option[String], - createdBy: Option[String], - createdAt: Option[DateTime], - contentProvider: Option[ContentProvider], - htmlExtra: Option[String], - word: Option[String], - definitions: Option[Seq[SimpleDefinition]], - examples: Option[Seq[SimpleExample]], - note: Option[String], - publishDate: Option[DateTime]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordSearchResult.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordSearchResult.scala deleted file mode 100644 index 1d50c67de0e..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordSearchResult.scala +++ /dev/null @@ -1,10 +0,0 @@ -package io.swagger.client.model - - -case class WordSearchResult( - count: Option[Long], - lexicality: Option[Double], - word: Option[String]) - extends ApiModel - - diff --git a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordSearchResults.scala b/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordSearchResults.scala deleted file mode 100644 index 331ea795da2..00000000000 --- a/samples/client/wordnik/akka-scala/src/main/scala/io/swagger/client/model/WordSearchResults.scala +++ /dev/null @@ -1,9 +0,0 @@ -package io.swagger.client.model - - -case class WordSearchResults( - searchResults: Option[Seq[WordSearchResult]], - totalResults: Option[Int]) - extends ApiModel - - diff --git a/samples/client/wordnik/android-java/pom.xml b/samples/client/wordnik/android-java/pom.xml deleted file mode 100644 index 7dd53a8c8ea..00000000000 --- a/samples/client/wordnik/android-java/pom.xml +++ /dev/null @@ -1,162 +0,0 @@ - - 4.0.0 - io.swagger - swagger-client - jar - swagger-client - 1.0.0 - - scm:git:git@github.com:wordnik/swagger-mustache.git - scm:git:git@github.com:wordnik/swagger-codegen.git - https://github.com/wordnik/swagger-codegen - - - 2.2.0 - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory}/lib - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.2 - - - - jar - test-jar - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add_sources - generate-sources - - add-source - - - - src/main/java - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - src/test/java - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - - - com.wordnik - swagger-annotations - ${swagger-annotations-version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} - compile - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} - compile - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-version} - compile - - - org.apache.httpcomponents - httpclient - ${httpclient-version} - compile - - - - - junit - junit - ${junit-version} - test - - - - - sonatype-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - - 1.5.3 - 2.1.5 - 4.8.1 - 1.0.0 - 4.8.1 - 4.0 - - diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/ApiException.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/ApiException.java deleted file mode 100644 index afeba0fc7d7..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/ApiException.java +++ /dev/null @@ -1,30 +0,0 @@ -package io.swagger.client; - -public class ApiException extends Exception { - int code = 0; - String message = null; - - public ApiException() { - } - - public ApiException(int code, String message) { - this.code = code; - this.message = message; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} \ No newline at end of file diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/ApiInvoker.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/ApiInvoker.java deleted file mode 100644 index 709be7ccf9b..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/ApiInvoker.java +++ /dev/null @@ -1,248 +0,0 @@ -package io.swagger.client; - - -import org.apache.http.entity.StringEntity; -import org.apache.http.util.EntityUtils; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import java.io.IOException; -import java.net.Socket; -import java.net.UnknownHostException; -import java.security.GeneralSecurityException; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.security.cert.X509Certificate; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class ApiInvoker { - private static ApiInvoker INSTANCE = new ApiInvoker(); - private Map defaultHeaderMap = new HashMap(); - - private HttpClient client = null; - - private boolean ignoreSSLCertificates = false; - - private ClientConnectionManager ignoreSSLConnectionManager; - - public ApiInvoker() { - initConnectionManager(); - } - - public static ApiInvoker getInstance() { - return INSTANCE; - } - - public static Object deserialize(String json, String containerType, Class cls) throws ApiException { - try { - if ("List".equals(containerType)) { - JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls); - return (List) JsonUtil.getJsonMapper().readValue(json, typeInfo); - } else if (String.class.equals(cls)) { - if (json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1) { - return json.substring(1, json.length() - 2); - } else { - return json; - } - } else { - return JsonUtil.getJsonMapper().readValue(json, cls); - } - } catch (IOException e) { - throw new ApiException(500, e.getMessage()); - } - } - - public static String serialize(Object obj) throws ApiException { - try { - if (obj != null) { - return JsonUtil.getJsonMapper().writeValueAsString(obj); - } else { - return null; - } - } catch (Exception e) { - throw new ApiException(500, e.getMessage()); - } - } - - public void ignoreSSLCertificates(boolean ignoreSSLCertificates) { - this.ignoreSSLCertificates = ignoreSSLCertificates; - } - - public void addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - } - - public String escapeString(String str) { - return str; - } - - public String invokeAPI(String host, String path, String method, Map queryParams, Object body, Map headerParams, String contentType) throws ApiException { - HttpClient client = getClient(host); - - StringBuilder b = new StringBuilder(); - for (String key : queryParams.keySet()) { - String value = queryParams.get(key); - if (value != null) { - if (b.toString().length() == 0) { - b.append("?"); - } else { - b.append("&"); - } - b.append(escapeString(key)).append("=").append(escapeString(value)); - } - } - String url = host + path + b.toString(); - - HashMap headers = new HashMap(); - - for (String key : headerParams.keySet()) { - headers.put(key, headerParams.get(key)); - } - - for (String key : defaultHeaderMap.keySet()) { - if (!headerParams.containsKey(key)) { - headers.put(key, defaultHeaderMap.get(key)); - } - } - headers.put("Accept", "application/json"); - - HttpResponse response = null; - try { - if ("GET".equals(method)) { - HttpGet get = new HttpGet(url); - get.addHeader("Accept", "application/json"); - for (String key : headers.keySet()) { - get.setHeader(key, headers.get(key)); - } - response = client.execute(get); - } else if ("POST".equals(method)) { - HttpPost post = new HttpPost(url); - - if (body != null) { - post.setHeader("Content-Type", contentType); - post.setEntity(new StringEntity(serialize(body), "UTF-8")); - } - for (String key : headers.keySet()) { - post.setHeader(key, headers.get(key)); - } - response = client.execute(post); - } else if ("PUT".equals(method)) { - HttpPut put = new HttpPut(url); - if (body != null) { - put.setHeader("Content-Type", contentType); - put.setEntity(new StringEntity(serialize(body), "UTF-8")); - } - for (String key : headers.keySet()) { - put.setHeader(key, headers.get(key)); - } - response = client.execute(put); - } else if ("DELETE".equals(method)) { - HttpDelete delete = new HttpDelete(url); - for (String key : headers.keySet()) { - delete.setHeader(key, headers.get(key)); - } - response = client.execute(delete); - } else if ("PATCH".equals(method)) { - HttpPatch patch = new HttpPatch(url); - - if (body != null) { - patch.setHeader("Content-Type", contentType); - patch.setEntity(new StringEntity(serialize(body), "UTF-8")); - } - for (String key : headers.keySet()) { - patch.setHeader(key, headers.get(key)); - } - response = client.execute(patch); - } - - int code = response.getStatusLine().getStatusCode(); - String responseString = null; - if (code == 204) { - responseString = ""; - } else if (code >= 200 && code < 300) { - if (response.getEntity() != null) { - HttpEntity resEntity = response.getEntity(); - responseString = EntityUtils.toString(resEntity); - } - } else { - if (response.getEntity() != null) { - HttpEntity resEntity = response.getEntity(); - responseString = EntityUtils.toString(resEntity); - } else { - responseString = "no data"; - } - throw new ApiException(code, responseString); - } - return responseString; - } catch (IOException e) { - throw new ApiException(500, e.getMessage()); - } - } - - private HttpClient getClient(String host) { - if (client == null) { - if (ignoreSSLCertificates && ignoreSSLConnectionManager != null) { - // Trust self signed certificates - client = new DefaultHttpClient(ignoreSSLConnectionManager, new BasicHttpParams()); - } else { - client = new DefaultHttpClient(); - } - } - return client; - } - - private void initConnectionManager() { - try { - final SSLContext sslContext = SSLContext.getInstance("SSL"); - - // set up a TrustManager that trusts everything - TrustManager[] trustManagers = new TrustManager[]{ - new X509TrustManager() { - public X509Certificate[] getAcceptedIssuers() { - return null; - } - - public void checkClientTrusted(X509Certificate[] certs, String authType) { - } - - public void checkServerTrusted(X509Certificate[] certs, String authType) { - } - }}; - - sslContext.init(null, trustManagers, new SecureRandom()); - - SSLSocketFactory sf = new SSLSocketFactory((KeyStore) null) { - private javax.net.ssl.SSLSocketFactory sslFactory = sslContext.getSocketFactory(); - - public Socket createSocket(Socket socket, String host, int port, boolean autoClose) - throws IOException, UnknownHostException { - return sslFactory.createSocket(socket, host, port, autoClose); - } - - public Socket createSocket() throws IOException { - return sslFactory.createSocket(); - } - }; - - sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); - Scheme httpsScheme = new Scheme("https", sf, 443); - SchemeRegistry schemeRegistry = new SchemeRegistry(); - schemeRegistry.register(httpsScheme); - schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); - - ignoreSSLConnectionManager = new SingleClientConnManager(new BasicHttpParams(), schemeRegistry); - } catch (NoSuchAlgorithmException e) { - // This will only be thrown if SSL isn't available for some reason. - } catch (KeyManagementException e) { - // This might be thrown when passing a key into init(), but no key is being passed. - } catch (GeneralSecurityException e) { - // This catches anything else that might go wrong. - // If anything goes wrong we default to the standard connection manager. - } - } -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/HttpPatch.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/HttpPatch.java deleted file mode 100644 index c40272a991e..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/HttpPatch.java +++ /dev/null @@ -1,14 +0,0 @@ -package io.swagger.client; - -public class HttpPatch extends HttpPost { - public static final String METHOD_PATCH = "PATCH"; - - public HttpPatch(final String url) { - super(url); - } - - @Override - public String getMethod() { - return METHOD_PATCH; - } -} \ No newline at end of file diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/JsonUtil.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/JsonUtil.java deleted file mode 100644 index f9f47ce6f7f..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/JsonUtil.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.swagger.client; - -public class JsonUtil { - public static ObjectMapper mapper; - - public static ObjectMapper getJsonMapper() { - return mapper; - } - - static { - mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - } -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/AccountApi.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/AccountApi.java deleted file mode 100644 index 8931e529821..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/AccountApi.java +++ /dev/null @@ -1,208 +0,0 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiInvoker; -import io.swagger.client.model.ApiTokenStatus; -import io.swagger.client.model.AuthenticationToken; -import io.swagger.client.model.User; -import io.swagger.client.model.WordList; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class AccountApi { - String basePath = "https://api.wordnik.com/v4"; - ApiInvoker apiInvoker = ApiInvoker.getInstance(); - - public void addHeader(String key, String value) { - getInvoker().addDefaultHeader(key, value); - } - - public ApiInvoker getInvoker() { - return apiInvoker; - } - - public String getBasePath() { - return basePath; - } - - public void setBasePath(String basePath) { - this.basePath = basePath; - } - - public ApiTokenStatus getApiTokenStatus(String api_key) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/account.json/apiTokenStatus".replaceAll("\\{format\\}", "json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - - headerParams.put("api_key", api_key); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (ApiTokenStatus) ApiInvoker.deserialize(response, "", ApiTokenStatus.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public AuthenticationToken authenticate(String username, String password) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/account.json/authenticate/{username}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(password))) { - queryParams.put("password", String.valueOf(password)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (AuthenticationToken) ApiInvoker.deserialize(response, "", AuthenticationToken.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public AuthenticationToken authenticatePost(String username, String body) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/account.json/authenticate/{username}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (AuthenticationToken) ApiInvoker.deserialize(response, "", AuthenticationToken.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public User getLoggedInUser(String auth_token) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/account.json/user".replaceAll("\\{format\\}", "json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - - headerParams.put("auth_token", auth_token); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (User) ApiInvoker.deserialize(response, "", User.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public List getWordListsForLoggedInUser(String auth_token, Integer skip, Integer limit) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/account.json/wordLists".replaceAll("\\{format\\}", "json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(skip))) { - queryParams.put("skip", String.valueOf(skip)); - } - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - - - headerParams.put("auth_token", auth_token); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (List) ApiInvoker.deserialize(response, "array", WordList.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordApi.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordApi.java deleted file mode 100644 index 6d7bf89b76b..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordApi.java +++ /dev/null @@ -1,483 +0,0 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiInvoker; -import io.swagger.client.model.AudioFile; -import io.swagger.client.model.Bigram; -import io.swagger.client.model.Definition; -import io.swagger.client.model.Example; -import io.swagger.client.model.FrequencySummary; -import io.swagger.client.model.WordObject; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class WordApi { - String basePath = "https://api.wordnik.com/v4"; - ApiInvoker apiInvoker = ApiInvoker.getInstance(); - - public void addHeader(String key, String value) { - getInvoker().addDefaultHeader(key, value); - } - - public ApiInvoker getInvoker() { - return apiInvoker; - } - - public String getBasePath() { - return basePath; - } - - public void setBasePath(String basePath) { - this.basePath = basePath; - } - - public WordObject getWord(String word, String useCanonical, String includeSuggestions) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - if (!"null".equals(String.valueOf(includeSuggestions))) { - queryParams.put("includeSuggestions", String.valueOf(includeSuggestions)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (WordObject) ApiInvoker.deserialize(response, "", WordObject.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public List getAudio(String word, String useCanonical, Integer limit) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}/audio".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (List) ApiInvoker.deserialize(response, "array", AudioFile.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public List getDefinitions(String word, Integer limit, String partOfSpeech, String includeRelated, List sourceDictionaries, String useCanonical, String includeTags) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}/definitions".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - if (!"null".equals(String.valueOf(partOfSpeech))) { - queryParams.put("partOfSpeech", String.valueOf(partOfSpeech)); - } - if (!"null".equals(String.valueOf(includeRelated))) { - queryParams.put("includeRelated", String.valueOf(includeRelated)); - } - if (!"null".equals(String.valueOf(sourceDictionaries))) { - queryParams.put("sourceDictionaries", String.valueOf(sourceDictionaries)); - } - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - if (!"null".equals(String.valueOf(includeTags))) { - queryParams.put("includeTags", String.valueOf(includeTags)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (List) ApiInvoker.deserialize(response, "array", Definition.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public List getEtymologies(String word, String useCanonical) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}/etymologies".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (List) ApiInvoker.deserialize(response, "array", String.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public void getExamples(String word, String includeDuplicates, String useCanonical, Integer skip, Integer limit) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}/examples".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(includeDuplicates))) { - queryParams.put("includeDuplicates", String.valueOf(includeDuplicates)); - } - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - if (!"null".equals(String.valueOf(skip))) { - queryParams.put("skip", String.valueOf(skip)); - } - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return; - } else { - return; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return; - } else { - throw ex; - } - } - } - - - public FrequencySummary getWordFrequency(String word, String useCanonical, Integer startYear, Integer endYear) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}/frequency".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - if (!"null".equals(String.valueOf(startYear))) { - queryParams.put("startYear", String.valueOf(startYear)); - } - if (!"null".equals(String.valueOf(endYear))) { - queryParams.put("endYear", String.valueOf(endYear)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (FrequencySummary) ApiInvoker.deserialize(response, "", FrequencySummary.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public void getHyphenation(String word, String useCanonical, String sourceDictionary, Integer limit) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}/hyphenation".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - if (!"null".equals(String.valueOf(sourceDictionary))) { - queryParams.put("sourceDictionary", String.valueOf(sourceDictionary)); - } - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return; - } else { - return; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return; - } else { - throw ex; - } - } - } - - - public List getPhrases(String word, Integer limit, Integer wlmi, String useCanonical) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}/phrases".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - if (!"null".equals(String.valueOf(wlmi))) { - queryParams.put("wlmi", String.valueOf(wlmi)); - } - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (List) ApiInvoker.deserialize(response, "array", Bigram.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public void getTextPronunciations(String word, String useCanonical, String sourceDictionary, String typeFormat, Integer limit) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}/pronunciations".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - if (!"null".equals(String.valueOf(sourceDictionary))) { - queryParams.put("sourceDictionary", String.valueOf(sourceDictionary)); - } - if (!"null".equals(String.valueOf(typeFormat))) { - queryParams.put("typeFormat", String.valueOf(typeFormat)); - } - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return; - } else { - return; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return; - } else { - throw ex; - } - } - } - - - public void getRelatedWords(String word, String useCanonical, String relationshipTypes, Integer limitPerRelationshipType) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}/relatedWords".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - if (!"null".equals(String.valueOf(relationshipTypes))) { - queryParams.put("relationshipTypes", String.valueOf(relationshipTypes)); - } - if (!"null".equals(String.valueOf(limitPerRelationshipType))) { - queryParams.put("limitPerRelationshipType", String.valueOf(limitPerRelationshipType)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return; - } else { - return; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return; - } else { - throw ex; - } - } - } - - - public Example getTopExample(String word, String useCanonical) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/word.json/{word}/topExample".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(useCanonical))) { - queryParams.put("useCanonical", String.valueOf(useCanonical)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (Example) ApiInvoker.deserialize(response, "", Example.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordListApi.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordListApi.java deleted file mode 100644 index 1d82e877b1f..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordListApi.java +++ /dev/null @@ -1,248 +0,0 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiInvoker; -import io.swagger.client.model.StringValue; -import io.swagger.client.model.WordList; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class WordListApi { - String basePath = "https://api.wordnik.com/v4"; - ApiInvoker apiInvoker = ApiInvoker.getInstance(); - - public void addHeader(String key, String value) { - getInvoker().addDefaultHeader(key, value); - } - - public ApiInvoker getInvoker() { - return apiInvoker; - } - - public String getBasePath() { - return basePath; - } - - public void setBasePath(String basePath) { - this.basePath = basePath; - } - - public WordList getWordListByPermalink(String permalink, String auth_token) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/wordList.json/{permalink}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - - headerParams.put("auth_token", auth_token); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (WordList) ApiInvoker.deserialize(response, "", WordList.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public void updateWordList(String permalink, WordList body, String auth_token) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/wordList.json/{permalink}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - - headerParams.put("auth_token", auth_token); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, contentType); - if (response != null) { - return; - } else { - return; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return; - } else { - throw ex; - } - } - } - - - public void deleteWordList(String permalink, String auth_token) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/wordList.json/{permalink}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - - headerParams.put("auth_token", auth_token); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, contentType); - if (response != null) { - return; - } else { - return; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return; - } else { - throw ex; - } - } - } - - - public void deleteWordsFromWordList(String permalink, List body, String auth_token) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/wordList.json/{permalink}/deleteWords".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - - headerParams.put("auth_token", auth_token); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType); - if (response != null) { - return; - } else { - return; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return; - } else { - throw ex; - } - } - } - - - public void getWordListWords(String permalink, String sortBy, String sortOrder, Integer skip, Integer limit, String auth_token) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/wordList.json/{permalink}/words".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(sortBy))) { - queryParams.put("sortBy", String.valueOf(sortBy)); - } - if (!"null".equals(String.valueOf(sortOrder))) { - queryParams.put("sortOrder", String.valueOf(sortOrder)); - } - if (!"null".equals(String.valueOf(skip))) { - queryParams.put("skip", String.valueOf(skip)); - } - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - - - headerParams.put("auth_token", auth_token); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return; - } else { - return; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return; - } else { - throw ex; - } - } - } - - - public void addWordsToWordList(String permalink, List body, String auth_token) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/wordList.json/{permalink}/words".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - - headerParams.put("auth_token", auth_token); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType); - if (response != null) { - return; - } else { - return; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return; - } else { - throw ex; - } - } - } - -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordListsApi.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordListsApi.java deleted file mode 100644 index 21fdf762bc7..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordListsApi.java +++ /dev/null @@ -1,63 +0,0 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiInvoker; -import io.swagger.client.model.WordList; - -import java.util.HashMap; -import java.util.Map; - -public class WordListsApi { - String basePath = "https://api.wordnik.com/v4"; - ApiInvoker apiInvoker = ApiInvoker.getInstance(); - - public void addHeader(String key, String value) { - getInvoker().addDefaultHeader(key, value); - } - - public ApiInvoker getInvoker() { - return apiInvoker; - } - - public String getBasePath() { - return basePath; - } - - public void setBasePath(String basePath) { - this.basePath = basePath; - } - - public WordList createWordList(WordList body, String auth_token) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/wordLists.json".replaceAll("\\{format\\}", "json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - - headerParams.put("auth_token", auth_token); - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (WordList) ApiInvoker.deserialize(response, "", WordList.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordsApi.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordsApi.java deleted file mode 100644 index 18d0f5e0df2..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/api/WordsApi.java +++ /dev/null @@ -1,339 +0,0 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiInvoker; -import io.swagger.client.model.DefinitionSearchResults; -import io.swagger.client.model.WordObject; -import io.swagger.client.model.WordOfTheDay; -import io.swagger.client.model.WordSearchResults; - -import java.util.HashMap; -import java.util.Map; - -public class WordsApi { - String basePath = "https://api.wordnik.com/v4"; - ApiInvoker apiInvoker = ApiInvoker.getInstance(); - - public void addHeader(String key, String value) { - getInvoker().addDefaultHeader(key, value); - } - - public ApiInvoker getInvoker() { - return apiInvoker; - } - - public String getBasePath() { - return basePath; - } - - public void setBasePath(String basePath) { - this.basePath = basePath; - } - - public WordObject getRandomWord(String hasDictionaryDef, String includePartOfSpeech, String excludePartOfSpeech, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/words.json/randomWord".replaceAll("\\{format\\}", "json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(hasDictionaryDef))) { - queryParams.put("hasDictionaryDef", String.valueOf(hasDictionaryDef)); - } - if (!"null".equals(String.valueOf(includePartOfSpeech))) { - queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech)); - } - if (!"null".equals(String.valueOf(excludePartOfSpeech))) { - queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech)); - } - if (!"null".equals(String.valueOf(minCorpusCount))) { - queryParams.put("minCorpusCount", String.valueOf(minCorpusCount)); - } - if (!"null".equals(String.valueOf(maxCorpusCount))) { - queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount)); - } - if (!"null".equals(String.valueOf(minDictionaryCount))) { - queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount)); - } - if (!"null".equals(String.valueOf(maxDictionaryCount))) { - queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount)); - } - if (!"null".equals(String.valueOf(minLength))) { - queryParams.put("minLength", String.valueOf(minLength)); - } - if (!"null".equals(String.valueOf(maxLength))) { - queryParams.put("maxLength", String.valueOf(maxLength)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (WordObject) ApiInvoker.deserialize(response, "", WordObject.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public void getRandomWords(String hasDictionaryDef, String includePartOfSpeech, String excludePartOfSpeech, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength, String sortBy, String sortOrder, Integer limit) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/words.json/randomWords".replaceAll("\\{format\\}", "json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(hasDictionaryDef))) { - queryParams.put("hasDictionaryDef", String.valueOf(hasDictionaryDef)); - } - if (!"null".equals(String.valueOf(includePartOfSpeech))) { - queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech)); - } - if (!"null".equals(String.valueOf(excludePartOfSpeech))) { - queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech)); - } - if (!"null".equals(String.valueOf(minCorpusCount))) { - queryParams.put("minCorpusCount", String.valueOf(minCorpusCount)); - } - if (!"null".equals(String.valueOf(maxCorpusCount))) { - queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount)); - } - if (!"null".equals(String.valueOf(minDictionaryCount))) { - queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount)); - } - if (!"null".equals(String.valueOf(maxDictionaryCount))) { - queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount)); - } - if (!"null".equals(String.valueOf(minLength))) { - queryParams.put("minLength", String.valueOf(minLength)); - } - if (!"null".equals(String.valueOf(maxLength))) { - queryParams.put("maxLength", String.valueOf(maxLength)); - } - if (!"null".equals(String.valueOf(sortBy))) { - queryParams.put("sortBy", String.valueOf(sortBy)); - } - if (!"null".equals(String.valueOf(sortOrder))) { - queryParams.put("sortOrder", String.valueOf(sortOrder)); - } - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return; - } else { - return; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return; - } else { - throw ex; - } - } - } - - - public DefinitionSearchResults reverseDictionary(String query, String findSenseForWord, String includeSourceDictionaries, String excludeSourceDictionaries, String includePartOfSpeech, String excludePartOfSpeech, Integer minCorpusCount, Integer maxCorpusCount, Integer minLength, Integer maxLength, String expandTerms, String includeTags, String sortBy, String sortOrder, String skip, Integer limit) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/words.json/reverseDictionary".replaceAll("\\{format\\}", "json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(query))) { - queryParams.put("query", String.valueOf(query)); - } - if (!"null".equals(String.valueOf(findSenseForWord))) { - queryParams.put("findSenseForWord", String.valueOf(findSenseForWord)); - } - if (!"null".equals(String.valueOf(includeSourceDictionaries))) { - queryParams.put("includeSourceDictionaries", String.valueOf(includeSourceDictionaries)); - } - if (!"null".equals(String.valueOf(excludeSourceDictionaries))) { - queryParams.put("excludeSourceDictionaries", String.valueOf(excludeSourceDictionaries)); - } - if (!"null".equals(String.valueOf(includePartOfSpeech))) { - queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech)); - } - if (!"null".equals(String.valueOf(excludePartOfSpeech))) { - queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech)); - } - if (!"null".equals(String.valueOf(minCorpusCount))) { - queryParams.put("minCorpusCount", String.valueOf(minCorpusCount)); - } - if (!"null".equals(String.valueOf(maxCorpusCount))) { - queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount)); - } - if (!"null".equals(String.valueOf(minLength))) { - queryParams.put("minLength", String.valueOf(minLength)); - } - if (!"null".equals(String.valueOf(maxLength))) { - queryParams.put("maxLength", String.valueOf(maxLength)); - } - if (!"null".equals(String.valueOf(expandTerms))) { - queryParams.put("expandTerms", String.valueOf(expandTerms)); - } - if (!"null".equals(String.valueOf(includeTags))) { - queryParams.put("includeTags", String.valueOf(includeTags)); - } - if (!"null".equals(String.valueOf(sortBy))) { - queryParams.put("sortBy", String.valueOf(sortBy)); - } - if (!"null".equals(String.valueOf(sortOrder))) { - queryParams.put("sortOrder", String.valueOf(sortOrder)); - } - if (!"null".equals(String.valueOf(skip))) { - queryParams.put("skip", String.valueOf(skip)); - } - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (DefinitionSearchResults) ApiInvoker.deserialize(response, "", DefinitionSearchResults.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public WordSearchResults searchWords(String query, String caseSensitive, String includePartOfSpeech, String excludePartOfSpeech, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength, Integer skip, Integer limit) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/words.json/search/{query}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "query" + "\\}", apiInvoker.escapeString(query.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(caseSensitive))) { - queryParams.put("caseSensitive", String.valueOf(caseSensitive)); - } - if (!"null".equals(String.valueOf(includePartOfSpeech))) { - queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech)); - } - if (!"null".equals(String.valueOf(excludePartOfSpeech))) { - queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech)); - } - if (!"null".equals(String.valueOf(minCorpusCount))) { - queryParams.put("minCorpusCount", String.valueOf(minCorpusCount)); - } - if (!"null".equals(String.valueOf(maxCorpusCount))) { - queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount)); - } - if (!"null".equals(String.valueOf(minDictionaryCount))) { - queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount)); - } - if (!"null".equals(String.valueOf(maxDictionaryCount))) { - queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount)); - } - if (!"null".equals(String.valueOf(minLength))) { - queryParams.put("minLength", String.valueOf(minLength)); - } - if (!"null".equals(String.valueOf(maxLength))) { - queryParams.put("maxLength", String.valueOf(maxLength)); - } - if (!"null".equals(String.valueOf(skip))) { - queryParams.put("skip", String.valueOf(skip)); - } - if (!"null".equals(String.valueOf(limit))) { - queryParams.put("limit", String.valueOf(limit)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (WordSearchResults) ApiInvoker.deserialize(response, "", WordSearchResults.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - - - public WordOfTheDay getWordOfTheDay(String date) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/words.json/wordOfTheDay".replaceAll("\\{format\\}", "json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if (!"null".equals(String.valueOf(date))) { - queryParams.put("date", String.valueOf(date)); - } - - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); - if (response != null) { - return (WordOfTheDay) ApiInvoker.deserialize(response, "", WordOfTheDay.class); - } else { - return null; - } - } catch (ApiException ex) { - if (ex.getCode() == 404) { - return null; - } else { - throw ex; - } - } - } - -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/ApiTokenStatus.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/ApiTokenStatus.java deleted file mode 100644 index 60388200618..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/ApiTokenStatus.java +++ /dev/null @@ -1,111 +0,0 @@ -package io.swagger.client.model; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.wordnik.swagger.annotations.*; - - -@ApiModel(description = "") -public class ApiTokenStatus { - - private Boolean valid = null; - private String token = null; - private Long resetsInMillis = null; - private Long remainingCalls = null; - private Long expiresInMillis = null; - private Long totalRequests = null; - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("valid") - public Boolean getValid() { - return valid; - } - - public void setValid(Boolean valid) { - this.valid = valid; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("token") - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("resetsInMillis") - public Long getResetsInMillis() { - return resetsInMillis; - } - - public void setResetsInMillis(Long resetsInMillis) { - this.resetsInMillis = resetsInMillis; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("remainingCalls") - public Long getRemainingCalls() { - return remainingCalls; - } - - public void setRemainingCalls(Long remainingCalls) { - this.remainingCalls = remainingCalls; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("expiresInMillis") - public Long getExpiresInMillis() { - return expiresInMillis; - } - - public void setExpiresInMillis(Long expiresInMillis) { - this.expiresInMillis = expiresInMillis; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("totalRequests") - public Long getTotalRequests() { - return totalRequests; - } - - public void setTotalRequests(Long totalRequests) { - this.totalRequests = totalRequests; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ApiTokenStatus {\n"); - - sb.append(" valid: ").append(valid).append("\n"); - sb.append(" token: ").append(token).append("\n"); - sb.append(" resetsInMillis: ").append(resetsInMillis).append("\n"); - sb.append(" remainingCalls: ").append(remainingCalls).append("\n"); - sb.append(" expiresInMillis: ").append(expiresInMillis).append("\n"); - sb.append(" totalRequests: ").append(totalRequests).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/AudioFile.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/AudioFile.java deleted file mode 100644 index 7c982c40a22..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/AudioFile.java +++ /dev/null @@ -1,232 +0,0 @@ -package io.swagger.client.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.wordnik.swagger.annotations.*; - -import java.util.Date; - - -@ApiModel(description = "") -public class AudioFile { - - private String attributionUrl = null; - private Integer commentCount = null; - private Integer voteCount = null; - private String fileUrl = null; - private String audioType = null; - private Long id = null; - private Double duration = null; - private String attributionText = null; - private String createdBy = null; - private String description = null; - private Date createdAt = null; - private Float voteWeightedAverage = null; - private Float voteAverage = null; - private String word = null; - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("attributionUrl") - public String getAttributionUrl() { - return attributionUrl; - } - - public void setAttributionUrl(String attributionUrl) { - this.attributionUrl = attributionUrl; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("commentCount") - public Integer getCommentCount() { - return commentCount; - } - - public void setCommentCount(Integer commentCount) { - this.commentCount = commentCount; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("voteCount") - public Integer getVoteCount() { - return voteCount; - } - - public void setVoteCount(Integer voteCount) { - this.voteCount = voteCount; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("fileUrl") - public String getFileUrl() { - return fileUrl; - } - - public void setFileUrl(String fileUrl) { - this.fileUrl = fileUrl; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("audioType") - public String getAudioType() { - return audioType; - } - - public void setAudioType(String audioType) { - this.audioType = audioType; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("duration") - public Double getDuration() { - return duration; - } - - public void setDuration(Double duration) { - this.duration = duration; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("attributionText") - public String getAttributionText() { - return attributionText; - } - - public void setAttributionText(String attributionText) { - this.attributionText = attributionText; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("createdBy") - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("description") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("createdAt") - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("voteWeightedAverage") - public Float getVoteWeightedAverage() { - return voteWeightedAverage; - } - - public void setVoteWeightedAverage(Float voteWeightedAverage) { - this.voteWeightedAverage = voteWeightedAverage; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("voteAverage") - public Float getVoteAverage() { - return voteAverage; - } - - public void setVoteAverage(Float voteAverage) { - this.voteAverage = voteAverage; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("word") - public String getWord() { - return word; - } - - public void setWord(String word) { - this.word = word; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AudioFile {\n"); - - sb.append(" attributionUrl: ").append(attributionUrl).append("\n"); - sb.append(" commentCount: ").append(commentCount).append("\n"); - sb.append(" voteCount: ").append(voteCount).append("\n"); - sb.append(" fileUrl: ").append(fileUrl).append("\n"); - sb.append(" audioType: ").append(audioType).append("\n"); - sb.append(" id: ").append(id).append("\n"); - sb.append(" duration: ").append(duration).append("\n"); - sb.append(" attributionText: ").append(attributionText).append("\n"); - sb.append(" createdBy: ").append(createdBy).append("\n"); - sb.append(" description: ").append(description).append("\n"); - sb.append(" createdAt: ").append(createdAt).append("\n"); - sb.append(" voteWeightedAverage: ").append(voteWeightedAverage).append("\n"); - sb.append(" voteAverage: ").append(voteAverage).append("\n"); - sb.append(" word: ").append(word).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/AudioType.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/AudioType.java deleted file mode 100644 index 6456cb53904..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/AudioType.java +++ /dev/null @@ -1,51 +0,0 @@ -package io.swagger.client.model; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.wordnik.swagger.annotations.*; - - -@ApiModel(description = "") -public class AudioType { - - private Integer id = null; - private String name = null; - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("id") - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("name") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AudioType {\n"); - - sb.append(" id: ").append(id).append("\n"); - sb.append(" name: ").append(name).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/AuthenticationToken.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/AuthenticationToken.java deleted file mode 100644 index f9d59b3a467..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/AuthenticationToken.java +++ /dev/null @@ -1,66 +0,0 @@ -package io.swagger.client.model; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.wordnik.swagger.annotations.*; - - -@ApiModel(description = "") -public class AuthenticationToken { - - private String token = null; - private Long userId = null; - private String userSignature = null; - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("token") - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("userId") - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("userSignature") - public String getUserSignature() { - return userSignature; - } - - public void setUserSignature(String userSignature) { - this.userSignature = userSignature; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AuthenticationToken {\n"); - - sb.append(" token: ").append(token).append("\n"); - sb.append(" userId: ").append(userId).append("\n"); - sb.append(" userSignature: ").append(userSignature).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Bigram.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Bigram.java deleted file mode 100644 index 0465c2816cc..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Bigram.java +++ /dev/null @@ -1,96 +0,0 @@ -package io.swagger.client.model; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.wordnik.swagger.annotations.*; - - -@ApiModel(description = "") -public class Bigram { - - private Long count = null; - private String gram2 = null; - private String gram1 = null; - private Double wlmi = null; - private Double mi = null; - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("count") - public Long getCount() { - return count; - } - - public void setCount(Long count) { - this.count = count; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("gram2") - public String getGram2() { - return gram2; - } - - public void setGram2(String gram2) { - this.gram2 = gram2; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("gram1") - public String getGram1() { - return gram1; - } - - public void setGram1(String gram1) { - this.gram1 = gram1; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("wlmi") - public Double getWlmi() { - return wlmi; - } - - public void setWlmi(Double wlmi) { - this.wlmi = wlmi; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("mi") - public Double getMi() { - return mi; - } - - public void setMi(Double mi) { - this.mi = mi; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Bigram {\n"); - - sb.append(" count: ").append(count).append("\n"); - sb.append(" gram2: ").append(gram2).append("\n"); - sb.append(" gram1: ").append(gram1).append("\n"); - sb.append(" wlmi: ").append(wlmi).append("\n"); - sb.append(" mi: ").append(mi).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Category.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Category.java deleted file mode 100644 index 5ceadd985e2..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Category.java +++ /dev/null @@ -1,51 +0,0 @@ -package io.swagger.client.model; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.wordnik.swagger.annotations.*; - - -@ApiModel(description = "") -public class Category { - - private Long id = null; - private String name = null; - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("name") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Category {\n"); - - sb.append(" id: ").append(id).append("\n"); - sb.append(" name: ").append(name).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Citation.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Citation.java deleted file mode 100644 index 7f636dc7e02..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Citation.java +++ /dev/null @@ -1,51 +0,0 @@ -package io.swagger.client.model; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.wordnik.swagger.annotations.*; - - -@ApiModel(description = "") -public class Citation { - - private String cite = null; - private String source = null; - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("cite") - public String getCite() { - return cite; - } - - public void setCite(String cite) { - this.cite = cite; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("source") - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Citation {\n"); - - sb.append(" cite: ").append(cite).append("\n"); - sb.append(" source: ").append(source).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/ContentProvider.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/ContentProvider.java deleted file mode 100644 index 9b56335411d..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/ContentProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -package io.swagger.client.model; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.wordnik.swagger.annotations.*; - - -@ApiModel(description = "") -public class ContentProvider { - - private Integer id = null; - private String name = null; - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("id") - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - - /** - **/ - @ApiModelProperty(required = false, value = "") - @JsonProperty("name") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ContentProvider {\n"); - - sb.append(" id: ").append(id).append("\n"); - sb.append(" name: ").append(name).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Definition.java b/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Definition.java deleted file mode 100644 index ea0e6463ad7..00000000000 --- a/samples/client/wordnik/android-java/src/main/java/io/swagger/client/model/Definition.java +++ /dev/null @@ -1,269 +0,0 @@ -package io.swagger.client.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.wordnik.swagger.annotations.*; -import io.swagger.client.model.Citation; -import io.swagger.client.model.ExampleUsage; -import io.swagger.client.model.Label; -import io.swagger.client.model.Note; -import io.swagger.client.model.Related; -import io.swagger.client.model.TextPron; - -import java.util.ArrayList; -import java.util.List; - - -@ApiModel(description = "") -public class Definition { - - private String extendedText = null; - private String text = null; - private String sourceDictionary = null; - private List citations = new ArrayList(); - private List